summaryrefslogtreecommitdiff
path: root/npc/annuals/halloween
diff options
context:
space:
mode:
Diffstat (limited to 'npc/annuals/halloween')
-rwxr-xr-xnpc/annuals/halloween/config.txt285
-rwxr-xr-xnpc/annuals/halloween/debug.txt138
-rwxr-xr-xnpc/annuals/halloween/munro.txt46
-rwxr-xr-xnpc/annuals/halloween/trick_or_treat.txt322
4 files changed, 791 insertions, 0 deletions
diff --git a/npc/annuals/halloween/config.txt b/npc/annuals/halloween/config.txt
new file mode 100755
index 00000000..ddbc7971
--- /dev/null
+++ b/npc/annuals/halloween/config.txt
@@ -0,0 +1,285 @@
+
+
+
+
+
+
+
+- script #HalloweenConfig NPC32767,{
+ 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
+ $@halloween_start_month = $HALLOWEEN_TIME_KEY[0];
+ $@halloween_reward_start_month = $HALLOWEEN_TIME_KEY[1];
+ $@halloween_end_month = $HALLOWEEN_TIME_KEY[2];
+
+ // Reward Day Start/End
+ $@halloween_reward_start_day = $HALLOWEEN_TIME_KEY[3];
+ $@halloween_reward_end_day = $HALLOWEEN_TIME_KEY[4];
+
+ // Time Settings
+ $@halloween_no_event_time = 0;
+ $@halloween_event_time = 1;
+ $@halloween_reward_time = 2;
+
+ // How many, maximum is 8
+ $@halloween_memory_count = 8;
+ // Level to go trick-or-treating
+ $@halloween_min_level = 10;
+
+ // Number of trick and treats completed to get charm.
+ $@halloween_charm_count = 10;
+ $@halloween_got_charm_reward = (1 << 17);
+ setarray $@halloween_big_reward, 905, 1175;
+ $@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
+ $@halloween_sweets_num = getarraysize($@halloween_sweets);
+
+ setarray $@halloween_mask_IDs, 678, 679, 1221, 634, 615, 639, 769, 801, 1218, 1276, 1277, 1279, 4027;
+ setarray $@halloween_scare_factors, 2, 4, 4, 4, 2, 3, 2, 2, 1, 3, 2, 4, 4;
+
+ if (getarraysize($@halloween_mask_IDs) != getarraysize($@halloween_scare_factors))
+ goto L_HalloweenError;
+ // temporary counter
+ $@n = 0;
+
+ $@halloween_npc_caretaker = $@n;
+ $@halloween_npc_names$[$@n] = "[Caretaker]";
+ $@halloween_greetings$[$@n] = "\"Alright, come on then. Show me your trick.\"";
+ $@halloween_trick_notscary$[$@n] = "Trick? You must have misheard me. I've come because the Government needs to build a road through your house.";
+ $@halloween_react_notscary$[$@n] = "\"And?\"";
+ $@halloween_trick_scary$[$@n] = "You look pretty deceased to me, old man. Undead must die! Yaah!";
+ $@halloween_react_scary$[$@n] = "\"Now listen here, I'm as alive as you - oh. Say, that was a good trick!\"";
+ $@halloween_trick_veryscary$[$@n] = "Your wife... she's - she's - she's DEAD!";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_eurni = $@n;
+ $@halloween_npc_names$[$@n] = "[Eurni the Surgeon]";
+ $@halloween_greetings$[$@n] = "\"Oh, right.\"";
+ $@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...";
+ $@halloween_react_notscary$[$@n] = "\"Heheh, sucks, buddy. But there's always a risk.\"";
+ $@halloween_trick_scary$[$@n] = "Look out! A scorpion!";
+ $@halloween_react_scary$[$@n] = "\"Where? Darn things, I think they're what keep scaring away my customers.\"";
+ $@halloween_trick_veryscary$[$@n] = "I know about your hobby of performing numerous Sex changes on yourself.";
+ $@halloween_react_veryscary$[$@n] = "\"Shut up! Look, will you hold your tongue if I give you more treats...?\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_george = $@n;
+ $@halloween_npc_names$[$@n] = "[George the Pirate]";
+ $@halloween_greetings$[$@n] = "\"Shiver me timbers! What do ye mean?\"";
+ $@halloween_trick_notscary$[$@n] = "Well... I do a trick, and then... you give me a treat...";
+ $@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!\"";
+ $@halloween_trick_scary$[$@n] = "Your eyepatch is on the wrong eye!";
+ $@halloween_react_scary$[$@n] = "\"Arrrrh, so it is! Ta for pointing it out, mate - wait, no it isn't! Harhar, what a good trick!\"";
+ $@halloween_trick_veryscary$[$@n] = "By the powers, ye're a daft landlubber to be sure, ye barnacle-ridden swab!";
+ $@halloween_react_veryscary$[$@n] = "\"Arrrrh, ye scurvy dog! I'm sure my first mate will return with the ship eventually.\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_inac = $@n;
+ $@halloween_npc_names$[$@n] = "[Inac]";
+ $@halloween_greetings$[$@n] = "\"Oh, yes?\"";
+ $@halloween_trick_notscary$[$@n] = "Yes, we monsters moved into the tunnels... and now we're coming out... for revenge!";
+ $@halloween_react_notscary$[$@n] = "\"Haha! That's the worse trick I've seen today.\"";
+ $@halloween_trick_scary$[$@n] = "One of those monsters you mentioned is crawling out of the well!";
+ $@halloween_react_scary$[$@n] = "\"He IS? Where!? Aah! Oh. You were just tricking, right? Hahaha, that was good, I really believed you.\"";
+ $@halloween_trick_veryscary$[$@n] = "Yeah, but it's all fossil water. One day it's gonna dry up!";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_kfahr = $@n;
+ $@halloween_npc_names$[$@n] = "[Kfahr the Warrior]";
+ $@halloween_greetings$[$@n] = "\"Ah, yes!\" He rubs his hands. \"Trick away, then!\"";
+ $@halloween_trick_notscary$[$@n] = "Meh... I'm only trick-or-treating you to avoid listening to your BORING stories.";
+ $@halloween_react_notscary$[$@n] = "\"Boring?\" He grins. \"You must be mistaking me for someone else.\"";
+ $@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!";
+ $@halloween_react_scary$[$@n] = "\"What? But- but- why do they- oh, you tricked me. I was about to really get worried for a moment.\"";
+ $@halloween_trick_veryscary$[$@n] = "Have you heard? Tulimshar was destroyed by a giant Desert Worm!";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_nurse = $@n;
+ $@halloween_npc_names$[$@n] = "[Nurse]";
+ $@halloween_greetings$[$@n] = "\"I don't know why I let the Mayor trick me into this... well, go on then.\"";
+ $@halloween_trick_notscary$[$@n] = "I ate too much Hallowe'en candy, now I'm sick!";
+ $@halloween_react_notscary$[$@n] = "\"Well, no one's to blame but yourself, you know. Just make sure you don't eat any more.\"";
+ $@halloween_trick_scary$[$@n] = "Hurnscald has been struck by plague! You must come and tend to the dying!";
+ $@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!\"";
+ $@halloween_trick_veryscary$[$@n] = "The Doctor asked me to tell you that he doesn't want to see you any more.";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_pachua = $@n;
+ $@halloween_npc_names$[$@n] = "[Chief Pachua]";
+ $@halloween_greetings$[$@n] = "\"Ah, the strange custom the Government man told me about.\"";
+ $@halloween_trick_notscary$[$@n] = "Look out! A scorpion!";
+ $@halloween_react_notscary$[$@n] = "\"Don't mind him, he won't hurt you. Er... so I give you sweets now, or what?\"";
+ $@halloween_trick_scary$[$@n] = "Yes, the ritual giving of treats... LOTS of treats... or else!";
+ $@halloween_react_scary$[$@n] = "\"Alright, here you go.\"";
+ $@halloween_trick_veryscary$[$@n] = "Yes, the ritual giving of treats followed by the sacrifice of the treat-giver...";
+ $@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.\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_yanis = $@n;
+ $@halloween_npc_names$[$@n] = "[Yanis]";
+ $@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...\"";
+ $@halloween_trick_notscary$[$@n] = "Of course I will... not!";
+ $@halloween_react_notscary$[$@n] = "\"Hm!\"";
+ $@halloween_trick_scary$[$@n] = "Regulations, smegulations. The Tonori Government can go suck a lollipop for all I care!";
+ $@halloween_react_scary$[$@n] = "\"!? How dare you - oh, that was your trick! You did have me worried for a moment...\"";
+ $@halloween_trick_veryscary$[$@n] = "What regulations?";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_vincent = $@n;
+ $@halloween_npc_names$[$@n] = "[Vincent]";
+ $@halloween_greetings$[$@n] = "\"Ooh, okay! Trick away!\"";
+ $@halloween_trick_notscary$[$@n] = "Look out! A scorpion!";
+ $@halloween_react_notscary$[$@n] = "\"They're everywhere in this desert! Don't worry about them.\"";
+ $@halloween_trick_scary$[$@n] = "Hey, that action figure you're building just CAME TO LIFE!";
+ $@halloween_react_scary$[$@n] = "\"Really? Cool! Where? What? You were tricking me? WAAAH!\"";
+ $@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.";
+ $@halloween_react_veryscary$[$@n] = "\"My Bug Leg action figure! You broke it!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_weellos = $@n;
+ $@halloween_npc_names$[$@n] = "[Weellos]";
+ $@halloween_greetings$[$@n] = "\"Trick me, then!\"";
+ $@halloween_trick_notscary$[$@n] = "Look out! A scorpion!";
+ $@halloween_react_notscary$[$@n] = "\"Pesky things, I know, but they're everywhere around here...\"";
+ $@halloween_trick_scary$[$@n] = "Actually, it's a fake. It was built just ten years ago.";
+ $@halloween_react_scary$[$@n] = "\"No! But I've read all the accounts... oh, haha! Very funny!\"";
+ $@halloween_trick_veryscary$[$@n] = "They say the earthquake ruined the foundations of this building, and that it's going to fall down.";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_zack = $@n;
+ $@halloween_npc_names$[$@n] = "[Zack]";
+ $@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.\"";
+ $@halloween_trick_notscary$[$@n] = "You think this is something to do with Hallowe'en? Hands up!";
+ $@halloween_react_notscary$[$@n] = "\"Heh... That was ok.\"";
+ $@halloween_trick_scary$[$@n] = "And now that I've found you, you die!";
+ $@halloween_react_scary$[$@n] = "\"Aah! What did I do? Oh - wait - I see! That was a good one!\"";
+ $@halloween_trick_veryscary$[$@n] = "Yes, I have found you. After all these years.";
+ $@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!\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_kimarr = $@n;
+ $@halloween_npc_names$[$@n] = "[Kimarr]";
+ $@halloween_greetings$[$@n] = "\"Many have tried to scare me, all have failed. Try your best, but the frozen wastes contain all manner of horrors.\"";
+ $@halloween_trick_notscary$[$@n] = "Look out Yetis!";
+ $@halloween_react_notscary$[$@n] = "\"You will have to do better then that.\"";
+ $@halloween_trick_scary$[$@n] = "Hrmm Is that your wife calling you?";
+ $@halloween_react_scary$[$@n] = "\"What? You haven't se... wait a second. Ok that was good.\"";
+ $@halloween_trick_veryscary$[$@n] = "The Kaizeian government declared fluffies an endangered species.";
+ $@halloween_react_veryscary$[$@n] = "\"NOooOOOooo!!! The Hunt!!! ... wait a second, you city folk are slick.\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_nikolai = $@n;
+ $@halloween_npc_names$[$@n] = "[Nikolai]";
+ $@halloween_greetings$[$@n] = "\"Let us see if you are scarier then Kfahr's Fairy Tales.\"";
+ $@halloween_trick_notscary$[$@n] = "Your going over their to the store.";
+ $@halloween_react_notscary$[$@n] = "\"*You're* *there* Ugh, thats more annoying then scary.\"";
+ $@halloween_trick_scary$[$@n] = "Whats White, Blue and slimey? I don't know either but it's right behind you.";
+ $@halloween_react_scary$[$@n] = "\"More Slimes, Oh no the books again. O you tricked me, good one.\"";
+ $@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.";
+ $@halloween_react_veryscary$[$@n] = "\"AHHHHH!!!! You burned our books!!! *GAH* ... *Eye Twitch*\"";
+
+ $@n = $@n + 1;
+
+ $@halloween_npc_vellamo = $@n;
+ $@halloween_npc_names$[$@n] = "[Vellamo]";
+ $@halloween_greetings$[$@n] = "\"Ahh yes, more candy related ritual.\"";
+ $@halloween_trick_notscary$[$@n] = "Candy? No, I want Parsley.";
+ $@halloween_react_notscary$[$@n] = "\"Parsley? is this some kind of monster? I'm not getting this scare at all\"";
+ $@halloween_trick_scary$[$@n] = "Chief Warrick says he needs the candy inventory by end of day.";
+ $@halloween_react_scary$[$@n] = "\"Ahh, no! I forgot to put a cover sheet on my Candy Production and Storage report.\"";
+ $@halloween_trick_veryscary$[$@n] = "I'm sorry, but your doctor says your diabetic.";
+ $@halloween_react_veryscary$[$@n] = "\"Darkest day of my life, blacker then the darkest chocolate.\"";
+
+ $@halloween_num_npcs = $@n + 1;
+ $@halloween_all_npc_bits = -1 << (32 - $@halloween_num_npcs);
+
+ $@n = 0;
+
+ // Age to go trick-or-treating (1 week before the start)
+ if ((gettime(6) >= $@halloween_start_month) || (gettime(6) <= $@halloween_end_month))
+ $@halloween_min_age = ((gettime(5) + 7)*86400);
+ if (gettime(6) == $@halloween_reward_start_month)
+ $@halloween_min_age = ((gettime(5) + 38)*86400);
+
+ $@start_month = $@halloween_start_month;
+ $@end_month = $@halloween_end_month;
+ $@start_day = 1;
+ $@end_day = $@halloween_reward_end_day;
+ $@reward_start_month = $@halloween_reward_start_month;
+ $@reward_start_day = $@halloween_reward_start_day;
+
+ callfunc "GetEventTime";
+ $@halloween_time = $@event_time;
+
+ if($@halloween_time == 0 && $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);
+ goto L_Return;
+
+L_Return:
+ callfunc "SpawnMunro";
+ callfunc "ReplaceTrees";
+ end;
+
+L_HalloweenError:
+ debugmes "Halloween is Dead Jim.";
+ mapexit;
+}
diff --git a/npc/annuals/halloween/debug.txt b/npc/annuals/halloween/debug.txt
new file mode 100755
index 00000000..9d7e3650
--- /dev/null
+++ b/npc/annuals/halloween/debug.txt
@@ -0,0 +1,138 @@
+
+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:
+ HALLOWEENTIME = 255;
+ HALLOWEENYEAR = 2012;
+ goto L_Debug;
+
+L_HalloweenTimeKey:
+ 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;
+ donpcevent "#HalloweenConfig::OnCommandRestartQuest";
+ goto L_Debug;
+
+L_QuestState:
+ mes "Karma: " + (HALLOWEENTIME & 65535);
+ @big_reward_status$ = " No.";
+ if (HALLOWEENTIME & $@halloween_got_big_reward)
+ @big_reward_status$ = " Yes.";
+ mes "Big Reward: " + @big_reward_status$;
+ @charm_reward_status$ = " No.";
+ if (HALLOWEENTIME & $@halloween_got_charm_reward)
+ @charm_reward_status$ = " Yes.";
+ mes "Charm Reward:" + @charm_reward_status$;
+ @npc_check_loop = 0;
+ goto L_NpcCheckLoop;
+
+L_NpcCheckLoop:
+ @display_mes$ = "NPC ID " + @npc_check_loop + ":" + $@halloween_npc_names$[@npc_check_loop];
+ @npc_status$ = " Needed";
+ if (HALLOWEENTIME & (1 << (31 - @npc_check_loop)))
+ @npc_status$ = " Complete";
+ @display_mes$ = @display_mes$ + @npc_status$;
+ mes @display_mes$;
+ @display_mes$ = "";
+ goto L_NpcCheckInc;
+
+L_NpcCheckInc:
+ @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;
+ HALLOWEENTIME = HALLOWEENTIME | (1 << (31 - @halloween_npc_id));
+ goto L_Debug;
+
+L_ResetMe:
+ HALLOWEENTIME = 0;
+ HALLOWEENYEAR = $HALLOWEEN_TIME_KEY[5];
+ goto L_Debug;
+
+L_ResetMask:
+ mes "Enter NPC to reset:";
+ input @halloween_npc_id;
+ $@halloween_maskmemory[8 * @halloween_npc_id] = 0;
+ goto L_Debug;
+
+L_close:
+ @tmp = 0;
+ @Mask = 0;
+ @karma = 0;
+ @loop = 0;
+ @menu = 0;
+ @halloween_npc_id = 0;
+ close2;
+ return;
+}
diff --git a/npc/annuals/halloween/munro.txt b/npc/annuals/halloween/munro.txt
new file mode 100755
index 00000000..93d01764
--- /dev/null
+++ b/npc/annuals/halloween/munro.txt
@@ -0,0 +1,46 @@
+026-1,24,37,0 script Munro NPC183,{
+ 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.\"";
+ 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;
+}
diff --git a/npc/annuals/halloween/trick_or_treat.txt b/npc/annuals/halloween/trick_or_treat.txt
new file mode 100755
index 00000000..fa4eb6f4
--- /dev/null
+++ b/npc/annuals/halloween/trick_or_treat.txt
@@ -0,0 +1,322 @@
+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:
+ @Mask = getequipid(equip_head);
+ goto L_Begin;
+
+L_Begin:
+ @karma = (HALLOWEENTIME & 65535);
+ if (@Mask > 0)
+ goto L_WearingMask;
+ goto L_NoMask;
+
+L_WearingMask:
+ // set the scare factor of the equipped mask
+ @Mask_index = 0;
+ @scare_factor = 1;
+ goto L_MaskLoop;
+
+L_MaskLoop:
+ if ($@halloween_mask_IDs[@Mask_index] == @Mask)
+ goto L_FoundMask;
+ @Mask_index = @Mask_index + 1;
+ if ($@halloween_mask_IDs[@Mask_index])
+ goto L_MaskLoop;
+ // not a mask in the list
+ @Mask = 0;
+ goto L_MaskDone;
+
+L_FoundMask:
+ @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:
+ @Mask_index = 0;
+ // check if the mask is in the memory
+ @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:
+ @tmp = $@halloween_maskmemory[8 * @halloween_npc_id + @loop];
+ if (!@tmp)
+ goto L_MaskMemoryNo;
+ if (@tmp == @Mask)
+ goto L_MaskMemoryYes;
+ @loop = @loop + 1;
+ if (@loop != $@halloween_memory_count)
+ goto L_MaskMemoryCheck;
+ goto L_MaskMemoryNo;
+
+L_MaskMemoryYes:
+ // not necessarily true
+ mes "\"I remember you, " + getitemlink(getequipid(equip_head)) + " person. No more treats for you!\"";
+ goto L_close;
+
+L_MaskMemoryNo:
+ // player will probably get treats
+ @loop = 0;
+ @sweets_types = 0;
+ goto L_Count_Sweets;
+
+L_Count_Sweets:
+ if ($@halloween_sweets[@loop] == 0)
+ goto L_Check_Inventory;
+ if (countitem($@halloween_sweets[@loop]))
+ @sweets_types = @sweets_types + 1;
+ @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:
+ // NPC Cheater detection starts after max NPCs hit
+ if (rand($@halloween_num_npcs, 65535) <= @karma)
+ goto L_Cheater;
+ // NPC Cheater detection engages at 48 Trick or Treats
+ if (@karma >= 48)
+ 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;
+ 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)
+ 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];
+ @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];
+ @scare_factor = @scare_factor * 3;
+ goto L_Tricking_Reward;
+
+L_Tricking_Reward:
+ next;
+ if (@karma >= 16)
+ @scare_factor = rand(@scare_factor / 2, @scare_factor);
+ if (@karma >= 24)
+ @scare_factor = rand(@scare_factor / 3, @scare_factor);
+ if (@scare_factor < 1)
+ @scare_factor = 1;
+ goto L_Tricking_Reward_Loop;
+
+L_Tricking_Reward_Loop:
+ @random = rand($@halloween_sweets_num);
+ setarray @getitem_ids, $@halloween_sweets[@random];
+ setarray @getitem_counts, 1;
+ callfunc "CheckInventory";
+ if (@check_fail)
+ @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;
+ @scare_factor = @scare_factor - 1;
+ goto L_Tricking_Reward_Loop;
+
+L_SetRememberFace:
+ 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
+ @loop = 7;
+ goto L_SetRememberMask;
+
+L_SetRememberMask:
+ $@halloween_maskmemory[8 * @halloween_npc_id + @loop] = $@halloween_maskmemory[8 * @halloween_npc_id + @loop - 1];
+ @loop = @loop - 1;
+ if (@loop)
+ goto L_SetRememberMask;
+ $@halloween_maskmemory[8 * @halloween_npc_id] = @Mask;
+ 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:
+ @tmp = 0;
+ @Mask = 0;
+ @karma = 0;
+ @loop = 0;
+ @menu = 0;
+ @halloween_npc_id = 0;
+ return;
+
+L_QuickReturn:
+ @halloween_npc_id = 0;
+ return;
+}
+function script TrickOrTreatTally {
+ @npc_loop = 0;
+ @npc_tally = 0;
+ goto L_LoopCheck;
+
+L_LoopCheck:
+ if (HALLOWEENTIME & (1 << (31 - @npc_loop)))
+ @npc_tally = (@npc_tally + 1);
+ goto L_IncLoop;
+
+L_IncLoop:
+ @npc_loop = (@npc_loop + 1);
+ if (@npc_loop >= 15)
+ goto L_Return;
+ goto L_LoopCheck;
+
+L_Return:
+ return;
+}
+function script HalloweenCheckOld {
+ if(HALLOWEENYEAR == $HALLOWEEN_TIME_KEY[5])
+ goto L_Return;
+ goto L_OldMatch;
+
+L_OldMatch:
+ HALLOWEENTIME = 0;
+ HALLOWEENYEAR = $HALLOWEEN_TIME_KEY[5];
+ goto L_Return;
+
+L_Return:
+ return;
+}
+function script HalloweenTree {
+ mes "[Confused Tree]";
+ if ((HALLOWEENTIME & 65535) > ($@halloween_num_npcs * 3))
+ mes "\"Whoa slow down greedy, leave some candy for the reset of us!\"";
+ if ((HALLOWEENTIME & 65535) > $@halloween_num_npcs)
+ mes "\"I see you have ben enjoying trick or treating, I hope you don't get a stomach ache.\"";
+ if ((HALLOWEENTIME & 65535) <= $@halloween_num_npcs)
+ 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;
+ @npc_check_loop = 0;
+ goto L_NpcCheckLoop;
+
+L_NpcCheckLoop:
+ mes $@halloween_npc_names$[@npc_check_loop];
+ next;
+ goto L_NpcCheckInc;
+
+L_NpcCheckInc:
+ @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:
+ @head = getequipid(equip_head);
+ @chest = getequipid(equip_torso);
+ @leg = getequipid(equip_legs);
+ @random_mes$ = "\" I like your costume.\"";
+ if ((@head <= 0) && (@chest <= 0) && (@leg <= 0))
+ @random_mes$ = "\"Birthday Suit, always a classic.\"";
+ if ((@head == 615) && (@chest == 870))
+ @random_mes$ = "\"How embrassing... we are wearing the same costume.\"";
+ if ((@head == 617) || (@head == 622) || (@head == 621))
+ @random_mes$ = "\"Yar, matey I see that.\"";
+ if ((@head == 633) || (@head == 1205) || (@chest == 1183) || (@chest == 1184) || (@chest == 1185) || (@chest == 1186) || (@chest == 1187))
+ @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;
+}