summaryrefslogtreecommitdiff
path: root/world
diff options
context:
space:
mode:
Diffstat (limited to 'world')
-rw-r--r--world/map/npc/002-1/elanore.txt34
-rw-r--r--world/map/npc/009-7/core.txt33
-rw-r--r--world/map/npc/functions/clear_vars.txt5
-rw-r--r--world/map/npc/functions/global_event_handler.txt38
4 files changed, 65 insertions, 45 deletions
diff --git a/world/map/npc/002-1/elanore.txt b/world/map/npc/002-1/elanore.txt
index be14c8bc..b6cdde5a 100644
--- a/world/map/npc/002-1/elanore.txt
+++ b/world/map/npc/002-1/elanore.txt
@@ -17,6 +17,24 @@ function|script|ElanoreFix
return;
}
+function|script|elanore_decrease_exp
+{
+ if (attachrid(@killerrid) == 0)
+ end;
+ set @Q_heal_exp, MAGIC_EXPERIENCE >> 24;
+ if (@Q_heal_exp < 8) goto L_OnPcKillWipe;
+ set @Q_heal_exp, @Q_heal_exp - 8;
+ goto L_OnPcKillFinish;
+
+L_OnPcKillWipe:
+ set @Q_heal_exp, 0;
+ goto L_OnPcKillFinish;
+
+L_OnPcKillFinish:
+ set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE & ~(255 << 24)) | (@Q_heal_exp << 24);
+ return;
+}
+
002-1,75,62,0|script|Elanore#_M|108
{
set @has_magic, getskilllv(SKILL_MAGIC);
@@ -155,22 +173,6 @@ L_Main:
"Goodbye!", L_bye;
goto L_Close;
-OnPCKillEvent:
- if (attachrid(@killerrid) == 0)
- end;
- set @Q_heal_exp, MAGIC_EXPERIENCE >> 24;
- if (@Q_heal_exp < 8) goto L_OnPcKillWipe;
- set @Q_heal_exp, @Q_heal_exp - 8;
- goto L_OnPcKillFinish;
-
-L_OnPcKillWipe:
- set @Q_heal_exp, 0;
- goto L_OnPcKillFinish;
-
-L_OnPcKillFinish:
- set MAGIC_EXPERIENCE, (MAGIC_EXPERIENCE & ~(255 << 24)) | (@Q_heal_exp << 24);
- goto L_Close;
-
L_Lifestones:
mes "[Elanore the Healer]";
mes "\"I always need components for my own healing spells. If you bring me ten gamboge leaves, ten alizarin leaves, ten mauve leaves and ten cobalt leaves, I can make ten lifestones; I will give you half of them.\"";
diff --git a/world/map/npc/009-7/core.txt b/world/map/npc/009-7/core.txt
index ccbec25a..7ee652d8 100644
--- a/world/map/npc/009-7/core.txt
+++ b/world/map/npc/009-7/core.txt
@@ -460,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/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt
index c894586b..0b363e31 100644
--- a/world/map/npc/functions/clear_vars.txt
+++ b/world/map/npc/functions/clear_vars.txt
@@ -257,6 +257,10 @@ L_Barber_Janitor:
callfunc "getHeadStyles"; // this converts class, color and hair
goto L_Return;
+L_Misc:
+ if(Death_Kill) set Death_Kill, 0;
+ goto L_Return;
+
L_Return:
return;
}
@@ -387,6 +391,5 @@ L_EventClear:
// Variable was used in Voltain's script, was renamed and turned into a temporary variable
set $state, 0;
-
end;
}
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
index 45efcaae..0b691e45 100644
--- a/world/map/npc/functions/global_event_handler.txt
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -1,44 +1,26 @@
+// This is the global event dispatcher
+// Do not add code to this file. Please only add callfuncs
+//
+// Author: meko
+
017-9,0,0,0|script|#GlobalHandler|-1
{
end;
-OnPCLoginEvent: // this does not work yet but as soon as it is implemented it will start working
+OnPCLoginEvent:
callfunc "ClearVariables";
end;
OnPCKillEvent:
- set Death_Kill, Death_Kill + 1; // this counts the number of players you have killed
+ callfunc "elanore_decrease_exp"; // decrease heal exp for doing bad things
end;
OnPCKilledEvent:
- goto L_Fightclub_Killed; // this is used by the 1v1 arena
+ callfunc "fightclub_event_killed"; // this is used by the 1v1 arena
+ end;
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 @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_Fightclub_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;
+ callfunc "fightclub_event_die"; // this is used by the 1v1 arena
end;
}