diff options
Diffstat (limited to 'world/map/npc/009-7')
-rw-r--r-- | world/map/npc/009-7/_mobs.txt | 2 | ||||
-rw-r--r-- | world/map/npc/009-7/battlemaster.txt | 2 | ||||
-rw-r--r-- | world/map/npc/009-7/core.txt | 50 | ||||
-rw-r--r-- | world/map/npc/009-7/debug.txt | 19 | ||||
-rw-r--r-- | world/map/npc/009-7/mapflags.txt | 1 |
5 files changed, 54 insertions, 20 deletions
diff --git a/world/map/npc/009-7/_mobs.txt b/world/map/npc/009-7/_mobs.txt index deae9123..bb641d0c 100644 --- a/world/map/npc/009-7/_mobs.txt +++ b/world/map/npc/009-7/_mobs.txt @@ -3,7 +3,7 @@ -009-7,0,0,0|script|Mob009-7|-1 +009-7,0,0,0|script|Mob009-7|32767 { end; } 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..e1f0b58d 100644 --- a/world/map/npc/009-7/core.txt +++ b/world/map/npc/009-7/core.txt @@ -58,7 +58,7 @@ L_Proceed: goto L_Missing; L_Missing: - end; + return; L_Proceed2: set $@fightclub_myself, 0; @@ -85,11 +85,11 @@ L_Loop: L_Exists: mes "This battle is already in the queue."; - close; + return; L_Full: mes "There is already " + $@Duel_QueueLimit + " battles in the queue, which is the maximum. Please try again later."; - close; + return; L_Proceed2: if(getarraysize($@Duel_Queue_ID) >= ($@Duel_QueueLimit + 1)) goto L_Full; @@ -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; } @@ -459,3 +460,36 @@ function|script|fightclub_exit if(@Duel_HasPendingRequest) message strcharinfo(0), "You have received a new duel request."; return; } + + + +// ** called on OnPCKilledEvent +function|script|fightclub_event_killed +{ + 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 + set $@duel_winner, @killerrid; // grab the rid of the killer + set @killerrid, 0; // reset killerid + callfunc "fightclub_death"; + goto L_End; +L_End: + if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; + return; +} + +// ** called on OnPCDieEvent +function|script|fightclub_event_die +{ + 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 + set $@duel_loser, getcharid(3); // grab the rid of the victim + callfunc "fightclub_death"; + goto L_End; +L_End: + if(getpvpflag(0) == $@Duel_Channel) setpvpflag @previous_channel; + return; +} diff --git a/world/map/npc/009-7/debug.txt b/world/map/npc/009-7/debug.txt index f5283898..94735b3e 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,20 +32,11 @@ 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, "restart|Restart fightclub.", L_Restart, "quit|Nevermind.", L_End; -L_Killer: - gmcommand "@killer"; - goto L_Menu; - -L_Killable: - gmcommand "@killable"; - goto L_Menu; - L_DuelEnabled: if(@due < 1) goto L_DuelEnabled2; set $SANGUINE, $SANGUINE | $@SV_FCDBit; @@ -127,6 +119,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 |