summaryrefslogtreecommitdiff
path: root/world/map/npc/009-7
diff options
context:
space:
mode:
authormekolat <mekolat@gmail.com>2014-10-30 14:11:59 -0400
committermekolat <mekolat@gmail.com>2014-10-30 14:44:48 -0400
commitb2aaa61286c1e3a107df7fcd8d63086b360aa0f6 (patch)
tree0d8d06c4b25734c240c1909a064e4b6d9acfad5f /world/map/npc/009-7
parent7486b2b9f4447b7b5b7f5d8c5ec13b867a2978c7 (diff)
downloadserverdata-b2aaa61286c1e3a107df7fcd8d63086b360aa0f6.tar.gz
serverdata-b2aaa61286c1e3a107df7fcd8d63086b360aa0f6.tar.bz2
serverdata-b2aaa61286c1e3a107df7fcd8d63086b360aa0f6.tar.xz
serverdata-b2aaa61286c1e3a107df7fcd8d63086b360aa0f6.zip
add global death handler
Diffstat (limited to 'world/map/npc/009-7')
-rw-r--r--world/map/npc/009-7/core.txt10
-rw-r--r--world/map/npc/009-7/eventHandler.txt26
2 files changed, 8 insertions, 28 deletions
diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt
index a6c0c0f0..3a92a928 100644
--- a/world/map/npc/009-7/core.txt
+++ b/world/map/npc/009-7/core.txt
@@ -347,6 +347,7 @@ L_Return:
function|script|fightclub_death|, // ** called by event handler whenever someone dies
{
if(@Duel_Fighter != 1) goto L_NoDuel;
+ if(($@Duel_CurrentDuel < 1) || ($@Duel_Started != 1)) goto L_Reset;
if(@killerrid != 0) goto L_Murdered;
goto L_Killed;
@@ -396,11 +397,16 @@ L_Stranger:
// the victim was not murdered by its adversary (wtf)
if(debug) donpcevent "Debug#Duels::OnKillerNotInDuel";
callfunc "fightclub_EmergencyWipe";
- end;
+ return;
L_NoDuel:
if(debug) donpcevent "Debug#Duels::OnVictimNotInDuel";
- end;
+ return;
+
+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
+ return;
}
function|script|fightclub_enter|, // ** called every time a player enters the ring
diff --git a/world/map/npc/009-7/eventHandler.txt b/world/map/npc/009-7/eventHandler.txt
index 6e560f35..4098e14a 100644
--- a/world/map/npc/009-7/eventHandler.txt
+++ b/world/map/npc/009-7/eventHandler.txt
@@ -129,30 +129,4 @@ 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
- 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;
- 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;
}