From cb7e8abbd5aa798c5b802d83567d3f377bd82131 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 20 Jun 2018 19:43:10 -0300 Subject: is_night() helper --- npc/functions/weather.txt | 15 +++++++++++---- 1 file 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); -- cgit v1.2.3-60-g2f50