summaryrefslogtreecommitdiff
path: root/world
diff options
context:
space:
mode:
Diffstat (limited to 'world')
-rw-r--r--world/map/npc/annuals/check_time.txt55
-rw-r--r--world/map/npc/annuals/halloween/config.txt34
-rw-r--r--world/map/npc/annuals/xmas/config.txt32
-rw-r--r--world/map/npc/scripts.conf1
4 files changed, 76 insertions, 46 deletions
diff --git a/world/map/npc/annuals/check_time.txt b/world/map/npc/annuals/check_time.txt
new file mode 100644
index 00000000..06de3038
--- /dev/null
+++ b/world/map/npc/annuals/check_time.txt
@@ -0,0 +1,55 @@
+// check a date
+// Wushin
+// $@start_month
+// $@end_month
+// $@start_day
+// $@end_day
+// $@reward_start_month
+// $@reward_start_day
+
+function|script|GetEventTime
+{
+ set $@month, gettime(6);
+ set $@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) || ($@month <= $@end_month && $@day <= $@reward_start_day))
+ goto L_EventTime;
+ goto L_NoEventTime;
+
+L_NoEventTime:
+ set $@event_time, 0;
+ return;
+
+L_EventTime:
+ set $@event_time, 1;
+ return;
+
+L_RewardTime:
+ set $@event_time, 2;
+ return;
+}
diff --git a/world/map/npc/annuals/halloween/config.txt b/world/map/npc/annuals/halloween/config.txt
index 0401fc3d..20fba752 100644
--- a/world/map/npc/annuals/halloween/config.txt
+++ b/world/map/npc/annuals/halloween/config.txt
@@ -337,32 +337,18 @@ L_Main:
if (gettime(6) == $@halloween_reward_start_month)
set $@halloween_min_age, ((gettime(5) + 38)*86400);
- if(gettime(6) <= $@halloween_end_month && gettime(5) > $@halloween_reward_end_day)
- goto L_NoEventTime;
- if((gettime(6) == $@halloween_reward_start_month && gettime(5) >= $@halloween_reward_start_day
- && (gettime(5) <= $@halloween_reward_end_day && $@halloween_reward_start_month == $@halloween_end_month
- || !($@halloween_reward_start_month == $@halloween_end_month)))
- || (gettime(6) == $@halloween_end_month && gettime(5) <= $@halloween_reward_end_day
- && (gettime(5) >= $@halloween_reward_start_day && $@halloween_reward_start_month == $@halloween_end_month
- || !($@halloween_reward_start_month == $@halloween_end_month)))
- || (gettime(6) < $@halloween_end_month && gettime(6) > $@halloween_reward_start_month))
- goto L_RewardTime;
- if((gettime(6) >= $@halloween_start_month) || (gettime(6) <= $@halloween_end_month && gettime(5) <= $@halloween_reward_start_day))
- goto L_EventTime;
- goto L_NoEventTime;
-
-L_NoEventTime:
- if($HALLOWEEN_TIME_KEY[5] < gettime(7))
- setarray $HALLOWEEN_TIME_KEY, $HALLOWEEN_TIME_KEY[0],$HALLOWEEN_TIME_KEY[1],$HALLOWEEN_TIME_KEY[2],$HALLOWEEN_TIME_KEY[3],$HALLOWEEN_TIME_KEY[4],gettime(7);
- set $@halloween_time, $@halloween_no_event_time;
- goto L_Return;
+ set $@start_month, $@halloween_start_month;
+ set $@end_month, $@halloween_end_month;
+ set $@start_day, 1;
+ set $@end_day, $@halloween_reward_end_day;
+ set $@reward_start_month, $@halloween_reward_start_month;
+ set $@reward_start_day, $@halloween_reward_start_day;
-L_EventTime:
- set $@halloween_time, $@halloween_event_time;
- goto L_Return;
+ callfunc "GetEventTime";
+ set $@halloween_time, $@event_time;
-L_RewardTime:
- set $@halloween_time, $@halloween_reward_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:
diff --git a/world/map/npc/annuals/xmas/config.txt b/world/map/npc/annuals/xmas/config.txt
index e95494d3..8f7c9139 100644
--- a/world/map/npc/annuals/xmas/config.txt
+++ b/world/map/npc/annuals/xmas/config.txt
@@ -262,30 +262,18 @@ L_Main:
set $@xmas_spawn_y2, 89;
set $@xmas_respawn_count, 9;
- if((gettime(6) == $@xmas_reward_start_month && gettime(5) >= $@xmas_reward_start_day
- && (gettime(5) <= $@xmas_reward_end_day && $@xmas_reward_start_month == $@xmas_end_month
- || !($@xmas_reward_start_month == $@xmas_end_month)))
- || (gettime(6) == $@xmas_end_month && gettime(5) <= $@xmas_reward_end_day
- && (gettime(5) >= $@xmas_reward_start_day && $@xmas_reward_start_month == $@xmas_end_month
- || !($@xmas_reward_start_month == $@xmas_end_month)))
- || (gettime(6) < $@xmas_end_month && gettime(6) > $@xmas_reward_start_month))
- goto L_RewardTime;
- if((gettime(6) >= $@xmas_start_month) || (gettime(6) <= $@xmas_end_month && gettime(5) <= $@xmas_reward_start_day))
- goto L_EventTime;
- goto L_NoEventTime;
-
-L_NoEventTime:
- if($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);
- set $@xmas_time, $@xmas_no_event_time;
- goto L_Return;
+ set $@start_month, $@xmas_start_month;
+ set $@end_month, $@xmas_end_month;
+ set $@start_day, 1;
+ set $@end_day, $@xmas_reward_end_day;
+ set $@reward_start_month, $@xmas_reward_start_month;
+ set $@reward_start_day, $@xmas_reward_start_day;
-L_EventTime:
- set $@xmas_time, $@xmas_event_time;
- goto L_Return;
+ callfunc "GetEventTime";
+ set $@xmas_time, $@event_time;
-L_RewardTime:
- set $@xmas_time, $@xmas_reward_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:
diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf
index d37a8c57..af6ea91f 100644
--- a/world/map/npc/scripts.conf
+++ b/world/map/npc/scripts.conf
@@ -44,6 +44,7 @@ import: npc/_import.txt
npc: npc/functions/gm_island.txt
// Annuals Framework
npc: npc/annuals/fathertime.txt
+npc: npc/annuals/check_time.txt
npc: npc/annuals/tree_beard.txt
// Annual Christmas
npc: npc/annuals/xmas/config.txt