summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/clear_vars.txt36
-rw-r--r--npc/functions/global_event_handler.txt2
-rw-r--r--npc/functions/mob_points.txt11
-rw-r--r--npc/functions/vault.txt2
4 files changed, 48 insertions, 3 deletions
diff --git a/npc/functions/clear_vars.txt b/npc/functions/clear_vars.txt
index e5e6e5d4..aac27666 100644
--- a/npc/functions/clear_vars.txt
+++ b/npc/functions/clear_vars.txt
@@ -1,7 +1,11 @@
+// Update variables on server init, login and logout
-function script ClearVariables {
- if (@login_event != 1) goto L_Deprecated;
+function script isChristmas21 {
+ // FIXME: 12/12 = 346; 26/12 = 360; 09/01 = 9 (OBVIOUSLY)
+ return (gettime(8) >= 346 || gettime(8) <= 360 || $@XMAS21_OVERRIDE);
+}
+function script ClearVariables {
// Some temporary bugfix
GM = getgroupid();
@@ -138,10 +142,38 @@ function script ClearVariables {
//QUEST_MAGIC2 = 0;
OrumQuest = 0;
}
+
+ // Christmas 2021 Event
+ if (isChristmas21()) {
+ #OLD_EXP=BaseExp;
+ #OLD_LV=BaseLevel;
+ }
return;
}
+function script FlushVariables {
+ // Some variables should not be saved
+ GM = 0;
+ ##01_TMWEXP = 0;
+
+ // Christmas 2021 Event
+ if (isChristmas21()) {
+ #NEW_LV+=(BaseLevel-#OLD_LV);
+ if (BaseLevel != #OLD_LV) {
+ #NEW_EXP=BaseExp;
+ } else {
+ #NEW_EXP+=BaseExp-#OLD_EXP;
+ }
+ #OLD_EXP=0;
+ #OLD_LV=0;
+ if (getvaultid()) ##01_TMWEXP=#NEW_EXP; // (Techinically wrong)
+ }
+ return;
+}
+
+
+
function script ServerUpdate {
if ($@STARTUP) {
debugmes "Cowardly refusing to update server outside startup";
diff --git a/npc/functions/global_event_handler.txt b/npc/functions/global_event_handler.txt
index b63fb28f..f94e7fc8 100644
--- a/npc/functions/global_event_handler.txt
+++ b/npc/functions/global_event_handler.txt
@@ -15,7 +15,7 @@ OnPCLoginEvent:
end;
OnPCLogoutEvent:
- GM = 0;
+ FlushVariables();
vaultOnLogout();
end;
diff --git a/npc/functions/mob_points.txt b/npc/functions/mob_points.txt
index b4361f0a..fb13def9 100644
--- a/npc/functions/mob_points.txt
+++ b/npc/functions/mob_points.txt
@@ -15,6 +15,17 @@ function script MobPoints {
MONSTERS_KILLED+=1;
@mobId=killedrid;
+ if (isChristmas21() && compare(getmap(), "@"+callfunc("X21ID2"))) {
+ if (getmonsterinfo(getarg(0), MOB_LV) >= 150)
+ getitem AquaTicket, 2;
+ else if (getmonsterinfo(getarg(0), MOB_LV) >= 100 && any(true, false))
+ getitem AquaTicket, 2;
+ else if (getmonsterinfo(getarg(0), MOB_LV) >= 40 && any(true, false, false))
+ getitem AquaTicket, 1;
+ else if (rand2(5) == 3)
+ getitem AquaTicket, 1;
+ }
+
if (MPQUEST) {
.@moblv=strmobinfo(3,killedrid);
diff --git a/npc/functions/vault.txt b/npc/functions/vault.txt
index 4f45c871..2022b726 100644
--- a/npc/functions/vault.txt
+++ b/npc/functions/vault.txt
@@ -88,6 +88,8 @@ function script vaultOnLogout {
"VAR1V", ##01_TMWQUEST,
"VAR2N", "TMWGLOBAL",
"VAR2V", ##01_TMWGLOBAL,
+ "VAR2N", "TMWEXP",
+ "VAR2V", ##01_TMWEXP,
"VEXP", ##VAULT_EXP,
"GOTO", ##VAULT_GOTO,
"MLTO", ##VAULT_MLTO);