summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@gmail.com>2014-10-28 22:45:32 -0400
committermekolat <mekolat@gmail.com>2014-10-30 14:21:17 -0400
commit7377f8576c897329e4a96feb45848717b4f26848 (patch)
treeea686917861db54feae1ac3f938e0b6be5b53889
parent1407e7d012b52d425228b5f05c0220f2585b3160 (diff)
downloadserverdata-7377f8576c897329e4a96feb45848717b4f26848.tar.gz
serverdata-7377f8576c897329e4a96feb45848717b4f26848.tar.bz2
serverdata-7377f8576c897329e4a96feb45848717b4f26848.tar.xz
serverdata-7377f8576c897329e4a96feb45848717b4f26848.zip
use bitmasking & merge death handler
-rw-r--r--world/map/npc/001-3/guards.txt4
-rw-r--r--world/map/npc/009-6/brodomir.txt3
-rw-r--r--world/map/npc/009-7/battlemaster.txt68
-rw-r--r--world/map/npc/009-7/core.txt13
-rw-r--r--world/map/npc/009-7/eventHandler.txt1
5 files changed, 31 insertions, 58 deletions
diff --git a/world/map/npc/001-3/guards.txt b/world/map/npc/001-3/guards.txt
index 7b18f252..0c79d3a2 100644
--- a/world/map/npc/001-3/guards.txt
+++ b/world/map/npc/001-3/guards.txt
@@ -15,12 +15,12 @@ L_Sure:
mes "[Phaet the Royal Guard]";
mes "\"Ok.\"";
next;
- if(Duel_PVP == 1) goto L_FightClub;
+ if(DUELS & $@DuelPvpBit) goto L_FightClub;
warp "001-2.gat", 25, 23;
close;
L_FightClub:
- set Duel_PVP, 0;
+ set DUELS, DUELS &~ $@DuelPvpBit;
warp "009-7.gat", 39, 37;
close;
}
diff --git a/world/map/npc/009-6/brodomir.txt b/world/map/npc/009-6/brodomir.txt
index d4b8082f..e981e603 100644
--- a/world/map/npc/009-6/brodomir.txt
+++ b/world/map/npc/009-6/brodomir.txt
@@ -227,11 +227,12 @@ L_SkipItem:
end;
L_Dead_Duels:
+ set DUELS, DUELS &~ $@DuelPvpBit;
warp "009-7.gat", 39, 37;
end;
L_Dead:
- if(Duel_LMS == 1) goto L_Dead_Duels;
+ if(DUELS & $@DuelPvpBit) goto L_Dead_Duels;
warp "009-3.gat", 155,83;
end;
diff --git a/world/map/npc/009-7/battlemaster.txt b/world/map/npc/009-7/battlemaster.txt
index e211092c..776950c0 100644
--- a/world/map/npc/009-7/battlemaster.txt
+++ b/world/map/npc/009-7/battlemaster.txt
@@ -25,7 +25,7 @@ L_Brodomir:
mes "[Battle Master]";
mes "\"Get ready!\"";
close2;
- set Duel_LMS, 1; // tell the arena to send the player back here when he exits
+ set DUELS, DUELS | $@DuelPvpBit; // tell the arena to send the player back here when he exits
warp "009-6.gat", 33, 37;
savepoint "009-7.gat", 39, 37;
end;
@@ -36,7 +36,7 @@ L_PVP:
mes "[Battle Master]";
mes "\"Get ready!\"";
close2;
- set Duel_PVP, 1; // tell the arena to send the player back here when he dies
+ set DUELS, DUELS | $@DuelPvpBit; // tell the arena to send the player back here when he dies
warp "001-3.gat", 0, 0;
savepoint "009-7.gat", 39, 37;
end;
@@ -51,34 +51,25 @@ L_NoMoney:
function|script|fightclub_GoBack|,
{
- if(Duel_LMS == 1) goto L_GoBack;
+ set @Duel_PVP, DUELS & $@DuelPvpBit;
+ if((@Duel_PVP == 0) && ((getmap() == "009-6") || (getmap() == "009-5"))) goto L_NormalExit;
+ if((getmap() != "009-6") && (getmap() != "009-5") && (getmap() != "001-2") && (getmap() != "001-3")) goto L_Clean;
+ if(@Duel_PVP != 0) goto L_GoBack;
return;
L_GoBack:
- set Duel_LMS, 0;
+ set DUELS, DUELS &~ $@DuelPvpBit;
warp "009-7.gat", 39, 37;
gmcommand "@alive";
- message strcharinfo(0), "Thank you for participating in Last Man Standing!";
+ message strcharinfo(0), "Thank you for participating!";
return;
L_Clean:
- set Duel_LMS, 0;
+ set DUELS, DUELS &~ $@DuelPvpBit;
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;
+ if(@Duel_PVP == 0) end;
savepoint "009-7.gat", 39, 37;
return;
@@ -89,46 +80,23 @@ L_NormalExit:
}
009-6.gat,36,48,0|script|#GoBack2#Duels|127,0,1,
{
- callfunc "fightclub_GoBack"; end;
+ callfunc "fightclub_GoBack";
+ end;
}
009-5.gat,53,74,0|script|#GoBack3#Duels|127,3,1,
{
- callfunc "fightclub_GoBack"; end;
+ callfunc "fightclub_GoBack";
+ end;
}
-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_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;
-
-OnPCKilledEvent:
- goto L_Death;
-
-OnPCDieEvent:
- goto L_Death;
-}
001-2.gat,130,22,0|script|#GoBack4#Duels|127,1,1,
{
- callfunc "fightclub_GoBack2"; end;
+ callfunc "fightclub_GoBack";
+ end;
}
001-3.gat,73,28,0|script|#GoBack#Duels|127,0,1,
{
- callfunc "fightclub_GoBack2"; end;
+ callfunc "fightclub_GoBack";
+ end;
}
diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt
index 2cefe1b4..9ec0ab77 100644
--- a/world/map/npc/009-7/core.txt
+++ b/world/map/npc/009-7/core.txt
@@ -38,7 +38,7 @@ function|script|fightclub_getrules|,
goto L_Missing;
L_Proceed:
- set $@Temp_NoMagic, Duel_NoMagic;
+ set $@Temp_NoMagic, (DUELS & $@NoMagicBit);
if($@fightclub_myself == getcharid(3)) goto L_Proceed2; // the target is ourselves
if(attachrid($@fightclub_myself) == 1) goto L_Proceed2;
goto L_Missing;
@@ -154,7 +154,7 @@ L_Proceed2:
function|script|fightclub_NextBattleProceed|, // ** called after the delay
{
- set $@Duel_NoMagic, Duel_NoMagic; // get the rules of the caster
+ set $@Duel_NoMagic, (DUELS & $@NoMagicBit); // get the rules of the caster
donpcevent "Rouge#Duels::OnAnnounceNext";
set $@Duel_Started, 0;
addtimer ($@Duel_TimeBeforeWarp * 1000), "#FightClub#utils::OnDelayedStart";
@@ -285,6 +285,9 @@ function|script|fightclub_StartUp|, // ** called after the server boots up
setarray $@Duel_Queue_Red$, "";
cleararray $@Duel_Queue_Red$, "", ($@Duel_QueueLimit + 1);
set $@Duel_TotalTime, 0;
+ // flags below
+ set $@DuelPvpBit, (1 << 1);
+ set $@NoMagicBit, (1 << 2);
return;
}
@@ -318,18 +321,18 @@ L_Main:
"Nevermind.", L_Return;
L_Start:
- set Duel_NoMagic, 1; // set the rule to 1 to enable it
+ set DUELS, DUELS | $@NoMagicBit;
goto L_NoMagic;
L_NoMagic:
- if(Duel_NoMagic != 1) goto L_Done;
+ if((DUELS & $@NoMagicBit) != 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;
+ set DUELS, DUELS &~ $@NoMagicBit;
goto L_Done;
L_Done:
diff --git a/world/map/npc/009-7/eventHandler.txt b/world/map/npc/009-7/eventHandler.txt
index c23ae3b7..662b222a 100644
--- a/world/map/npc/009-7/eventHandler.txt
+++ b/world/map/npc/009-7/eventHandler.txt
@@ -141,6 +141,7 @@ OnPCKilledEvent: // fired with the RID of the victim
end;
OnPCDieEvent: // fired with the RID of the victim
+ callfunc "fightclub_GoBack"; // TODO: we need a unified death handler
set @killer, 0;
if(@Duel_Fighter != 1) end;
if (($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_Reset;