Skip to content

Commit

Permalink
Improvements in the way BGs are exited, guild informations are refres…
Browse files Browse the repository at this point in the history
…hed.

Removal of BG Skulls on exiting the BG.
Initial implementation of BG stats. @todo saving to database.
Addition of @bgstart/stop commands for GMs to start and stop battlegrounds. Credits to Vylow and Micheiru for the idea.
  • Loading branch information
sagunkho committed Jan 26, 2017
1 parent 90ca429 commit 40d08d2
Show file tree
Hide file tree
Showing 5 changed files with 529 additions and 142 deletions.
35 changes: 26 additions & 9 deletions npc/custom/hBG/bg_common.txt
Expand Up @@ -64,17 +64,32 @@ OnInit:
initnpctimer; // Initiate rotation timer.

if (.BGCommandsEnabled) {
/* Admin / GM Commands */
bindatcmd "bgstart","BG_Queue_Handler::OnBGStartCommand",99,99;
bindatcmd "bgstop","BG_Queue_Handler::OnBGStopCommand",99,99;
/* Player Commands */
bindatcmd "joinbg","BG_Queue_Handler::OnDoJoin",0,99;
bindatcmd "leavebg","BG_Queue_Handler::OnDoLeave",0,99;
}
end;

OnBGStartCommand:
.BGEnabled = 1;
goto OnEndArena;
OnBGStopCommand:
.BGEnabled = 0;
.@msg$ = "[Battlegrounds] Arenas and Queuing have been disabled by a Game Master.";
announce .@msg$, 0, 0x00FFFF, 0x190, 12, 100, 100;
donpcevent .BG_Arena$+"::OnMatchEnd";
goto OnEndArena;

// @joinbg
OnDoJoin:
if (questprogress(8506,PLAYTIME) == 2)
if (!.BGEnabled)
message strcharinfo(0),"Battlegrounds are currently disabled.";
else if (questprogress(8506,PLAYTIME) == 2)
erasequest 8506;

if (questprogress(8506,PLAYTIME) == 1) {
else if (questprogress(8506,PLAYTIME) == 1) {
dispbottom "[You are a Deserter. You can't participate until the indicator goes off]";
end;
}
Expand All @@ -87,6 +102,7 @@ OnDoLeave:
hBG_queue_leave .BG_Queue;
end;

// Triggers after an arena has ended.
OnEndArena:
set $@Arena_Status, 0;
// Warps teams back to the battle room.
Expand All @@ -100,8 +116,9 @@ OnEndArena:
// Fall through
// Start Arena rotation.
OnRotate:
// Rotate every 120 seconds.
// Rotate every n seconds.
OnTimer5000:
if (!.BGEnabled) end;
// Restart from index 0, if reached max.
if (set($BG_Index,$BG_Index + 1) >= .TotalArenas)
set $BG_Index,0;
Expand All @@ -114,7 +131,7 @@ OnQueueJoinEvent:
// BG Status Types -
// 0 - Idle, ready to start.
// 1 - Running, others can join.
// 2 - Ending, BG Clear-up mode.
// 2 - Ending, Battleground is clearing up.
if ($@Arena_Status == 2)
end;

Expand Down Expand Up @@ -447,7 +464,7 @@ moc_para01,18,18,6 duplicate(BG_Register) Battle Recruiter#para 4_F_JOB_KNIGHT
/**
* General Guillaume
*/
bat_room,160,159,3 script General Guillaume 4_M_KY_KIYOM,{
bat_room,160,159,3 script General Guillaume#hBG 4_M_KY_KIYOM,{
cutin "bat_kiyom2",2;
set .@name$, "[General Guillaume]";
mes .@name$;
Expand All @@ -474,7 +491,7 @@ bat_room,160,159,3 script General Guillaume 4_M_KY_KIYOM,{
/**
* Prince Croix
*/
bat_room,160,140,3 script Prince Croix 4_M_CRU_CRUA,{
bat_room,160,140,3 script Prince Croix#hBG 4_M_CRU_CRUA,{
cutin "bat_crua1",2;
set .@name$, "[Prince Croix]";
mes .@name$;
Expand Down Expand Up @@ -574,5 +591,5 @@ bat_room,148,150,4 script Teleporter#bat 4_F_TELEPORTER,{
*/
bat_room,148,147,4 script Kafra Staff::kaf_bat 4_F_KAFRA9,{
cutin "kafra_09",2;
callfunc "F_Kafra",0,2,1,150,0;
}
callfunc "F_Kafra", 5, 0, 1, 20, 600;
}
8 changes: 4 additions & 4 deletions npc/custom/hBG/bg_tierra_dom.txt
Expand Up @@ -47,7 +47,7 @@ OnNScore:
else
set .Croix_Score, .Croix_Score + 1;

donpcevent "Tierra_DOM::OnValidateScore";
donpcevent "Tierra_DOM::OnMatchEnd";
end;

OnSScore:
Expand All @@ -59,7 +59,7 @@ OnSScore:
else
set .Croix_Score, .Croix_Score + 1;

donpcevent "Tierra_DOM::OnValidateScore";
donpcevent "Tierra_DOM::OnMatchEnd";
end;

OnCScore:
Expand All @@ -71,10 +71,10 @@ OnCScore:
else
set .Croix_Score, .Croix_Score + 1;

donpcevent "Tierra_DOM::OnValidateScore";
donpcevent "Tierra_DOM::OnMatchEnd";
end;

OnValidateScore:
OnMatchEnd:
if( .Guillaume_Score > 99 )
set .Guillaume_Score, 99;
if( .Croix_Score > 99 )
Expand Down
10 changes: 5 additions & 5 deletions npc/custom/hBG/bg_tierra_eoe.txt
Expand Up @@ -103,7 +103,7 @@ OnGuillaumeFlag:
mapannounce "bat_a02","Guillaume Team captured the Flag [+3 points]",1,0x0000FF;
}

donpcevent "Tierra_EOS::OnValidateScore";
donpcevent "Tierra_EOS::OnMatchEnd";
donpcevent "Neutral_Flag::OnBase";
end;

Expand All @@ -123,7 +123,7 @@ OnCroixFlag:
mapannounce "bat_a02","Croix Team captured the Flag [+3 points]",1,0xFF0000;
}

donpcevent "Tierra_EOS::OnValidateScore";
donpcevent "Tierra_EOS::OnMatchEnd";
donpcevent "Neutral_Flag::OnBase";
end;

Expand All @@ -143,7 +143,7 @@ OnNorthScore:
else
set .Croix_Score, .Croix_Score + 1;

donpcevent "Tierra_EOS::OnValidateScore";
donpcevent "Tierra_EOS::OnMatchEnd";
end;

OnSouthScore:
Expand All @@ -162,10 +162,10 @@ OnSouthScore:
else
set .Croix_Score, .Croix_Score + 1;

donpcevent "Tierra_EOS::OnValidateScore";
donpcevent "Tierra_EOS::OnMatchEnd";
end;

OnValidateScore:
OnMatchEnd:
if( .Guillaume_Score > 99 )
set .Guillaume_Score, 99;
if( .Croix_Score > 99 )
Expand Down
8 changes: 4 additions & 4 deletions npc/custom/hBG/bg_tierra_ti.txt
Expand Up @@ -92,7 +92,7 @@ OnReady:
hBG_team_updatescore $@BG_Team3,.Traitor_Score;
end;

OnValidateScore:
OnMatchEnd:
if( $@Arena_Status != 1 || getvariableofnpc(.BG_Arena$,"BG_Queue_Handler") != "Tierra_TI" )
end;
if( .Guillaume_Score >= 80 || .Croix_Score >= 80 || .Traitor_Score >= 80 )
Expand Down Expand Up @@ -188,7 +188,7 @@ OnTouch:
hBG_team_updatescore $@BG_Team1,.@Score;
mapannounce "region_8","Guillaume Totem : " + .@Points + " slaughtered skulls by " + strcharinfo(0) + " [" + .@Score + "/80]",1,0x0000FF;
// bg_rankpoints "skulls",.@Points;
donpcevent "Tierra_TI::OnValidateScore";
donpcevent "Tierra_TI::OnMatchEnd";
}
end;
}
Expand Down Expand Up @@ -228,7 +228,7 @@ OnTouch:
hBG_team_updatescore $@BG_Team2,.@Score;
mapannounce "region_8","Croix Totem : " + .@Points + " slaughtered skulls by " + strcharinfo(0) + " [" + .@Score + "/80]",1,0xFF0000;
// bg_rankpoints "skulls",.@Points;
donpcevent "Tierra_TI::OnValidateScore";
donpcevent "Tierra_TI::OnMatchEnd";
}
end;
}
Expand Down Expand Up @@ -268,7 +268,7 @@ OnTouch:
hBG_team_updatescore $@BG_Team3,.@Score;
mapannounce "region_8","Traitor Totem : " + .@Points + " slaughtered skulls by " + strcharinfo(0) + " [" + .@Score + "/80]",1,0x00FF00;
// bg_rankpoints "skulls",.@Points;
donpcevent "Tierra_TI::OnValidateScore";
donpcevent "Tierra_TI::OnMatchEnd";
}
end;
}
Expand Down

0 comments on commit 40d08d2

Please sign in to comment.