summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-10-22 15:19:22 -0700
committerBen Longbons <b.r.longbons@gmail.com>2011-10-22 15:44:50 -0700
commitdd92758fdbb472d98ea33ecbc85f951a3e9cf883 (patch)
tree8e61ec3162c33b247815856ea6f1ce972b275b80
parentc3f4578a4e08a364a3257fc4b49ccf309f9f128c (diff)
downloadserverdata-dd92758fdbb472d98ea33ecbc85f951a3e9cf883.tar.gz
serverdata-dd92758fdbb472d98ea33ecbc85f951a3e9cf883.tar.bz2
serverdata-dd92758fdbb472d98ea33ecbc85f951a3e9cf883.tar.xz
serverdata-dd92758fdbb472d98ea33ecbc85f951a3e9cf883.zip
Add missing trick-or-treat NPC and severely reduce the possibility of exploitationv2011.10.23
-rw-r--r--world/map/npc/021-1/inac.txt9
-rw-r--r--world/map/npc/halloween/2011/config.txt2
-rw-r--r--world/map/npc/halloween/2011/trick_or_treat.txt27
3 files changed, 32 insertions, 6 deletions
diff --git a/world/map/npc/021-1/inac.txt b/world/map/npc/021-1/inac.txt
index 85580f4b..da537a20 100644
--- a/world/map/npc/021-1/inac.txt
+++ b/world/map/npc/021-1/inac.txt
@@ -1,6 +1,11 @@
//
021-1.gat,53,103,0|script|Inac|156,{
+ set @hw2011_npc_id, $@hw2011_npc_inac;
+ if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day)
+ goto L_TrickOrTreat;
+
+L_Begin:
mes "[Inac]";
mes "\"This cities water system is amazing. It was built centuries ago after the cataclysm that turned Tonori into this desert.\"";
next;
@@ -10,4 +15,8 @@
mes "[Inac]";
mes "\"They also say monsters have moved into the underground tunnels that bring and distribute water.\"";
close;
+
+L_TrickOrTreat:
+ callfunc "TrickOrTreat2011";
+ goto L_Begin;
}
diff --git a/world/map/npc/halloween/2011/config.txt b/world/map/npc/halloween/2011/config.txt
index a120158a..a62e680e 100644
--- a/world/map/npc/halloween/2011/config.txt
+++ b/world/map/npc/halloween/2011/config.txt
@@ -12,6 +12,7 @@
// Global stuff
// $@hw2011_big_reward$ = The main reward randomly given, usually after the counter has reached 7-10
// $@hw2011_sweets$ = Array with all the sweets to be given as treats
+// $@hw2011_sweets_num = Size of that array
// $@hw2011_mask_IDs = Array with the IDs of all the masks that cover your face + The Scary Axehat
// $@hw2011_scare_factors = Array with the basic scare factor of each mask
// 678 Noh Mask 2
@@ -82,6 +83,7 @@ OnInit:
"CranberryLollipop",
"GrapeLollipop",
"OrangeLollipop";
+ set $@hw2011_sweets_num, getarraysize($@hw2011_sweets$);
setarray $@hw2011_mask_IDs, 678, 679, 1221, 634, 615, 639, 769, 801, 1218, 1276, 1277, 1279, 4027, 616;
setarray $@hw2011_scare_factors, 2, 4, 4, 4, 2, 3, 2, 2, 1, 3, 2, 4, 4, 4;
diff --git a/world/map/npc/halloween/2011/trick_or_treat.txt b/world/map/npc/halloween/2011/trick_or_treat.txt
index 5dea60a7..07b6c6fe 100644
--- a/world/map/npc/halloween/2011/trick_or_treat.txt
+++ b/world/map/npc/halloween/2011/trick_or_treat.txt
@@ -30,6 +30,7 @@ function|script|TrickOrTreat2011|{
"Reset this NPC's mask memory", L_ResetMask,
"Just do the quest", -;
L_Begin:
+ set @karma, hw2011 & 0xffff;
// must be early to handle all the one-off mes;s in the init stuff
mes $@hw2011_npc_names$[@hw2011_npc_id];
@@ -107,12 +108,15 @@ L_Check_Inventory:
L_Check_Karma:
// Please don't change this, you'll break stuff.
- if (rand($@hw2011_num_npcs, 0xffff) <= (hw2011 & 0xffff))
+ if (rand($@hw2011_num_npcs, 0xffff) <= @karma)
+ goto L_Cheater;
+ // this is a cheap, limited form of ilog2
+ if ((@karma >= 0x10) && !(rand( 4 - (@karma >= 0x40) + (@karma >= 0x100) + (@karma >= 0x400) )))
goto L_Cheater;
if (hw2011 & $@hw2011_got_big_reward)
goto L_Tricking_Trick_or_Treat;
- // assert: (hw2011 & 0xffff) < $@hw2011_num_npcs
- if (rand($@hw2011_num_npcs - (hw2011 & 0xffff)))
+ // assert: @karma < $@hw2011_num_npcs
+ if (rand($@hw2011_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 $@hw2011_big_reward$, 1;
@@ -123,7 +127,7 @@ L_Check_Karma:
L_Cheater:
mes "\"I recognize you despite your mask, you have been taking sweets you do not deserve.\"";
- if ((hw2011 & 0xFFFF) != 0xFFFF)
+ if (@karma != 0xFFFF)
set hw2011, hw2011 + 1;
goto L_Close;
@@ -162,13 +166,23 @@ L_Tricking_Veryscary:
goto L_Tricking_Reward;
L_Tricking_Reward:
+ next;
+ if (@karma >= 0x10)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@karma >= 0x100)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@karma >= 0x1000)
+ set @scare_factor, rand(@scare_factor / 2, @scare_factor);
+ if (@scare_factor < 1)
+ set @scare_factor, 1;
+L_Tricking_Reward_Loop:
if (!@scare_factor)
goto L_Tricking_End;
// NOTE: it gives out one piece at a time, but can loop several times
- getitem $@hw2011_sweets$[rand(20)], 1;
+ getitem $@hw2011_sweets$[rand($@hw2011_sweets_num)], 1;
set @scare_factor, @scare_factor - 1;
- goto L_Tricking_Reward;
+ goto L_Tricking_Reward_Loop;
L_SetRememberFace:
set hw2011, hw2011 | (0x1 << (31 - @hw2011_npc_id));
goto L_Close;
@@ -214,6 +228,7 @@ L_NoMask:
L_Close:
set @tmp, 0;
set @mask, 0;
+ set @karma, 0;
set @loop, 0;
set @menu, 0;