summaryrefslogtreecommitdiff
path: root/world/map/npc/annuals/2022.txt
diff options
context:
space:
mode:
Diffstat (limited to 'world/map/npc/annuals/2022.txt')
-rw-r--r--world/map/npc/annuals/2022.txt97
1 files changed, 97 insertions, 0 deletions
diff --git a/world/map/npc/annuals/2022.txt b/world/map/npc/annuals/2022.txt
index 3c2d4dbb..58b9fa27 100644
--- a/world/map/npc/annuals/2022.txt
+++ b/world/map/npc/annuals/2022.txt
@@ -286,3 +286,100 @@ OnInit:
end;
}
+
+020-1,78,85,0|script|Santa#X2022|200
+{
+ mesn l("Santa Claus");
+ mesq l("Hey folks! I was using [@@5288|@@] to foil Baltashar attempts to ruin Christmas for the poor kids, but the plan turned against me this time! Hohoho!");
+ next;
+ mesn l("Santa Claus");
+ mesq l("That's because I forgot Jack Frost existed, hohoho! So, if you could collect the [@@5288|@@] back to me... Well, you would get a Christmas gift, that's for sure, hohoho!");
+ next;
+ mesn l("Santa Claus");
+ mesq l("I recovered "+$XMAS2022+" [@@5288|@@]. From these, you gave me "+XMAS2022+" [@@5288|@@]. Grinchboos have them but they only appear every hour in four maps, and the others were lost to time, so... Do you want to give me some more?");
+ next;
+ menu
+ "Deliver", L_Deliver,
+ "Scoreboards", L_Scores,
+ "I'll get to it.", L_Close;
+
+L_Deliver:
+ set XMAS2022, XMAS2022 + countitem(Naftalin);
+ set $XMAS2022, $XMAS2022 + countitem(Naftalin);
+ delitem Naftalin, countitem(Naftalin);
+ set @loop, 0;
+ set @rank, 0;
+ goto L_MaybeInsertNext;
+
+L_MaybeInsertNext:
+ if (XMAS2022 > $Record_XXXmas_Kills[@rank])
+ goto L_InsertScore;
+ // you already had a better score
+ if (strcharinfo(0) == $Record_XXXmas_Name$[@rank])
+ goto L_Scores;
+ set @rank, @rank + 1;
+ if (@rank == MAX_HIGH_SCORES)
+ goto L_Scores;
+ goto L_MaybeInsertNext;
+
+L_InsertScore:
+ set @loop, @rank;
+ goto L_FindLastScore;
+
+L_FindLastScore:
+ // comment this out to allow the player to be in the list more than once
+ // though actually, it might be better just to assume the list is full
+ if (strcharinfo(0) == $Record_XXXmas_Name$[@loop])
+ goto L_MoveStuff;
+
+ set @loop, @loop + 1;
+ if (@loop == MAX_HIGH_SCORES)
+ goto L_MoveStuff;
+ goto L_FindLastScore;
+
+L_MoveStuff:
+ if (@loop == @rank)
+ goto L_FinallyInsertMe;
+ set $Record_XXXmas_Kills[@loop], $Record_XXXmas_Kills[@loop - 1];
+ set $Record_XXXmas_Name$[@loop], $Record_XXXmas_Name$[@loop - 1];
+ set $Record_XXXmas_Date$[@loop], $Record_XXXmas_Date$[@loop - 1];
+ set @loop, @loop - 1;
+ goto L_MoveStuff;
+
+L_FinallyInsertMe:
+ set $Record_XXXmas_Kills[@rank], XMAS2022;
+ set $Record_XXXmas_Name$[@rank], strcharinfo(0);
+ callfunc "time_stamp";
+ set $Record_XXXmas_Date$[@rank], @ts_date$ + " " + @ts_time$;
+ set @ts_date$, "";
+ set @ts_time$, "";
+ goto L_Scores;
+
+L_Scores:
+ set @rank, 0;
+ set @loop, 0;
+ goto L_ShowNextRecord;
+
+L_ShowNextRecord:
+ if ($Record_XXXmas_Kills[@loop] == 0)
+ goto L_Close;
+ mes (@loop + 1) + " - " + $Record_XXXmas_Name$[@loop] + " - " + $Record_XXXmas_Kills[@loop] + " [@@5288|@@] delivered at " + $Record_XXXmas_Date$[@loop];
+ set @loop, @loop + 1;
+ if (MAX_HIGH_SCORES > 4 && (@loop % 5) == 0 && $Record_XXXmas_Kills[@loop] > 0)
+ goto L_NextShowNextRecord;
+ goto L_ShowNextRecord;
+
+L_NextShowNextRecord:
+ next;
+ goto L_ShowNextRecord;
+
+L_Close:
+ close;
+}
+
+// Override mapflags for Christmas 2022
+033-1|mapflag|town
+034-1|mapflag|town
+046-1|mapflag|town
+047-1|mapflag|town
+