diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-07-07 20:36:00 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-07-07 20:36:00 -0300 |
commit | 6967b9e0b63d19141d4f59b7933a960ac81916d0 (patch) | |
tree | 8ecd9cd2461f3598cb7faece71eb77162aa4ef2a /npc/annuals | |
parent | 9877fd4ad81120af8e63e96d5d429092014dc017 (diff) | |
parent | 046c659193e1ca8bd13478678d1277df8bf9395c (diff) | |
download | serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.gz serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.bz2 serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.tar.xz serverdata-6967b9e0b63d19141d4f59b7933a960ac81916d0.zip |
Merge branch 'master' into legacy
Override all files with 'master' version.
This version is meant to preserve git history as requested by bjorn.
Diffstat (limited to 'npc/annuals')
-rw-r--r-- | npc/annuals/check_time.txt | 46 | ||||
-rw-r--r-- | npc/annuals/fathertime.txt | 32 | ||||
-rw-r--r-- | npc/annuals/halloween/config.txt | 284 | ||||
-rw-r--r-- | npc/annuals/halloween/debug.txt | 138 | ||||
-rw-r--r-- | npc/annuals/halloween/munro.txt | 46 | ||||
-rw-r--r-- | npc/annuals/halloween/trick_or_treat.txt | 322 | ||||
-rw-r--r-- | npc/annuals/tree_beard.txt | 1038 | ||||
-rw-r--r-- | npc/annuals/xmas/barriers.txt | 155 | ||||
-rw-r--r-- | npc/annuals/xmas/config.txt | 252 | ||||
-rw-r--r-- | npc/annuals/xmas/core.txt | 229 | ||||
-rw-r--r-- | npc/annuals/xmas/debug.txt | 220 | ||||
-rw-r--r-- | npc/annuals/xmas/helpers.txt | 44 | ||||
-rw-r--r-- | npc/annuals/xmas/list.txt | 98 | ||||
-rw-r--r-- | npc/annuals/xmas/mobmanager.txt | 77 | ||||
-rw-r--r-- | npc/annuals/xmas/reagents.txt | 139 | ||||
-rw-r--r-- | npc/annuals/xmas/states.txt | 51 |
16 files changed, 3171 insertions, 0 deletions
diff --git a/npc/annuals/check_time.txt b/npc/annuals/check_time.txt new file mode 100644 index 00000000..5d229e4c --- /dev/null +++ b/npc/annuals/check_time.txt @@ -0,0 +1,46 @@ + +function script GetEventTime { + $@month = gettime(6); + $@day = gettime(5); + + if ($@start_month > $@end_month) + goto L_YearWrap; + goto L_Normal; + +L_Normal: + if(($@month < $@start_month) + || ($@month == $@start_month && $@day < $@start_day)) + goto L_NoEventTime; + if(($@month > $@end_month) + || ($@month == $@end_month && $@day > $@end_day)) + goto L_NoEventTime; + if(($@month > $@reward_start_month) + || ($@month == $@reward_start_month && $@day >= $@reward_start_day)) + goto L_RewardTime; + goto L_EventTime; + +L_YearWrap: + if(($@month == $@reward_start_month && $@day >= $@reward_start_day + && ($@day <= $@end_day && $@reward_start_month == $@end_month + || !($@reward_start_month == $@end_month))) + || ($@month == $@end_month && $@day <= $@end_day + && ($@day >= $@reward_start_day && $@reward_start_month == $@end_month + || !($@reward_start_month == $@end_month))) + || ($@month < $@end_month && $@month > $@reward_start_month)) + goto L_RewardTime; + if (($@month >= $@start_month && $@day >= $@start_day) || ($@month <= $@end_month && $@day <= $@end_day)) + goto L_EventTime; + goto L_NoEventTime; + +L_NoEventTime: + $@event_time = 0; + return; + +L_EventTime: + $@event_time = 1; + return; + +L_RewardTime: + $@event_time = 2; + return; +} diff --git a/npc/annuals/fathertime.txt b/npc/annuals/fathertime.txt new file mode 100644 index 00000000..6a92e7dc --- /dev/null +++ b/npc/annuals/fathertime.txt @@ -0,0 +1,32 @@ +017-9,26,28,0 script #HolidayConfig NPC32767,{ + end; + +OnInit: + if (debug >= 2) end; + donpcevent strnpcinfo(0) + "::OnTimer20000"; + end; + +OnClock0000: +OnTimer20000: + donpcevent "#XmasConfig::OnCommandRestartQuest"; + donpcevent "#HalloweenConfig::OnCommandRestartQuest"; + donpcevent "Easter Eggs::OnCheckEaster"; + //initnpctimer; + end; +} + +function script TMWBirthday { + if (gettime(GETTIME_MONTH) != APRIL) return; + if (gettime(GETTIME_DAYOFMONTH) != 11) return; + .@age=gettime(GETTIME_YEAR)-2004; + .@end=(.@age % 10); + .@mo$=(.@end == 1 ? "st" : (.@end == 2 ? "nd" : (.@end == 3 ? "rd" : "th"))); + dispbottom l("It is TMW's %d%s birthday!", .@age, .@mo$); + // Handle gifts + if (#TMWBDAY < .@age) { + #TMWBDAY=.@age; + getitem TMWBirthdayGift, 1; + } + return; +} + diff --git a/npc/annuals/halloween/config.txt b/npc/annuals/halloween/config.txt new file mode 100644 index 00000000..d86e3de7 --- /dev/null +++ b/npc/annuals/halloween/config.txt @@ -0,0 +1,284 @@ + + + + + + + +- 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; + + $@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 100644 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 100644 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 100644 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; +} diff --git a/npc/annuals/tree_beard.txt b/npc/annuals/tree_beard.txt new file mode 100644 index 00000000..ba135853 --- /dev/null +++ b/npc/annuals/tree_beard.txt @@ -0,0 +1,1038 @@ +020-1,90,79,0 script Present#1 NPC386,{ + callfunc "XmasStates"; + callfunc "XmasMainItemReward"; + close; +} + +009-1,54,39,0 script Present#2 NPC386,{ + callfunc "XmasStates"; + callfunc "XmasMainItemReward"; + close; +} + +001-1,58,76,0 script Present#3 NPC386,{ + callfunc "XmasStates"; + callfunc "XmasMainItemReward"; + close; +} + +function script SpawnMobs { + donpcevent "XmasSpawnManager::OnCommandSpawnStart"; + return; +} + +function script PresentHandler { + if($@xmas_time == $@xmas_reward_time) + goto L_DeliverPresents; + goto L_DisablePresents; + +L_DeliverPresents: + enablenpc "Present#1"; + enablenpc "Present#2"; + enablenpc "Present#3"; + goto L_Return; + +L_DisablePresents: + disablenpc "Present#1"; + disablenpc "Present#2"; + disablenpc "Present#3"; + goto L_Return; + +L_Return: + return; +} + +function script ReplaceTrees { + if ($@xmas_time) + goto L_XmasTree; + if ($@halloween_time) + goto L_HalloweenLive; + + setnpcdisplay("#ConfusedTree", NPC394); + setnpcdisplay("#ConfusedIcedTree", NPC380); + setnpcdisplay("#ConfusedPalmTree", NPC384); + return; + +L_XmasTree: + setnpcdisplay("#ConfusedTree", NPC381); + setnpcdisplay("#ConfusedIcedTree", NPC379); + setnpcdisplay("#ConfusedPalmTree", NPC383); + return; + +L_HalloweenLive: + setnpcdisplay("#ConfusedTree", NPC133); + setnpcdisplay("#ConfusedIcedTree", NPC133); + setnpcdisplay("#ConfusedPalmTree", NPC133); + return; +} + +// Evol scripts. +// Author: +// gumi +// Based on CrazyTree, originally made by: +// gumi +// pclouds +// veryape +// wushin +// Description: +// emulated confused tree prototype + +// ~t lowercase hot word regex + +009-1,54,38,0 script #ConfusedTree NPC394,14,14,{ + + function tree_panel { + if (is_trusted() == false && #Tree_Trusted == false) + { + narrator(l("You see a tree.")); + // FIXME Inspector Quest + if (getq(HurnscaldQuests_Inspector) == 2) + { + select( + l("Have you seen anything strange lately?"), + l("Do you know anything about the recent robberies?")); + + narrator(S_FIRST_BLANK_LINE, + l("..."), + l("It doesn't reply.")); + } + close; + } + + function clear_db { + clear(); + mes(l("##BWARNING:##b you are about to permanently empty the quote database.")); + next(); + mes(l("Do you want to continue?")); + + select( + l("Abort!"), + l("Empty the quote DB")); + + if (@menu == 2) + { + .@sentence$ = "I am an idiot"; + mes(l("Please write the following sentence:")); + mes(""); + mesf(" ##B%s.", .@sentence$); + input(.@confirm$); + + if (!startswith(strtoupper(.@confirm$), strtoupper(.@sentence$))) { + mes(l("Invalid!")); + close; + } + + query_sql("TRUNCATE TABLE tree_quotes;"); + mes(l("Database erased.")); + // GM Log + logmes(sprintf("%s has deleted all quotes from CrazyTree =(", strcharinfo(0)), LOGMES_ATCOMMAND); + next(); + } + + return; + } + + function list_commands { + clear(); + mes(l("To grab a quote:")); + mes(col(" ~grab ##Bplayer name##b", 7)); + next(); + mes(l("To get a quote:")); + mes(col(" ~quote anyone", 7)); + mes(col(" ~quote ##Bplayer name##b", 7)); + mes(col(" ~quote ##B#number##b", 7)); + next(); + mes(l("To remove a quote:")); + mes(col(" ~remove quote ##B#number##b", 7)); + mes(col(" ~remove last quote", 7)); + next(); + mes(l("Last seen:")); + mes(col(" ~seen ##Bplayer name##b", 7)); + next(); + mes(l("To ignore a player:")); + mes(col(" ~ignore ##Bplayer name##b", 7)); + next(); + mes(l("To unignore a player:")); + mes(col(" ~unignore ##Bplayer name##b", 7)); + next(); + + if (is_admin()) + { + mes(l("To trust a player:")); + mes(col(" ~trust ##Bplayer name##b", 7)); + next(); + mes(l("To de-trust a player:")); + mes(col(" ~untrust ##Bplayer name##b", 7)); + next(); + } + return; + } + + do + { + clear(); + setnpcdialogtitle(l("Tree Control Panel")); + mes(l("Oh noes! You found my secret backdoor!")); + next(); + mes(l("Please select an option:")); + + select( + l("List the commands"), + rif(is_admin(), l("Empty the quote DB")), + l("Dance for me")); + + switch (@menu) + { + case 1: list_commands(); break; + case 2: clear_db(); break; + default: speech(l("Too lazy.")); close; + } + + } while (true); + + end; + } + + // utility functions below + + function check_is_ignored { + .@val = htget(.ignore_ht, strcharinfo(PC_NAME), 0); + + if (.@val > gettimetick(2)) + { + ++.ignored_times; + end; + } + + else if (.@val > 0) + { + htput(.ignore_ht, strcharinfo(PC_NAME), 0); // remove expired entries + } + + return; + } + + function special_name { + .@name$ = strcharinfo(PC_NAME); + .@low$ = strtolower(.@name$); + + if (rand(.sname_rate) == 0) + { + for (.@i = 0; .@i < .alias; .@i += 2) + { + if (.@low$ ~= .alias$[.@i]) + { + explode(.@aliases$, .alias$[.@i+1], "`"); + .@name$ = .@aliases$[rand(getarraysize(.@aliases$))]; + break; + } + } + } + + return .@name$; + } + + function face { + if (gettimetick(2) - .last_emote < .emote_rate) + { + ++.ignored_times; + return; + } + + .last_emote = gettimetick(2); + return emotion(getarg(0, E_SURPRISE)); + } + + function rp { + // used for queries + return replacestr(getarg(0,""), "~t", strtolower("(?:" + .name$ + "|" + .hotwords$ + ")")); + } + + function format_reply { + // used for replies + .@str$ = getarg(0, ""); + + // search for {{mustaches}} + while (.@str$ ~= "{{([^}]+)}}") + { + .@sub$ = replacestr($@regexmatch$[1], " ", ""); // remove whitespaces + .@sub$ = strtolower(.@sub$); // always lowercase the var name + .@capitalize = .@titlecase = .@allcaps = false; + + if (charat(.@sub$, 0) == "^") + { + .@capitalize = true; + .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char + } + + else if (charat(.@sub$, 0) == "+") + { + .@titlecase = true; + .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char + } + + else if (charat(.@sub$, 0) == "!") + { + .@allcaps = true; + .@sub$ = substr(.@sub$, 1, getstrlen(.@sub$) - 1); // strip first char + } + + if (compare(.@sub$, ",")) { + .@var$ = sprintf(".H%s$", substr(md5(.@sub$), 0, 25)); + + if (getelementofarray(getd(.@var$), 1) == "") { + explode(.@sub2$, .@sub$, ","); + .@size = 1; + + for (.@i = 0; .@i < getarraysize(.@sub2$); ++.@i) { + .@subsize = getd(sprintf(".D_%s", .@sub2$)); + copyarray(getelementofarray(getd(.@var$), .@size), getd(sprintf(".D_%s$[1]", .@sub2$)), .@subsize); + .@size += .@subsize; + } + } + } else { + .@var$ = sprintf(".D_%s$", .@sub$); + } + + .@rep$ = relative_array_random(getd(.@var$)); + + if (.@capitalize) .@rep$ = capitalize(.@rep$); + else if (.@titlecase) .@rep$ = titlecase(.@rep$); + else if (.@allcaps) .@rep$ = strtoupper(.@rep$); + + .@str$ = replacestr(.@str$, $@regexmatch$[0], .@rep$); // remove the mustache, replace by value + } + + // search for emotes + if (.@str$ ~= "%%([^ ])") + { + // only handling a few of them + switch (ord($@regexmatch$[1])) + { + case 73: face(any(E_WINK, E_ANGEL)); break; + case 83: face(any(E_SAD, E_CRYING)); break; + case 85: face(E_SURPRISE); break; + case 93: face(any(E_HEARTEYE, E_HEART)); break; + case 94: face(E_DISGUST); break; + case 99: face(E_DEAD); break; + case 105: face(E_CRYING); break; + case 106: + case 91: face(any(E_SPEECH, E_BLAH)); break; + case 107: face(E_INSULTBUBBLE); break; + default: .@unhandled = true; + } + + if (.@unhandled != true) + { + if (.@str$ == $@regexmatch$[0]) end; // don't send handled, emote-only messages + .@str$ = replacestr(.@str$, " "+ $@regexmatch$[0], ""); // otherwise strip the emote + } + } + + // built-in variables + .@str$ = replacestr(.@str$, "~n", .name$); // npc name + .@str$ = replacestr(.@str$, "~p", special_name()); // player name or special name + .@str$ = replacestr(.@str$, "~P", strcharinfo(PC_NAME)); // unaltered player name + + return rp(.@str$); + } + + function strip_colors { + .@str$ = replacestr(getarg(0, ""), "##0", ""); + .@str$ = replacestr(.@str$, "##1", ""); + .@str$ = replacestr(.@str$, "##2", ""); + .@str$ = replacestr(.@str$, "##3", ""); + .@str$ = replacestr(.@str$, "##4", ""); + .@str$ = replacestr(.@str$, "##5", ""); + .@str$ = replacestr(.@str$, "##6", ""); + .@str$ = replacestr(.@str$, "##7", ""); + .@str$ = replacestr(.@str$, "##8", ""); + .@str$ = replacestr(.@str$, "##9", ""); + return replacestr(.@str$, "##a", ""); + } + + function strip_formatting { + .@str$ = strip_colors(getarg(0, "")); + .@str$ = replacestr(.@str$, "##B", ""); + return replacestr(.@str$, "##b", ""); + } + + function delayed_reply { + ++.answered_times; + @tree_reply$ = getarg(0, ""); + addtimer(.delay_reply, .name$ + "::OnDoReply"); + return; + } + + function reply { + .@reply$ = format_reply(getarg(0, "")); + getmapxy(.@pc_map$, .@pc_x, .@pc_y, UNITTYPE_PC); // get char location + + if (((.@reply$ == .last_reply$ && gettimetick(2) - .last_reply < .repeat_rate) + || gettimetick(2) - .last_reply < .talk_rate + || (gettimetick(2) - .blocked < .block_time && is_trusted() == false) + || .@pc_map$ != .map$ + || distance(.x, .y, .@pc_x, .@pc_y) > .distance + || .@reply$ == "") + && is_dev() == false) + { + ++.ignored_times; + return; + } + + .last_reply = gettimetick(2); + .last_reply$= .@reply$; + + delayed_reply(.@reply$); + return; + } + + function seen_me { + if (playerattached() > 0 && htexists(.seen_ht)) + { + htput(.seen_ht, strcharinfo(PC_NAME), gettimetick(2)); + } + return; + } + + function have_you_seen { + .@player$ = getarg(0, ""); + .@player = getcharid(CHAR_ID_ACCOUNT, .@player$); + + if (.@player > 0) + { + // nested if, because they don't short-circuit + if (checkoption(Option_Invisible, .@player) == false) { + delayed_reply(sprintf("Player `%s` is currently online.", .@player$)); + end; + } + } + + .@time = htget(.seen_ht, .@player$, 0); + + if (.@time < 1) + delayed_reply(sprintf("I haven't seen player `%s` today.", .@player$)); + + else + delayed_reply(sprintf("Player `%s` was last seen %s.", .@player$, FuzzyTime(.@time, 0, 99))); + + end; + } + + function special_drops { + .@drop$ = relative_array_random(.drops$); + .@name$ = strcharinfo(PC_NAME); + .@low$ = strtolower(.@name$); + + if (rand(.sdrop_rate) == 0) + { + for (.@i = 0; .@i < .sdrops; .@i += 2) + { + if (.@low$ ~= .sdrops$[.@i]) + { + explode(.@d$, .sdrops$[.@i+1], "`"); + .@drop$ = .@d$[rand(getarraysize(.@d$))]; + break; + } + } + } + + return .@drop$; + } + + function roll_dice { + .@dices = max(min(getarg(0, 1), 8), 1); // 1..8 + .@sides = max((getarg(1, 6) < 1 ? 6 : getarg(1, 6)), 1); // 1..MAX_INT + + .@result$ = sprintf("*rolls the dice%s: %d", + rif(.@dices > 1, "s"), rand(1, .@sides)); // first dice + + for (.@d = 1; .@d < .@dices; ++.@d) + { + .@result$ += ", " + rand(1, .@sides); + } + + return .@result$ + ".*"; + } + + function flip_coin { + .@coins = getarg(0, 1); + + .@result$ = sprintf("*flips the coin%s: %s", + rif(.@coins > 1, "s"), (rand(2) == 1 ? "heads" : "tails")); // first coin + + for (.@c = 1; .@c < .@coins; ++.@c) + { + .@result$ += ", " + (rand(2) == 1 ? "heads" : "tails"); + } + + return .@result$ + ".*"; + } + + function roulette { + if (.roulette == 1) + { + npctalk("*pulls the trigger: *##BBANG##b*.*"); + delayed_reply("*reloads and spins the chambers.*"); + .roulette = rand(1, 7); // the Nagant_M1895 has 7 chambers + + // now the fun part + nude(); + percentheal(-100, 0); + } + + else + { + delayed_reply("*pulls the trigger: *click*.*"); + .roulette = (.roulette == 7 ? 1 : .roulette + 1); + } + + end; + } + + function monologue_player { + return sprintf("Your current monologue is at least %d line%s long.", + @monologue, rif(@monologue != 1, "s")); + } + + function who_player { + return sprintf("You seem to be ##B~P##b [%i:%i].", + getcharid(CHAR_ID_ACCOUNT), getcharid(CHAR_ID_CHAR)); + } + + function make_quote_table { + // Do not modify this + query_sql("CREATE TABLE IF NOT EXISTS `tree_quotes` (" + " `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT," + " `char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0'," + " `grabber` INT(11) UNSIGNED NOT NULL DEFAULT '0'," + " `timestamp` INT(10) UNSIGNED NOT NULL DEFAULT '0'," + " `message` VARCHAR(150) NOT NULL DEFAULT ''," + " PRIMARY KEY (`id`)," + " KEY `char_id` (`char_id`)," + " KEY `grabber` (`grabber`)" + ") ENGINE=MyISAM;"); + + .last_query = gettimetick(2); + return; + } + + function grab_quote { + .@name$ = getarg(0, ""); + + if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2)) + { + ++.ignored_times; + end; + } + + if (.@name$ == strcharinfo(PC_NAME)) + { + delayed_reply("##BError: You may not grab yourself."); + end; + } + + explode(.@tmp$[0], htget(.msg_ht, .@name$, ""), ":"); // get last message, if any + htput(.msg_ht, .@name$, ""); // ensure you can't grab twice the same message + + .@char_id = atoi(.@tmp$[0]); // grab the char id part + + if (.@char_id < 1) + { + delayed_reply(sprintf("##BError: I couldn't find anything to grab from player `%s`.", .@name$)); + end; + } + + .@msg$ = implode(.@tmp$, ":"); // put it back together + .@start = getstrlen(.@tmp$[0]) + getstrlen(.@tmp$[1]) + 2; // char:time:msg <= we just want the msg part + .@msg$ = escape_sql(strip_formatting(substr(.@msg$, .@start, getstrlen(.@msg$) - 1))); // sanitize + + if (.@msg$ == "") + { + delayed_reply("##BError: Message is empty or malformed. It cannot be grabbed."); + end; + } + + else if (.@msg$ ~= "^[!#~@]?(?:grab)?shield(?:ed)?(?:[:.!]? .*)?$") + { + delayed_reply("##BError: Message is shielded."); + end; + } + + query_sql(sprintf("INSERT INTO tree_quotes (char_id,grabber,timestamp,message) VALUES (%i,%i,%i,'%s');", + .@char_id, getcharid(CHAR_ID_CHAR), gettimetick(2), .@msg$)); + + query_sql("SELECT MAX(id) FROM tree_quotes;", .q_last_id); // get the last quote id + + .last_query = gettimetick(2); + + delayed_reply(sprintf("Success: Quote grabbed. (#%i)", .q_last_id)); + end; + } + + function remove_quote { + .@tmp = getarg(0, 0); + + if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2)) + { + ++.ignored_times; + end; + } + + query_sql(sprintf("SELECT id FROM tree_quotes WHERE id = %i ORDER BY id DESC LIMIT 1;", .@tmp), .@id); // check if it exists + + if (.@id < 1) + { + delayed_reply(sprintf("##BError: I couldn't find quote #%i in the database.", .@tmp)); + end; + } + + query_sql(sprintf("DELETE FROM tree_quotes WHERE id = %i ORDER BY id DESC LIMIT 1;", .@id)); + + .last_query = gettimetick(2); + + delayed_reply(sprintf("Success: Quote removed. (#%i)", .@id)); + end; + } + + function cite_quote { + .@id = getarg(0,0); + + if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2)) + { + ++.ignored_times; + end; + } + + // FIXME: Maybe load all quotes to memory and only do a SQL lookup oninit + query_sql(sprintf("SELECT t.id, c.name AS grabee, d.name AS grabber, t.timestamp, t.message " + "FROM `tree_quotes` t " + "JOIN `char` c ON t.char_id = c.char_id " + "JOIN `char` d ON t.grabber = d.char_id " + "WHERE t.id=%i ORDER BY t.id DESC LIMIT 1;", + .@id), + .@nid[0], .@grabee$[0], .@grabber$[0], .@time[0], .@msg$[0]); + + .last_query = gettimetick(2); + + if (.@nid[0] < 1) + { + delayed_reply(sprintf("##BError: I couldn't find quote #%i in the database.", .@id)); + end; + } + + delayed_reply(sprintf("<%s> ##B%s##b ##a— grabbed by %s %s.", + .@grabee$[0], .@msg$[0], .@grabber$[0], FuzzyTime(.@time[0],0,1))); + end; + } + + function random_quote { + .@name$ = escape_sql(getarg(0, "")); + + if (gettimetick(2) - .last_query < (is_trusted() ? .qpoll_rate : .qpoll_rate2)) + { + ++.ignored_times; + end; + } + + query_sql("SELECT t.id, c.name AS grabee, d.name AS grabber, t.timestamp, t.message " + "FROM `char` c " + "JOIN `tree_quotes` t ON t.char_id = c.char_id " + "JOIN `char` d ON d.char_id = t.grabber " + + rif(.@name$ != "", sprintf("WHERE c.name='%s' ", .@name$)) + + "ORDER BY RAND() LIMIT 1;", + .@nid[0], .@grabee$[0], .@grabber$[0], .@time[0], .@msg$[0]); + + .last_query = gettimetick(2); + + if (.@nid[0] < 1) + { + if (.@name$ != "") + delayed_reply(sprintf("##BError: I couldn't find any quote from `%s` in the database.", getarg(0, ""))); + else + delayed_reply("##BError: The quote database is empty."); + end; + } + + delayed_reply(sprintf("<%s> ##B%s##b ##a— grabbed by %s %s. (#%i)", + .@grabee$[0], .@msg$[0], .@grabber$[0], FuzzyTime(.@time[0],0,1), .@nid[0])); + end; + } + + function trigger_hotword { + .@o$ = getarg(0, ""); // original lowercase + .@m$ = replacestr(.@o$, "*", ""); // original lowercase clean + + + if (.@m$ ~= "(?:^| )tell(?: (?:me|him|her|us|them))? a(?:n ?other| lame| bad| boring)? joke") + reply(relative_array_random(.jokes$)); + + else if (.@m$ ~= "(?:^| )heal me(?:$|[^a-z])") + reply(relative_array_random(.healing$)); + // XXX: maybe actually heal the player once in a while + + else if (.@m$ ~= "(?:^| )(?:what|who) are you") + reply(relative_array_random(.whoami$)); + + else if (.@m$ ~= rp("(?:^| )(?:hi+|hello|heya?|hiya|good (?:morning|afternoon))[^a-z]* .*~t|~t.* (?:hi+|hello|heya?|hiya)")) + { + .blocked = 0; + .@rpl$ = relative_array_random(.greetings$); + reply(.@rpl$); + } + + else if (.@o$ ~= rp("(?:^[*]| )(?:kicks?|shakes?) .*~t")) + reply(special_drops()); + + else if (.@o$ ~= rp("(?:^[*]| )(?:cuts?|nukes?|kills?|chops? down|saws?|hews?|murders?) .*~t")) + reply(relative_array_random(.kill$)); + + else if (.@o$ ~= rp("(?:^[*]| )pokes? .*~t")) + reply(relative_array_random(.poke$)); + + else if (.@o$ ~= rp("(?:^[*]| )(?:waters?|pees?|licks?) .*~t")) + reply(relative_array_random(.disgusting$)); + + else if (compare(.@m$, " answer ") && .@m$ ~= "(?:life|universe|everything)(?:$|[^a-z])") + reply(relative_array_random(.answer$)); + + else if (.@o$ ~= rp("(?:^[*]| )(?:burns?|incinerates?|ignites?) .*~t")) + reply(relative_array_random(.burning$)); + // XXX: maybe here send a fire particle effect + + else if (.@m$ ~= rp("(?:^| )die ~t")) + reply(relative_array_random(.die$)); + + else if (.@o$ ~= rp("(?:^[*]| )bites? .*~t|(?:^[*]| )drops? .* on ~t")) + reply(relative_array_random(.silly$)); + + else if (.@m$ ~= rp("(?:^| )(?:loves?|hugs?|kiss(es)?) .*~t|~t.* love(?:$|[^a-z])")) + reply(relative_array_random(.love$)); + + else if (.@m$ ~= rp("(?:^| )dance .*~t|~t.* dance(?:$|[^a-z])")) + reply(relative_array_random(.dance$)); + + else if (.@m$ ~= rp("(?:^| )hates? .*~t")) + reply(relative_array_random(.hate$)); + + else if (.@o$ ~= rp("(?:^[*]| )(?:eats?|shoots?|plucks?|tortures?|slaps?|slaps?|poisons?|breaks?|stabs?|throws?|punch(?:es)?) .*~t")) + reply(relative_array_random(.pain$)); + + else if (.@o$ ~= rp("(?:^[*]| )(?:climbs?|rides?|mounts?) .*~t")) + reply(relative_array_random(.climb$)); + + else if (.@m$ ~= "(?:^| )(?:see y(?:a|ou)|good night|(?:bye)?bye+)(?:$|[^a-z])") + reply(relative_array_random(.bye$)); + + else if (.@m$ ~= rp("(?:^| )bad ~t")) + reply(relative_array_random(.bad$)); + + else if (.@m$ ~= "(?:^| )(?:how old are you|uptime)(?:$|[^a-z])") + reply("%%B Server uptime: " + FuzzyTime(.uptime, 1, 99) + "."); + + else if (.@m$ ~= "(?:^| )how chatty are you(?:$|[^a-z])") + reply("%%B Answered " + .answered_times + " times, ignored " + .ignored_times + " times."); + + else if (.@m$ ~= "(?:^| )what.* version(?:$|[^a-z])") + reply("%%B ~n, version " + .version + "."); // XXX: maybe return Hercules version and serverdata commit instead + + else if (.@m$ ~= "(?:^| )(?:(?:8|eight)[ -]?ball|(?:should|would|will|do|does) (?:i|you|he|she|it|we|they))(?:$|[^a-z])") + reply(relative_array_random(.eightball$)); + + else if (.@m$ ~= "(?:^| )roll(?: a| the)? dice(?:$|[^a-z])") + reply(roll_dice(1, 6)); + + else if (.@m$ ~= "(?:^| )roll(?: a)? ([1-8])d((?:[1-9][0-9]{0,10})?)(?:$|[^0-9a-z])") + reply(roll_dice(atoi($@regexmatch$[1]), atoi($@regexmatch$[2]))); + + else if (.@m$ ~= "(?:^| )roll ([1-8]) dices?(?:$|[^a-z])") + reply(roll_dice(atoi($@regexmatch$[1]), 6)); + + else if (.@m$ ~= "(?:^| )(?:flip|toss)(?: a| the)? coin(?:$|[^a-z])") + reply(flip_coin(1)); + + else if (.@m$ ~= "(?:^| )(?:flip|toss) ([1-8]) coins?(?:$|[^a-z])") + reply(flip_coin(atoi($@regexmatch$[1]))); + + else if (.@m$ ~= "(?:^| )(?:press|pull)(?: the)? trigger(?:$|[^a-z])") + roulette(); + + else if (.@m$ ~= "(?:^| )(?:how long|what) is(?: my)? monologue(?:$|[^a-z])") + reply(monologue_player()); + + else if (.@m$ ~= "(?:^| )who am i(?:$|[^a-z])") + reply(who_player()); + + else if (.@m$ ~= "(?:^| )shut up(?:$|[^a-z])") + { + reply(relative_array_random(.shut_up$)); + .blocked = gettimetick(2); + } + + else if (rand(.dunno_rate) == 0) + reply(relative_array_random(.no_idea$)); + + else + ++.ignored_times; + + end; + } + + function trigger_hiall { + if (rand(.hiall_rate) == 0) + reply(relative_array_random(.greetings$)); + + else + ++.ignored_times; + + end; + } + +OnClick: + //if ($@xmas_time) + // goto L_XmasTree; + if ($@halloween_time) + callfunc "HalloweenTree"; + tree_panel(); + end; + + +OnTalkNearby: + .@no_nick$ = strip(strip_formatting(substr($@p0$, getstrlen(strcharinfo(PC_NAME)) + 3, getstrlen($@p0$) - 1))); // not very obvious stuff + .@no_nick_lower$ = strtolower(.@no_nick$); // FIXME: hercules doesn't have a way to do case insensitive regex yet + .@no_nick_clean$ = replacestr(.@no_nick_lower$, "*", ""); + + htput(.msg_ht, strcharinfo(PC_NAME), getcharid(CHAR_ID_CHAR) + ":" + gettimetick(2) + ":" + .@no_nick$); // log last message, for quotegrabs + .lastsender = getcharid(CHAR_ID_CHAR); // for monologue + + .last_activity = gettimetick(2); // for the auto-janitor + + if ((is_trusted() || #Tree_Trusted) && charat(.@no_nick$, 0) == .symbol$) + { + if (.@no_nick$ ~= "^.grab \"?([^#:@\"]{4,23})\"?$") + reply(grab_quote($@regexmatch$[1])); + + else if (.@no_nick$ ~= "^.(?:ungrab|remove|delete)(?: quote)? #([0-9]+)$") + reply(remove_quote(atoi($@regexmatch$[1]))); + + else if (.@no_nick$ ~= "^.(?:ungrab|remove|delete)(?: last(?: quote)?)?$") + reply(remove_quote(.q_last_id)); + + else if (.@no_nick$ ~= "^.(?:quote|cite) #([0-9]+)$") + reply(cite_quote(atoi($@regexmatch$[1]))); + + else if (.@no_nick$ ~= "^.(?:(?:random )?quote|cite)(?: anyone| someone| random)?$") + reply(random_quote()); + + else if (.@no_nick$ ~= "^.(?:quote|cite) \"?([^#:@\"]{4,23})\"?$") + reply(random_quote($@regexmatch$[1])); + + else if (.@no_nick$ ~= "^.seen \"?([^#:@\"]{4,23})\"?$") + reply(have_you_seen($@regexmatch$[1])); + + // to allow trusted testers to reboot without knowing the exit code + else if (debug && .@no_nick$ ~= "^.re(?:boot|load|start)(?:(?: the)? server)?$") + { + announce("The server is rebooting. This may take a couple minutes.", bc_all); + // GM Log + logmes(sprintf("%s has restarted the server with CrazyTree.", strcharinfo(0)), LOGMES_ATCOMMAND); + sleep2(1000); + atcommand("@serverexit 104"); + } + + // exit, pull all, clean, build, reboot + else if (debug && .@no_nick$ ~= "^.re-?build(?:(?: the)? server)?$") + { + announce("The server is rebuilding. This will take several minutes.", bc_all); + // GM Log + logmes(sprintf("%s has restarted & rebuilt the server with CrazyTree.", strcharinfo(0)), LOGMES_ATCOMMAND); + sleep2(1000); + atcommand("@serverexit 108"); + } + + else if (.@no_nick$ ~= "^.(?:add )?ignored? \"?([^#:@\"]{4,23})\"?$") + { + .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]); + if (.@chr < 1) + { + reply("##BError: Player not found or not online."); + end; + } + htput(.ignore_ht, strcharinfo(PC_NAME, .@chr), gettimetick(2) + 3600); + reply(sprintf("Success: Player `%s` is now ignored for 1 hour.", + strcharinfo(PC_NAME, .@chr))); + } + + else if (.@no_nick$ ~= "^.(?:un|de-?|remove )ignored? \"?([^#:@\"]{4,23})\"?$") + { + .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]); + if (.@chr < 1) + { + reply("##BError: Player not found or not online."); + end; + } + htput(.ignore_ht, strcharinfo(PC_NAME, .@chr), 0); + reply(sprintf("Success: Player `%s` is no longer ignored.", + strcharinfo(PC_NAME, .@chr))); + } + + else if (is_admin() && .@no_nick$ ~= "^.(?:add )?trust(?:ed)? \"?([^#:@\"]{4,23})\"?$") + { + .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]); + if (.@chr < 1) + { + reply("##BError: Player not found or not online."); + end; + } + set(getvariableofpc(#Tree_Trusted, .@chr), true); + // GM Log + logmes(sprintf("%s has granted access to \"%s\" on CrazyTree.", strcharinfo(0), strcharinfo(PC_NAME, .@chr)), LOGMES_ATCOMMAND); + reply(sprintf("Success: Player `%s` can now use restricted commands.", + strcharinfo(PC_NAME, .@chr))); + } + + else if (is_admin() && .@no_nick$ ~= "^.(?:un|de-?|remove )trust(?:ed)? \"?([^#:@\"]{4,23})\"?$") + { + .@chr = getcharid(CHAR_ID_ACCOUNT, $@regexmatch$[1]); + if (.@chr < 1) + { + reply("##BError: Player not found or not online."); + end; + } + set(getvariableofpc(#Tree_Trusted, .@chr), false); + // GM Log + logmes(sprintf("%s has removed access from \"%s\" on CrazyTree.", strcharinfo(0), strcharinfo(PC_NAME, .@chr)), LOGMES_ATCOMMAND); + reply(sprintf("Success: Player `%s` can no longer use restricted commands.", + strcharinfo(PC_NAME, .@chr))); + } + + else + reply("##BError: Command not found or invalid syntax."); + } + + else if (.@no_nick_lower$ ~= rp("^(~t[^a-z ]* .*|(?:.* (?:~t[^a-z ]* .*|~t[^ a-z]*)))$")) + { + check_is_ignored(); + trigger_hotword($@regexmatch$[1]); + } + + else if (.@no_nick_clean$ ~= "^(hi(ya)?|hello|heya?) (all|friends|every(one|body))") + { + check_is_ignored(); + trigger_hiall(); + } + + else + { + if (.lastsender == getcharid(CHAR_ID_CHAR)) + @monologue++; + + else + @monologue = 1; + } + + // TODO: eliza mode, whisper eliza mode + end; + +OnTouch: + if (rand(.touch_rate) == 0) { + face(); + } + end; + +OnDoReply: + if (@tree_reply$ != "") { + npctalk(@tree_reply$); + @tree_reply$ = ""; + } + end; + +OnPCLogoutEvent: + seen_me(); + end; + +OnTimer3600000: + // scheduled janitor + .@now = gettimetick(2); + initnpctimer(); // schedule next + + if (.last_activity > (.@now - 3600)) { + end; // last activity is too recent + } + + // cleanup routine below + .lastsender = 0; + .last_activity = 0; + .last_reply = 0; + .last_emote = 0; + .last_query = 0; + .blocked = 0; + .enable_janitor = 0; + + htclear(.msg_ht); // empty the message table (quotegrabs) + htclear(.ignore_ht); // empty the ignore table + + .@it = htiterator(.seen_ht); // allocate new iterator + for (.@key$ = htinextkey(.@it); hticheck(.@it); .@key$ = htinextkey(.@it)) { + if (.@key$ == "") { + continue; + } + + if (htget(.seen_ht, .@key$, 0) < (.@now - 86400)) { + htput(.seen_ht, .@key$, 0); // remove from hash table if older than 24h + } + } + htidelete(.@it); // free the iterator + + face(); // do an emote (because why not) + end; + + +OnInit: + // config below + .hotwords$ = "tree"; // what hot words the npc should listen to, besides its own name (regex) + .distance = 14; // the npc will only listen to player within X tiles + //.dir = season_direction(); // sprite direction according to the season + .talk_rate = 1; // min number of seconds to wait between replies + .repeat_rate = 1; // min number of seconds to wait before sending the same message twice in a row + .block_time = 600; // how long to stay quiet after someone says shut up, in seconds + .emote_rate = 3; // min number of seconds to wait between emotes + .sdrop_rate = 8; // 1 in X chances to get a special drop + .sname_rate = 8; // 1 in X chances to get a special name + .dunno_rate = 2; // 1 in X chances to get a reply when the command is not found + .hiall_rate = 2; // 1 in X chances to reply to a "hi everyone" + .touch_rate = 4; // 1 in X chances to trigger the OnTouch action + .qpoll_rate = 1; // min number of seconds to wait before calling the sql db again for GMs + .qpoll_rate2 = 5; // min number of seconds to wait before calling the sql db again for non-GMs (currently unused) + .delay_reply = 250; // number of ms to wait to reply + .enable_janitor = true; // automatically free memory when idle + .symbol$ = "~"; // symbol for GM-only commands + + // register some arrays + callfunc("TREE_dictionaries"); + + // do random stuff + make_quote_table(); + face(); + + // boring stuff below + .version[0] = 21; // increase this when you make a change + .version[1] = 1; + .uptime = gettimetick(2); + .alwaysVisible = true; // the NPC doesn't de-spawn when moving away + .pid = 1; // regex pattern id + .msg_ht = htnew(); // hashtable id for message history + .seen_ht = htnew(); // hashtable id for seen log + .ignore_ht = htnew(); // hashtable id for ignored players + .roulette = rand(1, 7); // spin the chambers + defpattern(.pid, "^(.*)$", "OnTalkNearby"); + activatepset(.pid); + if (.enable_janitor) { + initnpctimer(); + } +} + +// Duplicates below +001-1,57,75,0 duplicate(#ConfusedTree) #ConfusedPalmTree NPC384,14,14 +020-1,90,78,0 duplicate(#ConfusedTree) #ConfusedIcedTree NPC380,14,14 + diff --git a/npc/annuals/xmas/barriers.txt b/npc/annuals/xmas/barriers.txt new file mode 100644 index 00000000..0b62281b --- /dev/null +++ b/npc/annuals/xmas/barriers.txt @@ -0,0 +1,155 @@ + +function script ThrowOutTheBum { + @getout = 0; + if((@xmas_thrown_out) && ($@xmas_time)) + goto L_SideOut; + goto L_Return; + +L_SideOut: + if(@xmas_helper_start_state) + goto L_Warp; + goto L_Hint; + +L_Hint: + message strcharinfo(0), "I said get out! We've got no time for your kind here."; + mesn l("Balthasar"); + mes "\"What are you doing? Come, see me in the caves below!\""; + mes "\"I said go south till you reach the snowman. Then head into the cave to the east.\""; + close2; + warp "020-1",33,94; + @getout = 1; + goto L_Return; + +L_Warp: + message strcharinfo(0), "I said get out, We've no time for your kind here."; + warp "020-1",33,94; + @getout = 1; + goto L_Return; + +L_Return: + return; +} + +030-2,153,21,0 script #DarkDoor NPC45,0,0,{ + callfunc "XmasStates"; + + if((@xmas_boss_door_state) && ($@xmas_time)) + goto L_XmasMain; + goto L_NotActive; + +L_XmasMain: + mes "You get the strange sensation that this might go terribly wrong. You had better bring some of your strongest comrades to help you in that case."; + mes "Open the warehouse door?"; + menu + "Yes, I feel brave.", L_Open, + "No, It's quite nice out here.", L_close; + +L_Open: + if ($@XmasBattleStatus) goto L_BattleInProgress; + warp "030-4",34,48; + goto L_close; + +L_BattleInProgress: + mes "You can hear shouts and screams of despair from behind the door. But trying to open it fails."; + next; + mes "You will have to wait till someone from the inside opens the door again."; + goto L_close; + +L_NotActive: + message strcharinfo(0), "This door appears locked by magical forces."; + end; + +L_close: + close; +} + + +030-3,27,24,0 script SmallCrack#XmasPassage NPC400,0,1,{ + callfunc "XmasStates"; + + if((@xmas_basement_passage) && ($@xmas_time)) + goto L_XmasMain; + goto L_NotActive; + +L_NotActive: + mes "You don't notice anything special."; + goto L_close; + +L_XmasMain: + mes "You notice a small creak in the wall, what do you want to do?"; + next; + goto L_EnterDialogue; + +L_EnterDialogue: + menu + "Nothing.", L_close, + "Bang my head against it repeatedly.", L_Tux9th, + "Oh, not very much, I do not see anynthing there.", L_close, + "Hit it with my strong fist.", L_Enter; + +L_Tux9th: + heal -20, 0; + message strcharinfo(0), "Ouch, that hurt!"; + setlook LOOK_HAIR_STYLE, rand(20); + goto L_Fail; + +L_Enter: + if (getequipid(equip_hand1) > 0 || getequipid(equip_hand2) > 0) goto L_Sword; + if (getequipid(equip_gloves) <= 0) goto L_Gloves; + goto L_QueryWarp; + +L_Sword: + mes "That is not your fist silly,"; + mes "use your fist, alright?"; + goto L_close; + +L_Gloves: + mes "Wow! Next time you plan to hit a wall,"; + mes "you had better equip some decent gloves in advance."; + heal -20, 0; + message strcharinfo(0), "Ouch, that hurt!"; + goto L_QueryWarp; + +L_QueryWarp: + mes "You gaze into a black hole, do you want to enter?"; + mes " "; + menu + "Yes", L_Warp, + "No", L_close; + +L_Warp: + warp "030-2",47,44; + goto L_close; + +L_Fail: + mes "Seems like that won't work out as you planned."; + goto L_close; + +L_close: + close; +} + +030-2,48,44,0 script #BasementDoor NPC45,0,0,{ + callfunc "XmasStates"; + + if((@xmas_basement_passage) && ($@xmas_time)) + goto L_XmasMain; + goto L_NotActive; + +L_XmasMain: + mes "Descend into the caves?"; + menu + "Yes.", L_Open, + "No.", L_close; + +L_Open: + warp "030-3",27,26; + goto L_close; + +L_NotActive: + message strcharinfo(0), "This door appears locked by magical forces."; + end; + +L_close: + close; +} diff --git a/npc/annuals/xmas/config.txt b/npc/annuals/xmas/config.txt new file mode 100644 index 00000000..b3816df2 --- /dev/null +++ b/npc/annuals/xmas/config.txt @@ -0,0 +1,252 @@ + + +- script #XmasConfig NPC32767,{ + end; + +OnCommandRestartQuest: + goto L_Main; + +OnInit: + goto L_Main; + +L_Main: + // Xmas Key Identifier Set through Botcheck Debug + if(!($XMAS_TIME_KEY) || (getarraysize($XMAS_TIME_KEY) != 6)) + setarray $XMAS_TIME_KEY, 12,12,1,25,6,gettime(7); + if(($XMAS_TIME_KEY[0] == 0) || ($XMAS_TIME_KEY[0] > 12)) + goto L_XmasError; + if(($XMAS_TIME_KEY[1] == 0) || ($XMAS_TIME_KEY[1] > 12)) + goto L_XmasError; + if(($XMAS_TIME_KEY[2] == 0) || ($XMAS_TIME_KEY[2] > 12)) + goto L_XmasError; + if(($XMAS_TIME_KEY[3] == 0) || ($XMAS_TIME_KEY[3] > 31)) + goto L_XmasError; + if(($XMAS_TIME_KEY[4] == 0) || ($XMAS_TIME_KEY[4] > 31)) + goto L_XmasError; + if($XMAS_TIME_KEY[5] == 0) + goto L_XmasError; + + // Event Runs until Reward Period. + // Month Start/End + $@xmas_start_month = $XMAS_TIME_KEY[0]; + $@xmas_reward_start_month = $XMAS_TIME_KEY[1]; + $@xmas_end_month = $XMAS_TIME_KEY[2]; + + // Reward Day Start/End + $@xmas_reward_start_day = $XMAS_TIME_KEY[3]; + $@xmas_reward_end_day = $XMAS_TIME_KEY[4]; + + // Time Settings + $@xmas_no_event_time = 0; + $@xmas_event_time = 1; + $@xmas_reward_time = 2; + + // Main Quest Settings + // Bit used to Set Which one of the 2 quests you are on + $@xmas_side_bit = false;//(1 << 31); FIXME + $@xmas_base_bonus_xp = 4; + $@xmas_karma_bonus = 1; + $@xmas_reward_max_karma = 15; + $@xmas_reward_hero_boss = 15; + $@xmas_reward_all_lists = 10; + $@xmas_reward_all_helpers = 10; + $@xmas_reward_tally_rare = 80; + $@xmas_reward_tally_common = 40; + // Guidance System + $@xmas_route_bit = (1 << 23); + // Basement Passage way + $@xmas_basement_passage = (1 << 24); + // Thrown Out + $@xmas_thrown_out_bit = (1 << 25); + // Quest Start (@xmas_state) + $@xmas_list_path2_state = 1; + $@xmas_list_path1_state = 2; + $@xmas_list_both_state = 3; + $@xmas_list_complete_state = 4; + $@xmas_list_deliver_state = 5; + // Helper SubQuest + $@xmas_helpers_start_state = 6; + $@xmas_helpers_done_state = 7; + // Reagents + $@xmas_reagents_start = 8; + $@xmas_reagents_done = 9; + // Boss Door State + $@xmas_boss_door_open_state = 10; + // Reward State + $@xmas_reward_start = 11; + $@xmas_reward1_done = 12; + $@xmas_reward2_done = 13; + $@xmas_reward_done = 14; + + // Boss Fight Required Level for Hard Mode + $@BossHardLevel = 70; + $@xmas_boss_start_bit = (1 << 26); + $@xmas_boss_hero_bit = (1 << 27); + $@xmas_boss_start_shift = 26; + $@xmas_boss_hero_shift = 27; + setarray $@xmas_boss_req$, "IronPotion", "DarkCrystal"; + setarray $@xmas_boss_amount, 15, 10; + if(getarraysize($@xmas_boss_amount) != getarraysize($@xmas_boss_req$)) + goto L_XmasError; + // Santas Helper quest rewards + setarray $@SantasHelper_Annual_Reward$, + "RedTurtleneck", + "YellowTurtleneck", + "LightBlueTurtleneck", + "PinkTurtleneck", + "OrangeTurtleneck", + "PurpleTurtleneck", + "KnitCap", + "KnitCap"; + + // Main Quest rewards + setarray $@xmas_present_from$, "Santa", "Orum"; + setarray $@xmas_rare_reward$, "FunkyChristmasSweater", "DarkChristmasSweater"; + setarray $@xmas_uncommon_reward$, "NutcrackerHat", "AmberChristmasSweater", "RedStockings", "PinkChristmasSweater", "BlueChristmasSweater"; + // Quest Side 0 Settings + setarray $@xmas_zero_reagents$, "ShockSweet", "EmptyBottle", "EmeraldPowder"; + setarray $@xmas_zero_reagents_names$, "Shock Sweet", "Empty Bottles", "Emerald Powders"; + setarray $@xmas_zero_reagents_amounts, 1, 4, 10; + if(getarraysize($@xmas_zero_reagents_amounts) != getarraysize($@xmas_zero_reagents$)) + goto L_XmasError; + + // Quest Side 1 Settings + setarray $@xmas_one_reagents$, "DarkCrystal", "IronPotion", "EmeraldPowder"; + setarray $@xmas_one_reagents_names$, "Dark Crystal", "Iron Potions", "Emerald Powders"; + setarray $@xmas_one_reagents_amounts, 1, 4, 10; + if(getarraysize($@xmas_one_reagents_amounts) != getarraysize($@xmas_one_reagents$)) + goto L_XmasError; + + // List Bits + $@xmas_all_lists_bit = (1 << 29); + setarray $@xmas_child_list, (1 << 8), (1 << 9), (1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14), (1 << 15); + setarray $@xmas_child_list_name$, "Ayasha", "Latif", "Charda", "Faris", "Rasin", "Ghada", "Rossy", "Kadiya"; + if(getarraysize($@xmas_child_list) != getarraysize($@xmas_child_list_name$)) + goto L_XmasError; + + $@xmas_perfect_list_count = getarraysize($@xmas_child_list); + $@xmas_required_list_count = (getarraysize($@xmas_child_list) / 2); + + // Santa's Helper + $@xmas_sh_bit = (1 << 22); + $@xmas_sh_purple_amount = 25; + $@xmas_sh_blue_amount = 20; + $@xmas_sh_green_amount = 5; + + // Main Helper Bit + $@xmas_helper_bit = (1 << 30); + $@xmas_all_helpers_bit = (1 << 28); + + // Acorns + $@xmas_helper_bit_acorns = (1 << 21); + $@xmas_acorn_amount = 10; + $@xmas_iron_potion_amount = 1; + + // Bedding + $@xmas_helper_bit_bed_starts = (1 << 16); + $@xmas_helper_bit_bed_ends = (1 << 17); + $@xmas_bedding_amount = 10; + + // Boxes + $@xmas_log_amount = 2; + + // Wrap + $@xmas_reed_amount = 2; + $@xmas_water_amount = 1; + $@xmas_wrap_reward = 1; + + // Wrap Dye Amounts + $@xmas_poa_amount = 2; + $@xmas_wrap_yellow_amount = 2; + $@xmas_wrap_ltblue_amount = 2; + $@xmas_wrap_purple_amount = 2; + $@xmas_wrap_green_amount = 2; + + // Present Return + $@xmas_present_amount = 5; + + // Shipping + $@xmas_wrap_amount = 1; + $@xmas_empty_box_amount = 1; + $@xmas_ship_present_amount = 1; + + // Glitter + $@xmas_helper_bit_glitter_starts = (1 << 18); + $@xmas_helper_bit_glitter_ends = (1 << 19); + $@xmas_red_amount = 5; + $@xmas_yellow_amount = 5; + + // Storage (Daily Xmas) + $@xmas_helper_bit_storage = (1 << 20); + // Good Daily Ammounts + $@xmas_good_level = 30; + $@xmas_good_cost = 12; + $@xmas_good_count = 3; + $@xmas_good_name$ = "Candy"; + $@xmas_good_friendly_name$ = "Candies"; + $@xmas_good_money = 500; + $@xmas_good_exp = 200; + + // Bad Daily Ammounts + $@xmas_bad_level = 30; + $@xmas_bad_cost = 12; + $@xmas_bad_count = 3; + + $@xmas_bad_name$ = "RedApple"; + $@xmas_bad_friendly_name$ = "Red Apples"; + $@xmas_bad_money = 500; + $@xmas_bad_exp = 200; + + //Boss Fight Reward + $@xmas_boss_bp = 50; + + // Helpers Flags needed to set $@xmas_all_helpers_bit + setarray $@xmas_helper_list, $@xmas_helper_bit_bed_ends, $@xmas_helper_bit_glitter_ends, $@xmas_helper_bit_storage, $@xmas_helper_bit_acorns, $@xmas_sh_bit; + $@xmas_perfect_helpers_count = getarraysize($@xmas_helper_list); + $@xmas_required_helpers_count = (getarraysize($@xmas_helper_list) / 2); + + // MobManager + setarray $@xmas_mob_names$, "Santa Slime", "Candied Slime", "Candied Slime"; + setarray $@xmas_mob_spawns, "1015", "1111", "1111"; + setarray $@xmas_mob_counts, 10, 5, 5; + setarray $@xmas_map_spawns$, "019-1", "019-3", "030-3"; + if(getarraysize($@xmas_mob_spawns) != getarraysize($@xmas_map_spawns$)) + goto L_XmasError; + if(getarraysize($@xmas_mob_names$) != getarraysize($@xmas_map_spawns$)) + goto L_XmasError; + if(getarraysize($@xmas_mob_counts) != getarraysize($@xmas_map_spawns$)) + goto L_XmasError; + + $@xmas_spawn_x1 = 54; + $@xmas_spawn_y1 = 48; + $@xmas_spawn_x2 = 79; + $@xmas_spawn_y2 = 89; + $@xmas_respawn_count = 9; + + $@start_month = $@xmas_start_month; + $@end_month = $@xmas_end_month; + $@start_day = 1; + $@end_day = $@xmas_reward_end_day; + $@reward_start_month = $@xmas_reward_start_month; + $@reward_start_day = $@xmas_reward_start_day; + + callfunc "GetEventTime"; + $@xmas_time = $@event_time; + + if($@xmas_time == 0 && $XMAS_TIME_KEY[5] < gettime(7)) + setarray $XMAS_TIME_KEY, $XMAS_TIME_KEY[0],$XMAS_TIME_KEY[1],$XMAS_TIME_KEY[2],$XMAS_TIME_KEY[3],$XMAS_TIME_KEY[4],gettime(7); + goto L_Return; + +L_Return: + // technically this only needs to skip the npctimer in SpawnMobs, + // but this is a low-level debug setting so whatever. + if (debug >= 2) end; + callfunc "SpawnMobs"; + callfunc "PresentHandler"; + callfunc "ReplaceTrees"; + end; + +L_XmasError: + debugmes "Xmas is Dead Jim."; + mapexit; +} diff --git a/npc/annuals/xmas/core.txt b/npc/annuals/xmas/core.txt new file mode 100644 index 00000000..2abeefce --- /dev/null +++ b/npc/annuals/xmas/core.txt @@ -0,0 +1,229 @@ + +function script XmasNaughty { + @xmas_karma = ((XMASTIME & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT); + if((@xmas_karma - @karma_bonus) >= 0) + goto L_SetNaughty; + goto L_ResetNaughty; + +L_SetNaughty: + @xmas_karma = (@xmas_karma - @karma_bonus); + goto L_Return; + +L_ResetNaughty: + @xmas_karma = 0; + goto L_Return; + +L_Return: + XMASTIME = (XMASTIME & ~(NIBBLE_1_MASK) | (@xmas_karma << NIBBLE_1_SHIFT)); + @karma_bonus = 0; + return; +} + +function script XmasNice { + @xmas_karma = ((XMASTIME & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT); + if((@xmas_karma + @karma_bonus) < 16) + goto L_SetNice; + goto L_ResetNice; + +L_SetNice: + @xmas_karma = (@karma_bonus + @xmas_karma); + goto L_Return; + +L_ResetNice: + @xmas_karma = 15; + goto L_Return; + +L_Return: + XMASTIME = (XMASTIME & ~(NIBBLE_1_MASK) | (@xmas_karma << NIBBLE_1_SHIFT)); + @karma_bonus = 0; + return; +} + +function script XmasXpReward { + if (BaseLevel >= 10) + goto L_HigherLevel; + goto L_LowLevel; + +L_HigherLevel: + getexp ((BaseLevel / 10) * ($@xmas_base_bonus_xp * BaseLevel)), 0; + goto L_Return; + +L_LowLevel: + getexp ($@xmas_base_bonus_xp * BaseLevel), 0; + goto L_Return; + +L_Return: + return; +} + +function script XmasSetState { + XMASTIME = (XMASTIME & ~(NIBBLE_0_MASK) | (@xmas_state << NIBBLE_0_SHIFT)); + return; +} + +function script XmasSetSide { + XMASTIME = XMASTIME | $@xmas_side_bit; + return; +} + +function script XmasSetRoute { + XMASTIME = XMASTIME | $@xmas_route_bit; + return; +} + +function script XmasThrowOut { + XMASTIME = XMASTIME | $@xmas_thrown_out_bit; + return; +} + +function script XmasSetBossStart { + XMASTIME = XMASTIME | $@xmas_boss_start_bit; + return; +} + +function script XmasSetBossHero { + XMASTIME = XMASTIME | $@xmas_boss_hero_bit; + return; +} + +function script XmasSetReward { + @xmas_endgame = 0; + @xmas_reward_side = 0; + @xmas_reward_tally = 0; + if(@xmas_side) + goto L_SetSide; + goto L_NotSetSide; + +L_SetSide: + @xmas_reward_side = 1; + @xmas_reward_tally = (@xmas_reward_tally + ($@xmas_reward_max_karma - @xmas_karma)); + goto L_SetRewardBonus; + +L_NotSetSide: + @xmas_reward_tally = (@xmas_reward_tally + @xmas_karma); + goto L_SetRewardBonus; + +L_SetRewardBonus: + if(@xmas_boss_hero) + @xmas_reward_tally = (@xmas_reward_tally + $@xmas_reward_hero_boss); + if(@xmas_all_helpers) + @xmas_reward_tally = (@xmas_reward_tally + $@xmas_reward_all_helpers); + if(@xmas_all_lists) + @xmas_reward_tally = (@xmas_reward_tally + $@xmas_reward_all_lists); + //formula should: + if (@xmas_reward_tally > 5) + @xmas_reward_lower_bound = 2 * @xmas_reward_tally - rand(5); + if (@xmas_reward_tally <= 5) + @xmas_reward_lower_bound = @xmas_reward_tally; + @xmas_reward_upper_bound = @xmas_reward_lower_bound + ((Luk) / 5); + @xmas_reward = (rand(@xmas_reward_lower_bound, @xmas_reward_upper_bound)); + @xmas_reward_lower_bound = 0; + @xmas_reward_upper_bound = 0; + return; +} + +function script XmasMainXpBpReward { + callfunc "XmasSetReward"; + + if(BaseLevel >= 99) + goto L_EndGameReward; + goto L_LevelingReward; + +L_EndGameReward: + @xmas_bp_reward = 100 + rand(@xmas_reward, 2 * @xmas_reward); + BOSS_POINTS = BOSS_POINTS + @xmas_bp_reward; + message strcharinfo(0), "You gain " + @xmas_bp_reward + " Bosspoints, giving you a total of " + BOSS_POINTS + "."; + @xmas_bp_reward = 0; + return; + +L_LevelingReward: + if(@xmas_reward >= $@xmas_reward_tally_rare) + goto L_XmasLevel; + goto L_XmasExp; + +L_XmasLevel: + BaseLevel = BaseLevel + 1; + return; + +L_XmasExp: + getexp ((@xmas_reward * BaseLevel * (BaseLevel + 10)) / 10), 0; + return; +} + +function script XmasMainItemReward { + callfunc "XmasSetReward"; + + if (($@xmas_time == $@xmas_reward_time) && ((@xmas_reward_start_state) || (@xmas_reward1_done_state))) + goto L_FinalGift; + if (($@xmas_time == $@xmas_reward_time) && ((@xmas_reward_done_state) || (@xmas_reward2_done_state))) + goto L_GotGift; + if ($@xmas_time == $@xmas_reward_time) + goto L_NoGift; + goto L_Return; + +L_GotGift: + mes "Hey, this is not for you!"; + goto L_Return; + +L_NoGift: + mes "Oh someone got a present. Maybe you can get one too if help the right person?"; + goto L_Return; + +L_FinalGift: + mes "[To: " + strcharinfo(0) + "]"; + mes "[From: " + $@xmas_present_from$[@xmas_reward_side] + "]"; + mes "O look, a present from " + $@xmas_present_from$[@xmas_reward_side]; + next; + getinventorylist; + if (@inventorylist_count > 97) + goto L_FullInv; + @xmas_reward = (@xmas_reward + ((BaseLevel + 10)/10)); + if (debug > 0) + message strcharinfo(0), "Reward variable: " + @xmas_reward; + @xmas_uncommon_slot1 = rand(getarraysize($@xmas_uncommon_reward$)); + @xmas_uncommon_slot2 = rand(getarraysize($@xmas_uncommon_reward$)); + if(@xmas_reward >= $@xmas_reward_tally_rare) + @xmas_reward_item$ = $@xmas_rare_reward$[@xmas_reward_side]; + if(@xmas_reward >= $@xmas_reward_tally_common) + @xmas_reward_item1$ = $@xmas_uncommon_reward$[@xmas_uncommon_slot1]; + @xmas_reward_item2$ = $@xmas_uncommon_reward$[@xmas_uncommon_slot2]; + if(checkweight("Iten", 1) == 0) + goto L_FullInv; + if(@xmas_reward >= $@xmas_reward_tally_rare) + getitem @xmas_reward_item$, 1; + if(@xmas_reward >= $@xmas_reward_tally_common) + getitem @xmas_reward_item1$, 1; + getitem @xmas_reward_item2$, 1; + @xmas_uncommon_slot1 = 0; + @xmas_uncommon_slot2 = 0; + @xmas_reward_item$ = ""; + @xmas_reward_item1$ = ""; + @xmas_reward_item2$ = ""; + if (@xmas_reward_start_state) + @xmas_state = $@xmas_reward2_done; + if (@xmas_reward1_done_state) + @xmas_state = $@xmas_reward_done; + callfunc "XmasSetState"; + goto L_Return; + +L_FullInv: + mes "\"You have no place to put the present.\""; + goto L_Return; + +L_Return: + return; +} + +function script XmasCheckOld { + if(XMASYEAR == $XMAS_TIME_KEY[5]) + goto L_Return; + goto L_OldMatch; + +L_OldMatch: + XMASTIME = 0; + XMASYEAR = $XMAS_TIME_KEY[5]; + goto L_Return; + +L_Return: + return; +} diff --git a/npc/annuals/xmas/debug.txt b/npc/annuals/xmas/debug.txt new file mode 100644 index 00000000..f7ba17bd --- /dev/null +++ b/npc/annuals/xmas/debug.txt @@ -0,0 +1,220 @@ + +function script XmasDebug { + if(debug) + goto L_Debug; + goto L_Live; + +L_Live: + mes "What do you want to do?"; + menu + "Debug Vars", L_DebugLive, + "Xmas Time Key Change.", L_XmasTimeKey, + "Reset Xmas Chamber.", L_XmasChamberReset, + "Do nothing.", L_close; + +L_DebugLive: + mes "--Sever--"; + mes "Event State: " + $@xmas_time; + mes "Event Start" + $XMAS_TIME_KEY[0] + "/1"; + mes "Reward Start: " + $XMAS_TIME_KEY[1] + "/" + $XMAS_TIME_KEY[3]; + mes "Event End: " + $XMAS_TIME_KEY[2] + "/" + $XMAS_TIME_KEY[4]; + mes "Event Time Key (year (CCYY)): " + $XMAS_TIME_KEY[5]; + goto L_close; + +L_Debug: + mes "What do you want to do?"; + menu + "Debug Vars", L_DebugVars, + "Set Quest State.", L_XmasState, + "Set Karma. [0-15] 15 Nice", L_XmasKarma, + "Set All Lists", L_SetAllLists, + "Set All Helpers", L_SetAllHelpers, + "Set Boss Hero", L_SetBossHero, + "Reset Quest State.", L_Reset, + "Set Old Event Flag.", L_LastReset, + "Xmas Time Key Change.", L_XmasTimeKey, + "Reset Xmas Chamber.", L_XmasChamberReset, + "Do nothing.", L_close; + +L_DebugVars: + callfunc "XmasStates"; + mes "--Sever--"; + mes "Event State: " + $@xmas_time; + mes "Event Start" + $XMAS_TIME_KEY[0] + "/1"; + mes "Reward Start: " + $XMAS_TIME_KEY[1] + "/" + $XMAS_TIME_KEY[3]; + mes "Event End: " + $XMAS_TIME_KEY[2] + "/" + $XMAS_TIME_KEY[4]; + mes "Event Time Key (year (CCYY)): " + $XMAS_TIME_KEY[5]; + next; + mes "--Player--"; + mes "Player Event Time Key " + XMASYEAR; + mes "xmas_state: " + @xmas_state; + mes "xmas_karma: " + @xmas_karma; + mes "xmas_side: " + @xmas_side; + next; + mes "xmas_list_gather: " + @xmas_list_gather; + mes "xmas_list_complete: " + @xmas_list_complete; + mes "xmas_list_deliver: " + @xmas_list_deliver; + mes "xmas_helper_start_state: " + @xmas_helper_start_state; + mes "xmas_helper_done_state: " + @xmas_helper_done_state; + mes "xmas_reagent_start_state: " + @xmas_reagent_start_state; + mes "xmas_reagent_done_state: " + @xmas_reagent_done_state; + mes "xmas_boss_door_state: " + @xmas_boss_door_state; + mes "xmas_reward_start_state " + @xmas_reward_start_state; + mes "xmas_reward1_done_state " + @xmas_reward1_done_state; + mes "xmas_reward2_done_state " + @xmas_reward2_done_state; + mes "xmas_reward_done_state: " + @xmas_reward_done_state; + next; + mes "xmas_basement_passage: " + @xmas_basement_passage; + mes "xmas_thrown_out: " + @xmas_thrown_out; + mes "xmas_hard_mode: " + @xmas_boss_hero; + next; + mes "xmas_sweater: " + @xmas_sh_done; + next; + mes "xmas_all_lists: " + @xmas_all_lists; + next; + mes "xmas_helper_bit: " + @xmas_helper_bit; + mes "xmas_all_helpers: " + @xmas_all_helpers; + mes "xmas_helper_acorn: " + @xmas_helper_acorn; + mes "xmas_helper_bedding: " + @xmas_helper_bedding; + mes "xmas_helper_glitter: " + @xmas_helper_glitter; + mes "xmas_helper_storage: " + @xmas_helper_storage; + mes "xmas_knows_route: " + @xmas_knows_route; + goto L_close; + +L_LastReset: + XMASTIME = 255; + XMASYEAR = 2012; + goto L_close; + +L_Reset: + XMASTIME = 0; + XMASYEAR = $XMAS_TIME_KEY[5]; + goto L_close; + +L_XmasTimeKey: + mes "Xmas Time Key Change."; + mes "Start Month?"; + input @xmas_time_key_smonth; + if((@xmas_time_key_smonth == 0) || (@xmas_time_key_smonth > 12)) + goto L_XmasError; + mes "Reward Start Month?"; + input @xmas_time_key_srmonth; + if((@xmas_time_key_srmonth == 0) || (@xmas_time_key_srmonth > 12)) + goto L_XmasError; + mes "End Month?"; + input @xmas_time_key_emonth; + if((@xmas_time_key_emonth == 0) || (@xmas_time_key_emonth > 12)) + goto L_XmasError; + mes "Reward Start Day?"; + input @xmas_time_key_rsday; + if((@xmas_time_key_rsday == 0) || (@xmas_time_key_rsday > 31)) + goto L_XmasError; + mes "Reward End Day?"; + input @xmas_time_key_reday; + if((@xmas_time_key_reday == 0) || (@xmas_time_key_reday > 31)) + goto L_XmasError; + mes "Time Key (CCYY) "; + input @xmas_time_key_year; + goto L_SetNewKey; + +L_XmasError: + mes "Incorrect Entry. Try again."; + goto L_close; + +L_SetNewKey: + setarray $XMAS_TIME_KEY, @xmas_time_key_smonth, @xmas_time_key_srmonth, @xmas_time_key_emonth, @xmas_time_key_rsday, @xmas_time_key_reday, @xmas_time_key_year; + donpcevent "#XmasConfig::OnCommandRestartQuest"; + goto L_close; + +L_XmasChamberReset: + donpcevent "AniManOMat::OnCommandChamberReset"; + goto L_close; + +L_XmasState: + mes "Quest state?"; + input @xmas_state; + callfunc "XmasSetState"; + goto L_close; + +L_XmasKarma: + mes "Karma (0-15) 0: Naughty, 15: Good"; + input @xmas_karma; + XMASTIME = (XMASTIME & ~(NIBBLE_1_MASK) | (@xmas_karma << NIBBLE_1_SHIFT)); + goto L_close; + +L_SetAllLists: + XMASTIME = XMASTIME | $@xmas_all_lists_bit; + goto L_close; + +L_SetAllHelpers: + XMASTIME = XMASTIME | $@xmas_all_helpers_bit; + goto L_close; + +L_SetBossHero: + XMASTIME = XMASTIME | $@xmas_boss_hero_bit; + goto L_close; + +L_close: + @xmas_state = 0; + @xmas_karma = 0; + @xmas_hard_mode = 0; + @xmas_time_key_smonth = 0; + @xmas_time_key_emonth = 0; + @xmas_time_key_rsday = 0; + @xmas_time_key_reday = 0; + @xmas_time_key_year = 0; + close2; + return; +} + +020-1,86,76,0 script XmasDebug#1 NPC105,{ + callfunc "XmasDebug"; + goto L_End; + +OnInit: + if(!(debug)) + disablenpc "XmasDebug#1"; + goto L_End; + +L_End: + end; +} + +030-2,193,62,0 script XmasDebug#2 NPC105,{ + callfunc "XmasDebug"; + goto L_End; + +OnInit: + if(!(debug)) + disablenpc "XmasDebug#2"; + goto L_End; + +L_End: + end; +} + +030-3,26,26,0 script XmasDebug#3 NPC105,{ + callfunc "XmasDebug"; + goto L_End; + +OnInit: + if(!(debug)) + disablenpc "XmasDebug#3"; + goto L_End; + +L_End: + end; +} + +030-4,30,30,0 script XmasDebug#4 NPC111,{ + callfunc "XmasDebug"; + goto L_End; + +OnInit: + if(!(debug)) + disablenpc "XmasDebug#4"; + goto L_End; + +L_End: + end; +} diff --git a/npc/annuals/xmas/helpers.txt b/npc/annuals/xmas/helpers.txt new file mode 100644 index 00000000..28d5e650 --- /dev/null +++ b/npc/annuals/xmas/helpers.txt @@ -0,0 +1,44 @@ + +function script XmasHelperPoints { + @xmas_helper_count = 0; + @xmas_helper_loop = 0; + if((@xmas_helper_done_state) || !(@xmas_helper_start_state)) + goto L_Return; + goto L_Loop; + +L_Loop: + if(XMASTIME & $@xmas_helper_list[@xmas_helper_loop]) + goto L_AddOne; + goto L_LoopAgain; + +L_AddOne: + @xmas_helper_count = (@xmas_helper_count + 1); + goto L_LoopAgain; + +L_LoopAgain: + if((@xmas_helper_loop + 1) == getarraysize($@xmas_helper_list)) + goto L_HelperTally; + @xmas_helper_loop = (@xmas_helper_loop + 1); + goto L_Loop; + +L_HelperTally: + if(@xmas_helper_count == $@xmas_perfect_helpers_count) + goto L_PerfectHelpers; + if(@xmas_helper_count > $@xmas_required_helpers_count) + goto L_SetHelperState; + goto L_Return; + +L_PerfectHelpers: + XMASTIME = XMASTIME | $@xmas_all_helpers_bit; + goto L_SetHelperState; + +L_SetHelperState: + @xmas_state = $@xmas_helpers_done_state; + callfunc "XmasSetState"; + goto L_Return; + +L_Return: + @xmas_helper_count = 0; + @xmas_helper_loop = 0; + return; +} diff --git a/npc/annuals/xmas/list.txt b/npc/annuals/xmas/list.txt new file mode 100644 index 00000000..6f902e04 --- /dev/null +++ b/npc/annuals/xmas/list.txt @@ -0,0 +1,98 @@ + +function script XmasCheckList { + @xmas_list_count = 0; + @xmas_list_loop = 0; + + if((@xmas_list_deliver) || !(@xmas_list_gather)) + goto L_Return; + goto L_Loop; + +L_Loop: + if(XMASTIME & $@xmas_child_list[@xmas_list_loop]) + goto L_AddOne; + goto L_LoopAgain; + +L_AddOne: + @xmas_list_count = (@xmas_list_count + 1); + goto L_LoopAgain; + +L_LoopAgain: + if((@xmas_list_loop + 1) == getarraysize($@xmas_child_list)) + goto L_ListTally; + @xmas_list_loop = (@xmas_list_loop + 1); + goto L_Loop; + +L_ListTally: + if(@xmas_list_count == $@xmas_perfect_list_count) + goto L_PerfectList; + if(@xmas_list_count > $@xmas_required_list_count) + goto L_SetListState; + goto L_Return; + +L_PerfectList: + XMASTIME = XMASTIME | $@xmas_all_lists_bit; + goto L_SetListState; + +L_SetListState: + @xmas_state = $@xmas_list_complete_state; + callfunc "XmasSetState"; + goto L_Return; + +L_Return: + @xmas_list_loop = 0; + return; +} + +function script XmasList { + callfunc "XmasStates"; + + if(($@xmas_time) && (@xmas_list_gather) && !(@xmas_list_complete)) + goto L_QuestTime; + goto L_Return; + +L_QuestTime: + if(XMASTIME & $@xmas_child_list[@child_number]) + goto L_Return; + goto L_GetList; + +L_GetList: + menu + "Hey, I have come to collect your wish list for Santa", L_List, + "Oh sorry, what were you going to say?", L_Return; + +L_List: + mes "[" + $@xmas_child_list_name$[@child_number] + "]"; + mes "Here is my list. Make sure it gets delivered, please!"; + next; + mes "You store " + $@xmas_child_list_name$[@child_number] + "'s wish list carefully in a hidden pocket of your backpack."; + XMASTIME = XMASTIME | $@xmas_child_list[@child_number]; + callfunc "XmasXpReward"; + menu + "I really should be going.", L_Return; + +L_Return: + return; +} + +function script XmasListList { + @xmas_list_loop = 0; + @xmas_child_loop = 0; + goto L_Loop; + +L_Loop: + @xmas_child_loop = ($@xmas_child_list[@xmas_list_loop]); + if ((XMASTIME & @xmas_child_loop) != 0) goto L_LoopAgain; + mes "\"" + $@xmas_child_list_name$[@xmas_list_loop] + "\""; + next; + goto L_LoopAgain; + +L_LoopAgain: + if((@xmas_list_loop + 1) == getarraysize($@xmas_child_list_name$)) + goto L_Return; + @xmas_list_loop = (@xmas_list_loop + 1); + goto L_Loop; + +L_Return: + @xmas_list_loop = 0; + return; +} diff --git a/npc/annuals/xmas/mobmanager.txt b/npc/annuals/xmas/mobmanager.txt new file mode 100644 index 00000000..d96b0fb0 --- /dev/null +++ b/npc/annuals/xmas/mobmanager.txt @@ -0,0 +1,77 @@ + +019-1,0,0,0 script XmasSpawnManager NPC400,{ + end; + +OnCommandSpawnStart: + if ($@xmas_spawn_started) + goto L_End; + $@xmas_spawn_started = 1; + goto L_InitSpawn; + +L_InitSpawn: + initnpctimer; + $@xmas_current_count = 0; + $@xmas_map_loop = 0; + goto L_StartLoop; + +L_StartLoop: + $@xmas_mob_lck = 1; + $@mob_count = mobcount($@xmas_map_spawns$[$@xmas_map_loop], "XmasSpawnCounter#" + $@xmas_map_loop + "::OnTally"); + $@spawn_amount = ($@xmas_mob_counts[$@xmas_map_loop] - $@mob_count); + if ($@spawn_amount) + goto L_Spawn; + goto L_NextMap; + +L_Spawn: + areamonster $@xmas_map_spawns$[$@xmas_map_loop], $@xmas_spawn_x1, $@xmas_spawn_y1, $@xmas_spawn_x2, $@xmas_spawn_y2, $@xmas_mob_names$[$@xmas_map_loop], $@xmas_mob_spawns[$@xmas_map_loop], $@spawn_amount, "XmasSpawnCounter#" + $@xmas_map_loop + "::OnTally"; + $@xmas_current_count = ($@xmas_current_count + $@spawn_amount); + goto L_NextMap; + +L_NextMap: + if (($@xmas_map_loop + 1) == getarraysize($@xmas_map_spawns$)) + goto L_End; + $@xmas_map_loop = ($@xmas_map_loop + 1); + goto L_StartLoop; + +OnCommandTally: + $@xmas_map_loop = 0; + $@xmas_current_count = ($@xmas_current_count - 1); + if (($@xmas_current_count < $@xmas_respawn_count) && !($@xmas_mob_lck)) + goto L_StartLoop; + goto L_End; + +OnTimer110000: + initnpctimer; + goto L_StartLoop; + +L_End: + $@mob_count = 0; + $@spawn_amount = 0; + $@xmas_mob_lck = 0; + $@xmas_map_loop = 0; + end; +} + +019-1,0,0,0 script XmasSpawnCounter#0 NPC400,{ + end; + +OnTally: + donpcevent "XmasSpawnManager::OnCommandTally"; + end; +} + +019-3,0,0,0 script XmasSpawnCounter#1 NPC400,{ + end; + +OnTally: + donpcevent "XmasSpawnManager::OnCommandTally"; + end; +} + +030-3,0,0,0 script XmasSpawnCounter#2 NPC400,{ + end; + +OnTally: + donpcevent "XmasSpawnManager::OnCommandTally"; + end; +} diff --git a/npc/annuals/xmas/reagents.txt b/npc/annuals/xmas/reagents.txt new file mode 100644 index 00000000..dbdf52e7 --- /dev/null +++ b/npc/annuals/xmas/reagents.txt @@ -0,0 +1,139 @@ + +function script CheckReagents { + @xmas_reagent_loop = 0; + if((@xmas_reagent_done_state) || !(@xmas_reagent_start_state)) + goto L_Return; + if(@xmas_side) + goto L_OneLoop; + goto L_ZeroLoop; + +L_ZeroLoop: + if(countitem($@xmas_zero_reagents$[@xmas_reagent_loop]) >= $@xmas_zero_reagents_amounts[@xmas_reagent_loop]) + goto L_ZeroLoopAgain; + goto L_Return; + +L_ZeroLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$)) + goto L_AllReagents; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_ZeroLoop; + +L_OneLoop: + if(countitem($@xmas_one_reagents$[@xmas_reagent_loop]) >= $@xmas_one_reagents_amounts[@xmas_reagent_loop]) + goto L_OneLoopAgain; + goto L_Return; + +L_OneLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$)) + goto L_AllReagents; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_OneLoop; + +L_AllReagents: + @xmas_state = $@xmas_reagents_done; + callfunc "XmasSetState"; + goto L_Return; + +L_Return: + return; +} + +function script DeleteReagents { + @xmas_reagent_loop = 0; + if(@xmas_side) + goto L_OneLoop; + goto L_ZeroLoop; + +L_ZeroLoop: + delitem $@xmas_zero_reagents$[@xmas_reagent_loop], $@xmas_zero_reagents_amounts[@xmas_reagent_loop]; + goto L_ZeroLoopAgain; + +L_ZeroLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$)) + goto L_Return; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_ZeroLoop; + +L_OneLoop: + delitem $@xmas_one_reagents$[@xmas_reagent_loop], $@xmas_one_reagents_amounts[@xmas_reagent_loop]; + goto L_OneLoopAgain; + +L_OneLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$)) + goto L_Return; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_OneLoop; + +L_Return: + return; +} + +function script ListReagents { + @xmas_reagent_loop = 0; + mes "\"I'm going to need \""; + next; + + if(@xmas_side) + goto L_OneLoop; + goto L_ZeroLoop; + +L_ZeroLoop: + mes "\"" + $@xmas_zero_reagents_amounts[@xmas_reagent_loop] + " " + $@xmas_zero_reagents_names$[@xmas_reagent_loop] + "\""; + next; + goto L_ZeroLoopAgain; + +L_ZeroLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_zero_reagents$)) + goto L_AllReagents; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_ZeroLoop; + +L_OneLoop: + mes "\"" + $@xmas_one_reagents_amounts[@xmas_reagent_loop] + " " + $@xmas_one_reagents_names$[@xmas_reagent_loop] + "\""; + next; + goto L_OneLoopAgain; + +L_OneLoopAgain: + if((@xmas_reagent_loop + 1) == getarraysize($@xmas_one_reagents$)) + goto L_AllReagents; + @xmas_reagent_loop = (@xmas_reagent_loop + 1); + goto L_OneLoop; + +L_AllReagents: + return; +} + +function script BadPowderMake { + if(countitem("PileOfAsh") < ($@xmas_red_amount + $@xmas_yellow_amount)) + goto L_NotEnough; + if(countitem("RedDye") < $@xmas_red_amount) + goto L_NotEnough; + if(countitem("YellowDye") < $@xmas_yellow_amount) + goto L_NotEnough; + getinventorylist; + if (@inventorylist_count > 100) + goto L_FullInv; + goto L_MakePowder; + +L_MakePowder: + delitem "PileOfAsh", ($@xmas_red_amount + $@xmas_yellow_amount); + delitem "RedDye", $@xmas_red_amount; + delitem "YellowDye", $@xmas_yellow_amount; + getitem "RedPowder", $@xmas_red_amount; + getitem "YellowPowder", $@xmas_yellow_amount; + mes "\"Here is your powder, now move!\""; + goto L_Return; + +L_FullInv: + mes "\"... Excuse me but where did you expect you were going to hold these powders...\""; + mes "\"WAIT! no, I don't want to know. Just come back when you have some room.\""; + goto L_Return; + +L_NotEnough: + mes "\"You don't have enough of eagents to make the powders.\""; + mes "\"To replace the glitter we will need get " + ($@xmas_red_amount + $@xmas_yellow_amount) + " Piles of Ash, " + $@xmas_red_amount + " Red Dyes and " + $@xmas_yellow_amount + " Yellow Dyes\""; + goto L_Return; + +L_Return: + return; +} diff --git a/npc/annuals/xmas/states.txt b/npc/annuals/xmas/states.txt new file mode 100644 index 00000000..c21ccce5 --- /dev/null +++ b/npc/annuals/xmas/states.txt @@ -0,0 +1,51 @@ + +function script XmasStates { + // Check for Old Quest Line Keys. Reset Quest if so. + callfunc "XmasCheckOld"; + // Main Quest + @xmas_state = ((XMASTIME & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); + @xmas_karma = ((XMASTIME & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT); + @xmas_side = XMASTIME & $@xmas_side_bit; + + @xmas_list_gather = (@xmas_state >= $@xmas_list_path2_state); + @xmas_list_path2 = (@xmas_state == $@xmas_list_path2_state); + @xmas_list_path1 = (@xmas_state == $@xmas_list_path1_state); + @xmas_list_both = (@xmas_state == $@xmas_list_both_state); + @xmas_list_complete = (@xmas_state >= $@xmas_list_complete_state); + @xmas_list_deliver = (@xmas_state >= $@xmas_list_deliver_state); + @xmas_helper_start_state = (@xmas_state >= $@xmas_helpers_start_state); + @xmas_helper_done_state = (@xmas_state >= $@xmas_helpers_done_state); + @xmas_reagent_start_state = (@xmas_state >= $@xmas_reagents_start); + @xmas_reagent_done_state = (@xmas_state >= $@xmas_reagents_done); + @xmas_boss_door_state = (@xmas_state >= $@xmas_boss_door_open_state); + @xmas_reward_start_state = (@xmas_state == $@xmas_reward_start); + @xmas_reward1_done_state = (@xmas_state == $@xmas_reward1_done); + @xmas_reward2_done_state = (@xmas_state == $@xmas_reward2_done); + @xmas_reward_done_state = (@xmas_state == $@xmas_reward_done); + + // Basement Passage + @xmas_basement_passage = XMASTIME & $@xmas_basement_passage; + // Thrown Out + @xmas_thrown_out = XMASTIME & $@xmas_thrown_out_bit; + // Learned Route to Orum + @xmas_knows_route = XMASTIME & $@xmas_route_bit; + // Santas Helper + @xmas_sh_done = XMASTIME & $@xmas_sh_bit; + // List Quest + @xmas_all_lists = XMASTIME & $@xmas_all_lists_bit; + // Helper Quest + @xmas_helper_bit = XMASTIME & $@xmas_helper_bit; + @xmas_all_helpers = XMASTIME & $@xmas_all_helpers_bit; + // Acorns + @xmas_helper_acorn = XMASTIME & $@xmas_helper_bit_acorns; + // Bedding + @xmas_helper_bedding = XMASTIME & $@xmas_helper_bit_bed_starts; + // Glitter + @xmas_helper_glitter = XMASTIME & $@xmas_helper_bit_glitter_starts; + // Storage + @xmas_helper_storage = XMASTIME & $@xmas_helper_bit_storage; + // Bosses + @xmas_boss_start = XMASTIME & $@xmas_boss_start_bit; + @xmas_boss_hero = XMASTIME & $@xmas_boss_hero_bit; + return; +} |