summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--world/map/db/generic_item_db.txt4
-rw-r--r--world/map/db/use_item_db.txt4
-rw-r--r--world/map/npc/001-1/vincent.txt2
-rw-r--r--world/map/npc/006-1/pachua.txt3
-rw-r--r--world/map/npc/008-1/george.txt3
-rw-r--r--world/map/npc/009-2/kfahr.txt3
-rw-r--r--world/map/npc/009-2/nurse.txt2
-rw-r--r--world/map/npc/010-2/workers.txt3
-rw-r--r--world/map/npc/021-1/eurni.txt3
-rw-r--r--world/map/npc/021-1/inac.txt3
-rw-r--r--world/map/npc/021-1/weellos.txt3
-rw-r--r--world/map/npc/021-2/government_building.txt3
-rw-r--r--world/map/npc/026-1/_import.txt1
-rw-r--r--world/map/npc/026-1/munro.txt93
-rw-r--r--world/map/npc/027-2/caretaker.txt3
-rw-r--r--world/map/npc/030-2/storage_helper.txt2
-rw-r--r--world/map/npc/033-1/kimarr.txt3
-rw-r--r--world/map/npc/048-2/sageNikolai.txt3
-rw-r--r--world/map/npc/annuals/fathertime.txt22
-rw-r--r--world/map/npc/annuals/halloween/config.txt372
-rw-r--r--world/map/npc/annuals/halloween/debug.txt180
-rw-r--r--world/map/npc/annuals/halloween/munro.txt60
-rw-r--r--world/map/npc/annuals/halloween/trick_or_treat.txt329
-rw-r--r--world/map/npc/annuals/tree_beard.txt (renamed from world/map/npc/annuals/xmas/tree_beard.txt)46
-rw-r--r--world/map/npc/annuals/xmas/config.txt10
-rw-r--r--world/map/npc/annuals/xmas/debug.txt17
-rw-r--r--world/map/npc/scripts.conf9
27 files changed, 1053 insertions, 133 deletions
diff --git a/world/map/db/generic_item_db.txt b/world/map/db/generic_item_db.txt
index 5b17fa3e..0b3732dc 100644
--- a/world/map/db/generic_item_db.txt
+++ b/world/map/db/generic_item_db.txt
@@ -190,10 +190,6 @@
3002, RealisticBrain, Realistic Brain, 3, 200, 100, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
3003, JarofBlood, Jar of Blood, 3, 200, 100, 375, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
3004, Tongue, Tongue, 3, 5, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
-3006, TonoriDelight, Tonori Delight, 3, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {}, {}
-3007, Marshmallow, Marshmallow, 3, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {}, {}
-3009, JellySkull, Jelly Skull, 3, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {}, {}
-3010, CandyPumpkin, Candy Pumpkin, 3, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {}, {}
3011, PumpkinSeeds, Pumpkin Seeds, 3, 5, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
4000, AngryScorpionStinger, Angry Scorpion Stinger, 3, 50, 25, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
4001, Coal, Coal, 3, 250, 100, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {}, {}
diff --git a/world/map/db/use_item_db.txt b/world/map/db/use_item_db.txt
index fa8283d9..7f7ad2c6 100644
--- a/world/map/db/use_item_db.txt
+++ b/world/map/db/use_item_db.txt
@@ -85,6 +85,10 @@
1258, Honey, Honey, 0, 100, 80, 20, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 45, 0;}, {}
1280, Scissors, Scissors, 0, 1000, 500, 120, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {callfunc "useScissors";}, {}
1281, ShockSweet, Shock Sweet, 0, 1000, 500, 5, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {callfunc "useShockSweet";}, {}
+3006, TonoriDelight, Tonori Delight, 0, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 10, 0;}, {}
+3007, Marshmallow, Marshmallow, 0, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 10, 0;}, {}
+3009, JellySkull, Jelly Skull, 0, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 10, 0;}, {}
+3010, CandyPumpkin, Candy Pumpkin, 0, 5, 1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 10, 0;}, {}
4035, PickledBeets, Pickled Beets, 0, 100, 50, 150, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 50, 0; setlook LOOK_HAIR_COLOR, HC_PURPLE;}, {}
4036, RoastedAcorn, Roasted Acorn, 0, 100, 50, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, {itemheal 15, 0;}, {}
5126, MTJarofOwnBlood, MTJar of Own Blood, 0, 200, 100, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {itemheal -250, 0;getitem 5127, 1;}, {}
diff --git a/world/map/npc/001-1/vincent.txt b/world/map/npc/001-1/vincent.txt
index 46d67e48..7f46ac44 100644
--- a/world/map/npc/001-1/vincent.txt
+++ b/world/map/npc/001-1/vincent.txt
@@ -4,6 +4,8 @@
{
// This NPC previously used the variable TMW_Quest
callfunc "ClearVarTMW_Quest";
+ set @halloween_npc_id, $@halloween_npc_vincent;
+ callfunc "TrickOrTreat";
set @state, ((QUEST_SouthTulimshar & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
diff --git a/world/map/npc/006-1/pachua.txt b/world/map/npc/006-1/pachua.txt
index d2f193dd..b97b0c96 100644
--- a/world/map/npc/006-1/pachua.txt
+++ b/world/map/npc/006-1/pachua.txt
@@ -5,6 +5,9 @@
if (@npc_check)
goto L_Close;
+ set @halloween_npc_id, $@halloween_npc_pachua;
+ callfunc "TrickOrTreat";
+
set @LEATHER_PATCH_PRICE, 300;
set @wants_leather_patch, QUEST_Forestbow_state & NIBBLE_4_MASK;
diff --git a/world/map/npc/008-1/george.txt b/world/map/npc/008-1/george.txt
index 92215420..df89f52c 100644
--- a/world/map/npc/008-1/george.txt
+++ b/world/map/npc/008-1/george.txt
@@ -2,6 +2,9 @@
008-1.gat,136,36,0|script|George#pirate|138,
{
+ set @halloween_npc_id, $@halloween_npc_george;
+ callfunc "TrickOrTreat";
+
if (getequipid(equip_head) == 617) goto L_Pirate;
if (getequipid(equip_head) == 622) goto L_Bandana;
if (getequipid(equip_head) == 621) goto L_EyePatch;
diff --git a/world/map/npc/009-2/kfahr.txt b/world/map/npc/009-2/kfahr.txt
index 400e1cb3..9c772452 100644
--- a/world/map/npc/009-2/kfahr.txt
+++ b/world/map/npc/009-2/kfahr.txt
@@ -15,6 +15,9 @@
009-2.gat,67,57,0|script|Kfahr|125,
{
+ set @halloween_npc_id, $@halloween_npc_kfahr;
+ callfunc "TrickOrTreat";
+
set @QS_NEWBIE, 0;
set @QS_MET_KFAHR, 1;
set @QS_KNOWS_KFAHR, 2;
diff --git a/world/map/npc/009-2/nurse.txt b/world/map/npc/009-2/nurse.txt
index 63ae6a67..44605134 100644
--- a/world/map/npc/009-2/nurse.txt
+++ b/world/map/npc/009-2/nurse.txt
@@ -25,6 +25,8 @@
009-2.gat,147,65,0|script|Nurse|119,
{
callfunc "ClearVariables";
+ set @halloween_npc_id, $@halloween_npc_nurse;
+ callfunc "TrickOrTreat";
set @SNAKET_AMOUNT, 5;
set @BSCORPIONST_AMOUNT, 10;
diff --git a/world/map/npc/010-2/workers.txt b/world/map/npc/010-2/workers.txt
index 2f7da8aa..17109491 100644
--- a/world/map/npc/010-2/workers.txt
+++ b/world/map/npc/010-2/workers.txt
@@ -9,6 +9,9 @@
010-2.gat,39,75,0|script|Zack|155,
{
+ set @halloween_npc_id, $@halloween_npc_zack;
+ callfunc "TrickOrTreat";
+
mes "[Zack]";
mes "\"My brother and I are fixing the cellar pass.\"";
close;
diff --git a/world/map/npc/021-1/eurni.txt b/world/map/npc/021-1/eurni.txt
index 8f9e1b5d..ca514740 100644
--- a/world/map/npc/021-1/eurni.txt
+++ b/world/map/npc/021-1/eurni.txt
@@ -2,6 +2,9 @@
021-1.gat,141,113,0|script|Eurni|136,
{
+ set @halloween_npc_id, $@halloween_npc_eurni;
+ callfunc "TrickOrTreat";
+
if (BaseLevel < 10) goto L_TooYoung;
if (Zeny < 10000) goto L_NoMoney;
diff --git a/world/map/npc/021-1/inac.txt b/world/map/npc/021-1/inac.txt
index 75cd0451..5903e34b 100644
--- a/world/map/npc/021-1/inac.txt
+++ b/world/map/npc/021-1/inac.txt
@@ -2,6 +2,9 @@
021-1.gat,53,103,0|script|Inac|156,
{
+ set @halloween_npc_id, $@halloween_npc_inac;
+ callfunc "TrickOrTreat";
+
mes "[Inac]";
mes "\"This cities water system is amazing. It was built centuries ago after the cataclysm that turned Tonori into this desert.\"";
next;
diff --git a/world/map/npc/021-1/weellos.txt b/world/map/npc/021-1/weellos.txt
index 3e6236ea..60fba330 100644
--- a/world/map/npc/021-1/weellos.txt
+++ b/world/map/npc/021-1/weellos.txt
@@ -3,6 +3,9 @@
021-1.gat,130,125,0|script|Weellos|103,
{
+ set @halloween_npc_id, $@halloween_npc_weelos;
+ callfunc "TrickOrTreat";
+
set QUEST_NorthTulimshar, QUEST_NorthTulimshar | $@knowWeellosNT;
set @kylian, ((QUEST_NorthTulimshar & NIBBLE_5_MASK) >> NIBBLE_5_SHIFT);
diff --git a/world/map/npc/021-2/government_building.txt b/world/map/npc/021-2/government_building.txt
index abf01ccb..89abee80 100644
--- a/world/map/npc/021-2/government_building.txt
+++ b/world/map/npc/021-2/government_building.txt
@@ -141,6 +141,9 @@ S_give_rings:
mes "\"Hello what Can I do for you?\"";
next;
+ set @halloween_npc_id, $@halloween_npc_tathin;
+ callfunc "TrickOrTreat";
+
if (getskilllv(SKILL_PARTY) == 2 )
goto L_Base_Menu;
if (BaseLevel >= 15
diff --git a/world/map/npc/026-1/_import.txt b/world/map/npc/026-1/_import.txt
index f618ee0a..7f84af41 100644
--- a/world/map/npc/026-1/_import.txt
+++ b/world/map/npc/026-1/_import.txt
@@ -4,5 +4,4 @@ map: 026-1.gat
npc: npc/026-1/_mobs.txt
npc: npc/026-1/_warps.txt
npc: npc/026-1/mapflags.txt
-npc: npc/026-1/munro.txt
npc: npc/026-1/sign.txt
diff --git a/world/map/npc/026-1/munro.txt b/world/map/npc/026-1/munro.txt
deleted file mode 100644
index 02fdccb6..00000000
--- a/world/map/npc/026-1/munro.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-026-1.gat,24,37,0|script|Munro|183,
-{
- mes "[Munro]";
- mes "\"Whoh dude...\"";
- next;
- mes "[Munro]";
- mes "\"Man.. I don't know how I got here.. freaky..\"";
- next;
- mes "[Munro]";
- mes "\"Hey dude, what's that on your face? It's creeping me out!\"";
- menu
- "There is nothing on my face..", L_Nothing,
- "What, This skin?",L_ThisSkin;
-
-L_ThisSkin:
- mes "[Munro]";
- mes "\"Skin? Whoh far-out man.. This must be that weirdo place my brother Parua told me about..\"";
- next;
- mes "Munro stares at you vacantly for a moment";
- next;
- mes "Munro's eye-holes suddenly seem more aware";
- next;
- mes "[Munro]";
- mes "\"WHOH! SKIN? d.....dude! How can you stand having that stuff all over you? That's gotta suck!\"";
- next;
- mes "[Munro]";
- mes "\"Here dude.. Take this. It won't get rid of that groady skin but it'll at least make you LOOK normal..\"";
- getitem "SkeletonCharm",1;
- next;
- mes "[Munro]";
- mes "\"I have a lot of these man.. a LOT. Take all you want man.. Just remember they only work when I'm around to power them. Freaky-deaky skull power you know?\"";
- goto L_Exit;
-
-L_Nothing:
- mes "[Munro]";
- mes "\"Oh.. ok dude! Whatever you say!\"";
- goto L_Exit;
-
-L_Exit:
- close;
-}
-
-026-1.gat,25,37,0|script|#AnnualHalloween|-1,
-{
- end;
-
-OnInit:
- if (debug >= 2) end;
- initnpctimer;
- end;
-
-OnTimer1000:
- set $@isHalloween, 0;
- if ((gettime(6) == 10 && gettime(5) >= 27) || (gettime(6) == 11 && gettime(5) <= 5))
- set $@isHalloween, 1;
-
- if (gettime(6) == 12 && gettime(5) >= 23 && gettime(5) <= 26)
- set $@isHalloween, 1;
-
- if ($@isHalloween)
- goto L_enablemunro;
-
- goto L_disablemunro;
-
-
-L_enablemunro:
- enablenpc "Munro";
- goto L_End;
-
-L_disablemunro:
- disablenpc "Munro";
- goto L_End;
-
-L_End:
- setnpctimer 0;
- end;
-}
-
-
-function|script|CheckMunro|,
-{
- if ((gettime(6) == 10 && gettime(5) >= 27) || (gettime(6) == 11 && gettime(5) <= 5))
- goto L_Return;
-
- if (gettime(6) == 12 && gettime(5) >= 23 && gettime(5) <= 26)
- goto L_Return;
-
- callfunc "UnequipLater";
- goto L_Return;
-
-L_Return:
- return;
-}
diff --git a/world/map/npc/027-2/caretaker.txt b/world/map/npc/027-2/caretaker.txt
index 593a91a8..c10db6fe 100644
--- a/world/map/npc/027-2/caretaker.txt
+++ b/world/map/npc/027-2/caretaker.txt
@@ -4,6 +4,9 @@
027-2.gat,24,25,0|script|Caretaker|159,
{
+ set @halloween_npc_id, $@halloween_npc_caretaker;
+ callfunc "TrickOrTreat";
+
if (QUEST_Graveyard_Caretaker == 1) goto L_Return_Dialog;
if (QUEST_Graveyard_Caretaker == 2) goto L_Has_Letter;
if (QUEST_Graveyard_Caretaker == 3) goto L_Delivered_Letter;
diff --git a/world/map/npc/030-2/storage_helper.txt b/world/map/npc/030-2/storage_helper.txt
index ff6fa242..092d9a7d 100644
--- a/world/map/npc/030-2/storage_helper.txt
+++ b/world/map/npc/030-2/storage_helper.txt
@@ -3,6 +3,8 @@
030-2.gat,25,35,0|script|Vellamo|328,
{
+ set @halloween_npc_id, $@halloween_npc_vellamo;
+ callfunc "TrickOrTreat";
callfunc "XmasStates";
if($@xmas_time)
diff --git a/world/map/npc/033-1/kimarr.txt b/world/map/npc/033-1/kimarr.txt
index 26993614..a5a066bd 100644
--- a/world/map/npc/033-1/kimarr.txt
+++ b/world/map/npc/033-1/kimarr.txt
@@ -34,6 +34,9 @@
033-1.gat,74,32,0|script|Kimarr|218,
{
+ set @halloween_npc_id, $@halloween_npc_kimarr;
+ callfunc "TrickOrTreat";
+
if ($@Fluffy_FighterID == getcharid(3))
goto L_Attention;
diff --git a/world/map/npc/048-2/sageNikolai.txt b/world/map/npc/048-2/sageNikolai.txt
index 9ce3e719..5aa1b659 100644
--- a/world/map/npc/048-2/sageNikolai.txt
+++ b/world/map/npc/048-2/sageNikolai.txt
@@ -5,6 +5,9 @@
048-2.gat,98,106,0|script|Nikolai|362,
{
+ set @halloween_npc_id, $@halloween_npc_nikolai;
+ callfunc "TrickOrTreat";
+
set @investigate, ((QUEST_BlueSage & $@Q_BlueSageInvestigate_MASK) >> $@Q_BlueSageInvestigate_SHIFT);
set @bookpages, ((QUEST_BlueSage & $@Q_BlueSageBookPages_MASK) >> $@Q_BlueSageBookPages_SHIFT);
set @slimes, ((QUEST_BlueSage & $@Q_BlueSageSlimes_MASK) >> $@Q_BlueSageSlimes_SHIFT);
diff --git a/world/map/npc/annuals/fathertime.txt b/world/map/npc/annuals/fathertime.txt
index 40af55ff..4d3cdf68 100644
--- a/world/map/npc/annuals/fathertime.txt
+++ b/world/map/npc/annuals/fathertime.txt
@@ -1,6 +1,5 @@
// Annual Timer
// One timer to check to enable all holiday events
-
017-9.gat,26,28,0|script|#HolidayConfig|-1,
{
end;
@@ -16,6 +15,27 @@ L_StartTimer:
OnTimer20000:
setnpctimer 0;
cmdothernpc "#XmasConfig", "RestartQuest";
+ cmdothernpc "#HalloweenConfig", "RestartQuest";
initnpctimer;
end;
}
+017-9.gat,31,24,0|script|HolidayDebug#1|105,
+{
+ if(getgmlevel() < 40)
+ goto L_End;
+
+ menu
+ "Xmas.", L_XmasDebug,
+ "Halloween.", L_HalloweenDebug;
+
+L_XmasDebug:
+ callfunc "XmasDebug";
+ goto L_End;
+
+L_HalloweenDebug:
+ callfunc "HalloweenDebug";
+ goto L_End;
+
+L_End:
+ end;
+}
diff --git a/world/map/npc/annuals/halloween/config.txt b/world/map/npc/annuals/halloween/config.txt
new file mode 100644
index 00000000..d3d0f616
--- /dev/null
+++ b/world/map/npc/annuals/halloween/config.txt
@@ -0,0 +1,372 @@
+// Halloween Annual
+// Authors: alastrim, enchilado, o11c, wushin
+// This file initializes global constants, which includes dialog.
+
+// Event Configuration:
+// Generic stuff
+// $@halloween_start_day = the first day in October the quest can be done
+// $@halloween_year = the year this quest is activated, for event necromancers
+// $@halloween_memory_count = Number of masks each NPC remembers
+// $@halloween_min_level = Minimum level to go trick-or-treating
+
+// Global stuff
+// $@halloween_big_reward = The main reward randomly given, usually after the counter has reached 7-10
+// $@halloween_sweets = Array with all the sweets to be given as treats
+// $@halloween_sweets_num = Size of that array
+// $@halloween_mask_IDs = Array with the IDs of all the masks that cover your face + The Scary Axehat
+// $@halloween_scare_factors = Array with the basic scare factor of each mask
+// 678 Noh Mask 2
+// 679 Demon Mask 4
+// 1221 Skull Mask 4
+// 634 Face Mask 4
+// 615 Pumpkin Helmet 2
+// 639 Crusade Helmet 3
+// 769 Guy Fawkes Mask 2
+// 801 Pinkie Helmet 2
+// 1218 Paper Bag 1
+// 1276 Opera Mask 3
+// 1277 Jester Mask 2
+// 1279 Goblin Mask 4
+// 4027 Yeti Mask 4
+// 616 Axe Hat 4
+
+// Per-NPC stuff
+// $@halloween_npc_<name> = constants for @halloween_npc_id, the index into the array
+// $@halloween_npc_names$ = Array with all NPC names inside brackets, to be used in the function
+// $@halloween_greetings$ = Array with all the NPC initial greetings when you "trick or treat" them
+// $@halloween_trick_notscary$ = Array with the less scary menu options
+// $@halloween_react_notscary$ = Array with all the reactions to the less scary menu options
+// $@halloween_trick_scary$ = Array with scary menu options
+// $@halloween_react_scary$ = Array with all the reactions to the scary menu options
+// $@halloween_trick_veryscary$ = Array with the most scary menu options
+// $@halloween_react_veryscary$ = Array with all the reactions to the very scary menu options
+
+// In the appropriate NPCs, do something like:
+//+ if ($@halloween_time)
+//+ goto L_Halloween;
+//+ goto L_Main;
+//+
+//+L_Halloween:
+//+ set @halloween_npc_id, $@halloween_npc_eurni;
+//+ callfunc "TrickOrTreat";
+//+ goto L_Main;
+//+
+//+L_Main:
+
+// Variables:
+// $@halloween_maskmemory = Sliced Array containing the record of the last masks used to trick or treat each NPC.
+// @halloween_npc_id = NPC id, this variable is set when calling this function by an NPC
+// HALLOWEENTIME = Permanent variable used to control your progress in the quest.
+// The high bits are used to keep track of the NPCs you already tricked while showing your face.
+// The low bits are used to keep track of how many times you've gotten treats.
+// Currently, the vague plan is 16 for each, but we may need to use this variable for the second part of the quest.
+// HALLOWEENYEAR = Keys the player to the year so the annual can be redone.
+
+// !!! IMPORTANT NOTE: a maximum of 14 NPCs can be used for this quest !!!
+// HALLOWEENTIME
+// Byte 0 + 1: Karma (65535)
+// BIT 16: Big Reward
+// BIT 17: Charm Reward
+// BIT 18: NPC #13
+// BIT 19: NPC #12
+// BIT 20: NPC #11
+// BIT 21: NPC #10
+// BIT 22: NPC #9
+// BIT 23: NPC #8
+// BIT 24: NPC #7
+// BIT 25: NPC #6
+// BIT 26: NPC #5
+// BIT 27: NPC #4
+// BIT 28: NPC #3
+// BIT 29: NPC #2
+// BIT 30: NPC #1
+// BIT 31: NPC #0
+
+-|script|#HalloweenConfig|-1,
+{
+ end;
+
+OnCommandRestartQuest:
+ goto L_Main;
+
+OnInit:
+ goto L_Main;
+
+L_Main:
+ // Halloween Key Identifier Set through Botcheck Debug
+ if(!($HALLOWEEN_TIME_KEY) || (getarraysize($HALLOWEEN_TIME_KEY) != 6))
+ setarray $HALLOWEEN_TIME_KEY, 10,10,11,24,2,gettime(7);
+ if(($HALLOWEEN_TIME_KEY[0] == 0) || ($HALLOWEEN_TIME_KEY[0] > 12))
+ goto L_HalloweenError;
+ if(($HALLOWEEN_TIME_KEY[1] == 0) || ($HALLOWEEN_TIME_KEY[1] > 12))
+ goto L_HalloweenError;
+ if(($HALLOWEEN_TIME_KEY[2] == 0) || ($HALLOWEEN_TIME_KEY[2] > 12))
+ goto L_HalloweenError;
+ if(($HALLOWEEN_TIME_KEY[3] == 0) || ($HALLOWEEN_TIME_KEY[3] > 31))
+ goto L_HalloweenError;
+ if(($HALLOWEEN_TIME_KEY[4] == 0) || ($HALLOWEEN_TIME_KEY[4] > 31))
+ goto L_HalloweenError;
+ if($HALLOWEEN_TIME_KEY[5] == 0)
+ goto L_HalloweenError;
+
+ // Event Runs until Reward Period.
+ // Month Start/End
+ set $@halloween_start_month, $HALLOWEEN_TIME_KEY[0];
+ set $@halloween_reward_start_month, $HALLOWEEN_TIME_KEY[1];
+ set $@halloween_end_month, $HALLOWEEN_TIME_KEY[2];
+
+ // Reward Day Start/End
+ set $@halloween_reward_start_day, $HALLOWEEN_TIME_KEY[3];
+ set $@halloween_reward_end_day, $HALLOWEEN_TIME_KEY[4];
+
+ // Time Settings
+ set $@halloween_no_event_time, 0;
+ set $@halloween_event_time, 1;
+ set $@halloween_reward_time, 2;
+
+ // How many, maximum is 8
+ set $@halloween_memory_count, 5;
+ // Level to go trick-or-treating
+ set $@halloween_min_level, 10;
+ // Age to go trick-or-treating
+ set $@halloween_min_age, (7*86400);
+
+ // Number of trick and treats completed to get charm.
+ set $@halloween_charm_count, 10;
+ set $@halloween_got_charm_reward, (1 << 17);
+ setarray $@halloween_big_reward, 905, 1175;
+ set $@halloween_got_big_reward, (1 << 16);
+ setarray $@halloween_sweets,
+ 534, // OrangeCupcake
+ 737, // ChocolateCake
+ 510, // Candy
+ 513, // Cake
+ 509, // ChocolateBar
+ 519, // CherryCake
+ 736, // WhiteCake
+ 738, // OrangeCake
+ 739, // AppleCake
+ 3006, // TonoriDelight
+ 3007, // Marshmallow
+ 3009, // JellySkull
+ 3010, // CandyPumpkin
+ 838, // CranberryLollipop
+ 839, // GrapeLollipop
+ 840; // OrangeLollipop
+ set $@halloween_sweets_num, getarraysize($@halloween_sweets);
+
+ setarray $@halloween_mask_IDs, 678, 679, 1221, 634, 615, 639, 769, 801, 1218, 1276, 1277, 1279, 4027, 616;
+ setarray $@halloween_scare_factors, 2, 4, 4, 4, 2, 3, 2, 2, 1, 3, 2, 4, 4, 4;
+
+ if (getarraysize($@halloween_mask_IDs) != getarraysize($@halloween_scare_factors))
+ goto L_HalloweenError;
+ // temporary counter
+ set $@n, 0;
+
+ set $@halloween_npc_caretaker, $@n;
+ set $@halloween_npc_names$[$@n], "[Caretaker]";
+ set $@halloween_greetings$[$@n], "\"Alright, come on then. Show me your trick.\"";
+ set $@halloween_trick_notscary$[$@n], "Trick? You must have misheard me. I've come because the Government needs to build a road through your house.";
+ set $@halloween_react_notscary$[$@n], "\"And?\"";
+ set $@halloween_trick_scary$[$@n], "You look pretty deceased to me, old man. Undead must die! Yaah!";
+ set $@halloween_react_scary$[$@n], "\"Now listen here, I'm as alive as you - oh. Say, that was a good trick!\"";
+ set $@halloween_trick_veryscary$[$@n], "Your wife... she's - she's - she's DEAD!";
+ set $@halloween_react_veryscary$[$@n], "\"But... I live here! My wife l... is dead here. You can't - oh. I DIDN'T mishear you. You really had me fooled!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_eurni, $@n;
+ set $@halloween_npc_names$[$@n], "[Eurni the Surgeon]";
+ set $@halloween_greetings$[$@n], "\"Oh, right.\"";
+ set $@halloween_trick_notscary$[$@n], "I paid good money for your services, and when I get home I find that now I'm not a man OR a woman...";
+ set $@halloween_react_notscary$[$@n], "\"Heheh, sucks, buddy. But there's always a risk.\"";
+ set $@halloween_trick_scary$[$@n], "Look out! A scorpion!";
+ set $@halloween_react_scary$[$@n], "\"Where? Darn things, I think they're what keep scaring away my customers.\"";
+ set $@halloween_trick_veryscary$[$@n], "I know about your hobby of performing numerous sex changes on yourself.";
+ set $@halloween_react_veryscary$[$@n], "\"Shut up! Look, will you hold your tongue if I give you more treats...?\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_george, $@n;
+ set $@halloween_npc_names$[$@n], "[George the Pirate]";
+ set $@halloween_greetings$[$@n], "\"Shiver me timbers! What do ye mean?\"";
+ set $@halloween_trick_notscary$[$@n], "Well... I do a trick, and then... you give me a treat...";
+ set $@halloween_react_notscary$[$@n], "\"Arrrrh, I knew what ye meant, to be sure! I were just kidding with ye, pretending to be a crazy old pirate! Arrrrh!\"";
+ set $@halloween_trick_scary$[$@n], "Your eyepatch is on the wrong eye!";
+ set $@halloween_react_scary$[$@n], "\"Arrrrh, so it is! Ta for pointing it out, mate - wait, no it isn't! Harhar, what a good trick!\"";
+ set $@halloween_trick_veryscary$[$@n], "By the powers, ye're a daft landlubber to be sure, ye barnacle-ridden swab!";
+ set $@halloween_react_veryscary$[$@n], "\"Arrrrh, ye scurvy dog! I'm sure my first mate will return with the ship eventually.\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_inac, $@n;
+ set $@halloween_npc_names$[$@n], "[Inac]";
+ set $@halloween_greetings$[$@n], "\"Oh, yes?\"";
+ set $@halloween_trick_notscary$[$@n], "Yes, we monsters moved into the tunnels... and now we're coming out... for revenge!";
+ set $@halloween_react_notscary$[$@n], "\"Haha! That's the worse trick I've seen today.\"";
+ set $@halloween_trick_scary$[$@n], "One of those monsters you mentioned is crawling out of the well!";
+ set $@halloween_react_scary$[$@n], "\"He IS? Where!? Aah! Oh. You were just tricking, right? Hahaha, that was good, I really believed you.\"";
+ set $@halloween_trick_veryscary$[$@n], "Yeah, but it's all fossil water. One day it's gonna dry up!";
+ set $@halloween_react_veryscary$[$@n], "\"Fossil water? You mean it's turned to STONE? But you can't drink - oh... you were just tricking, right? You WEREN'T? Aaaah!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_kfahr, $@n;
+ set $@halloween_npc_names$[$@n], "[Kfahr the Warrior]";
+ set $@halloween_greetings$[$@n], "\"Ah, yes!\" He rubs his hands. \"Trick away, then!\"";
+ set $@halloween_trick_notscary$[$@n], "Meh... I'm only trick-or-treating you to avoid listening to your BORING stories.";
+ set $@halloween_react_notscary$[$@n], "\"Boring?\" He grins. \"You must be mistaking me for someone else.\"";
+ set $@halloween_trick_scary$[$@n], "Did you hear the bad news already? They made up a law prohibiting to serve alcoholic drinks! That means no more beer!";
+ set $@halloween_react_scary$[$@n], "\"What? But- but- why do they- oh, you tricked me. I was about to really get worried for a moment.\"";
+ set $@halloween_trick_veryscary$[$@n], "Have you heard? Tulimshar was destroyed by a giant Desert Worm!";
+ set $@halloween_react_veryscary$[$@n], "\"What!?\" Kfahr stares. \"And no one called for me? This is appalling! But - what? That was your trick? Hm, nice one. You almost had me fooled!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_nurse, $@n;
+ set $@halloween_npc_names$[$@n], "[Nurse]";
+ set $@halloween_greetings$[$@n], "\"I don't know why I let the Mayor trick me into this... well, go on then.\"";
+ set $@halloween_trick_notscary$[$@n], "I ate too much Hallowe'en candy, now I'm sick!";
+ set $@halloween_react_notscary$[$@n], "\"Well, no one's to blame but yourself, you know. Just make sure you don't eat any more.\"";
+ set $@halloween_trick_scary$[$@n], "Hurnscald has been struck by plague! You must come and tend to the dying!";
+ set $@halloween_react_scary$[$@n], "\"But I don't know how to deal with plague! Oh no! You must get the Doctor! Unless... you were just tricking me! Whew, that's a relief!\"";
+ set $@halloween_trick_veryscary$[$@n], "The Doctor asked me to tell you that he doesn't want to see you any more.";
+ set $@halloween_react_veryscary$[$@n], "\"What? But we were getting it on so well. I mean, getting on so well! Oh... that was your trick! Dear me, I believed you!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_pachua, $@n;
+ set $@halloween_npc_names$[$@n], "[Chief Pachua]";
+ set $@halloween_greetings$[$@n], "\"Ah, the strange custom the Government man told me about.\"";
+ set $@halloween_trick_notscary$[$@n], "Look out! A scorpion!";
+ set $@halloween_react_notscary$[$@n], "\"Don't mind him, he won't hurt you. Er... so I give you sweets now, or what?\"";
+ set $@halloween_trick_scary$[$@n], "Yes, the ritual giving of treats... LOTS of treats... or else!";
+ set $@halloween_react_scary$[$@n], "\"Alright, here you go.\"";
+ set $@halloween_trick_veryscary$[$@n], "Yes, the ritual giving of treats followed by the sacrifice of the treat-giver...";
+ set $@halloween_react_veryscary$[$@n], "\"I do like a good sacrifice, but less so if it's me! I'll give you extra sweets if you forget the sacrifice.\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_tathin, $@n;
+ set $@halloween_npc_names$[$@n], "[Tathin]";
+ set $@halloween_greetings$[$@n], "\"I am employed by the Tonori Government, make sure you abide the regulations we wrote down for Trick-or-Treaters this year...\"";
+ set $@halloween_trick_notscary$[$@n], "Of course I will... not!";
+ set $@halloween_react_notscary$[$@n], "\"Hm!\"";
+ set $@halloween_trick_scary$[$@n], "Regulations, smegulations. The Tonori Government can go suck a lollipop for all I care!";
+ set $@halloween_react_scary$[$@n], "\"!? How dare you - oh, that was your trick! You did have me worried for a moment...\"";
+ set $@halloween_trick_veryscary$[$@n], "What regulations?";
+ set $@halloween_react_veryscary$[$@n], "\"You mean you haven't even READ - I don't believe - this is ghastly - I - oh... that was your trick... gosh, I believed you for a minute! I thought you really hadn't read them!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_vincent, $@n;
+ set $@halloween_npc_names$[$@n], "[Vincent]";
+ set $@halloween_greetings$[$@n], "\"Ooh, okay! Trick away!\"";
+ set $@halloween_trick_notscary$[$@n], "Look out! A scorpion!";
+ set $@halloween_react_notscary$[$@n], "\"They're everywhere in this desert! Don't worry about them.\"";
+ set $@halloween_trick_scary$[$@n], "Hey, that action figure you're building just CAME TO LIFE!";
+ set $@halloween_react_scary$[$@n], "\"Really? Cool! Where? What? You were tricking me? WAAAH!\"";
+ set $@halloween_trick_veryscary$[$@n], "Wow, this is a neat action figure! Haha, check out its moves! Oops! Never mind, I'm sure it'll glue back on.";
+ set $@halloween_react_veryscary$[$@n], "\"My Bug Leg action figure! You broke it!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_weellos, $@n;
+ set $@halloween_npc_names$[$@n], "[Weellos]";
+ set $@halloween_greetings$[$@n], "\"Trick me, then!\"";
+ set $@halloween_trick_notscary$[$@n], "Look out! A scorpion!";
+ set $@halloween_react_notscary$[$@n], "\"Pesky things, I know, but they're everywhere around here...\"";
+ set $@halloween_trick_scary$[$@n], "Actually, it's a fake. It was built just ten years ago.";
+ set $@halloween_react_scary$[$@n], "\"No! But I've read all the accounts... oh, haha! Very funny!\"";
+ set $@halloween_trick_veryscary$[$@n], "They say the earthquake ruined the foundations of this building, and that it's going to fall down.";
+ set $@halloween_react_veryscary$[$@n], "\"B-but it's one of the oldest buildings around! And... wait, I just remembered that it was designed to be earthquake-proof. You were tricking me!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_zack, $@n;
+ set $@halloween_npc_names$[$@n], "[Zack]";
+ set $@halloween_greetings$[$@n], "\"I thought no one would find me down here, but I'm glad I was wrong! Let's see your trick, then.\"";
+ set $@halloween_trick_notscary$[$@n], "You think this is something to do with Hallowe'en? Hands up!";
+ set $@halloween_react_notscary$[$@n], "\"Heh... That was ok.\"";
+ set $@halloween_trick_scary$[$@n], "And now that I've found you, you die!";
+ set $@halloween_react_scary$[$@n], "\"Aah! What did I do? Oh - wait - I see! That was a good one!\"";
+ set $@halloween_trick_veryscary$[$@n], "Yes, I have found you. After all these years.";
+ set $@halloween_react_veryscary$[$@n], "\"Uncle Henry? But how, I covered my tracks so well! I never told anyone that - wait... that was your trick! You had me worried for a minute!\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_kimarr, $@n;
+ set $@halloween_npc_names$[$@n], "[Kimarr]";
+ set $@halloween_greetings$[$@n], "\"Many have tried to scare me, all have failed. Try your best, but the frozen wastes contain all manner of horrors.\"";
+ set $@halloween_trick_notscary$[$@n], "Look out Yetis!";
+ set $@halloween_react_notscary$[$@n], "\"You will have to do better then that.\"";
+ set $@halloween_trick_scary$[$@n], "Hrmm Is that your wife calling you?";
+ set $@halloween_react_scary$[$@n], "\"What? You haven't se... wait a second. Ok that was good.\"";
+ set $@halloween_trick_veryscary$[$@n], "The Kaizeian government declared fluffies an endangered species.";
+ set $@halloween_react_veryscary$[$@n], "\"NOooOOOooo!!! The Hunt!!! ... wait a second, you city folk are slick.\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_nikolai, $@n;
+ set $@halloween_npc_names$[$@n], "[Nikolai]";
+ set $@halloween_greetings$[$@n], "\"Let us see if you are scarier then Kfahr's Fairy Tales.\"";
+ set $@halloween_trick_notscary$[$@n], "Your going over their to the store.";
+ set $@halloween_react_notscary$[$@n], "\"*You're* *there* Ugh, thats more annoying then scary.\"";
+ set $@halloween_trick_scary$[$@n], "Whats White, Blue and slimey? I don't know either but it's right behind you.";
+ set $@halloween_react_scary$[$@n], "\"More Slimes, Oh no the books again. O you tricked me, good one.\"";
+ set $@halloween_trick_veryscary$[$@n], "I hope you don't mind I used some of this kindling you have on the shelves to start a fire.";
+ set $@halloween_react_veryscary$[$@n], "\"AHHHHH!!!! You burned our books!!! *GAH* ... *Eye Twitch*\"";
+
+ set $@n, $@n + 1;
+
+ set $@halloween_npc_vellamo, $@n;
+ set $@halloween_npc_names$[$@n], "[Vellamo]";
+ set $@halloween_greetings$[$@n], "\"Ahh yes, more candy related ritual.\"";
+ set $@halloween_trick_notscary$[$@n], "Candy? No, I want Parsley.";
+ set $@halloween_react_notscary$[$@n], "\"Parsley? is this some kind of monster? I'm not getting this scare at all\"";
+ set $@halloween_trick_scary$[$@n], "Chief Warrick says he needs the candy inventory by end of day.";
+ set $@halloween_react_scary$[$@n], "\"Ahh, no! I forgot to put a cover sheet on my Candy Production and Storage report.\"";
+ set $@halloween_trick_veryscary$[$@n], "I'm sorry, but your doctor says your diabetic.";
+ set $@halloween_react_veryscary$[$@n], "\"Darkest day of my life, blacker then the darkest chocolate.\"";
+
+ set $@halloween_num_npcs, $@n + 1;
+ set $@halloween_all_npc_bits, -1 << (32 - $@halloween_num_npcs);
+
+ set $@n, 0;
+
+ if((gettime(6) == $@halloween_reward_start_month && gettime(5) >= $@halloween_reward_start_day
+ && (gettime(5) <= $@halloween_reward_end_day && $@halloween_reward_start_month == $@halloween_end_month
+ || !($@halloween_reward_start_month == $@halloween_end_month)))
+ || (gettime(6) == $@halloween_end_month && gettime(5) <= $@halloween_reward_end_day
+ && (gettime(5) >= $@halloween_reward_start_day && $@halloween_reward_start_month == $@halloween_end_month
+ || !($@halloween_reward_start_month == $@halloween_end_month)))
+ || (gettime(6) < $@halloween_end_month && gettime(6) > $@halloween_reward_start_month))
+ goto L_RewardTime;
+ if((gettime(6) >= $@halloween_start_month) || (gettime(6) <= $@halloween_end_month && gettime(5) <= $@halloween_reward_start_day))
+ goto L_EventTime;
+ goto L_NoEventTime;
+
+L_NoEventTime:
+ if($HALLOWEEN_TIME_KEY[5] < gettime(7))
+ setarray $HALLOWEEN_TIME_KEY, $HALLOWEEN_TIME_KEY[0],$HALLOWEEN_TIME_KEY[1],$HALLOWEEN_TIME_KEY[2],$HALLOWEEN_TIME_KEY[3],$HALLOWEEN_TIME_KEY[4],gettime(7);
+ set $@halloween_time, $@halloween_no_event_time;
+ goto L_Return;
+
+L_EventTime:
+ set $@halloween_time, $@halloween_event_time;
+ goto L_Return;
+
+L_RewardTime:
+ set $@halloween_time, $@halloween_reward_time;
+ goto L_Return;
+
+L_Return:
+ callfunc "SpawnMunro";
+ callfunc "ReplaceTrees";
+ end;
+
+L_HalloweenError:
+ debugmes "Halloween is Dead Jim.";
+ gmcommand "@mapexit";
+ end;
+}
diff --git a/world/map/npc/annuals/halloween/debug.txt b/world/map/npc/annuals/halloween/debug.txt
new file mode 100644
index 00000000..0da5e361
--- /dev/null
+++ b/world/map/npc/annuals/halloween/debug.txt
@@ -0,0 +1,180 @@
+// Halloween Debug
+// Author: Wushin
+
+function|script|HalloweenDebug|,
+{
+ if(debug)
+ goto L_Debug;
+ goto L_Live;
+
+L_Live:
+ menu
+ "Debug Time", L_DebugTime,
+ "Set Old Event Flag.", L_LastReset,
+ "Halloween Time Key Change.", L_HalloweenTimeKey,
+ "Reset NPC's mask memory", L_ResetMask,
+ "Nothing.", L_Close;
+
+L_Debug:
+ menu
+ "Debug Time", L_DebugTime,
+ "Set Old Event Flag.", L_LastReset,
+ "Halloween Time Key Change.", L_HalloweenTimeKey,
+ "Quest State", L_QuestState,
+ "Set NPC trick or treat flag", L_SetTrickOrTreats,
+ "Reset my quest state", L_ResetMe,
+ "Reset NPC's mask memory", L_ResetMask,
+ "Nothing.", L_Close;
+
+L_DebugTime:
+ mes "--Sever--";
+ mes "Event State: " + $@halloween_time;
+ mes "Event Start" + $HALLOWEEN_TIME_KEY[0] + "/1";
+ mes "Reward Start: " + $HALLOWEEN_TIME_KEY[1] + "/" + $HALLOWEEN_TIME_KEY[3];
+ mes "Event End: " + $HALLOWEEN_TIME_KEY[2] + "/" + $HALLOWEEN_TIME_KEY[4];
+ mes "Event Time Key (year (CCYY)): " + $HALLOWEEN_TIME_KEY[5];
+ next;
+ goto L_Debug;
+
+L_LastReset:
+ set HALLOWEENTIME, 255;
+ set HALLOWEENYEAR, 2012;
+ goto L_Debug;
+
+L_HalloweenTimeKey:
+ if (getgmlevel() < 20) goto L_Close;
+ mes "Halloween Time Key Change.";
+ mes "Start Month?";
+ input @halloween_time_key_smonth;
+ if((@halloween_time_key_smonth == 0) || (@halloween_time_key_smonth > 12))
+ goto L_HalloweenError;
+ mes "Reward Start Month?";
+ input @halloween_time_key_srmonth;
+ if((@halloween_time_key_srmonth == 0) || (@halloween_time_key_srmonth > 12))
+ goto L_HalloweenError;
+ mes "End Month?";
+ input @halloween_time_key_emonth;
+ if((@halloween_time_key_emonth == 0) || (@halloween_time_key_emonth > 12))
+ goto L_HalloweenError;
+ mes "Reward Start Day?";
+ input @halloween_time_key_rsday;
+ if((@halloween_time_key_rsday == 0) || (@halloween_time_key_rsday > 31))
+ goto L_HalloweenError;
+ mes "Reward End Day?";
+ input @halloween_time_key_reday;
+ if((@halloween_time_key_reday == 0) || (@halloween_time_key_reday > 31))
+ goto L_HalloweenError;
+ mes "Time Key (CCYY) ";
+ input @halloween_time_key_year;
+ goto L_SetNewKey;
+
+L_HalloweenError:
+ mes "Incorrect Entry. Try again.";
+ next;
+ goto L_Debug;
+
+L_SetNewKey:
+ setarray $HALLOWEEN_TIME_KEY, @halloween_time_key_smonth, @halloween_time_key_srmonth, @halloween_time_key_emonth, @halloween_time_key_rsday, @halloween_time_key_reday, @halloween_time_key_year;
+ cmdothernpc "#HalloweenConfig", "RestartQuest";
+ goto L_Debug;
+
+L_QuestState:
+ mes "Karma: " + (HALLOWEENTIME & 65535);
+ set @big_reward_status$, " No.";
+ if (HALLOWEENTIME & $@halloween_got_big_reward)
+ set @big_reward_status$, " Yes.";
+ mes "Big Reward: " + @big_reward_status$;
+ set @charm_reward_status$, " No.";
+ if (HALLOWEENTIME & $@halloween_got_charm_reward)
+ set @charm_reward_status$, " Yes.";
+ mes "Charm Reward:" + @charm_reward_status$;
+ set @npc_check_loop, 0;
+ goto L_NpcCheckLoop;
+
+L_NpcCheckLoop:
+ set @display_mes$, "NPC ID " + @npc_check_loop + ":" + $@halloween_npc_names$[@npc_check_loop];
+ set @npc_status$, " Needed";
+ if (HALLOWEENTIME & (1 << (31 - @npc_check_loop)))
+ set @npc_status$, " Complete";
+ set @display_mes$, @display_mes$ + @npc_status$;
+ mes @display_mes$;
+ set @display_mes$, "";
+ goto L_NpcCheckInc;
+
+L_NpcCheckInc:
+ set @npc_check_loop, (@npc_check_loop + 1);
+ if (@npc_check_loop >= getarraysize($@halloween_npc_names$))
+ goto L_TrickOrTreatCount;
+ goto L_NpcCheckLoop;
+
+L_TrickOrTreatCount:
+ callfunc "TrickOrTreatTally";
+ mes @npc_tally + " out of 14";
+ next;
+ goto L_Debug;
+
+L_SetTrickOrTreats:
+ mes "Enter NPC to set";
+ input @halloween_npc_id;
+ set HALLOWEENTIME, HALLOWEENTIME | (1 << (31 - @halloween_npc_id));
+ goto L_Debug;
+
+L_ResetMe:
+ set HALLOWEENTIME, 0;
+ set HALLOWEENYEAR, $HALLOWEEN_TIME_KEY[5];
+ goto L_Debug;
+
+L_ResetMask:
+ mes "Enter NPC to reset:";
+ input @halloween_npc_id;
+ set $@halloween_maskmemory[8 * @halloween_npc_id], 0;
+ goto L_Debug;
+
+L_Close:
+ set @tmp, 0;
+ set @mask, 0;
+ set @karma, 0;
+ set @loop, 0;
+ set @menu, 0;
+ set @halloween_npc_id, 0;
+ close;
+}
+009-1.gat,51,38,0|script|HalloweenDebug#1|409,
+{
+ callfunc "HalloweenDebug";
+ goto L_End;
+
+OnInit:
+ if(!debug)
+ disablenpc "HalloweenDebug#1";
+ goto L_End;
+
+L_End:
+ end;
+}
+001-1.gat,38,26,0|script|HalloweenDebug#2|409,
+{
+ callfunc "HalloweenDebug";
+ goto L_End;
+
+OnInit:
+ if(!debug)
+ disablenpc "HalloweenDebug#2";
+ goto L_End;
+
+L_End:
+ end;
+}
+026-1.gat,23,37,0|script|HalloweenDebug#3|409,
+{
+ callfunc "HalloweenDebug";
+ goto L_End;
+
+OnInit:
+ if(!debug)
+ disablenpc "HalloweenDebug#3";
+ goto L_End;
+
+L_End:
+ end;
+}
diff --git a/world/map/npc/annuals/halloween/munro.txt b/world/map/npc/annuals/halloween/munro.txt
new file mode 100644
index 00000000..c3ff6367
--- /dev/null
+++ b/world/map/npc/annuals/halloween/munro.txt
@@ -0,0 +1,60 @@
+// Part of Annual halloween
+026-1.gat,24,37,0|script|Munro|183,
+{
+ callfunc "HalloweenCheckOld";
+ callfunc "TrickOrTreatTally";
+ if (($@halloween_time == $@halloween_reward_time) && (@npc_tally >= $@halloween_charm_count) && !(HALLOWEENTIME & $@halloween_got_charm_reward))
+ goto L_Halloween;
+ goto L_NoReward;
+
+L_NoReward:
+ mes "[Munro]";
+ mes "\"Greetings mortal.\"";
+ next;
+ mes "\"Once again we come to that time of year when the veil is thin\"";
+ next;
+ mes "\"All those who have passed on can part the veil to return.\"";
+ next;
+ mes "\"A time to celebrate our ancestors and chase evil away.\"";
+ next;
+ mes "\"Celebrate the holiday with me and I will reward you later.\"";
+ goto L_Exit;
+
+L_Halloween:
+ mes "[Munro]";
+ mes "\"You have shown to have the Halloween spirit. Take this charm.\"";
+ set HALLOWEENTIME, HALLOWEENTIME | $@halloween_got_charm_reward;
+ getitem "SkeletonCharm",1;
+ goto L_Exit;
+
+L_Exit:
+ close;
+}
+function|script|SpawnMunro|,
+{
+ if ($@halloween_time)
+ goto L_EnableMunro;
+ goto L_DisableMunro;
+
+L_EnableMunro:
+ enablenpc "Munro";
+ goto L_Return;
+
+L_DisableMunro:
+ disablenpc "Munro";
+ goto L_Return;
+
+L_Return:
+ return;
+}
+function|script|CheckMunro|,
+{
+ if (($@halloween_time) || ($@xmas_time))
+ goto L_Return;
+
+ callfunc "UnequipLater";
+ goto L_Return;
+
+L_Return:
+ return;
+}
diff --git a/world/map/npc/annuals/halloween/trick_or_treat.txt b/world/map/npc/annuals/halloween/trick_or_treat.txt
new file mode 100644
index 00000000..c94977ab
--- /dev/null
+++ b/world/map/npc/annuals/halloween/trick_or_treat.txt
@@ -0,0 +1,329 @@
+// Halloween Annual
+// Authors: alastrim, enchilado, o11c, wushin
+// See config
+function|script|TrickOrTreat|,
+{
+ callfunc "HalloweenCheckOld";
+ if ($@halloween_time)
+ goto L_Halloween;
+ goto L_QuickReturn;
+
+L_Halloween:
+ if ((gettimetick(2)-TUT_var < $@halloween_min_age) || (BaseLevel < $@halloween_min_level)) //player must be created at least 1 weeks ago
+ goto L_QuickReturn;
+ menu
+ "Trick or Treat", L_HWQuest,
+ "[Go to normal NPC dialog]", L_QuickReturn;
+
+L_HWQuest:
+ set @mask, getequipid(equip_head);
+ goto L_Begin;
+
+L_Begin:
+ set @karma, (HALLOWEENTIME & 65535);
+ if (@mask > 0)
+ goto L_WearingMask;
+ goto L_NoMask;
+
+L_WearingMask:
+ // set the scare factor of the equipped mask
+ set @mask_index, 0;
+ set @scare_factor, 1;
+ goto L_MaskLoop;
+
+L_MaskLoop:
+ if ($@halloween_mask_IDs[@mask_index] == @mask)
+ goto L_FoundMask;
+ set @mask_index, @mask_index + 1;
+ if ($@halloween_mask_IDs[@mask_index])
+ goto L_MaskLoop;
+ // not a mask in the list
+ set @mask, 0;
+ goto L_MaskDone;
+
+L_FoundMask:
+ set @scare_factor, $@halloween_scare_factors[@mask_index];
+ if (@mask != 616)
+ goto L_MaskDone;
+ mes "\"Aaargh... Gross! This is sick! I can't even look at your face...\"";
+ goto L_MaskDone;
+
+L_MaskDone:
+ set @mask_index, 0;
+ // check if the mask is in the memory
+ set @loop, 0;
+ // Note: we don't handle remembered faces until they get their candy
+ if (!@mask)
+ goto L_MaskMemoryNo;
+ // check if the mask is remembered
+ goto L_MaskMemoryCheck;
+
+L_MaskMemoryCheck:
+ set @tmp, $@halloween_maskmemory[8 * @halloween_npc_id + @loop];
+ if (!@tmp)
+ goto L_MaskMemoryNo;
+ if (@tmp == @mask)
+ goto L_MaskMemoryYes;
+ set @loop, @loop + 1;
+ if (@loop != $@halloween_memory_count)
+ goto L_MaskMemoryCheck;
+ goto L_MaskMemoryNo;
+
+L_MaskMemoryYes:
+ // not necessarily true
+ mes "\"I remember you, " + getequipname(equip_head) + " person. No more treats for you!\"";
+ goto L_Close;
+
+L_MaskMemoryNo:
+ // player will probably get treats
+ set @loop, 0;
+ set @sweets_types, 0;
+ goto L_Count_Sweets;
+
+L_Count_Sweets:
+ if ($@halloween_sweets[@loop] == 0)
+ goto L_Check_Inventory;
+ if (countitem($@halloween_sweets[@loop]))
+ set @sweets_types, @sweets_types + 1;
+ set @loop, @loop + 1;
+ goto L_Count_Sweets;
+
+L_Check_Inventory:
+ getinventorylist;
+ if (@inventorylist_count + (@loop - @halloween_invy) > 100)
+ goto L_Full_Inventory;
+ if (@mask)
+ goto L_Check_Karma;
+ // check if the player's face is remembered
+ if (HALLOWEENTIME & (1 << (31 - @halloween_npc_id)))
+ goto L_Remember_Face;
+ goto L_Tricking_Trick_or_Treat;
+
+L_Check_Karma:
+ // Please don't change this, you'll break stuff.
+ if (rand($@halloween_num_npcs, 65535) <= @karma)
+ goto L_Cheater;
+ // this is a cheap, limited form of ilog2
+ if ((@karma >= 16) && !(rand( 4 - (@karma >= 64) + (@karma >= 256) + (@karma >= 1024) )))
+ goto L_Cheater;
+ if (HALLOWEENTIME & $@halloween_got_big_reward)
+ goto L_Tricking_Trick_or_Treat;
+ // assert: @karma < $@halloween_num_npcs
+ if (rand($@halloween_num_npcs - @karma))
+ goto L_Tricking_Trick_or_Treat;
+ mes "\"All this candy isn't healthy, here take this to have a break from it.\"";
+ getitem $@halloween_big_reward[rand(getarraysize($@halloween_big_reward))], 1;
+ set HALLOWEENTIME, HALLOWEENTIME | $@halloween_got_big_reward;
+ // you get the big reward first, then the main treats
+ // otherwise it would be too complicated, and/or possibly unfair
+ goto L_Tricking_Trick_or_Treat;
+
+L_Cheater:
+ mes "\"I recognize you despite your mask, you have been taking sweets you do not deserve.\"";
+ if (@karma != 65535)
+ set HALLOWEENTIME, HALLOWEENTIME + 1;
+ goto L_Close;
+
+L_Remember_Face:
+ // mes "You've been here before; I remember your face";
+ mes "\"I remember your face, " + strcharinfo(0) + ". No more treats for you!\"";
+ goto L_Close;
+
+L_Tricking_Trick_or_Treat:
+ // moved above
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes $@halloween_greetings$[@halloween_npc_id];
+ next;
+ // TODO: should we randomize these? (in a subsequent commit)
+ menu
+ $@halloween_trick_notscary$[@halloween_npc_id], L_Tricking_Notscary,
+ $@halloween_trick_scary$[@halloween_npc_id], L_Tricking_Scary,
+ $@halloween_trick_veryscary$[@halloween_npc_id], L_Tricking_Veryscary;
+
+L_Tricking_Notscary:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes $@halloween_react_notscary$[@halloween_npc_id];
+ goto L_Tricking_Reward;
+
+L_Tricking_Scary:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes $@halloween_react_scary$[@halloween_npc_id];
+ set @scare_factor, @scare_factor * 2;
+ goto L_Tricking_Reward;
+
+L_Tricking_Veryscary:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes $@halloween_react_veryscary$[@halloween_npc_id];
+ set @scare_factor, @scare_factor * 3;
+ goto L_Tricking_Reward;
+
+L_Tricking_Reward:
+ next;
+ if (@karma >= 16)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@karma >= 256)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@karma >= 4096)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@scare_factor < 1)
+ set @scare_factor, 1;
+ goto L_Tricking_Reward_Loop;
+
+L_Tricking_Reward_Loop:
+ set @random, rand($@halloween_sweets_num);
+ setarray @getitem_ids, $@halloween_sweets[@random];
+ setarray @getitem_counts, 1;
+ callfunc "CheckInventory";
+ if (@check_fail)
+ set @scare_factor, 0;
+ if (!@scare_factor)
+ goto L_Tricking_End;
+ // NOTE: it gives out one piece at a time, but can loop several times
+ getitem $@halloween_sweets[@random], 1;
+ set @scare_factor, @scare_factor - 1;
+ goto L_Tricking_Reward_Loop;
+
+L_SetRememberFace:
+ set HALLOWEENTIME, HALLOWEENTIME | (1 << (31 - @halloween_npc_id));
+ goto L_Close;
+
+L_Tricking_End:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes "\"That should be enough sweets for you. Thanks for participating!\"";
+ if (!@mask)
+ goto L_SetRememberFace;
+ // add the player's mask to the list
+ set @loop, 7;
+ goto L_SetRememberMask;
+
+L_SetRememberMask:
+ set $@halloween_maskmemory[8 * @halloween_npc_id + @loop], $@halloween_maskmemory[8 * @halloween_npc_id + @loop - 1];
+ set @loop, @loop - 1;
+ if (@loop)
+ goto L_SetRememberMask;
+ set $@halloween_maskmemory[8 * @halloween_npc_id], @mask;
+ set HALLOWEENTIME, HALLOWEENTIME + 1;
+ goto L_Close;
+
+L_Full_Inventory:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes "\"You are trying to collect candy but you have no space to carry all the kinds of stuff that I have to offer! Please, save room for more stuff and come back.\"";
+ goto L_Close;
+
+L_NoMask:
+ mes $@halloween_npc_names$[@halloween_npc_id];
+ mes "\"Hey " + strcharinfo(0) + ", are you trying to scare me with your face? Interesting! hahaha...\"";
+ goto L_Close;
+
+L_Close:
+ set @tmp, 0;
+ set @mask, 0;
+ set @karma, 0;
+ set @loop, 0;
+ set @menu, 0;
+ set @halloween_npc_id, 0;
+ return;
+
+L_QuickReturn:
+ set @halloween_npc_id, 0;
+ return;
+}
+function|script|TrickOrTreatTally|,
+{
+ set @npc_loop, 0;
+ set @npc_tally, 0;
+ goto L_LoopCheck;
+
+L_LoopCheck:
+ if (HALLOWEENTIME & (1 << (31 - @npc_loop)))
+ set @npc_tally, (@npc_tally + 1);
+ goto L_IncLoop;
+
+L_IncLoop:
+ set @npc_loop, (@npc_loop + 1);
+ if (@npc_loop >= 15)
+ goto L_Return;
+ goto L_LoopCheck;
+
+L_Return:
+ return;
+}
+// Checks for an expired event key
+// Each new annual event needs a new key
+// or it will allow completion from last year
+function|script|HalloweenCheckOld|,
+{
+ if(HALLOWEENYEAR == $HALLOWEEN_TIME_KEY[5])
+ goto L_Return;
+ goto L_OldMatch;
+
+L_OldMatch:
+ set HALLOWEENTIME, 0;
+ set HALLOWEENYEAR, $HALLOWEEN_TIME_KEY[5];
+ goto L_Return;
+
+L_Return:
+ return;
+}
+function|script|HalloweenTree|,
+{
+ mes "[Confused Tree]";
+ mes "\"I love halloween, wearing masks and going trick or treating is so much fun.\"";
+ goto L_StartMenu;
+
+L_StartMenu:
+ menu
+ "Whats Halloween?", L_Explain,
+ "Me too!", L_CheckDressed,
+ "Meh, I like Christmas Better.", L_XmasBetter;
+
+L_Explain:
+ mes "\"I've convinced some people throughout the world to help with trick or treating.\"";
+ next;
+ set @npc_check_loop, 0;
+ goto L_NpcCheckLoop;
+
+L_NpcCheckLoop:
+ mes $@halloween_npc_names$[@npc_check_loop];
+ next;
+ goto L_NpcCheckInc;
+
+L_NpcCheckInc:
+ set @npc_check_loop, (@npc_check_loop + 1);
+ if (@npc_check_loop >= getarraysize($@halloween_npc_names$))
+ goto L_ContinueExplain;
+ goto L_NpcCheckLoop;
+
+L_ContinueExplain:
+ mes "\"Find each person and put on a mask then try to scare them.\"";
+ next;
+ mes "\"The scarier you are, the more treats you will be awarded.\"";
+ next;
+ mes "\"If you are really scary you could get a rare reward.\"";
+ next;
+ goto L_StartMenu;
+
+L_CheckDressed:
+ set @head, getequipid(equip_head);
+ set @chest, getequipid(equip_torso);
+ set @leg, getequipid(equip_legs);
+ set @random_mes$, "\" I like your costume.\"";
+ if ((@head <= 0) && (@chest <= 0) && (@leg <= 0))
+ set @random_mes$, "\"Birthday Suit, always a classic.\"";
+ if ((@head == 615) && (@chest == 870))
+ set @random_mes$, "\"How embrassing... we are wearing the same costume.\"";
+ if ((@head == 617) || (@head == 622) || (@head == 621))
+ set @random_mes$, "\"Yar, matey I see that.\"";
+ if ((@head == 633) || (@head == 1205) || (@chest == 1183) || (@chest == 1184) || (@chest == 1185) || (@chest == 1186) || (@chest == 1187))
+ set @random_mes$, "\"Your sense of humor offends me, it's way to early for that.\"";
+ mes @random_mes$;
+ goto L_Return;
+
+L_XmasBetter:
+ mes "\"Bah, Humbug, Show your Halloween spirit! OOooooOooo\"";
+ misceffect 302, strcharinfo(0);
+ goto L_Return;
+
+L_Return:
+ return;
+}
diff --git a/world/map/npc/annuals/xmas/tree_beard.txt b/world/map/npc/annuals/tree_beard.txt
index d7e8b183..5923637f 100644
--- a/world/map/npc/annuals/xmas/tree_beard.txt
+++ b/world/map/npc/annuals/tree_beard.txt
@@ -1,4 +1,10 @@
-// Annual Xmas Environment changes
+// Annual Environment changes
+020-1.gat,90,78,0|script|#GhostTreeOne|133,
+{
+ callfunc "HalloweenTree";
+ close;
+}
+
020-1.gat,90,78,0|script|#Tree|380,
{
end;
@@ -16,6 +22,12 @@
close;
}
+009-1.gat,54,38,0|script|#GhostTreeTwo|133,
+{
+ callfunc "HalloweenTree";
+ close;
+}
+
009-1.gat,54,38,0|script|#TreeNoSnow|394,
{
end;
@@ -33,6 +45,12 @@
close;
}
+001-1.gat,41,45,0|script|#GhostTreeThree|133,
+{
+ callfunc "HalloweenTree";
+ close;
+}
+
001-1.gat,41,45,0|script|#PalmTree|384,
{
end;
@@ -80,25 +98,37 @@ L_Return:
function|script|ReplaceTrees|,
{
- if($@xmas_time)
+ disablenpc "#Tree";
+ disablenpc "#TreeNoSnow";
+ disablenpc "#PalmTree";
+ disablenpc "#GhostTreeOne";
+ disablenpc "#GhostTreeTwo";
+ disablenpc "#GhostTreeThree";
+ disablenpc "#XmasTree";
+ disablenpc "#XmasTreeNoSnow";
+ disablenpc "#XmasPalmTree";
+
+ if ($@xmas_time)
goto L_XmasTree;
+ if ($@halloween_time)
+ goto L_HalloweenLive;
goto L_Tree;
L_XmasTree:
- disablenpc "#Tree";
enablenpc "#XmasTree";
- disablenpc "#TreeNoSnow";
enablenpc "#XmasTreeNoSnow";
- disablenpc "#PalmTree";
enablenpc "#XmasPalmTree";
goto L_Return;
+L_HalloweenLive:
+ enablenpc "#GhostTreeOne";
+ enablenpc "#GhostTreeTwo";
+ enablenpc "#GhostTreeThree";
+ goto L_Return;
+
L_Tree:
- disablenpc "#XmasTree";
enablenpc "#Tree";
- disablenpc "#XmasTreeNoSnow";
enablenpc "#TreeNoSnow";
- disablenpc "#XmasPalmTree";
enablenpc "#PalmTree";
goto L_Return;
diff --git a/world/map/npc/annuals/xmas/config.txt b/world/map/npc/annuals/xmas/config.txt
index e63c07e2..e8ac5cc2 100644
--- a/world/map/npc/annuals/xmas/config.txt
+++ b/world/map/npc/annuals/xmas/config.txt
@@ -80,9 +80,6 @@ L_Main:
set $@xmas_event_time, 1;
set $@xmas_reward_time, 2;
- // Xmas debug (sets time)
- set $@xmas_debug, 0;
-
// Main Quest Settings
// Bit used to Set Which one of the 2 quests you are on
set $@xmas_side_bit, (1 << 31);
@@ -265,11 +262,6 @@ L_Main:
set $@xmas_spawn_y2, 89;
set $@xmas_respawn_count, 9;
- if($@xmas_debug == $@xmas_event_time)
- goto L_EventTime;
- if($@xmas_debug == $@xmas_reward_time)
- goto L_RewardTime;
-
if((gettime(6) == $@xmas_reward_start_month && gettime(5) >= $@xmas_reward_start_day
&& (gettime(5) <= $@xmas_reward_end_day && $@xmas_reward_start_month == $@xmas_end_month
|| !($@xmas_reward_start_month == $@xmas_end_month)))
@@ -297,9 +289,9 @@ L_RewardTime:
goto L_Return;
L_Return:
- callfunc "ReplaceTrees";
callfunc "SpawnMobs";
callfunc "PresentHandler";
+ callfunc "ReplaceTrees";
end;
L_XmasError:
diff --git a/world/map/npc/annuals/xmas/debug.txt b/world/map/npc/annuals/xmas/debug.txt
index 38bbdf15..a26565b6 100644
--- a/world/map/npc/annuals/xmas/debug.txt
+++ b/world/map/npc/annuals/xmas/debug.txt
@@ -227,27 +227,14 @@ L_End:
end;
}
-
-017-9.gat,31,24,0|script|XmasDebug#5|105,
-{
- if(getgmlevel() < 40)
- goto L_End;
-
- callfunc "XmasDebug";
- goto L_End;
-
-L_End:
- end;
-}
-
-020-1.gat,86,76,0|script|XmasDebug#6|105,
+020-1.gat,86,76,0|script|XmasDebug#5|105,
{
callfunc "XmasDebug";
goto L_End;
OnInit:
if(!(debug))
- disablenpc "XmasDebug#6";
+ disablenpc "XmasDebug#5";
goto L_End;
L_End:
diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf
index 8aa774e0..90c11883 100644
--- a/world/map/npc/scripts.conf
+++ b/world/map/npc/scripts.conf
@@ -39,8 +39,9 @@ import: npc/_import.txt
// GM Events
npc: npc/functions/gm_island.txt
-
+// Annuals Framework
npc: npc/annuals/fathertime.txt
+npc: npc/annuals/tree_beard.txt
// Annual Christmas
npc: npc/annuals/xmas/config.txt
npc: npc/annuals/xmas/states.txt
@@ -51,4 +52,8 @@ npc: npc/annuals/xmas/helpers.txt
npc: npc/annuals/xmas/list.txt
npc: npc/annuals/xmas/reagents.txt
npc: npc/annuals/xmas/mobmanager.txt
-npc: npc/annuals/xmas/tree_beard.txt
+// Annual halloween
+npc: npc/annuals/halloween/config.txt
+npc: npc/annuals/halloween/debug.txt
+npc: npc/annuals/halloween/munro.txt
+npc: npc/annuals/halloween/trick_or_treat.txt