diff options
author | mekolat <mekolat@gmail.com> | 2014-10-28 21:29:53 -0400 |
---|---|---|
committer | mekolat <mekolat@gmail.com> | 2014-10-30 14:21:17 -0400 |
commit | 1407e7d012b52d425228b5f05c0220f2585b3160 (patch) | |
tree | 23a6dc5f1e806c573b502eab2cf15cb4d9bb80ca | |
parent | e5190f9ddff51a2e246a7af5538909ec212e00db (diff) | |
download | serverdata-1407e7d012b52d425228b5f05c0220f2585b3160.tar.gz serverdata-1407e7d012b52d425228b5f05c0220f2585b3160.tar.bz2 serverdata-1407e7d012b52d425228b5f05c0220f2585b3160.tar.xz serverdata-1407e7d012b52d425228b5f05c0220f2585b3160.zip |
use same indenting everywhere
-rw-r--r-- | world/map/npc/009-7/battlemaster.txt | 94 | ||||
-rw-r--r-- | world/map/npc/009-7/core.txt | 474 | ||||
-rw-r--r-- | world/map/npc/009-7/debug.txt | 280 | ||||
-rw-r--r-- | world/map/npc/009-7/eventHandler.txt | 235 | ||||
-rw-r--r-- | world/map/npc/009-7/npcs.txt | 14 |
5 files changed, 556 insertions, 541 deletions
diff --git a/world/map/npc/009-7/battlemaster.txt b/world/map/npc/009-7/battlemaster.txt index c5d964b4..e211092c 100644 --- a/world/map/npc/009-7/battlemaster.txt +++ b/world/map/npc/009-7/battlemaster.txt @@ -54,35 +54,38 @@ function|script|fightclub_GoBack|, if(Duel_LMS == 1) goto L_GoBack; return; - L_GoBack: - set Duel_LMS, 0; - warp "009-7.gat", 39, 37; - gmcommand "@alive"; - message strcharinfo(0), "Thank you for participating in Last Man Standing!"; - return; - - L_Clean: - set Duel_LMS, 0; - return; - - L_Death: - if((Duel_LMS != 1) && ((getmap() == "009-6") || (getmap() == "009-5"))) L_NormalExit; - if(Duel_LMS != 1) end; - if((getmap() != "009-6") && (getmap() != "009-5")) goto L_Clean; - goto L_GoBack; - - OnPCKilledEvent: goto L_Death; - OnPCDieEvent: goto L_Death; - - OnResave: - if(Duel_LMS != 1) end; - savepoint "009-7.gat", 39, 37; - return; - - L_NormalExit: - warp "009-3.gat", 162, 82; - gmcommand "@alive"; - return; +L_GoBack: + set Duel_LMS, 0; + warp "009-7.gat", 39, 37; + gmcommand "@alive"; + message strcharinfo(0), "Thank you for participating in Last Man Standing!"; + return; + +L_Clean: + set Duel_LMS, 0; + return; + +L_Death: + if((Duel_LMS != 1) && ((getmap() == "009-6") || (getmap() == "009-5"))) L_NormalExit; + if(Duel_LMS != 1) end; + if((getmap() != "009-6") && (getmap() != "009-5")) goto L_Clean; + goto L_GoBack; + +OnPCKilledEvent: + goto L_Death; + +OnPCDieEvent: + goto L_Death; + +OnResave: + if(Duel_LMS != 1) end; + savepoint "009-7.gat", 39, 37; + return; + +L_NormalExit: + warp "009-3.gat", 162, 82; + gmcommand "@alive"; + return; } 009-6.gat,36,48,0|script|#GoBack2#Duels|127,0,1, { @@ -99,24 +102,27 @@ function|script|fightclub_GoBack2|, if(Duel_PVP == 1) goto L_GoBack; return; - L_GoBack: - set Duel_PVP, 0; - warp "009-7.gat", 39, 37; - gmcommand "@alive"; - message strcharinfo(0), "Thank you for participating in the PVP cave!"; - return; +L_GoBack: + set Duel_PVP, 0; + warp "009-7.gat", 39, 37; + gmcommand "@alive"; + message strcharinfo(0), "Thank you for participating in the PVP cave!"; + return; + +L_Clean: + set Duel_PVP, 0; + return; - L_Clean: - set Duel_PVP, 0; - return; +L_Death: + if(Duel_PVP != 1) end; + if((getmap() != "001-2") && (getmap() != "001-3")) goto L_Clean; + goto L_GoBack; - L_Death: - if(Duel_PVP != 1) end; - if((getmap() != "001-2") && (getmap() != "001-3")) goto L_Clean; - goto L_GoBack; +OnPCKilledEvent: + goto L_Death; - OnPCKilledEvent: goto L_Death; - OnPCDieEvent: goto L_Death; +OnPCDieEvent: + goto L_Death; } 001-2.gat,130,22,0|script|#GoBack4#Duels|127,1,1, { diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt index 18487a50..2cefe1b4 100644 --- a/world/map/npc/009-7/core.txt +++ b/world/map/npc/009-7/core.txt @@ -5,29 +5,29 @@ function|script|fightclub_sendrequest|, set @loop, 0; goto L_Loop; - L_Loop: - if(@Duel_Queue$[@loop] == @caster_name$) goto L_Exists; - if(@Duel_Queue$[@loop] == "") goto L_Proceed; - set @loop, (@loop + 1); - if(@loop >= getarraysize(@Duel_Queue)) goto L_Full; // this shouldn't happen since we check in magic but we still handle it - goto L_Loop; - - L_Full: - message @caster_name$, "There is already "+ $@Duel_PlayerQueueLimit +" duel request(s) in the queue of this player, which is the maximum."; - return; +L_Loop: + if(@Duel_Queue$[@loop] == @caster_name$) goto L_Exists; + if(@Duel_Queue$[@loop] == "") goto L_Proceed; + set @loop, (@loop + 1); + if(@loop >= getarraysize(@Duel_Queue)) goto L_Full; // this shouldn't happen since we check in magic but we still handle it + goto L_Loop; - L_Exists: - message @caster_name$, "You already requested a duel with this player."; - return; +L_Full: + message @caster_name$, "There is already "+ $@Duel_PlayerQueueLimit +" duel request(s) in the queue of this player, which is the maximum."; + return; - L_Proceed: - misceffect FX_MAGIC_DARKRED, @caster_name$; - message @caster_name$, "Your request has been sent."; - set @Duel_Queue$[@loop], @caster_name$; - if(@Duel_Fighter == 0) message strcharinfo(0), "You have received a new duel request. Talk to Rouge to accept or decline."; - if(@Duel_Fighter == 0) misceffect FX_MAGIC_DARKRED, strcharinfo(0); - if(@Duel_Fighter == 1) set @Duel_HasPendingRequest, 1; - return; +L_Exists: + message @caster_name$, "You already requested a duel with this player."; + return; + +L_Proceed: + misceffect FX_MAGIC_DARKRED, @caster_name$; + message @caster_name$, "Your request has been sent."; + set @Duel_Queue$[@loop], @caster_name$; + if(@Duel_Fighter == 0) message strcharinfo(0), "You have received a new duel request. Talk to Rouge to accept or decline."; + if(@Duel_Fighter == 0) misceffect FX_MAGIC_DARKRED, strcharinfo(0); + if(@Duel_Fighter == 1) set @Duel_HasPendingRequest, 1; + return; } function|script|fightclub_getrules|, @@ -37,23 +37,23 @@ function|script|fightclub_getrules|, if(attachrid(@target) == 1) goto L_Proceed; goto L_Missing; - L_Proceed: - set $@Temp_NoMagic, Duel_NoMagic; - if($@fightclub_myself == getcharid(3)) goto L_Proceed2; // the target is ourselves - if(attachrid($@fightclub_myself) == 1) goto L_Proceed2; - goto L_Missing; - - L_Missing: - end; - - L_Proceed2: - set $@fightclub_myself, 0; - set @target, 0; - if($@Temp_NoMagic != 1) - mes "(no rules)"; - if($@Temp_NoMagic == 1) mes "- No Magic"; - set $@Temp_NoMagic, 0; // now we clean these vars ASAP because they're globals - return; +L_Proceed: + set $@Temp_NoMagic, Duel_NoMagic; + if($@fightclub_myself == getcharid(3)) goto L_Proceed2; // the target is ourselves + if(attachrid($@fightclub_myself) == 1) goto L_Proceed2; + goto L_Missing; + +L_Missing: + end; + +L_Proceed2: + set $@fightclub_myself, 0; + set @target, 0; + if($@Temp_NoMagic != 1) + mes "(no rules)"; + if($@Temp_NoMagic == 1) mes "- No Magic"; + set $@Temp_NoMagic, 0; // now we clean these vars ASAP because they're globals + return; } function|script|fightclub_AddToQueue|, // ** called when someone agree to duel @@ -61,51 +61,51 @@ function|script|fightclub_AddToQueue|, // ** called when someone agree to duel set @Duel_Loop, 0; goto L_Loop; - L_Loop: - if(($@Duel_Queue_Blue$[@Duel_Loop] == @caster_name$) && ($@Duel_Queue_Red$[@Duel_Loop] == @target_name$)) goto L_Exists; - if(($@Duel_Queue_Red$[@Duel_Loop] == @caster_name$) && ($@Duel_Queue_Blue$[@Duel_Loop] == @target_name$)) goto L_Exists; - set @Duel_Loop, (@Duel_Loop + 1); - if(@Duel_Loop >= getarraysize($@Duel_Queue_ID)) goto L_Proceed; - goto L_Loop; - - L_Exists: - mes "This battle is already in the queue."; - close; - - L_Full: - mes "There is already " + $@Duel_QueueLimit + " battles in the queue, which is the maximum. Please try again later."; - close; - - L_Proceed: - if(getarraysize($@Duel_Queue_ID) >= ($@Duel_QueueLimit + 1)) goto L_Full; - set @index, getarraysize($@Duel_Queue_ID); - if(@index >= 1) goto L_Proceed2; - set @index, 1; - goto L_Proceed2; - - L_Proceed2: - if($@Duel_Queue_Red$[@index] != "") goto L_NotClean; - set $@Duel_Queue_Red$[@index], @caster_name$; - if($@Duel_Queue_Blue$[@index] != "") goto L_NotClean; - set $@Duel_Queue_Blue$[@index], @target_name$; - if($@Duel_Queue_ID[@index] != 0) goto L_NotClean; - set $@Duel_Queue_ID[@index], ($@Duel_Queue_ID[(@index - 1)] + 1); - if($@Duel_Queue_ID[@index] <= $Duel_LastDuel) goto L_FixId; - if($@Duel_CurrentDuel < 1) goto L_Request; - return; +L_Loop: + if(($@Duel_Queue_Blue$[@Duel_Loop] == @caster_name$) && ($@Duel_Queue_Red$[@Duel_Loop] == @target_name$)) goto L_Exists; + if(($@Duel_Queue_Red$[@Duel_Loop] == @caster_name$) && ($@Duel_Queue_Blue$[@Duel_Loop] == @target_name$)) goto L_Exists; + set @Duel_Loop, (@Duel_Loop + 1); + if(@Duel_Loop >= getarraysize($@Duel_Queue_ID)) goto L_Proceed; + goto L_Loop; - L_NotClean: - message @caster_name$, "An error occured: array element not empty. Try again in 5 seconds."; - return; +L_Exists: + mes "This battle is already in the queue."; + close; + +L_Full: + mes "There is already " + $@Duel_QueueLimit + " battles in the queue, which is the maximum. Please try again later."; + close; + +L_Proceed: + if(getarraysize($@Duel_Queue_ID) >= ($@Duel_QueueLimit + 1)) goto L_Full; + set @index, getarraysize($@Duel_Queue_ID); + if(@index >= 1) goto L_Proceed2; + set @index, 1; + goto L_Proceed2; + +L_Proceed2: + if($@Duel_Queue_Red$[@index] != "") goto L_NotClean; + set $@Duel_Queue_Red$[@index], @caster_name$; + if($@Duel_Queue_Blue$[@index] != "") goto L_NotClean; + set $@Duel_Queue_Blue$[@index], @target_name$; + if($@Duel_Queue_ID[@index] != 0) goto L_NotClean; + set $@Duel_Queue_ID[@index], ($@Duel_Queue_ID[(@index - 1)] + 1); + if($@Duel_Queue_ID[@index] <= $Duel_LastDuel) goto L_FixId; + if($@Duel_CurrentDuel < 1) goto L_Request; + return; - L_FixId: - set $@Duel_Queue_ID[@index], ($Duel_LastDuel + 1); - if($@Duel_CurrentDuel < 1) goto L_Request; - return; +L_NotClean: + message @caster_name$, "An error occured: array element not empty. Try again in 5 seconds."; + return; - L_Request: - callfunc "fightclub_NextBattle"; - return; +L_FixId: + set $@Duel_Queue_ID[@index], ($Duel_LastDuel + 1); + if($@Duel_CurrentDuel < 1) goto L_Request; + return; + +L_Request: + callfunc "fightclub_NextBattle"; + return; } function|script|fightclub_NextBattle|, // ** called when a duel is finished @@ -116,40 +116,40 @@ function|script|fightclub_NextBattle|, // ** called when a duel is finished set $@Duel_Loop, 1; // start the loop at 1 goto L_Loop; - L_Loop: // here we shift the array to the left - if($@Duel_Queue_ID[$@Duel_Loop] < 1) goto L_Empty; - set $@Duel_Queue_Red$[($@Duel_Loop - 1)], $@Duel_Queue_Red$[$@Duel_Loop]; - set $@Duel_Queue_Red$[$@Duel_Loop], ""; // it is always important to clean - set $@Duel_Queue_Blue$[($@Duel_Loop - 1)], $@Duel_Queue_Blue$[$@Duel_Loop]; - set $@Duel_Queue_Blue$[$@Duel_Loop], ""; - set $@Duel_Queue_ID[($@Duel_Loop - 1)], $@Duel_Queue_ID[$@Duel_Loop]; - set $@Duel_Queue_ID[$@Duel_Loop], 0; - set $@Duel_Loop, ($@Duel_Loop + 1); - if($@Duel_Loop >= getarraysize($@Duel_Queue_ID)) goto L_Proceed; - goto L_Loop; - - L_Empty: - // the queue is now empty - return; +L_Loop: // here we shift the array to the left + if($@Duel_Queue_ID[$@Duel_Loop] < 1) goto L_Empty; + set $@Duel_Queue_Red$[($@Duel_Loop - 1)], $@Duel_Queue_Red$[$@Duel_Loop]; + set $@Duel_Queue_Red$[$@Duel_Loop], ""; // it is always important to clean + set $@Duel_Queue_Blue$[($@Duel_Loop - 1)], $@Duel_Queue_Blue$[$@Duel_Loop]; + set $@Duel_Queue_Blue$[$@Duel_Loop], ""; + set $@Duel_Queue_ID[($@Duel_Loop - 1)], $@Duel_Queue_ID[$@Duel_Loop]; + set $@Duel_Queue_ID[$@Duel_Loop], 0; + set $@Duel_Loop, ($@Duel_Loop + 1); + if($@Duel_Loop >= getarraysize($@Duel_Queue_ID)) goto L_Proceed; + goto L_Loop; - L_Proceed: - callfunc "fightclub_CleanStage"; - set $@Duel_CurrentDuel, $@Duel_Queue_ID[0]; // since the array is shifted, the index is always 0 - set $Duel_LastDuel, $@Duel_Queue_ID[0]; // this is used to keep the same index across reboots - set $@Duel_BluePlayer, getcharid(3,$@Duel_Queue_Blue$[0]); - set $@Duel_RedPlayer, getcharid(3,$@Duel_Queue_Red$[0]); - if(attachrid($@Duel_BluePlayer) != 1) goto L_Missing; - if(attachrid($@Duel_RedPlayer) == 1) goto L_Proceed2; - goto L_Missing; - - L_Missing: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_Empty: + // the queue is now empty + return; - L_Proceed2: - addtimer ($@Duel_TimeBeforeNext * 1000), "#FightClub#utils::OnDelayedNextBattle"; - return; +L_Proceed: + callfunc "fightclub_CleanStage"; + set $@Duel_CurrentDuel, $@Duel_Queue_ID[0]; // since the array is shifted, the index is always 0 + set $Duel_LastDuel, $@Duel_Queue_ID[0]; // this is used to keep the same index across reboots + set $@Duel_BluePlayer, getcharid(3,$@Duel_Queue_Blue$[0]); + set $@Duel_RedPlayer, getcharid(3,$@Duel_Queue_Red$[0]); + if(attachrid($@Duel_BluePlayer) != 1) goto L_Missing; + if(attachrid($@Duel_RedPlayer) == 1) goto L_Proceed2; + goto L_Missing; + +L_Missing: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; + +L_Proceed2: + addtimer ($@Duel_TimeBeforeNext * 1000), "#FightClub#utils::OnDelayedNextBattle"; + return; } function|script|fightclub_NextBattleProceed|, // ** called after the delay @@ -172,10 +172,10 @@ function|script|fightclub_StartBattle|, callfunc "fightclub_enter"; return; - L_Missing: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_Missing: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; } function|script|fightclub_TimeOut|, @@ -190,10 +190,10 @@ function|script|fightclub_TimeOut|, callfunc "fightclub_NextBattle"; return; - L_Missing: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_Missing: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; } function|script|fightclub_Intrusion|, // ** called when someone uninvited is on stage @@ -232,40 +232,40 @@ function|script|fightclub_Missing|, // ** called when the red or blue player dis if (attachrid($@Duel_RedPlayer) == 1) goto L_Proceed; goto L_Resume; // can't attach either of them (this is not a problem since it means they are offline so their vars are clean anyway) - L_Proceed: - if($@Duel_Missing == 1) goto L_BlueWins; - goto L_RedWins; - - L_BlueWins: - donpcevent "Rouge#Duels::OnAnnounceBlueForfeit"; - set $@duel_winner, $@Duel_BluePlayer; - callfunc "fightclub_Victory"; - goto L_Clean; - - L_RedWins: - donpcevent "Rouge#Duels::OnAnnounceRedForfeit"; - set $@duel_winner, $@Duel_RedPlayer; - callfunc "fightclub_Victory"; - goto L_Clean; - - L_KillBlue: - callfunc "fightclub_exit"; - if(attachrid($@Duel_RedPlayer) == 1) goto L_KillRed; - goto L_Resume; - - L_KillRed: - callfunc "fightclub_exit"; - goto L_Resume; - - L_Clean: - if(attachrid($@Duel_BluePlayer) == 1) goto L_KillBlue; - if(attachrid($@Duel_RedPlayer) == 1) goto L_KillRed; - goto L_Resume; // couldn't kill them - - L_Resume: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_Proceed: + if($@Duel_Missing == 1) goto L_BlueWins; + goto L_RedWins; + +L_BlueWins: + donpcevent "Rouge#Duels::OnAnnounceBlueForfeit"; + set $@duel_winner, $@Duel_BluePlayer; + callfunc "fightclub_Victory"; + goto L_Clean; + +L_RedWins: + donpcevent "Rouge#Duels::OnAnnounceRedForfeit"; + set $@duel_winner, $@Duel_RedPlayer; + callfunc "fightclub_Victory"; + goto L_Clean; + +L_KillBlue: + callfunc "fightclub_exit"; + if(attachrid($@Duel_RedPlayer) == 1) goto L_KillRed; + goto L_Resume; + +L_KillRed: + callfunc "fightclub_exit"; + goto L_Resume; + +L_Clean: + if(attachrid($@Duel_BluePlayer) == 1) goto L_KillBlue; + if(attachrid($@Duel_RedPlayer) == 1) goto L_KillRed; + goto L_Resume; // couldn't kill them + +L_Resume: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; } function|script|fightclub_StartUp|, // ** called after the server boots up @@ -309,36 +309,36 @@ function|script|fightclub_setrules|, // ** called by npc; allows the player to c { goto L_Main; - L_Main: - mes "Your rules are the following: "; mes ""; - callfunc "fightclub_getrules"; - mes ""; mes "What do you want to do?"; - menu - "Change my rules.", L_Start, - "Nevermind.", L_Return; - - L_Start: - set Duel_NoMagic, 1; // set the rule to 1 to enable it - goto L_NoMagic; - - L_NoMagic: - if(Duel_NoMagic != 1) goto L_Done; - mes "Do you want to allow magic?"; - mes "If disabled, the fighters will not be able to use any kind of spell."; - menu - "Yes.", L_NoMagicYes, - "No.", L_Done; - L_NoMagicYes: - set Duel_NoMagic, 0; - goto L_Done; - - L_Done: - next; - mes "You have succesfully changed your options."; - goto L_Main; - - L_Return: - return; +L_Main: + mes "Your rules are the following: "; mes ""; + callfunc "fightclub_getrules"; + mes ""; mes "What do you want to do?"; + menu + "Change my rules.", L_Start, + "Nevermind.", L_Return; + +L_Start: + set Duel_NoMagic, 1; // set the rule to 1 to enable it + goto L_NoMagic; + +L_NoMagic: + if(Duel_NoMagic != 1) goto L_Done; + mes "Do you want to allow magic?"; + mes "If disabled, the fighters will not be able to use any kind of spell."; + menu + "Yes.", L_NoMagicYes, + "No.", L_Done; +L_NoMagicYes: + set Duel_NoMagic, 0; + goto L_Done; + +L_Done: + next; + mes "You have succesfully changed your options."; + goto L_Main; + +L_Return: + return; } function|script|fightclub_death|, // ** called by event handler whenever someone dies @@ -347,57 +347,57 @@ function|script|fightclub_death|, // ** called by event handler whenever someone if(@killerrid != 0) goto L_Murdered; goto L_Killed; - L_Killed: - if(getcharid(3) == $@Duel_RedPlayer) goto L_BlueWins; - goto L_RedWins; - - L_RedWins: - donpcevent "Rouge#Duels::OnAnnounceRedWins"; - set $@duel_winner, $@Duel_RedPlayer; - callfunc "fightclub_Victory"; - callfunc "fightclub_exit"; - if(attachrid($@Duel_RedPlayer) == 1) goto L_RedWins2; - goto L_Missing; - - L_RedWins2: - callfunc "fightclub_exit"; - goto L_Proceed; - - L_BlueWins: - donpcevent "Rouge#Duels::OnAnnounceBlueWins"; - set $@duel_winner, $@Duel_BluePlayer; - callfunc "fightclub_Victory"; - callfunc "fightclub_exit"; - if(attachrid($@Duel_BluePlayer) == 1) goto L_BlueWins2; - goto L_Missing; - - L_Missing: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_Killed: + if(getcharid(3) == $@Duel_RedPlayer) goto L_BlueWins; + goto L_RedWins; - L_BlueWins2: - callfunc "fightclub_exit"; - goto L_Proceed; +L_RedWins: + donpcevent "Rouge#Duels::OnAnnounceRedWins"; + set $@duel_winner, $@Duel_RedPlayer; + callfunc "fightclub_Victory"; + callfunc "fightclub_exit"; + if(attachrid($@Duel_RedPlayer) == 1) goto L_RedWins2; + goto L_Missing; - L_Proceed: - callfunc "fightclub_CleanStage"; - callfunc "fightclub_NextBattle"; - return; +L_RedWins2: + callfunc "fightclub_exit"; + goto L_Proceed; - L_Murdered: - if(($@Duel_RedPlayer != @killerrid) && ($@Duel_BluePlayer != @killerrid)) goto L_Stranger; - goto L_Killed; // now we proceed the same way as L_Killed +L_BlueWins: + donpcevent "Rouge#Duels::OnAnnounceBlueWins"; + set $@duel_winner, $@Duel_BluePlayer; + callfunc "fightclub_Victory"; + callfunc "fightclub_exit"; + if(attachrid($@Duel_BluePlayer) == 1) goto L_BlueWins2; + goto L_Missing; - L_Stranger: - // the victim was not murdered by its adversary (wtf) - if(debug) donpcevent "Debug#Duels::OnKillerNotInDuel"; - callfunc "fightclub_EmergencyWipe"; - end; +L_Missing: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; - L_NoDuel: - if(debug) donpcevent "Debug#Duels::OnVictimNotInDuel"; - end; +L_BlueWins2: + callfunc "fightclub_exit"; + goto L_Proceed; + +L_Proceed: + callfunc "fightclub_CleanStage"; + callfunc "fightclub_NextBattle"; + return; + +L_Murdered: + if(($@Duel_RedPlayer != @killerrid) && ($@Duel_BluePlayer != @killerrid)) goto L_Stranger; + goto L_Killed; // now we proceed the same way as L_Killed + +L_Stranger: + // the victim was not murdered by its adversary (wtf) + if(debug) donpcevent "Debug#Duels::OnKillerNotInDuel"; + callfunc "fightclub_EmergencyWipe"; + end; + +L_NoDuel: + if(debug) donpcevent "Debug#Duels::OnVictimNotInDuel"; + end; } function|script|fightclub_enter|, // ** called every time a player enters the ring @@ -428,11 +428,11 @@ function|script|fightclub_exit|, // ** called every time a player exits the ring gmcommand "@killer"; goto L_Clean; - L_Clean: - set @killer, 0; // the player no longer have @killer - gmcommand "@alive"; // refill hp/mana - sc_end 132; sc_end 14; sc_end 37; sc_end 185; // remove effects - message strcharinfo(0), "Thank you for participating in the fight club!"; - if(@Duel_HasPendingRequest) message strcharinfo(0), "You have received a new duel request."; - return; +L_Clean: + set @killer, 0; // the player no longer have @killer + gmcommand "@alive"; // refill hp/mana + sc_end 132; sc_end 14; sc_end 37; sc_end 185; // remove effects + message strcharinfo(0), "Thank you for participating in the fight club!"; + if(@Duel_HasPendingRequest) message strcharinfo(0), "You have received a new duel request."; + return; } diff --git a/world/map/npc/009-7/debug.txt b/world/map/npc/009-7/debug.txt index a06d25ec..2baba28b 100644 --- a/world/map/npc/009-7/debug.txt +++ b/world/map/npc/009-7/debug.txt @@ -1,136 +1,136 @@ function|script|fightclub_Debug|, { goto L_Menu; - L_Menu: - next; - set @bme,0; if(($fightclub_enabled % 6) == 3) set @bme,1; - set @due,0; if(($fightclub_enabled % 5) == 3) set @due,1; - mes "[Global]"; - mes "$Duel_Enabled: " + @due; - mes "$fightclub_bm_enabled: " + @bme; - mes "$@fightclub_password$: " + $fightclub_password$; - mes "$@Duel_TimeBeforeNext: " + $@Duel_TimeBeforeNext; - mes "$@Duel_TimeBeforeWarp: " + $@Duel_TimeBeforeWarp; - mes "$@Duel_TimeBeforeStart: " + $@Duel_TimeBeforeStart; - mes "$@Duel_TimeLimit: " + $@Duel_TimeLimit; - mes "$@Duel_QueueLimit: " + $@Duel_QueueLimit; - mes "$@Duel_PlayerQueueLimit: " + $@Duel_PlayerQueueLimit; - mes "$Duel_LastDuel: " + $Duel_LastDuel; - mes ""; - mes "[User]"; - mes "@Duel_Fighter: " + @Duel_Fighter; - next; - menu - "[G] Toggle $Duel_Enabled", L_DuelEnabled, - "[G] Toggle $fightclub_bm_enabled", L_BmEnabled, - "[G] Set $@fightclub_password$", L_FightclubPassword, - "[G] Set $@Duel_TimeBeforeNext", L_TimeBeforeNext, - "[G] Set $@Duel_TimeBeforeWarp", L_TimeBeforeWarp, - "[G] Set $@Duel_TimeBeforeStart", L_TimeBeforeStart, - "[G] Set $@Duel_TimeLimit", L_TimeLimit, - "[G] Set $@Duel_QueueLimit", L_QueueLimit, - "[G] Set $@Duel_PlayerQueueLimit", L_PlayerQueueLimit, - "[G] Set $Duel_LastDuel", L_LastDuel, - "[U] Toggle @Duel_Fighter", L_DuelFighter, - "Restart fightclub.", L_Restart, - "Nevermind.", L_End; - - L_DuelEnabled: - if(@due < 1) goto L_DuelEnabled2; - set $fightclub_enabled, 9; - if(@bme < 1) set $fightclub_enabled, 1; - goto L_Menu; - L_DuelEnabled2: - set $fightclub_enabled, 8; - if(@bme == 1) set $fightclub_enabled, 3; - goto L_Menu; - - L_BmEnabled: - if(@bme < 1) goto L_BmEnabled2; - set $fightclub_enabled, 8; - if(@due < 1) set $fightclub_enabled, 1; - goto L_Menu; - L_BmEnabled2: - set $fightclub_enabled, 9; - if(@due == 1) set $fightclub_enabled, 3; - goto L_Menu; - - L_DuelFighter: - if(@Duel_Fighter < 1) goto L_DuelFighter2; - set @Duel_Fighter, 0; - goto L_Menu; - L_DuelFighter2: - set @Duel_Fighter, 1; - goto L_Menu; - - L_TimeBeforeNext: - mes "range: 1~500"; - input @time; - if((@time < 1) || (@time > 500)) goto L_OutOfRange; - set $@Duel_TimeBeforeNext, @time; - goto L_Menu; - - L_TimeBeforeWarp: - mes "range: 1~500"; - input @time; - if((@time < 1) || (@time > 500)) goto L_OutOfRange; - set $@Duel_TimeBeforeWarp, @time; - goto L_Menu; - - L_TimeBeforeStart: - mes "range: 1~500"; - input @time; - if((@time < 1) || (@time > 500)) goto L_OutOfRange; - set $@Duel_TimeBeforeStart, @time; - goto L_Menu; - - L_TimeLimit: - mes "range: 1~900"; - input @time; - if((@time < 1) || (@time > 900)) goto L_OutOfRange; - set $@Duel_TimeLimit, @time; - goto L_Menu; - - L_QueueLimit: - mes "range: 1~20"; - input @limit; - if((@limit < 1) || (@limit > 20)) goto L_OutOfRange; - set $@Duel_QueueLimit, @limit; - goto L_Menu; - - L_PlayerQueueLimit: - mes "range: 1~5"; - input @limit; - if((@limit < 1) || (@limit > 5)) goto L_OutOfRange; - set $@Duel_PlayerQueueLimit, @limit; - goto L_Menu; - - L_LastDuel: - mes "range: 1+"; - mes "[R] This will trigger a reboot"; - input @last; - if(@last < 1) goto L_OutOfRange; - set $Duel_LastDuel, @last; - next; - goto L_Restart; - - L_FightclubPassword: - input @pass$; - if(@pass$ == "") goto L_OutOfRange; - set $@fightclub_password$, @pass$; - goto L_Menu; - - L_OutOfRange: - mes "Value out of range or empty."; - goto L_Menu; - - L_Restart: - callfunc "fightclub_EmergencyWipe"; - mes "The temporary variables have been reset."; - goto L_Menu; - - L_End: - return; +L_Menu: + next; + set @bme,0; if(($fightclub_enabled % 6) == 3) set @bme,1; + set @due,0; if(($fightclub_enabled % 5) == 3) set @due,1; + mes "[Global]"; + mes "$Duel_Enabled: " + @due; + mes "$fightclub_bm_enabled: " + @bme; + mes "$@fightclub_password$: " + $fightclub_password$; + mes "$@Duel_TimeBeforeNext: " + $@Duel_TimeBeforeNext; + mes "$@Duel_TimeBeforeWarp: " + $@Duel_TimeBeforeWarp; + mes "$@Duel_TimeBeforeStart: " + $@Duel_TimeBeforeStart; + mes "$@Duel_TimeLimit: " + $@Duel_TimeLimit; + mes "$@Duel_QueueLimit: " + $@Duel_QueueLimit; + mes "$@Duel_PlayerQueueLimit: " + $@Duel_PlayerQueueLimit; + mes "$Duel_LastDuel: " + $Duel_LastDuel; + mes ""; + mes "[User]"; + mes "@Duel_Fighter: " + @Duel_Fighter; + next; + menu + "[G] Toggle $Duel_Enabled", L_DuelEnabled, + "[G] Toggle $fightclub_bm_enabled", L_BmEnabled, + "[G] Set $@fightclub_password$", L_FightclubPassword, + "[G] Set $@Duel_TimeBeforeNext", L_TimeBeforeNext, + "[G] Set $@Duel_TimeBeforeWarp", L_TimeBeforeWarp, + "[G] Set $@Duel_TimeBeforeStart", L_TimeBeforeStart, + "[G] Set $@Duel_TimeLimit", L_TimeLimit, + "[G] Set $@Duel_QueueLimit", L_QueueLimit, + "[G] Set $@Duel_PlayerQueueLimit", L_PlayerQueueLimit, + "[G] Set $Duel_LastDuel", L_LastDuel, + "[U] Toggle @Duel_Fighter", L_DuelFighter, + "Restart fightclub.", L_Restart, + "Nevermind.", L_End; + +L_DuelEnabled: + if(@due < 1) goto L_DuelEnabled2; + set $fightclub_enabled, 9; + if(@bme < 1) set $fightclub_enabled, 1; + goto L_Menu; +L_DuelEnabled2: + set $fightclub_enabled, 8; + if(@bme == 1) set $fightclub_enabled, 3; + goto L_Menu; + +L_BmEnabled: + if(@bme < 1) goto L_BmEnabled2; + set $fightclub_enabled, 8; + if(@due < 1) set $fightclub_enabled, 1; + goto L_Menu; +L_BmEnabled2: + set $fightclub_enabled, 9; + if(@due == 1) set $fightclub_enabled, 3; + goto L_Menu; + +L_DuelFighter: + if(@Duel_Fighter < 1) goto L_DuelFighter2; + set @Duel_Fighter, 0; + goto L_Menu; +L_DuelFighter2: + set @Duel_Fighter, 1; + goto L_Menu; + +L_TimeBeforeNext: + mes "range: 1~500"; + input @time; + if((@time < 1) || (@time > 500)) goto L_OutOfRange; + set $@Duel_TimeBeforeNext, @time; + goto L_Menu; + +L_TimeBeforeWarp: + mes "range: 1~500"; + input @time; + if((@time < 1) || (@time > 500)) goto L_OutOfRange; + set $@Duel_TimeBeforeWarp, @time; + goto L_Menu; + +L_TimeBeforeStart: + mes "range: 1~500"; + input @time; + if((@time < 1) || (@time > 500)) goto L_OutOfRange; + set $@Duel_TimeBeforeStart, @time; + goto L_Menu; + +L_TimeLimit: + mes "range: 1~900"; + input @time; + if((@time < 1) || (@time > 900)) goto L_OutOfRange; + set $@Duel_TimeLimit, @time; + goto L_Menu; + +L_QueueLimit: + mes "range: 1~20"; + input @limit; + if((@limit < 1) || (@limit > 20)) goto L_OutOfRange; + set $@Duel_QueueLimit, @limit; + goto L_Menu; + +L_PlayerQueueLimit: + mes "range: 1~5"; + input @limit; + if((@limit < 1) || (@limit > 5)) goto L_OutOfRange; + set $@Duel_PlayerQueueLimit, @limit; + goto L_Menu; + +L_LastDuel: + mes "range: 1+"; + mes "[R] This will trigger a reboot"; + input @last; + if(@last < 1) goto L_OutOfRange; + set $Duel_LastDuel, @last; + next; + goto L_Restart; + +L_FightclubPassword: + input @pass$; + if(@pass$ == "") goto L_OutOfRange; + set $@fightclub_password$, @pass$; + goto L_Menu; + +L_OutOfRange: + mes "Value out of range or empty."; + goto L_Menu; + +L_Restart: + callfunc "fightclub_EmergencyWipe"; + mes "The temporary variables have been reset."; + goto L_Menu; + +L_End: + return; } 009-7.gat,41,45,0|script|Debug#Duels|181, @@ -140,12 +140,20 @@ function|script|fightclub_Debug|, callfunc "fightclub_Debug"; end; - OnInit: - if(!debug) disablenpc "Debug#Duels"; - end; +OnInit: + if(!debug) disablenpc "Debug#Duels"; + end; // debug messages below - OnKillerNotInDuel: npctalk "WARNING: The victim was not killed by its adversary. Aborting duel..."; end; - OnVictimNotInDuel: npctalk "WARNING: The victim is not part of the duel"; end; - OnVictimInDuelNoDuel: npctalk "WARNING: The victim is part of the duel but no duel is ongoing at the moment."; end; +OnKillerNotInDuel: + npctalk "WARNING: The victim was not killed by its adversary. Aborting duel..."; + end; + +OnVictimNotInDuel: + npctalk "WARNING: The victim is not part of the duel"; + end; + +OnVictimInDuelNoDuel: + npctalk "WARNING: The victim is part of the duel but no duel is ongoing at the moment."; + end; } diff --git a/world/map/npc/009-7/eventHandler.txt b/world/map/npc/009-7/eventHandler.txt index 2ad9ca0a..c23ae3b7 100644 --- a/world/map/npc/009-7/eventHandler.txt +++ b/world/map/npc/009-7/eventHandler.txt @@ -4,9 +4,10 @@ { if(countitem(647)||countitem(725)||countitem(1178)||countitem(5131)||countitem(5132)||countitem(5133)||countitem(5134)||countitem(5135)||countitem(5136)||countitem(5137)||countitem(5138)||countitem(5139)||countitem(5140)||(getgmlevel()>=20)) goto L_Enter; end; - L_Enter: - warp "009-7.gat",34,22; // this warp is a special thanks for contributors - end; + +L_Enter: + warp "009-7.gat",34,22; // this warp is a special thanks for contributors + end; } 009-7.gat,33,21,0|script|#trapdoor3#FightClub|327,0,0, { @@ -18,139 +19,139 @@ { end; - OnIntrusion: - if(getgmlevel() >= 60) end; // allow GMs to be in the ring - if(getcharid(3) == $@Duel_RedPlayer) end; // do not kill the red fighter - if(getcharid(3) == $@Duel_BluePlayer) end; // do not kill the blue fighter - donpcevent "Rouge#Duels::OnAnnounceIntrusion"; - callfunc "fightclub_DestroyMe"; // only kill the intruder(s) - end; +OnIntrusion: + if(getgmlevel() >= 60) end; // allow GMs to be in the ring + if(getcharid(3) == $@Duel_RedPlayer) end; // do not kill the red fighter + if(getcharid(3) == $@Duel_BluePlayer) end; // do not kill the blue fighter + donpcevent "Rouge#Duels::OnAnnounceIntrusion"; + callfunc "fightclub_DestroyMe"; // only kill the intruder(s) + end; - OnDelayedStart: - callfunc "fightclub_StartBattle"; - end; +OnDelayedStart: + callfunc "fightclub_StartBattle"; + end; - OnDelayedNextBattle: - callfunc "fightclub_NextBattleProceed"; - end; +OnDelayedNextBattle: + callfunc "fightclub_NextBattleProceed"; + end; - OnBecomeKiller: - callfunc "fightclub_enter_killer"; - end; +OnBecomeKiller: + callfunc "fightclub_enter_killer"; + end; - OnCommandIntrusion: - areatimer "009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2, 0, "#FightClub#utils::OnIntrusion"; // we can not do this directly on #handler because it already have a timer - end; +OnCommandIntrusion: + areatimer "009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2, 0, "#FightClub#utils::OnIntrusion"; // we can not do this directly on #handler because it already have a timer + end; } 009-7.gat,20,45,0|script|#FightClub#TimeLimit|127,0,0, { end; - OnStartTimer: - set $@Duel_TotalTime, 0; - goto L_StartTimer; +OnStartTimer: + set $@Duel_TotalTime, 0; + goto L_StartTimer; - OnStopTimer: - stopnpctimer; - end; +OnStopTimer: + stopnpctimer; + end; - OnTimer1000: - set $@Duel_TotalTime, ($@Duel_TotalTime + 1); - if($@Duel_TotalTime >= $@Duel_TimeLimit) goto L_TimeOut; - goto L_StartTimer; +OnTimer1000: + set $@Duel_TotalTime, ($@Duel_TotalTime + 1); + if($@Duel_TotalTime >= $@Duel_TimeLimit) goto L_TimeOut; + goto L_StartTimer; - L_TimeOut: - stopnpctimer; - callfunc "fightclub_TimeOut"; - end; +L_TimeOut: + stopnpctimer; + callfunc "fightclub_TimeOut"; + end; - L_StartTimer: - setnpctimer 0; - initnpctimer; - end; +L_StartTimer: + setnpctimer 0; + initnpctimer; + end; - OnInit: - set $@Duel_TotalTime, 0; - end; +OnInit: + set $@Duel_TotalTime, 0; + end; } 009-7.gat,20,44,0|script|#FightClub#handler|127,0,0, { end; - OnInit: - // this event is called when the map server boots up - set $@fightclub_x1, 27; - set $@fightclub_y1, 42; - set $@fightclub_x2, 38; - set $@fightclub_y2, 48; - callfunc "fightclub_StartUp"; - if(($fightclub_enabled % 5) != 3) end; - callfunc "fightclub_CleanStage"; - goto L_StartTimer; - - L_StartTimer: - setnpctimer 0; - initnpctimer; - end; - - OnTimer2000: - // this events checks who is on stage every 2 seconds - set $@areausers, getareausers("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2); // get the number of players on stage - if (($@areausers > 2) || (($@Duel_CurrentDuel < 1) && ($@areausers >= 1))) goto L_Intrusion; // too many players on the stage - if (($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_StartTimer; // no intrusion and no duel ongoing so loop again - if (attachrid($@Duel_BluePlayer) == 0) goto L_BlueMissing; - if (isin("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2) == 0) goto L_BlueMissing; - if (isdead() == 1) goto L_IAmACorpse; - if (attachrid($@Duel_RedPlayer) == 0) goto L_RedMissing; - if (isin("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2) == 0) goto L_RedMissing; - if (isdead() == 1) goto L_IAmACorpse; - detachrid; - goto L_StartTimer; - - L_IAmACorpse: - set $@duel_loser, getcharid(3); - callfunc "fightclub_death"; - goto L_StartTimer; - - L_RedMissing: - set $@Duel_Missing, 1; - callfunc "fightclub_Missing"; - goto L_StartTimer; - - L_BlueMissing: - set $@Duel_Missing, 2; - callfunc "fightclub_Missing"; - goto L_StartTimer; - - L_Intrusion: - cmdothernpc "#FightClub#utils", "Intrusion"; // we can not attach a second timer to this npc so we use another one - callfunc "fightclub_Intrusion"; - goto L_StartTimer; - - OnPCKilledEvent: // fired with the RID of the victim - set @killer, 0; - if(@Duel_Fighter != 1) end; - if(getmap() != "009-7") end; - set $@duel_loser, getcharid(3); // grab the rid of the victim - set $@duel_winner, @killerrid; // grab the rid of the killer - set @killerrid, 0; // reset killerid - callfunc "fightclub_death"; - end; - - OnPCDieEvent: // fired with the RID of the victim - set @killer, 0; - if(@Duel_Fighter != 1) end; - if (($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_Reset; - if(getmap() != "009-7") end; - set @killerrid, 0; // since the player was not murdered, the killerrid is 0 - set $@duel_loser, getcharid(3); // grab the rid of the victim - callfunc "fightclub_death"; - end; - - L_Reset: // the player has duel_fighter but no duel is ongoing (happens if the player quit before fightclub_exit can be called) - if(debug) donpcevent "Debug#Duels::OnVictimInDuelNoDuel"; - callfunc "fightclub_DestroyMe"; // here we attempt to resume the interrupted procedure - end; +OnInit: + // this event is called when the map server boots up + set $@fightclub_x1, 27; + set $@fightclub_y1, 42; + set $@fightclub_x2, 38; + set $@fightclub_y2, 48; + callfunc "fightclub_StartUp"; + if(($fightclub_enabled % 5) != 3) end; + callfunc "fightclub_CleanStage"; + goto L_StartTimer; + +L_StartTimer: + setnpctimer 0; + initnpctimer; + end; + +OnTimer2000: + // this events checks who is on stage every 2 seconds + set $@areausers, getareausers("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2); // get the number of players on stage + if (($@areausers > 2) || (($@Duel_CurrentDuel < 1) && ($@areausers >= 1))) goto L_Intrusion; // too many players on the stage + if (($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_StartTimer; // no intrusion and no duel ongoing so loop again + if (attachrid($@Duel_BluePlayer) == 0) goto L_BlueMissing; + if (isin("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2) == 0) goto L_BlueMissing; + if (isdead() == 1) goto L_IAmACorpse; + if (attachrid($@Duel_RedPlayer) == 0) goto L_RedMissing; + if (isin("009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2) == 0) goto L_RedMissing; + if (isdead() == 1) goto L_IAmACorpse; + detachrid; + goto L_StartTimer; + +L_IAmACorpse: + set $@duel_loser, getcharid(3); + callfunc "fightclub_death"; + goto L_StartTimer; + +L_RedMissing: + set $@Duel_Missing, 1; + callfunc "fightclub_Missing"; + goto L_StartTimer; + +L_BlueMissing: + set $@Duel_Missing, 2; + callfunc "fightclub_Missing"; + goto L_StartTimer; + +L_Intrusion: + cmdothernpc "#FightClub#utils", "Intrusion"; // we can not attach a second timer to this npc so we use another one + callfunc "fightclub_Intrusion"; + goto L_StartTimer; + +OnPCKilledEvent: // fired with the RID of the victim + set @killer, 0; + if(@Duel_Fighter != 1) end; + if(getmap() != "009-7") end; + set $@duel_loser, getcharid(3); // grab the rid of the victim + set $@duel_winner, @killerrid; // grab the rid of the killer + set @killerrid, 0; // reset killerid + callfunc "fightclub_death"; + end; + +OnPCDieEvent: // fired with the RID of the victim + set @killer, 0; + if(@Duel_Fighter != 1) end; + if (($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_Reset; + if(getmap() != "009-7") end; + set @killerrid, 0; // since the player was not murdered, the killerrid is 0 + set $@duel_loser, getcharid(3); // grab the rid of the victim + callfunc "fightclub_death"; + end; + +L_Reset: // the player has duel_fighter but no duel is ongoing (happens if the player quit before fightclub_exit can be called) + if(debug) donpcevent "Debug#Duels::OnVictimInDuelNoDuel"; + callfunc "fightclub_DestroyMe"; // here we attempt to resume the interrupted procedure + end; } diff --git a/world/map/npc/009-7/npcs.txt b/world/map/npc/009-7/npcs.txt index dff26fb2..11e7698b 100644 --- a/world/map/npc/009-7/npcs.txt +++ b/world/map/npc/009-7/npcs.txt @@ -5,14 +5,14 @@ $@fightclub_password$ + ".", L_Enter, "I have no clue.", L_Close; - L_Enter: - mes "Correct. You may enter."; - close2; - warp "009-7.gat", 22, 21; - end; +L_Enter: + mes "Correct. You may enter."; + close2; + warp "009-7.gat", 22, 21; + end; - L_Close: - close; +L_Close: + close; } 009-7.gat,34,23,0|shop|Bartender#Duels|177,Beer :-1,IronPotion :-1,ConcentrationPotion :-1,SmallManaElixir :2400,BottleOfWater :-1,Milk :-1 |