summaryrefslogtreecommitdiff
path: root/world/map/npc
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc')
-rw-r--r--world/map/npc/001-1/_warps.txt4
-rw-r--r--world/map/npc/009-7/core.txt10
-rw-r--r--world/map/npc/009-7/eventHandler.txt26
-rw-r--r--world/map/npc/021-1/_warps.txt16
-rw-r--r--world/map/npc/042-1/_warps.txt8
-rw-r--r--world/map/npc/functions/global_event_handler.txt43
-rw-r--r--world/map/npc/scripts.conf1
7 files changed, 66 insertions, 42 deletions
diff --git a/world/map/npc/001-1/_warps.txt b/world/map/npc/001-1/_warps.txt
index d113ba85..a15050cf 100644
--- a/world/map/npc/001-1/_warps.txt
+++ b/world/map/npc/001-1/_warps.txt
@@ -4,5 +4,5 @@
001-1.gat,44,87|warp|To Sandstorm Desert|3,-1,002-1.gat,58,14
001-1.gat,44,20|warp|To North Tulimshar|3,-1,021-1.gat,55,145
001-1.gat,125,21|warp|To North Tulimshar|0,-1,021-1.gat,136,146
-001-1.gat,32,70|warp|To Tulimshar Indoor|-1,-1,001-2.gat,25,34
-001-1.gat,75,40|warp|To Tulimshar Indoor|-1,-1,001-2.gat,71,72
+001-1.gat,32,71|warp|To Tulimshar Indoor|-1,-1,001-2.gat,25,34
+001-1.gat,75,41|warp|To Tulimshar Indoor|-1,-1,001-2.gat,71,72
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;
}
diff --git a/world/map/npc/021-1/_warps.txt b/world/map/npc/021-1/_warps.txt
index daa1a89d..429a522f 100644
--- a/world/map/npc/021-1/_warps.txt
+++ b/world/map/npc/021-1/_warps.txt
@@ -8,18 +8,18 @@
021-1.gat,135,119|warp|To Tulimshar Musuem|-1,-1,021-2.gat,90,177
021-1.gat,55,146|warp|To South Tulimshar|3,-1,001-1.gat,44,21
021-1.gat,136,147|warp|To South Tulimshar|0,-1,001-1.gat,125,22
-021-1.gat,53,133|warp|To Government Building|-1,-1,021-2.gat,27,29
-021-1.gat,55,133|warp|To Government Building|-1,-1,021-2.gat,33,29
-021-1.gat,57,133|warp|To Government Building|-1,-1,021-2.gat,39,29
-021-1.gat,103,99|warp|To Tulimshar Bakery|-1,-1,021-2.gat,91,27
+021-1.gat,53,134|warp|To Government Building|-1,-1,021-2.gat,27,29
+021-1.gat,55,134|warp|To Government Building|-1,-1,021-2.gat,33,29
+021-1.gat,57,134|warp|To Government Building|-1,-1,021-2.gat,39,29
+021-1.gat,103,100|warp|To Tulimshar Bakery|-1,-1,021-2.gat,91,27
021-1.gat,103,96|warp|To Bakery|-1,-1,021-2.gat,122,23
021-1.gat,49,64|warp|To Tulimshar Canyon|3,-1,024-1.gat,86,73
-021-1.gat,53,98|warp|To Wizard's Rest|-1,-1,021-2.gat,25,66
+021-1.gat,53,99|warp|To Wizard's Rest|-1,-1,021-2.gat,25,66
021-1.gat,52,95|warp|To Wizard's Rest|-1,-1,021-2.gat,70,63
021-1.gat,73,22|warp|To Tulimshar Port|3,-1,022-1.gat,73,109
021-1.gat,113,22|warp|To Tulimshar Port|3,-1,022-1.gat,113,109
-021-1.gat,132,30|warp|To Tulimshar Forge|-1,-1,021-2.gat,79,138
+021-1.gat,132,31|warp|To Tulimshar Forge|-1,-1,021-2.gat,79,138
021-1.gat,133,24|warp|To Tulimshar Forge|-1,-1,021-2.gat,75,92
021-1.gat,125,27|warp|To Tulimshar Forge|-1,-1,021-2.gat,124,68
-021-1.gat,125,30|warp|To Tulimshar Forge|-1,-1,021-2.gat,72,138
-021-1.gat,43,109|warp|To Store|-1,-1,021-2.gat,28,129
+021-1.gat,125,31|warp|To Tulimshar Forge|-1,-1,021-2.gat,72,138
+021-1.gat,43,110|warp|To Store|-1,-1,021-2.gat,28,129
diff --git a/world/map/npc/042-1/_warps.txt b/world/map/npc/042-1/_warps.txt
index b8e20944..8c1043ea 100644
--- a/world/map/npc/042-1/_warps.txt
+++ b/world/map/npc/042-1/_warps.txt
@@ -3,12 +3,12 @@
042-1.gat,97,41|warp|To Tulismhar Docks|-1,2,022-1.gat,21,37
042-1.gat,65,20|warp|To Lighthouse Beach|0,-1,023-1.gat,64,143
-042-1.gat,91,72|warp|To Store House|-1,-1,042-2.gat,22,92
-042-1.gat,104,72|warp|To Store House|-1,-1,042-2.gat,44,92
-042-1.gat,65,74|warp|To Tulimshar Suburbs House|-1,-1,042-2.gat,29,61
+042-1.gat,91,73|warp|To Store House|-1,-1,042-2.gat,22,92
+042-1.gat,104,73|warp|To Store House|-1,-1,042-2.gat,44,92
+042-1.gat,65,75|warp|To Tulimshar Suburbs House|-1,-1,042-2.gat,29,61
042-1.gat,62,42|warp|To Sorfina's Dinner|-1,-1,042-2.gat,112,85
042-1.gat,51,43|warp|To Sorfina's House|-1,-1,042-2.gat,44,30
-042-1.gat,117,101|warp|To Magic School Research|-1,-1,042-2.gat,103,62
+042-1.gat,117,102|warp|To Magic School Research|-1,-1,042-2.gat,103,62
042-1.gat,112,95|warp|To Magic School Research|-1,-1,042-2.gat,94,54
042-1.gat,120,95|warp|To Magic School Research|-1,-1,042-2.gat,112,54
042-1.gat,117,85|warp|To Tulismhar Docks|-1,-1,022-1.gat,49,82
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
new file mode 100644
index 00000000..acb328f4
--- /dev/null
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -0,0 +1,43 @@
+017-9.gat,0,0,0|script|#GlobalHandler|-1,-1,-1,
+{
+ end;
+
+OnPCLoginEvent: // this does not work yet but as soon as it is implemented it will start working
+ callfunc "ClearVariables";
+ end;
+
+OnPCKillEvent:
+ set Death_Kill, Death_Kill + 1; // this counts the number of players you have killed
+ end;
+
+OnPCKilledEvent:
+ goto L_Fightclub_Killed; // this is used by the 1v1 arena
+
+OnPCDieEvent:
+ callfunc "fightclub_GoBack"; // this used by the battle master
+ goto L_Fightclub_Die; // this is used by the 1v1 arena
+
+// custom handlers below
+
+L_Fightclub_Killed:
+ set @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_Fightclub_Die:
+ set @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:
+ end;
+}
diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf
index 047d7dbb..d37a8c57 100644
--- a/world/map/npc/scripts.conf
+++ b/world/map/npc/scripts.conf
@@ -23,6 +23,7 @@ npc: npc/functions/lockpicking.txt
npc: npc/functions/default_npc_checks.txt
npc: npc/functions/undead_debug.txt
npc: npc/functions/headstyles.txt
+npc: npc/functions/global_event_handler.txt
// Item Functions
npc: npc/items/magic_gm_top_hat.txt