summaryrefslogtreecommitdiff
path: root/npc/functions/weather.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-06-20 19:43:10 -0300
committerJesusaves <cpntb1@ymail.com>2018-06-20 21:48:08 -0300
commitcb7e8abbd5aa798c5b802d83567d3f377bd82131 (patch)
tree3d7fcd604497d92a1de9435b4993a5e35a5c6efd /npc/functions/weather.txt
parentf3760d70aa89ae0a4f00c09049b16ae35b4a27bd (diff)
downloadserverdata-cb7e8abbd5aa798c5b802d83567d3f377bd82131.tar.gz
serverdata-cb7e8abbd5aa798c5b802d83567d3f377bd82131.tar.bz2
serverdata-cb7e8abbd5aa798c5b802d83567d3f377bd82131.tar.xz
serverdata-cb7e8abbd5aa798c5b802d83567d3f377bd82131.zip
is_night() helper
Diffstat (limited to 'npc/functions/weather.txt')
-rw-r--r--npc/functions/weather.txt15
1 files changed, 11 insertions, 4 deletions
diff --git a/npc/functions/weather.txt b/npc/functions/weather.txt
index 7bfe4ea88..a4ff37054 100644
--- a/npc/functions/weather.txt
+++ b/npc/functions/weather.txt
@@ -4,6 +4,15 @@
// Description:
// Controls world seasons. RESPECT MASK_* VARS ON CONSTANTS DB
+// is_night()
+function script is_night {
+ // For convenience, night time is from 00:15 to 00:45, every hour.
+ // 2 = GETTIME_MINUTE
+ if (gettime(2) >= 15 && gettime(2) < 45)
+ return 1;
+ return 0;
+}
+
000-0,0,0,0 script #WeatherCore NPC_HIDDEN,{
end;
@@ -100,9 +109,7 @@ OnMinute45:
setmapmask .@key$, .@mk;
// Is it night time?
- // For convenience, night time is from 00:15 to 00:45, every hour.
- // 2 = GETTIME_MINUTE
- if (gettime(2) >= 15 && gettime(2) < 45) {
+ if (is_night()) {
setmapflag(.@key$, mf_nightenabled);
addmapmask .@key$, MASK_NIGHT;
} else if (getmapmask(.@key$) & MASK_NIGHT) {
@@ -114,7 +121,7 @@ OnMinute45:
htidelete(.@hti);
// During night, there are 20% more monsters on all maps
- if (gettime(2) >= 15 && gettime(2) < 45)
+ if (is_night())
setbattleflag("mob_count_rate", 120);
else
setbattleflag("mob_count_rate", 100);