From e0834f290b1225bc3090e3d43f18ec1047868cf9 Mon Sep 17 00:00:00 2001 From: mekolat Date: Fri, 1 May 2015 13:44:27 -0400 Subject: revamp the GM lounge --- world/map/npc/functions/announcements.txt | 193 +++++++++++++++++++++++ world/map/npc/functions/global_event_handler.txt | 3 +- world/map/npc/functions/gm_island.txt | 15 +- world/map/npc/functions/superdebug.txt | 52 ++++++ 4 files changed, 248 insertions(+), 15 deletions(-) create mode 100644 world/map/npc/functions/superdebug.txt (limited to 'world/map/npc/functions') diff --git a/world/map/npc/functions/announcements.txt b/world/map/npc/functions/announcements.txt index cd4e3b80..35bd3e78 100644 --- a/world/map/npc/functions/announcements.txt +++ b/world/map/npc/functions/announcements.txt @@ -1,3 +1,176 @@ +//############################################################################ +//# # +//# GM scheduled broadcasts # +//# # +//############################################################################ + +// $@GMSA_STATUS values: +// 0: Broadcasts not running +// 1: Broadcasts running +// $@GMSA_NAME$: the GM/Admin who created the broadcast, if any +// $@GMSA_MSG$: the message to be broadcasted +// $@GMSA_MAX: the number of times the broadcast will be performed, if > 0 +// $@GMSA_TICK: broadcast the message every $@GMSA_TICK hours +// $@GMSA_CURRENT_TICK: internal counter incremented every hour + +function|script|SBConfig +{ + if ($@GMSA_STATUS) + goto L_InfoBroadcast; + goto L_PrepareBroadcast; + +L_InfoBroadcast: + set @ms, (3600000*($@GMSA_TICK - $@GMSA_CURRENT_TICK) - getnpctimer(0, "Stone Board")); + callfunc "HumanTime"; + + mes "[GM Scheduled Broadcasts Board]"; + mes $@GMSA_NAME$ + " scheduled the current message, every " + $@GMSA_TICK + " hour(s):"; + mes $@GMSA_MSG$; + next; + mes "The next broadcast will happen in " + @time$ + "."; + next; + + set @next_broadcast_ts, 0; + set @next_broadcast_h, 0; + set @next_broadcast_m, 0; + + mes "What do you want to do?"; + menu + "Nothing.", L_Close, + "Nothing but... what is this?", L_Help, + "Stop broadcasting.", L_StopBroadcast, + "Trigger manually the current broadcast.", L_ManualBroadcast; + +L_PrepareBroadcast: + callsub S_Help; + next; + mes "There is no broadcast scheduled."; + mes "Do you want to create one?"; + menu + "No.", L_Close, + "Yes.", L_CreateBroadcast; + +L_CreateBroadcast: + mes "[GM Scheduled Broadcasts Board]"; + mes "Enter the message to broadcast:"; + input $@GMSA_MSG$; + if ($@GMSA_MSG$ == "") + goto L_InvalidBMsg; + + next; + mes "[GM Scheduled Broadcasts Board]"; + mes "The message will be broadcasted every X hour(s). Enter X:"; + input $@GMSA_TICK; + if ($@GMSA_TICK < 1 || $@GMSA_TICK > 24) + goto L_InvalidBroadcastTick; + + next; + mes "[GM Scheduled Broadcasts Board]"; + mes "If you want the message to be broadcasted a limited number of times, enter its value. Keep 0 otherwise:"; + input $@GMSA_MAX; + + next; + mes "[GM Scheduled Broadcasts Board]"; + if ($@GMSA_MAX == 0) + mes "The current message will be broadcasted every " + $@GMSA_TICK + " hour(s):"; + if ($@GMSA_MAX > 0) + mes "The current message will be broadcasted every " + $@GMSA_TICK + " hour(s), up to " + $@GMSA_MAX + " times:"; + mes $@GMSA_MSG$; + next; + mes "Is this correct?"; + menu + "No. I'll retry.", L_CreateBroadcast, + "No", L_Close, + "Yes. Broadcast this. (the first broadcast will happen in " + $@GMSA_TICK + " hour(s).)", L_StartBroadcast, + "Yes. Broadcast this, and make an extra broadcast right now.", L_StartBroadcast2; + +L_InvalidBMsg: + mes "[GM Scheduled Broadcasts Board]"; + mes "The message can't be empty. Please retry."; + goto L_CreateBroadcast; + +L_InvalidBroadcastTick: + mes "[GM Scheduled Broadcasts Board]"; + mes "You obviously can't repeat a message every 0 hours. Please retry."; + goto L_CreateBroadcast; + +L_Help: + callsub S_Help; + goto L_Close; + +S_Help: + mes "[GM Scheduled Broadcasts Board]"; + mes "This board allows a GM to schedule a message to be broadcast every X hours."; + mes "Only one broadcast can be scheduled at a time."; + return; + +L_ManualBroadcast: + announce $@GMSA_MSG$, 0; + mes "Done."; + goto L_Close; + +L_StopBroadcast: + donpcevent "Stone Board::OnStopBroadcast"; + mes "Done."; + goto L_Close; + +L_StartBroadcast2: + if ($@GMSA_STATUS == 1) + goto L_Abort; + announce $@GMSA_MSG$, 0; + goto L_StartBroadcast; + +L_StartBroadcast: + if ($@GMSA_STATUS == 1) + goto L_Abort; + set $@GMSA_STATUS, 1; + set $@GMSA_NAME$, strcharinfo(0); + set $@GMSA_CURRENT_TICK, 0; + initnpctimer "Stone Board"; + mes "Done."; + goto L_Close; + +L_Abort: + mes "[GM Scheduled Broadcasts Board]"; + mes $@GMSA_NAME$ + " has created a scheduled broadcast just before you, hence yours will abort."; + goto L_Close; + +L_Close: + return; +} + + +017-9,26,28,0|script|Stone Board|32767 +{ + end; + +OnStopBroadcast: + goto L_Stop; + +L_Stop: + stopnpctimer "Stone Board"; + setnpctimer 0, "Stone Board"; + set $@GMSA_STATUS, 0; + set $@GMSA_NAME$, ""; + set $@GMSA_MSG$, ""; + set $@GMSA_TICK, 0; + set $@GMSA_MAX, 0; + set $@GMSA_CURRENT_TICK, 0; + end; + +OnTimer3600000: + set $@GMSA_CURRENT_TICK, $@GMSA_CURRENT_TICK + 1; + setnpctimer 0, "Stone Board"; + if ($@GMSA_CURRENT_TICK != $@GMSA_TICK) + end; + announce $@GMSA_MSG$, 0; + set $@GMSA_CURRENT_TICK, 0; + set $@GMSA_MAX, $@GMSA_MAX - 1; + if ($@GMSA_MAX != 0) + end; + goto L_Stop; +} + function|script|DisplayMOTD { if($@MOTD_Disabled || $@MOTD$[0] == "") goto L_Return; @@ -12,3 +185,23 @@ L_MOTD: L_Return: return; } + +function|script|getBroadcast +{ + if (getmap() == "029-2" && getx() == 22 && gety() == 24) goto L_NewPlayer; + goto L_ReturningPlayer; + +L_NewPlayer: + // todo: show game rules on login (in another PR) + // ... does not look like it work.. the `menu` + // builtin behaves weirdly when on login + goto L_Return; + +L_ReturningPlayer: + if ($@GMSA_STATUS < 1) goto L_Return; + announce $@GMSA_MSG$, 3; + goto L_Return; + +L_Return: + return; +} diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt index 04f89159..7d380b0c 100644 --- a/world/map/npc/functions/global_event_handler.txt +++ b/world/map/npc/functions/global_event_handler.txt @@ -12,6 +12,7 @@ OnPCLoginEvent: callfunc "getHeadStyles"; // converts class, color and hair callfunc "ClearVariables"; // removes / converts old variables callfunc "DisplayMOTD"; // send the motd to the client, if enabled + callfunc "getBroadcast"; // get the scheduled broadcast, if any // add more here set @login_event, 2; end; @@ -29,7 +30,7 @@ OnPCDieEvent: callfunc "fightclub_event_die"; // this is used by the 1v1 arena end; -OnInit: //fixme: change to OnInterIfInit +OnInit: callfunc "ClearGlobalVars"; callfunc "MOTD"; // set the MOTD array end; diff --git a/world/map/npc/functions/gm_island.txt b/world/map/npc/functions/gm_island.txt index 94c745a7..89c0790a 100644 --- a/world/map/npc/functions/gm_island.txt +++ b/world/map/npc/functions/gm_island.txt @@ -16,11 +16,6 @@ function|script|GmWarp } function|script|GmDebug { - if (getgmlevel() < 60) - goto L_Return; - goto L_Main; - -L_Main: mes "[Gm Debug]"; mes "What do you want to do?"; menu @@ -31,22 +26,14 @@ L_GmStart: enablenpc "Gm Event#1"; enablenpc "Gm Event#2"; enablenpc "Gm Event#3"; - goto L_Return; + return; L_GmStop: disablenpc "Gm Event#1"; disablenpc "Gm Event#2"; disablenpc "Gm Event#3"; - goto L_Return; - -L_Return: return; } -017-9,32,21,0|script|Gm Event Debug|368 -{ - callfunc "GmDebug"; - close; -} 001-1,49,68,0|script|Gm Event#1|368,0,0 { callfunc "GmWarp"; diff --git a/world/map/npc/functions/superdebug.txt b/world/map/npc/functions/superdebug.txt new file mode 100644 index 00000000..8bb9350a --- /dev/null +++ b/world/map/npc/functions/superdebug.txt @@ -0,0 +1,52 @@ +// all-in-one debug +// author: meko + +function|script|SuperDebug +{ + goto L_Main; + +L_Main: + mes "[Numa]"; + mes "How may I help you?"; + next; + menu + "Announcements", L_StoneBoard, + "Holiday debug", L_Holiday, + "Event debug", L_Event; + // todo: generic npcs (in a future PR) + // todo: map list (in a future PR) + // todo: quest log debug (in a future PR) + +L_Holiday: + if(getgmlevel() < 40) goto L_GM; + mes "[Numa]"; + mes "What holiday do you want to debug?"; + next; + menu + "Xmas.", L_XmasDebug, + "Halloween.", L_HalloweenDebug; + +L_XmasDebug: + callfunc "XmasDebug"; + end; + +L_HalloweenDebug: + callfunc "HalloweenDebug"; + end; + +L_Event: + if(getgmlevel() < 60) goto L_GM; + callfunc "GmDebug"; + close; + +L_StoneBoard: + if (getgmlevel() < 30) goto L_GM; + callfunc "SBConfig"; + close; + +L_GM: + mes "[Numa]"; + mes "I'm awfully sorry."; + mes "You do not have the required GM level to perform this action."; + close; +} -- cgit v1.2.3-60-g2f50 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/functions') 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 From 5a2da4becdc11df9e6400218ed2a449611ad85af Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 12 May 2015 07:35:32 -0400 Subject: request from @MadCamel --- world/map/npc/017-9/npcs.txt | 5 +++++ world/map/npc/functions/announcements.txt | 1 + world/map/npc/functions/motdconfig.txt | 1 + world/map/npc/functions/superdebug.txt | 3 +++ 4 files changed, 10 insertions(+) (limited to 'world/map/npc/functions') diff --git a/world/map/npc/017-9/npcs.txt b/world/map/npc/017-9/npcs.txt index 25409829..c9f9aedb 100644 --- a/world/map/npc/017-9/npcs.txt +++ b/world/map/npc/017-9/npcs.txt @@ -1,6 +1,7 @@ 009-1,42,43,0|script|#SecretDoor|32767,0,0 { if (getgmlevel() < 20 && !debug) end; + gmlog "@warp 017-9"; warp "017-9", 27, 23; end; } @@ -8,6 +9,7 @@ 020-1,60,76,0|script|#SecretDoor2|32767,0,0 { if (getgmlevel() < 20 && !debug) end; + gmlog "@warp 017-9"; warp "017-9", 29, 21; end; } @@ -15,6 +17,7 @@ 001-1,54,118,0|script|#SecretDoor3|32767,0,0 { if (getgmlevel() < 20 && !debug) end; + gmlog "@warp 017-9"; warp "017-9", 21, 21; end; } @@ -22,6 +25,7 @@ 027-2,118,111,0|script|#SecretDoor4|32767,0,0 { if (getgmlevel() < 20 && !debug) end; + gmlog "@warp 017-9"; warp "017-9", 31, 21; end; } @@ -29,6 +33,7 @@ 029-1,34,96,0|script|#SecretDoor5|32767,0,0 { if (getgmlevel() < 20 && !debug) end; + gmlog "@warp 017-9"; warp "017-9", 23, 21; end; } diff --git a/world/map/npc/functions/announcements.txt b/world/map/npc/functions/announcements.txt index ce3d79ef..dd56eadc 100644 --- a/world/map/npc/functions/announcements.txt +++ b/world/map/npc/functions/announcements.txt @@ -128,6 +128,7 @@ L_StartBroadcast: set $@GMSA_CURRENT_TICK, 0; initnpctimer "Stone Board"; mes "Done."; + gmlog strcharinfo(0) + " modified the scheduled broadcast."; goto L_Close; L_Abort: diff --git a/world/map/npc/functions/motdconfig.txt b/world/map/npc/functions/motdconfig.txt index f2541ea6..9ad2b43f 100644 --- a/world/map/npc/functions/motdconfig.txt +++ b/world/map/npc/functions/motdconfig.txt @@ -12,6 +12,7 @@ function|script|MOTDConfig "toggle|Toggle MOTD", L_Toggle; L_Toggle: + gmlog strcharinfo(0) + " enabled or disabled the MOTD."; set $@MOTD_Disabled, !$@MOTD_Disabled; close2; return; diff --git a/world/map/npc/functions/superdebug.txt b/world/map/npc/functions/superdebug.txt index 6ca56b88..b9f067de 100644 --- a/world/map/npc/functions/superdebug.txt +++ b/world/map/npc/functions/superdebug.txt @@ -28,15 +28,18 @@ L_Holiday: "Halloween.", L_HalloweenDebug; L_XmasDebug: + gmlog strcharinfo(0) + " accessed the Xmas debug."; callfunc "XmasDebug"; end; L_HalloweenDebug: + gmlog strcharinfo(0) + " accessed the Halloween debug."; callfunc "HalloweenDebug"; end; L_Event: if(getgmlevel() < 60) goto L_GM; + gmlog strcharinfo(0) + " accessed the GM event debug."; callfunc "GmDebug"; close; -- cgit v1.2.3-60-g2f50