From 577b6b5249794a5f3b5c9600c637c8e82429f1dd Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 19 Jun 2018 09:01:15 -0300 Subject: Sanitization. Useful commands: @wsnow @wrain @wsand @wevil @wnight @wclear Weather won't affect anything on gameplay yet. --- npc/functions/weather.txt | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/npc/functions/weather.txt b/npc/functions/weather.txt index ea10a3c0d..17894535e 100644 --- a/npc/functions/weather.txt +++ b/npc/functions/weather.txt @@ -7,6 +7,7 @@ 000-0,0,0,0 script #WeatherCore NPC_HIDDEN,{ end; + OnInit: // Bind commands bindatcmd "wsnow", "#WeatherCore::OnSnow", 80, 80, 1; @@ -104,35 +105,48 @@ OnMinute45: debugmes "[Weather.sys] Weather reloaded"; end; + // Function to check stuff + // WeatherSwitch ( MASK ) + function WeatherSwitch { + // Get map + getmapxy(.@key$,.@a,.@b,0); + + // Sanitize + .@m$ = htget(.wcore, .@key$, "Not found"); + + // Change Weather or abort + if (.@m$ == "Not found") + dispbottom l("Command not permitted on this map! Check npc/functions/weather.conf"); + else + addmapmask(.@key$, MASK_RAIN); + return; + } + // Some commands, for GMs manually override weather OnRain: - getmapxy(.@key$,.@a,.@b,0); - addmapmask .@key$, MASK_RAIN; + WeatherSwitch(MASK_RAIN); end; OnSand: - getmapxy(.@key$,.@a,.@b,0); - addmapmask .@key$, MASK_SANDSTORM; + WeatherSwitch(MASK_SANDSTORM); end; OnSnow: - getmapxy(.@key$,.@a,.@b,0); - addmapmask .@key$, MASK_SNOW; + WeatherSwitch(MASK_SNOW); end; OnNight: - getmapxy(.@key$,.@a,.@b,0); - addmapmask .@key$, MASK_NIGHT; + WeatherSwitch(MASK_NIGHT); end; OnEvil: - getmapxy(.@key$,.@a,.@b,0); - addmapmask .@key$, MASK_EVILSANCTUM; + WeatherSwitch(MASK_EVILSANCTUM); end; +// Clear works on any map OnClear: getmapxy(.@key$,.@a,.@b,0); - setmapmask .@key$, MASK_NONE; + setmapmask(.@key$, MASK_NONE); end; } -- cgit v1.2.3-60-g2f50