From 4ba4d1fc9a8785c02d7f0bbb1680a83b72f46d0c Mon Sep 17 00:00:00 2001 From: mekolat Date: Wed, 15 Apr 2015 09:31:25 -0400 Subject: make the fight club use channels --- world/map/conf/magic-level1.sex | 10 -------- world/map/conf/magic-level2.sex | 21 ---------------- world/map/conf/magic-level3.sex | 1 - world/map/conf/magic-procedures.sex | 31 ------------------------ world/map/npc/009-7/battlemaster.txt | 2 +- world/map/npc/009-7/core.txt | 11 +++++---- world/map/npc/009-7/debug.txt | 9 +++++++ world/map/npc/009-7/mapflags.txt | 1 + world/map/npc/functions/global_event_handler.txt | 1 + 9 files changed, 18 insertions(+), 69 deletions(-) diff --git a/world/map/conf/magic-level1.sex b/world/map/conf/magic-level1.sex index af34d27a..671ec309 100644 --- a/world/map/conf/magic-level1.sex +++ b/world/map/conf/magic-level1.sex @@ -7,7 +7,6 @@ (GUARD (CASTTIME 500)) (EFFECT - (CALL fightclub_check 0 0) (SCRIPT "{callfunc \"CheckWand\";}") (IF (== (script_int caster "@Wand") @@ -203,7 +202,6 @@ (GUARD (COMPONENTS "Lifestone"))) (EFFECT - (CALL fightclub_check 1 0) (CALL adjust_spellpower school) (CALL default_effect) (IF (failed @@ -264,7 +262,6 @@ 2)) (COMPONENTS "SulphurPowder")))) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (SET damage @@ -301,7 +298,6 @@ (=> (COMPONENTS "SharpKnife") (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower WAR) (CALL default_effect) (CALL install_melee_spell @@ -317,7 +313,6 @@ (=> (COMPONENTS "Knife") (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower WAR) (CALL default_effect) (CALL install_melee_spell @@ -370,7 +365,6 @@ level)) (COMPONENTS "MauveHerb" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 6) @@ -400,7 +394,6 @@ level)) (COMPONENTS "AlizarinHerb" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 7) @@ -430,7 +423,6 @@ level)) (COMPONENTS "GambogeHerb" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 8) @@ -460,7 +452,6 @@ level)) (COMPONENTS "CobaltHerb" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 9) @@ -490,7 +481,6 @@ level)) (COMPONENTS "MaggotSlime" "Root")) (EFFECT - (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 70a37163..993f2a89 100644 --- a/world/map/conf/magic-level2.sex +++ b/world/map/conf/magic-level2.sex @@ -220,15 +220,6 @@ (> (skill caster school) level)) - (REQUIRE - (== (if_then_else (failed (pc target)) - 1 - (not - (is_in (location (pc target)) - (@+ - (@ "009-7" (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))))) 1)) (REQUIRE (if_then_else (failed @@ -363,7 +354,6 @@ 3)) (COMPONENTS "IronPowder")))) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (SET damage spellpower) (SET damage_bonus @@ -566,7 +556,6 @@ 3)) (COMPONENTS "Beer")))) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower WAR) (SET str (str caster)) @@ -601,7 +590,6 @@ 40)) (COMPONENTS "DarkCrystal" "SnakeEgg")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 3 31) @@ -638,7 +626,6 @@ (COMPONENTS (2 "Root"))))) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (SET damage @@ -693,7 +680,6 @@ level)) (COMPONENTS "SmallMushroom" "DarkCrystal")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 3 36) @@ -736,7 +722,6 @@ (+ 2 (/ spellpower 30))))) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (IF (!= caster target) @@ -785,7 +770,6 @@ (+ 2 (/ spellpower 30))))) (EFFECT - (CALL fightclub_check 0 1) (CALL adjust_spellpower school) (sfx target 11 0) (IF (!= caster target) @@ -1077,7 +1061,6 @@ (+ 2 (/ spellpower 30))))) (EFFECT - (CALL fightclub_check 0 1) (CALL adjust_spellpower school) (sfx target SFX_BARRIER 0) (IF (!= caster target) @@ -1114,7 +1097,6 @@ level)) (COMPONENTS "HardSpike" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 26) @@ -1144,7 +1126,6 @@ level)) (COMPONENTS "WhiteFur" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 1 27) @@ -1176,7 +1157,6 @@ level)) (COMPONENTS "MoubooFigurine" "Root")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (CALL default_effect) (CALL gain_xp 2 37) @@ -1206,7 +1186,6 @@ level)) (COMPONENTS "PinkAntenna" "Root")) (EFFECT - (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 d53f1a19..2550da3e 100644 --- a/world/map/conf/magic-level3.sex +++ b/world/map/conf/magic-level3.sex @@ -53,7 +53,6 @@ level)) (COMPONENTS "PileOfAsh")) (EFFECT - (CALL fightclub_check 0 0) (CALL adjust_spellpower school) (SET damage (min diff --git a/world/map/conf/magic-procedures.sex b/world/map/conf/magic-procedures.sex index 6157765d..ea62f50f 100644 --- a/world/map/conf/magic-procedures.sex +++ b/world/map/conf/magic-procedures.sex @@ -280,37 +280,6 @@ (PROCEDURE install_melee_spell (charges base_delay attack_animation) (CALL install_attack_spell charges base_delay 1 attack_animation)) -(PROCEDURE fightclub_check (onSelf onTarget) - (IF (&& - (is_in (location caster) - (@+ - (@ "009-7" (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))) - (|| - (== (script_int caster "$@Duel_NoMagic") 1) - (!= (script_int caster "@Duel_Fighter") 1))) - (ABORT)) - (IF (== onSelf 1) - (IF (&& - (== (substr (location caster) 2 5) "009-7") - (not - (is_in (location caster) - (@+ - (@ "009-7" (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))) - (IF (== onTarget 1) - (IF (&& - (!= (pc target) caster) - (is_in (location (pc target)) - (@+ - (@ "009-7" (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) (CALL default_effect) (sfx location SFX_SUMMON_START 0) diff --git a/world/map/npc/009-7/battlemaster.txt b/world/map/npc/009-7/battlemaster.txt index 33eb04d0..c7316913 100644 --- a/world/map/npc/009-7/battlemaster.txt +++ b/world/map/npc/009-7/battlemaster.txt @@ -58,7 +58,7 @@ function|script|fightclub_GoBack L_GoBack: set DUELS, DUELS &~ $@DuelPvpBit; warp "009-7", 39, 37; - gmcommand "@alive"; + heal MaxHp, MaxSp; message strcharinfo(0), "Thank you for participating!"; return; } diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt index b8439b03..ccbec25a 100644 --- a/world/map/npc/009-7/core.txt +++ b/world/map/npc/009-7/core.txt @@ -235,9 +235,9 @@ function|script|fightclub_Victory function|script|fightclub_DestroyMe { set @Duel_Fighter, 0; + setpvpchannel @previous_channel; 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 - heal -Hp, 0; // doing @killer is unreliable - gmcommand "@alive"; // refill hp/mana + heal MaxHp, MaxSp; // refill hp/mana if(getmap() == "009-7") warp "009-7", rand($@fightclub_x1, $@fightclub_x2), rand(($@fightclub_y1 - 2), ($@fightclub_y1 - 3)); return; } @@ -303,6 +303,7 @@ function|script|fightclub_StartUp setarray $@Duel_Queue_Red$, ""; cleararray $@Duel_Queue_Red$, "", ($@Duel_QueueLimit + 1); set $@Duel_TotalTime, 0; + set $@Duel_Channel, 20; if($fightclub_enabled) set $fightclub_enabled, 0; // this var moved to $SANGUINE // DUELS flags below set $@DuelPvpBit, (1 << 1); @@ -435,7 +436,7 @@ function|script|fightclub_enter { set @Duel_Fighter, 1; warp "009-7", rand($@fightclub_x1,$@fightclub_x2), rand($@fightclub_y1,$@fightclub_y2); - gmcommand "@alive"; // ensure that you can't duel wih a corpse + heal MaxHp, MaxSp; // 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), "#FightClubUtils::OnBecomeKiller"; // call fightclub_enter_killer in 3 seconds @@ -445,8 +446,8 @@ function|script|fightclub_enter // ** called 3 seconds after a player enters the ring 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 + if(getpvpflag(0) != $@Duel_Channel) set @previous_channel, getpvpflag(0); + setpvpchannel $@Duel_Channel; message strcharinfo(0), "GO !"; return; } diff --git a/world/map/npc/009-7/debug.txt b/world/map/npc/009-7/debug.txt index f5283898..cd75a342 100644 --- a/world/map/npc/009-7/debug.txt +++ b/world/map/npc/009-7/debug.txt @@ -19,6 +19,7 @@ L_Menu: mes "##3$##0Duel_LastDuel: ##7" + $Duel_LastDuel + "##0"; mes "---"; mes "##2@##0Duel_Fighter: ##7" + @Duel_Fighter + "##0"; + mes "pvp channel: ##7" + getpvpflag(0) + "##0"; next; menu "toggle|Toggle $Duel_Enabled", L_DuelEnabled, @@ -31,6 +32,7 @@ L_Menu: "edit|Set $@Duel_PlayerQueueLimit", L_PlayerQueueLimit, "edit|Set $@Duel_PlayerQueueTimeOut", L_PlayerQueueTimeOut, "edit|Set $Duel_LastDuel", L_LastDuel, + "edit|Set pvp channel", L_Channel, "toggle|Toggle @Duel_Fighter", L_DuelFighter, "toggle|Toggle killer state", L_Killer, "toggle|Toggle killable state", L_Killable, @@ -127,6 +129,13 @@ L_LastDuel: next; goto L_Restart; +L_Channel: + mes "range: 0~32767"; + input @chn; + if(@last > 32767) goto L_OutOfRange; + setpvpchannel @chn; + goto L_Menu; + L_OutOfRange: mes "Value out of range or empty."; goto L_Menu; diff --git a/world/map/npc/009-7/mapflags.txt b/world/map/npc/009-7/mapflags.txt index 9fdd3a99..b0589894 100644 --- a/world/map/npc/009-7/mapflags.txt +++ b/world/map/npc/009-7/mapflags.txt @@ -1,2 +1,3 @@ 009-7|mapflag|noteleport 009-7|mapflag|monster_noteleport +009-7|mapflag|nopvp diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt index cf331060..45efcaae 100644 --- a/world/map/npc/functions/global_event_handler.txt +++ b/world/map/npc/functions/global_event_handler.txt @@ -39,5 +39,6 @@ L_Fightclub_Die: goto L_End; L_End: + if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; end; } -- cgit v1.2.3-70-g09d2