summaryrefslogtreecommitdiff
path: root/world
diff options
context:
space:
mode:
authormekolat <mekolat@gmail.com>2014-11-04 13:01:07 -0500
committermekolat <mekolat@gmail.com>2014-11-12 14:02:47 -0500
commit64a4adaa06f1059c4ac705199d5a0716c8edef60 (patch)
tree32d1f05c6e846aa791f82d1773f2972f71ad166e /world
parent0ca075ae66c4e6a983e1f25f6e63a39ee12a568e (diff)
downloadserverdata-64a4adaa06f1059c4ac705199d5a0716c8edef60.tar.gz
serverdata-64a4adaa06f1059c4ac705199d5a0716c8edef60.tar.bz2
serverdata-64a4adaa06f1059c4ac705199d5a0716c8edef60.tar.xz
serverdata-64a4adaa06f1059c4ac705199d5a0716c8edef60.zip
fix fight club => v0.4
disallow towel inside ring kill on exit replace killer var with duel_killer remove nosave trigger restart on enable/disable remove accept/decline notification fix ring x2 and y2 forbid betsanc and asorm fix password var in debug allow random passwords handle all effects do not accept if not present fix rules check map too warp randomly on death fallthrough if no acceptable requests use bitmasking instead of modulo remove resave simplify goback do not re-declare randompassword password minigame
Diffstat (limited to 'world')
-rw-r--r--world/map/conf/magic-level1.sex20
-rw-r--r--world/map/conf/magic-level2.sex28
-rw-r--r--world/map/conf/magic-level3.sex2
-rw-r--r--world/map/conf/magic-misc.sex2
-rw-r--r--world/map/conf/magic-procedures.sex25
-rw-r--r--world/map/npc/009-6/brodomir.txt2
-rw-r--r--world/map/npc/009-7/_import.txt3
-rw-r--r--world/map/npc/009-7/battlemaster.txt31
-rw-r--r--world/map/npc/009-7/core.txt76
-rw-r--r--world/map/npc/009-7/debug.txt26
-rw-r--r--world/map/npc/009-7/eventHandler.txt23
-rw-r--r--world/map/npc/009-7/mapflags.txt2
-rw-r--r--world/map/npc/009-7/npcs.txt20
-rw-r--r--world/map/npc/009-7/rouge.txt21
-rw-r--r--world/map/npc/009-7/shops.txt3
-rw-r--r--world/map/npc/009-7/trapdoor.txt63
-rw-r--r--world/map/npc/functions/global_event_handler.txt4
-rw-r--r--world/map/npc/items/warpTowels.txt4
18 files changed, 192 insertions, 163 deletions
diff --git a/world/map/conf/magic-level1.sex b/world/map/conf/magic-level1.sex
index a4aaa8a2..af34d27a 100644
--- a/world/map/conf/magic-level1.sex
+++ b/world/map/conf/magic-level1.sex
@@ -7,7 +7,7 @@
(GUARD
(CASTTIME 500))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(SCRIPT "{callfunc \"CheckWand\";}")
(IF (==
(script_int caster "@Wand")
@@ -203,7 +203,7 @@
(GUARD
(COMPONENTS "Lifestone")))
(EFFECT
- (CALL fightclub_check 1)
+ (CALL fightclub_check 1 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(IF (failed
@@ -264,7 +264,7 @@
2))
(COMPONENTS "SulphurPowder"))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(SET damage
@@ -301,7 +301,7 @@
(=>
(COMPONENTS "SharpKnife")
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower WAR)
(CALL default_effect)
(CALL install_melee_spell
@@ -317,7 +317,7 @@
(=>
(COMPONENTS "Knife")
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower WAR)
(CALL default_effect)
(CALL install_melee_spell
@@ -370,7 +370,7 @@
level))
(COMPONENTS "MauveHerb" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 6)
@@ -400,7 +400,7 @@
level))
(COMPONENTS "AlizarinHerb" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 7)
@@ -430,7 +430,7 @@
level))
(COMPONENTS "GambogeHerb" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 8)
@@ -460,7 +460,7 @@
level))
(COMPONENTS "CobaltHerb" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 9)
@@ -490,7 +490,7 @@
level))
(COMPONENTS "MaggotSlime" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL gain_xp 1 10)
(CALL summon_spell 1002
diff --git a/world/map/conf/magic-level2.sex b/world/map/conf/magic-level2.sex
index 827cd847..c1e61bf5 100644
--- a/world/map/conf/magic-level2.sex
+++ b/world/map/conf/magic-level2.sex
@@ -225,8 +225,8 @@
(is_in (location (pc target))
(@+
(@ "009-7.gat" (script_int caster "$@fightclub_x1") (script_int caster "$@fightclub_y1"))
- (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1"))
- (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1"))))))
+ (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 1)
+ (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 1)))))
(REQUIRE
(if_then_else
(failed
@@ -361,7 +361,7 @@
3))
(COMPONENTS "IronPowder"))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(SET damage spellpower)
(SET damage_bonus
@@ -564,7 +564,7 @@
3))
(COMPONENTS "Beer"))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower WAR)
(SET str
(str caster))
@@ -599,7 +599,7 @@
40))
(COMPONENTS "DarkCrystal" "SnakeEgg"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 3 31)
@@ -636,7 +636,7 @@
(COMPONENTS
(2 "Root")))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(SET damage
@@ -691,7 +691,7 @@
level))
(COMPONENTS "SmallMushroom" "DarkCrystal"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 3 36)
@@ -734,7 +734,7 @@
(+ 2
(/ spellpower 30)))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(IF (!= caster target)
@@ -783,7 +783,7 @@
(+ 2
(/ spellpower 30)))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 1)
(CALL adjust_spellpower school)
(sfx target 11 0)
(IF (!= caster target)
@@ -1075,7 +1075,7 @@
(+ 2
(/ spellpower 30)))))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 1)
(CALL adjust_spellpower school)
(sfx target SFX_BARRIER 0)
(IF (!= caster target)
@@ -1112,7 +1112,7 @@
level))
(COMPONENTS "HardSpike" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 26)
@@ -1142,7 +1142,7 @@
level))
(COMPONENTS "WhiteFur" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 1 27)
@@ -1174,7 +1174,7 @@
level))
(COMPONENTS "MoubooFigurine" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 2 37)
@@ -1204,7 +1204,7 @@
level))
(COMPONENTS "PinkAntenna" "Root"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(CALL default_effect)
(CALL gain_xp 2 38)
diff --git a/world/map/conf/magic-level3.sex b/world/map/conf/magic-level3.sex
index 21b5692f..d53f1a19 100644
--- a/world/map/conf/magic-level3.sex
+++ b/world/map/conf/magic-level3.sex
@@ -53,7 +53,7 @@
level))
(COMPONENTS "PileOfAsh"))
(EFFECT
- (CALL fightclub_check 0)
+ (CALL fightclub_check 0 0)
(CALL adjust_spellpower school)
(SET damage
(min
diff --git a/world/map/conf/magic-misc.sex b/world/map/conf/magic-misc.sex
index 4a08f118..a1cd0dbc 100644
--- a/world/map/conf/magic-misc.sex
+++ b/world/map/conf/magic-misc.sex
@@ -19,7 +19,7 @@
(=>
(GUARD
(REQUIRE
- (== (% (script_int target "$fightclub_enabled") 5) 3)))
+ (== (& (script_int target "$SANGUINE") (script_int target "$@SV_FCDBit")) 0)))
(EFFECT
(IF (== target caster)
(BLOCK
diff --git a/world/map/conf/magic-procedures.sex b/world/map/conf/magic-procedures.sex
index e9ec7aae..e510ec3f 100644
--- a/world/map/conf/magic-procedures.sex
+++ b/world/map/conf/magic-procedures.sex
@@ -280,26 +280,35 @@
(PROCEDURE install_melee_spell (charges base_delay attack_animation)
(CALL install_attack_spell charges base_delay 1 attack_animation))
-(PROCEDURE fightclub_check (healing)
+(PROCEDURE fightclub_check (onSelf onTarget)
(IF (&&
(is_in (location caster)
(@+
(@ "009-7.gat" (script_int caster "$@fightclub_x1") (script_int caster "$@fightclub_y1"))
- (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1"))
- (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1"))))
+ (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 1)
+ (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 1)))
(||
(== (script_int caster "$@Duel_NoMagic") 1)
(!= (script_int caster "@Duel_Fighter") 1)))
(ABORT))
- (IF (== healing 1)
+ (IF (== onSelf 1)
(IF (&&
(== (substr (location caster) 2 5) "009-7")
(not
(is_in (location caster)
(@+
(@ "009-7.gat" (script_int caster "$@fightclub_x1") (script_int caster "$@fightclub_y1"))
- (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1"))
- (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1"))))))
+ (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 1)
+ (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 1)))))
+ (ABORT)))
+ (IF (== onTarget 1)
+ (IF (&&
+ (!= (pc target) caster)
+ (is_in (location (pc target))
+ (@+
+ (@ "009-7.gat" (script_int caster "$@fightclub_x1") (script_int caster "$@fightclub_y1"))
+ (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 1)
+ (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 1))))
(ABORT))))
(PROCEDURE summon_spell (mob_id count delay lifetime control_level school)
@@ -312,8 +321,8 @@
(is_in (location caster)
(@+
(@ "009-7.gat" (- (script_int caster "$@fightclub_x1") 2) (- (script_int caster "$@fightclub_y1") 2))
- (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 2)
- (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 2))) 1 2))
+ (+ (- (script_int caster "$@fightclub_x2") (script_int caster "$@fightclub_x1")) 5)
+ (+ (- (script_int caster "$@fightclub_y2") (script_int caster "$@fightclub_y1")) 5))) 1 2))
caster
mob_id
(if_then_else
diff --git a/world/map/npc/009-6/brodomir.txt b/world/map/npc/009-6/brodomir.txt
index 5e332814..e0443bc4 100644
--- a/world/map/npc/009-6/brodomir.txt
+++ b/world/map/npc/009-6/brodomir.txt
@@ -171,7 +171,6 @@ L_Warp:
mapwarp "009-6.gat", "009-5.gat", 0, 0;
mapannounce "009-5.gat", "PvP On!", 0;
pvpon "009-5.gat";
- areatimer "009-5.gat", 20, 20, 80, 80, 0, "#GoBack2#Duels::OnResave";
end;
L_Warpfail:
@@ -238,7 +237,6 @@ L_Dead:
L_End:
mapwarp "009-5.gat", "009-6.gat", 36, 42;
- areatimer "009-6.gat", 17, 23, 47, 50, 0, "#GoBack2#Duels::OnResave";
goto L_Cleanup;
L_Alreadystarted:
diff --git a/world/map/npc/009-7/_import.txt b/world/map/npc/009-7/_import.txt
index 8881ee7c..4e3eb6d6 100644
--- a/world/map/npc/009-7/_import.txt
+++ b/world/map/npc/009-7/_import.txt
@@ -8,5 +8,6 @@ npc: npc/009-7/core.txt
npc: npc/009-7/debug.txt
npc: npc/009-7/eventHandler.txt
npc: npc/009-7/mapflags.txt
-npc: npc/009-7/npcs.txt
npc: npc/009-7/rouge.txt
+npc: npc/009-7/shops.txt
+npc: npc/009-7/trapdoor.txt
diff --git a/world/map/npc/009-7/battlemaster.txt b/world/map/npc/009-7/battlemaster.txt
index d5c2a37f..a946c5f9 100644
--- a/world/map/npc/009-7/battlemaster.txt
+++ b/world/map/npc/009-7/battlemaster.txt
@@ -1,6 +1,6 @@
009-7.gat,40,35,0|script|Battle Master#Duels|322
{
- if(($fightclub_enabled % 6) != 3) goto L_Disabled;
+ if($SANGUINE & $@SV_BMDBit != 0) goto L_Disabled;
mes "[Battle Master]";
mes "\"Hey, you seem tough enough! Would you like to prove your skills?\"";
next;
@@ -52,8 +52,6 @@ L_NoMoney:
function|script|fightclub_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;
@@ -63,39 +61,30 @@ L_GoBack:
gmcommand "@alive";
message strcharinfo(0), "Thank you for participating!";
return;
-
-L_Clean:
- set DUELS, DUELS &~ $@DuelPvpBit;
- return;
-
-OnResave:
- if(@Duel_PVP == 0) 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
+009-6.gat,36,48,0|script|#GoBack2Duels|127,0,1
+{
+ callfunc "fightclub_GoBack";
+ end;
+}
+009-5.gat,53,74,0|script|#GoBack3Duels|127,3,1
{
callfunc "fightclub_GoBack";
end;
}
-009-5.gat,53,74,0|script|#GoBack3#Duels|127,3,1
+009-3.gat,158,83,0|script|#GoBack5Duels|127,7,0
{
callfunc "fightclub_GoBack";
end;
}
-001-2.gat,130,22,0|script|#GoBack4#Duels|127,1,1
+001-2.gat,130,22,0|script|#GoBack4Duels|127,1,1
{
callfunc "fightclub_GoBack";
end;
}
-001-3.gat,73,28,0|script|#GoBack#Duels|127,0,1
+001-3.gat,73,28,0|script|#GoBack1Duels|127,0,1
{
callfunc "fightclub_GoBack";
end;
diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt
index ab033c66..cc4b9806 100644
--- a/world/map/npc/009-7/core.txt
+++ b/world/map/npc/009-7/core.txt
@@ -49,9 +49,9 @@ L_Missing:
L_Proceed2:
set $@fightclub_myself, 0;
set @target, 0;
- if($@Temp_NoMagic != 1)
+ if($@Temp_NoMagic == 0)
mes "(no rules)";
- if($@Temp_NoMagic == 1) mes "- No Magic";
+ if($@Temp_NoMagic != 0) mes "- No Magic";
set $@Temp_NoMagic, 0; // now we clean these vars ASAP because they're globals
return;
}
@@ -59,14 +59,14 @@ L_Proceed2:
// ** called when someone agree to duel
function|script|fightclub_AddToQueue
{
- set @Duel_Loop, 0;
+ set @ATQ_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;
+ if(($@Duel_Queue_Blue$[@ATQ_Loop] == @caster_name$) && ($@Duel_Queue_Red$[@ATQ_Loop] == @target_name$)) goto L_Exists;
+ if(($@Duel_Queue_Red$[@ATQ_Loop] == @caster_name$) && ($@Duel_Queue_Blue$[@ATQ_Loop] == @target_name$)) goto L_Exists;
+ set @ATQ_Loop, (@ATQ_Loop + 1);
+ if(@ATQ_Loop >= getarraysize($@Duel_Queue_ID)) goto L_Proceed2;
goto L_Loop;
L_Exists:
@@ -77,14 +77,14 @@ L_Full:
mes "There is already " + $@Duel_QueueLimit + " battles in the queue, which is the maximum. Please try again later.";
close;
-L_Proceed:
+L_Proceed2:
if(getarraysize($@Duel_Queue_ID) >= ($@Duel_QueueLimit + 1)) goto L_Full;
set @index, getarraysize($@Duel_Queue_ID);
- if(@index >= 1) goto L_Proceed2;
+ if(@index >= 1) goto L_Proceed22;
set @index, 1;
- goto L_Proceed2;
+ goto L_Proceed22;
-L_Proceed2:
+L_Proceed22:
if($@Duel_Queue_Red$[@index] != "") goto L_NotClean;
set $@Duel_Queue_Red$[@index], @caster_name$;
if($@Duel_Queue_Blue$[@index] != "") goto L_NotClean;
@@ -92,7 +92,6 @@ L_Proceed2:
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_NotClean:
@@ -101,11 +100,6 @@ L_NotClean:
L_FixId:
set $@Duel_Queue_ID[@index], ($Duel_LastDuel + 1);
- if($@Duel_CurrentDuel < 1) goto L_Request;
- return;
-
-L_Request:
- callfunc "fightclub_NextBattle";
return;
}
@@ -150,17 +144,18 @@ L_Missing:
return;
L_Proceed2:
- addtimer ($@Duel_TimeBeforeNext * 1000), "#FightClub#utils::OnDelayedNextBattle";
+ addtimer ($@Duel_TimeBeforeNext * 1000), "#FightClubUtils::OnDelayedNextBattle";
return;
}
// ** called after the delay
function|script|fightclub_NextBattleProceed
{
- set $@Duel_NoMagic, (DUELS & $@NoMagicBit); // get the rules of the caster
+ set $@Duel_NoMagic, 0;
+ if((DUELS & $@NoMagicBit) != 0) set $@Duel_NoMagic, 1; // get the rules of the caster
donpcevent "Rouge#Duels::OnAnnounceNext";
set $@Duel_Started, 0;
- addtimer ($@Duel_TimeBeforeWarp * 1000), "#FightClub#utils::OnDelayedStart";
+ addtimer ($@Duel_TimeBeforeWarp * 1000), "#FightClubUtils::OnDelayedStart";
return;
}
@@ -168,7 +163,7 @@ function|script|fightclub_StartBattle
{
set $@Duel_Started, 1;
npcwarp 40, 45, "Rouge#Duels";
- donpcevent "#FightClub#TimeLimit::OnStartTimer";
+ donpcevent "#FightClubTimeLimit::OnStartTimer";
if(attachrid($@Duel_RedPlayer) != 1) goto L_Missing;
callfunc "fightclub_enter";
if(attachrid($@Duel_BluePlayer) != 1) goto L_Missing;
@@ -183,7 +178,6 @@ L_Missing:
function|script|fightclub_TimeOut
{
- debugmes "on time out";
donpcevent "Rouge#Duels::OnAnnounceTimeOut";
if(attachrid($@Duel_RedPlayer) != 1) goto L_Missing;
callfunc "fightclub_exit";
@@ -226,8 +220,11 @@ function|script|fightclub_Victory
// ** called when the player needs to be reset
function|script|fightclub_DestroyMe
{
- callfunc "fightclub_exit";
- percentheal -100, 0; // dying removes @killable, @killer or any temp buff
+ set @Duel_Fighter, 0;
+ sc_end 132; sc_end 14; sc_end 37; sc_end 185; sc_end 194; sc_end 195; sc_end 196; sc_end 197; sc_end 198; sc_end 199; // remove effects
+ percentheal -100, 0; // doing @killer is unreliable
+ gmcommand "@alive"; // refill hp/mana
+ if(getmap() == "009-7") warp "009-7.gat", rand($@fightclub_x1, $@fightclub_x2), rand(($@fightclub_y1 - 2), ($@fightclub_y1 - 3));
return;
}
@@ -278,14 +275,12 @@ L_Resume:
// ** called after the server boots up
function|script|fightclub_StartUp
{
- if($fightclub_enabled < 1) set $fightclub_enabled, 1; // init the (permanent) enabled global (this will only be done once, when the duel system is merged with master)
if($@Duel_TimeBeforeNext < 1) set $@Duel_TimeBeforeNext, 5; // init the (temporary) TimeBeforeNext global
if($@Duel_TimeBeforeWarp < 1) set $@Duel_TimeBeforeWarp, 5; // init the (temporary) TimeBeforeWarp global
if($@Duel_TimeBeforeStart < 1) set $@Duel_TimeBeforeStart, 3; // init the (temporary) TimeBeforeStart global
if($@Duel_TimeLimit < 1) set $@Duel_TimeLimit, 120; // init the (temporary) TimeLimit global
if($@Duel_QueueLimit < 1) set $@Duel_QueueLimit, 5; // init the (temporary) QueueLimit global
if($@Duel_PlayerQueueLimit < 1) set $@Duel_PlayerQueueLimit, 2; // init the (temporary) PlayerQueueLimit global
- if($@fightclub_password$ == "") set $@fightclub_password$, "Banana"; // init the (temporary) fightclub_password global
setarray $@Duel_Queue_ID, 0;
cleararray $@Duel_Queue_ID, 0, ($@Duel_QueueLimit + 1);
setarray $@Duel_Queue_Blue$, "";
@@ -293,9 +288,12 @@ function|script|fightclub_StartUp
setarray $@Duel_Queue_Red$, "";
cleararray $@Duel_Queue_Red$, "", ($@Duel_QueueLimit + 1);
set $@Duel_TotalTime, 0;
- // flags below
+ // DUELS flags below
set $@DuelPvpBit, (1 << 1);
set $@NoMagicBit, (1 << 2);
+ // $SANGUINE flags below
+ set $@SV_FCDBit, (1 << 1);
+ set $@SV_BMDBit, (1 << 2);
return;
}
@@ -312,7 +310,7 @@ function|script|fightclub_CleanStage
set $@Duel_Missing, 0;
set $@Duel_TotalTime, 0;
npcwarp 32, 45, "Rouge#Duels";
- donpcevent "#FightClub#TimeLimit::OnStopTimer";
+ donpcevent "#FightClubTimeLimit::OnStopTimer";
killmonster "009-7.gat", "All";
return;
}
@@ -335,7 +333,6 @@ L_Start:
goto L_NoMagic;
L_NoMagic:
- 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
@@ -387,9 +384,7 @@ L_BlueWins:
goto L_Missing;
L_Missing:
- callfunc "fightclub_CleanStage";
- callfunc "fightclub_NextBattle";
- return;
+ goto L_Proceed;
L_BlueWins2:
callfunc "fightclub_exit";
@@ -397,7 +392,6 @@ L_BlueWins2:
L_Proceed:
callfunc "fightclub_CleanStage";
- callfunc "fightclub_NextBattle";
return;
L_Murdered:
@@ -426,8 +420,9 @@ function|script|fightclub_enter
set @Duel_Fighter, 1;
warp "009-7.gat", rand($@fightclub_x1,$@fightclub_x2), rand($@fightclub_y1,$@fightclub_y2);
gmcommand "@alive"; // ensure that you can't duel wih a corpse
+ sc_end 132; sc_end 14; sc_end 37; sc_end 185; sc_end 194; sc_end 195; sc_end 196; sc_end 197; sc_end 198; sc_end 199; // remove effects
message strcharinfo(0), "Get Ready.";
- addtimer ($@Duel_TimeBeforeStart * 1000), "#FightClub#utils::OnBecomeKiller"; // call fightclub_enter_killer in 3 seconds
+ addtimer ($@Duel_TimeBeforeStart * 1000), "#FightClubUtils::OnBecomeKiller"; // call fightclub_enter_killer in 3 seconds
return;
}
@@ -436,7 +431,6 @@ function|script|fightclub_enter_killer
{
gmcommand "@killable";
gmcommand "@killer"; // add both killable and killer so if one doesn't kick in, the other (hopefully) will
- set @killer, 1;
message strcharinfo(0), "GO !";
return;
}
@@ -444,17 +438,7 @@ function|script|fightclub_enter_killer
// ** called every time a player exits the ring
function|script|fightclub_exit
{
- set @Duel_Fighter, 0;
- if(getmap() == "009-7") warp "009-7.gat", 31, 40; // do not warp if player left the room
- if(@killer != 1) goto L_Clean;
- gmcommand "@killable";
- 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
+ callfunc "fightclub_DestroyMe"; // kill and reset state
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 da780bc7..c4877b40 100644
--- a/world/map/npc/009-7/debug.txt
+++ b/world/map/npc/009-7/debug.txt
@@ -4,12 +4,11 @@ function|script|fightclub_Debug
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;
+ set @bme,0; if($SANGUINE & $@SV_BMDBit == 0) set @bme,1;
+ set @due,0; if($SANGUINE & $@SV_FCDBit == 0) 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;
@@ -24,7 +23,6 @@ L_Menu:
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,
@@ -38,22 +36,18 @@ L_Menu:
L_DuelEnabled:
if(@due < 1) goto L_DuelEnabled2;
- set $fightclub_enabled, 9;
- if(@bme < 1) set $fightclub_enabled, 1;
+ set $SANGUINE, $SANGUINE | $@SV_FCDBit;
goto L_Menu;
L_DuelEnabled2:
- set $fightclub_enabled, 8;
- if(@bme == 1) set $fightclub_enabled, 3;
- goto L_Menu;
+ set $SANGUINE, $SANGUINE &~ $@SV_FCDBit;
+ goto L_Restart;
L_BmEnabled:
if(@bme < 1) goto L_BmEnabled2;
- set $fightclub_enabled, 8;
- if(@due < 1) set $fightclub_enabled, 1;
+ set $SANGUINE, $SANGUINE | $@SV_BMDBit;
goto L_Menu;
L_BmEnabled2:
- set $fightclub_enabled, 9;
- if(@due == 1) set $fightclub_enabled, 3;
+ set $SANGUINE, $SANGUINE &~ $@SV_BMDBit;
goto L_Menu;
L_DuelFighter:
@@ -115,12 +109,6 @@ L_LastDuel:
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;
diff --git a/world/map/npc/009-7/eventHandler.txt b/world/map/npc/009-7/eventHandler.txt
index dcaae899..fa809fd2 100644
--- a/world/map/npc/009-7/eventHandler.txt
+++ b/world/map/npc/009-7/eventHandler.txt
@@ -1,6 +1,6 @@
// this file handles every events related to the fight club and calls the appropriate functions from core
-009-7.gat,45,33,0|script|#trapdoor2#FightClub|327,0,0
+009-7.gat,45,33,0|script|#trapdoor2FightClub|327,0,0
{
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;
@@ -9,13 +9,13 @@ 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
+009-7.gat,33,21,0|script|#trapdoor3FightClub|327,0,0
{
warp "009-7.gat",44,32;
end;
}
-009-7.gat,22,38,0|script|#FightClub#utils|127
+009-7.gat,22,38,0|script|#FightClubUtils|127
{
end;
@@ -40,11 +40,11 @@ OnBecomeKiller:
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
+ areatimer "009-7.gat", $@fightclub_x1, $@fightclub_y1, $@fightclub_x2, $@fightclub_y2, 0, "#FightClubUtils::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
+009-7.gat,20,45,0|script|#FightClubTimeLimit|127,0,0
{
end;
@@ -76,7 +76,7 @@ OnInit:
end;
}
-009-7.gat,20,44,0|script|#FightClub#handler|127,0,0
+009-7.gat,20,44,0|script|#FightClubHandler|127,0,0
{
end;
@@ -87,7 +87,7 @@ OnInit:
set $@fightclub_x2, 38;
set $@fightclub_y2, 48;
callfunc "fightclub_StartUp";
- if(($fightclub_enabled % 5) != 3) end;
+ if($SANGUINE & $@SV_FCDBit != 0) end;
callfunc "fightclub_CleanStage";
goto L_StartTimer;
@@ -100,7 +100,8 @@ 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 (($@Duel_CurrentDuel < 1) && ($@Duel_Started != 1)) goto L_Request; // start the next duel
+ if ($@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;
@@ -110,6 +111,10 @@ OnTimer2000:
detachrid;
goto L_StartTimer;
+L_Request:
+ callfunc "fightclub_NextBattle";
+ goto L_StartTimer;
+
L_IAmACorpse:
set $@duel_loser, getcharid(3);
callfunc "fightclub_death";
@@ -126,7 +131,7 @@ L_BlueMissing:
goto L_StartTimer;
L_Intrusion:
- cmdothernpc "#FightClub#utils", "Intrusion"; // we can not attach a second timer to this npc so we use another one
+ cmdothernpc "#FightClubUtils", "Intrusion"; // we can not attach a second timer to this npc so we use another one
callfunc "fightclub_Intrusion";
goto L_StartTimer;
}
diff --git a/world/map/npc/009-7/mapflags.txt b/world/map/npc/009-7/mapflags.txt
index d89aaf4f..6a40d04d 100644
--- a/world/map/npc/009-7/mapflags.txt
+++ b/world/map/npc/009-7/mapflags.txt
@@ -1,4 +1,2 @@
009-7.gat|mapflag|noteleport
009-7.gat|mapflag|monster_noteleport
-009-7.gat|mapflag|nosave|009-7,31,40
-009-7.gat|mapflag|resave|009-7,31,40
diff --git a/world/map/npc/009-7/npcs.txt b/world/map/npc/009-7/npcs.txt
deleted file mode 100644
index cdeb6d84..00000000
--- a/world/map/npc/009-7/npcs.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-009-2.gat,38,105,0|script|#trapdoor#FightClub|327,0,0
-{
- mes "What is the password?";
- menu
- $@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_Close:
- close;
-}
-
-009-7.gat,34,23,0|shop|Bartender#Duels|177,Beer:*1,IronPotion:*1,ConcentrationPotion:*1,SmallManaElixir:*2400,BottleOfWater:*1,Milk:*1
-
-009-7.gat,27,26,0|shop|Garçon#Duels|180,RoastedMaggot:*1,PickledBeets:*5000,ChickenLeg:*1,Steak:*1,Beer:*180
diff --git a/world/map/npc/009-7/rouge.txt b/world/map/npc/009-7/rouge.txt
index bf872566..c8c4dfaa 100644
--- a/world/map/npc/009-7/rouge.txt
+++ b/world/map/npc/009-7/rouge.txt
@@ -11,10 +11,11 @@ L_CallDebug:
goto L_Main;
L_Main:
- mes "[Rouge]";
+ set @requests, 0;
if(@Duel_Queue$[0] != "") goto L_Queue;
+ mes "[Rouge]";
mes "Welcome to the Sanguine Vault's duel arena.";
- if(($fightclub_enabled % 5) != 3) goto L_Disabled;
+ if($SANGUINE & $@SV_FCDBit != 0) goto L_Disabled;
mes "What do you want to do?";
menu
"See the commands.", L_Challenge,
@@ -25,7 +26,13 @@ L_Queue:
set @caster_name$, @Duel_Queue$[0];
set @target_name$, strcharinfo(0);
set @target, getcharid(3, @caster_name$);
+ set $@my_rid, getcharid(3);
set @Duel_Queue$[0], "";
+ if(attachrid(@target) != 1) goto L_Missing;
+ if(getmap() != "009-7") goto L_Missing;
+ if(attachrid($@my_rid) != 1) goto L_End;
+ set @requests, (@requests + 1);
+ set $@my_rid, 0; // clean this ASAP
mes @caster_name$ + " wishes to challenge you to a duel.";
mes "";
callfunc "fightclub_getrules";
@@ -37,6 +44,7 @@ L_Queue:
"No.", L_Decline;
L_ShiftQueue: // here we shift the array to the left
+ if((@Duel_Queue$[@loop] == "" ) && (@requests < 1)) goto L_Main;
if(@Duel_Queue$[@loop] == "") goto L_End;
set @Duel_Queue$[(@loop - 1)], @Duel_Queue$[@loop];
set @Duel_Queue$[@loop], "";
@@ -46,17 +54,20 @@ L_ShiftQueue: // here we shift the array to the left
L_Accept:
callfunc "fightclub_AddToQueue";
- message @caster_name$, @target_name$ + " Accepted your offer.";
set @loop, 1;
goto L_ShiftQueue;
L_Decline:
- message @caster_name$, @target_name$ + " turned down your offer.";
set @loop, 1;
goto L_ShiftQueue;
+L_Missing:
+ if(attachrid($@my_rid) != 1) goto L_End;
+ set $@my_rid, 0; // clean this ASAP
+ goto L_Decline;
+
L_Challenge:
- if(($fightclub_enabled % 5) != 3) goto L_Disabled;
+ if($SANGUINE & $@SV_FCDBit != 0) goto L_Disabled;
next;
mes "[Rouge]";
mes "To challenge a player to a duel, you need to write this command:";
diff --git a/world/map/npc/009-7/shops.txt b/world/map/npc/009-7/shops.txt
new file mode 100644
index 00000000..a291cae0
--- /dev/null
+++ b/world/map/npc/009-7/shops.txt
@@ -0,0 +1,3 @@
+009-7.gat,34,23,0|shop|Bartender#Duels|177,Beer:*1,IronPotion:*1,ConcentrationPotion:*1,SmallManaElixir:*2400,BottleOfWater:*1,Milk:*1
+
+009-7.gat,27,26,0|shop|Garçon#Duels|180,RoastedMaggot:*1,PickledBeets:*5000,ChickenLeg:*1,Steak:*1,Beer:*180
diff --git a/world/map/npc/009-7/trapdoor.txt b/world/map/npc/009-7/trapdoor.txt
new file mode 100644
index 00000000..7ab6b0b6
--- /dev/null
+++ b/world/map/npc/009-7/trapdoor.txt
@@ -0,0 +1,63 @@
+009-2.gat,38,105,0|script|#trapdoor#FightClub|327,0,0
+{
+ set @index, rand(0,(getarraysize($@fightclub_randompasswords$) - 1));
+ set @password$, $@fightclub_definitions$[@index];
+ mes "[Bouncer]";
+ mes "\"To enter, you must find the word I have in mind.\"";
+ mes "\"Here's a hint: ##2"+ @password$ + "##0.\"";
+ next;
+ mes "Pick the correct word for this definition.";
+ set @choices_nr, 3;
+ set @good, rand(0,(@choices_nr - 1));
+ setarray @choices$, "";
+ cleararray @choices$, "", getarraysize(@choices$);
+ set @loop, 0;
+ goto L_Shuffle;
+
+L_Shuffle:
+ set @nindex, rand(0,(getarraysize($@fightclub_randompasswords$) - 1));
+ if(@nindex == @index) goto L_Shuffle; // do not get the good definition
+ set @loop2, 0;
+ goto L_Search;
+
+L_Search:
+ if(@choices$[@loop2] == $@fightclub_randompasswords$[@nindex]) goto L_Shuffle; // array is already populated with this choice
+ if(@loop2 >= (@choices_nr - 1)) goto L_Shuffle2;
+ set @loop2, @loop2 + 1;
+ goto L_Search;
+
+L_Shuffle2:
+ set @choices$[@loop], $@fightclub_randompasswords$[@nindex];
+ if(@loop >= (@choices_nr - 1)) goto L_Answer;
+ set @loop, @loop + 1;
+ goto L_Shuffle;
+
+L_Answer:
+ set @choices$[@good], $@fightclub_randompasswords$[@index]; // set the good definition
+ set @choices$[getarraysize(@choices$)], "I have no clue";
+ menu
+ @choices$[0], L_Enter,
+ @choices$[1], L_Enter,
+ @choices$[2], L_Enter,
+ @choices$[3], L_Enter,
+ @choices$[4], L_Enter,
+ @choices$[5], L_Enter,
+ @choices$[6], L_Enter;
+
+L_Enter:
+ if(@menu != (@good + 1)) goto L_Close;
+ mes "Correct. You may enter.";
+ close2;
+ warp "009-7.gat", 22, 21;
+ end;
+
+L_Close:
+ mes "Incorrect.";
+ close;
+
+OnInit:
+ setarray $@fightclub_randompasswords$, "Abibliophobia", "Anencephalous", "Batrachomyomachy", "Blunderbuss", "Boustrophedon", "Bumbershoot", "Canoodle", "Cockalorum", "Cockamamie", "Collywobbles", "Eructation", "Flibbertigibbet", "Formication", "Gaberlunzie", "Gastromancy", "Gobemouche", "Hemidemisemiquaver", "Hobbledehoy", "Hootenanny", "Lickspittle", "Lollygag", "Mumpsimus", "Nincompoop", "Oocephalus", "Pettifogger", "Sialoquent", "Slangwhanger", "Smellfungus", "Tatterdemalion", "Vomitory", "Widdershins", "Avoirdupois", "Embonpoint", "Bibble", "Erinaceous", "Impignorate", "Nudiustertian", "Tittynope", "Winklepicker", "Yarborough", "Floccinaucinihilipilification";
+ setarray $@fightclub_definitions$, "The fear of running out of reading material","Lacking a brain","Making a mountain out of a molehill","A gun with a flared muzzle or disorganized activity","A back and forth pattern","An umbrella","To hug and kiss","A small, haughty man","Absurd, outlandish","Butterflies in the stomach","A burp, belch","Nonsense, balderdash","The sense of ants crawling on your skin","A wandering beggar","Telling fortune from the rumblings of the stomach","A highly gullible person","A musical timing of 1/64","An awkward or ill-mannered young boy","A country or folk music get-together","A servile person, a toady","To move slowly, fall behind","To move slowly, fall behind","A foolish person","An egghead","A person who tries to befuddle others with his speech","Spitting while speaking","A loud abusive speaker or obnoxious writer","A perpetual pessimist","A child in rags","An exit or outlet","In a contrary or counterclockwise direction", "Commodities sold by weight", "A plump, hourglass figure", "To drink often; to eat and/or drink noisily", "Resembling a hedgehog", "To pawn or mortgage something", "The day before yesterday", "A small quantity of something left over", "Style of shoe or boot with a sharp and long pointed toe", "Hand of cards containing no card above a nine", "Estimation that something is valueless";
+ if(getarraysize($@fightclub_randompasswords$) != getarraysize($@fightclub_definitions$)) gmcommand "@mapexit";
+ end;
+}
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
index 0e5650e1..f05e3b62 100644
--- a/world/map/npc/functions/global_event_handler.txt
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -20,7 +20,7 @@ OnPCDieEvent:
// custom handlers below
L_Fightclub_Killed:
- set @killer, 0;
+ set @duel_killer, 0;
if(@Duel_Fighter != 1) goto L_End;
if(getmap() != "009-7") goto L_End;
set $@duel_loser, getcharid(3); // grab the rid of the victim
@@ -30,7 +30,7 @@ L_Fightclub_Killed:
goto L_End;
L_Fightclub_Die:
- set @killer, 0;
+ set @duel_killer, 0;
if(@Duel_Fighter != 1) goto L_End;
if(getmap() != "009-7") goto L_End;
set @killerrid, 0; // since the player was not murdered, the killerrid is 0
diff --git a/world/map/npc/items/warpTowels.txt b/world/map/npc/items/warpTowels.txt
index ac82c92b..585112ff 100644
--- a/world/map/npc/items/warpTowels.txt
+++ b/world/map/npc/items/warpTowels.txt
@@ -5,12 +5,12 @@ function|script|WarpTowel
goto L_DontPanic;
if (isin("botcheck.gat",25,27,51,47))
goto L_Prison;
- if (getmapflag(getmap(), MF_NOSAVE))
+ if (getmapflag(getmap(), MF_NOSAVE) || isin("009-7.gat",$@fightclub_x1,$@fightclub_y1,$@fightclub_x2,$@fightclub_y2))
goto L_Forbid;
callfunc "MultiWarpTowel";
- if (@warpTowelName$ == "HitchhikersTowel")
+ if (@warpTowelName$ == "HitchhikersTowel")
goto L_Save;
if(@warpTowelName$ == "WhiteHitchhikersTowel")
goto L_White;