From 1deaa280cb8e5252d0a01534bba5097d93c09064 Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 12 May 2015 07:23:10 -0400 Subject: add motd config --- world/map/npc/functions/announcements.txt | 15 ------------ world/map/npc/functions/motdconfig.txt | 39 +++++++++++++++++++++++++++++++ world/map/npc/functions/superdebug.txt | 6 +++++ world/map/npc/scripts.conf | 2 +- 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 world/map/npc/functions/motdconfig.txt (limited to 'world/map/npc') diff --git a/world/map/npc/functions/announcements.txt b/world/map/npc/functions/announcements.txt index 35bd3e78..ce3d79ef 100644 --- a/world/map/npc/functions/announcements.txt +++ b/world/map/npc/functions/announcements.txt @@ -171,21 +171,6 @@ OnTimer3600000: goto L_Stop; } -function|script|DisplayMOTD -{ - if($@MOTD_Disabled || $@MOTD$[0] == "") goto L_Return; - goto L_MOTD; - -L_MOTD: - message strcharinfo(0), "##7Server : " + $@MOTD$[@motd_index]; - set @motd_index, @motd_index + 1; - if($@MOTD$[@motd_index] == "") goto L_Return; - goto L_MOTD; - -L_Return: - return; -} - function|script|getBroadcast { if (getmap() == "029-2" && getx() == 22 && gety() == 24) goto L_NewPlayer; diff --git a/world/map/npc/functions/motdconfig.txt b/world/map/npc/functions/motdconfig.txt new file mode 100644 index 00000000..f2541ea6 --- /dev/null +++ b/world/map/npc/functions/motdconfig.txt @@ -0,0 +1,39 @@ +function|script|MOTDConfig +{ + mes "[MOTD]"; + mes "lines:"; + mes "---"; + set @line, 0; + callsub S_Lines; + mes "---"; + mes "Enabled: " + !($@MOTD_Disabled); + next; + menu + "toggle|Toggle MOTD", L_Toggle; + +L_Toggle: + set $@MOTD_Disabled, !$@MOTD_Disabled; + close2; + return; + +S_Lines: + mes @line + ": "+ $@MOTD$[@line]; + set @line, @line + 1; + if(@line != getarraysize($@MOTD$)) goto S_Lines; + return; +} + +function|script|DisplayMOTD +{ + if($@MOTD_Disabled || $@MOTD$[0] == "") goto L_Return; + goto L_MOTD; + +L_MOTD: + message strcharinfo(0), "##7Server : " + $@MOTD$[@motd_index]; + set @motd_index, @motd_index + 1; + if($@MOTD$[@motd_index] == "") goto L_Return; + goto L_MOTD; + +L_Return: + return; +} diff --git a/world/map/npc/functions/superdebug.txt b/world/map/npc/functions/superdebug.txt index 8bb9350a..6ca56b88 100644 --- a/world/map/npc/functions/superdebug.txt +++ b/world/map/npc/functions/superdebug.txt @@ -11,6 +11,7 @@ L_Main: next; menu "Announcements", L_StoneBoard, + "MOTD", L_MOTD, "Holiday debug", L_Holiday, "Event debug", L_Event; // todo: generic npcs (in a future PR) @@ -44,6 +45,11 @@ L_StoneBoard: callfunc "SBConfig"; close; +L_MOTD: + if (getgmlevel() < 40) goto L_GM; + callfunc "MOTDConfig"; + close; + L_GM: mes "[Numa]"; mes "I'm awfully sorry."; diff --git a/world/map/npc/scripts.conf b/world/map/npc/scripts.conf index 1830a807..e2603c8e 100644 --- a/world/map/npc/scripts.conf +++ b/world/map/npc/scripts.conf @@ -30,8 +30,8 @@ npc: npc/functions/stat_reset.txt npc: npc/functions/quiz.txt npc: npc/functions/dynamic_menu.txt npc: npc/functions/DyeConfig.txt -npc: npc/functions/announcements.txt npc: npc/functions/motd.txt +npc: npc/functions/motdconfig.txt // Item Functions npc: npc/items/magic_gm_top_hat.txt -- cgit v1.2.3-60-g2f50