summaryrefslogtreecommitdiff
path: root/npc/commands
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2016-08-09 14:10:24 -0400
committergumi <mekolat@users.noreply.github.com>2016-09-01 12:08:59 -0400
commiteb074c8e29521749639368f2d9fca4ab1e728b34 (patch)
tree5e11c7b039754fbcd11bb15e99228ebbb7b2baa3 /npc/commands
parent124ac1561042fdbd5b1f6b1df72893d997ac274c (diff)
downloadserverdata-eb074c8e29521749639368f2d9fca4ab1e728b34.tar.gz
serverdata-eb074c8e29521749639368f2d9fca4ab1e728b34.tar.bz2
serverdata-eb074c8e29521749639368f2d9fca4ab1e728b34.tar.xz
serverdata-eb074c8e29521749639368f2d9fca4ab1e728b34.zip
add Super Menu, add scripted MOTD, add MOTD config
Diffstat (limited to 'npc/commands')
-rw-r--r--npc/commands/motd.txt182
-rw-r--r--npc/commands/numa.txt49
2 files changed, 231 insertions, 0 deletions
diff --git a/npc/commands/motd.txt b/npc/commands/motd.txt
new file mode 100644
index 00000000..4bf3a11c
--- /dev/null
+++ b/npc/commands/motd.txt
@@ -0,0 +1,182 @@
+function script displayMOTD {
+ .@size = getvariableofnpc(.size, "@motd");
+ .@dsize = getvariableofnpc(.dsize, "@motd");
+
+ // generic MOTD
+ for (.@i = 0; .@i < .@size; ++.@i)
+ {
+ dispbottom $MOTD_Messages$[.@i];
+ }
+
+ // git stuff and such
+ if (debug)
+ {
+ for (.@i = 0; .@i < .@dsize; ++.@i)
+ {
+ dispbottom $Debug_Messages$[.@i]; // FIXME: send this to the Debug tab instead
+ }
+ }
+ return;
+}
+
+function script MOTDConfig {
+
+ function toggleMOTD {
+ $MOTD_Disabled = !($MOTD_Disabled);
+ // FIXME: log to GM log
+ }
+
+ function addNewLine {
+ clear;
+ mes l("Please enter the new line.");
+ input .@s$;
+ .@s$ = strip(.@s$);
+ if (.@s$ != "")
+ {
+ .@size = getvariableofnpc(.size, "@motd");
+ $MOTD_Messages$[.@size] = .@s$;
+ set getvariableofnpc(.size, "@motd"), getarraysize($MOTD_Messages$);
+ // FIXME: log to GM log
+ }
+ }
+
+ function modifyLine {
+
+ function removeLine {
+ .@l = getarg(0);
+ deletearray $MOTD_Messages$[.@l], 1; // remove and shift
+ mes l("Line @@ has been removed.", .@l);
+ set getvariableofnpc(.size, "@motd"), getarraysize($MOTD_Messages$);
+ // FIXME: log to GM log
+ }
+
+ function moveUp {
+ .@l = getarg(0);
+ .@top$ = $MOTD_Messages$[.@l - 1];
+ $MOTD_Messages$[.@l - 1] = $MOTD_Messages$[.@l];
+ $MOTD_Messages$[.@l] = .@top$;
+ }
+
+ function moveDown {
+ .@l = getarg(0);
+ .@bottom$ = $MOTD_Messages$[.@l + 1];
+ $MOTD_Messages$[.@l + 1] = $MOTD_Messages$[.@l];
+ $MOTD_Messages$[.@l] = .@bottom$;
+ }
+
+ function editLine {
+ .@l = getarg(0);
+ clear;
+ mes l("Old line:");
+ mes "---";
+ mes $MOTD_Messages$[.@l];
+ mes "---";
+ mes "";
+ mes l("Enter new line:");
+ next;
+ input .@s$;
+ .@s$ = strip(.@s$);
+ if (.@s$ != "")
+ {
+ $MOTD_Messages$[.@l] = .@s$;
+ // FIXME: log to GM log
+ }
+ }
+
+ .@max = (getarg(0) - 1);
+
+ do
+ {
+ mes l("Enter line number:");
+ next;
+ input .@n;
+ if ($MOTD_Messages$[.@n] != "")
+ {
+ clear;
+ mes l("line @@: @@", .@n, $MOTD_Messages$[.@n]);
+ next;
+ menuint
+ l("Modify another line"), 1,
+ l("Remove this line"), 2,
+ l("Modify this line"), 3,
+ rif(.@n > 0, l("Move this line up")), 4,
+ rif(.@n < .@max, l("Move this line down")), 5,
+ l("Return to main menu"), 6;
+
+ switch (@menuret)
+ {
+ case 2: removeLine .@n; return;
+ case 3: editLine .@n; return;
+ case 4: moveUp .@n; return;
+ case 5: moveDown .@n; return;
+ case 6: return;
+ }
+ }
+ } while (1);
+ }
+
+ do
+ {
+ clear;
+ setnpcdialogtitle l("MOTD Config");
+ mes l("This menu allows you to modify the generic message that is sent to players on login.");
+ mes "";
+
+ mes "---";
+ .@size = getvariableofnpc(.size, "@motd");
+ for (.@i = 0; .@i < .@size; ++.@i)
+ {
+ mes l("line @@: @@", .@i, $MOTD_Messages$[.@i]);
+ }
+ if (.@size == 0)
+ {
+ mes "(" + l("no active MOTD") + ")";
+ }
+ mes "---";
+ .@d = $MOTD_Disabled;
+ mes l("Enabled: @@", (.@d ? l("no") : l("yes")));
+ next;
+
+ menuint
+ (.@d ? l("Enable") : l("Disable")), 1,
+ l("Add a new line"), 2,
+ rif(.@size, l("Modify or remove a line")), 3,
+ rif(.@size, l("Test MOTD")), 4,
+ rif(getarg(0,0), l("Return to Super Menu")), 5,
+ l("Close"), 6;
+
+ switch (@menuret)
+ {
+ case 1: toggleMOTD; break;
+ case 2: addNewLine; break;
+ case 3: modifyLine .@size; break;
+ case 4: displayMOTD; break;
+ case 6: closedialog; end;
+ default: return;
+ }
+ } while (1);
+}
+
+
+
+
+- script @motd 32767,{
+ end;
+
+OnCall:
+ MOTDConfig;
+ closedialog;
+ end;
+
+OnPCLoginEvent:
+ if ($MOTD_Disabled < 1)
+ {
+ displayMOTD;
+ }
+ end;
+
+OnInit:
+ .size = getarraysize($MOTD_Messages$);
+ .dsize = getarraysize($Debug_Messages$);
+ bindatcmd "motd", "@motd::OnCall", 3, 99, 0;
+}
diff --git a/npc/commands/numa.txt b/npc/commands/numa.txt
new file mode 100644
index 00000000..0083a677
--- /dev/null
+++ b/npc/commands/numa.txt
@@ -0,0 +1,49 @@
+function script SuperMenu {
+ do
+ {
+ .@gid = getgroupid();
+ clear;
+ setnpcdialogtitle l("Super Menu");
+ mes l("This menu contains all options available to you, based on your access privileges.");
+ mes "";
+ mes l("What do you want to access?");
+ next;
+ menuint
+ rif(.@gid >= 3, l("Scheduled broadcasts")), 1,
+ rif(.@gid >= 3, l("MOTD")), 2,
+ rif(.@gid >= 4, l("Event management")), 3,
+ l("Debug"), 4,
+ l("Close"), 5;
+
+ switch (@menuret)
+ {
+ //case 1: StoneBoard 1; break;
+ case 2: MOTDConfig 1; break;
+ //case 3: GlobalEventMenu 1; break;
+ //case 4: GlobalDebugMenu 1; break;
+ default: return;
+ }
+ } while (1);
+}
+
+
+
+- script @numa 32767,{
+ end;
+
+OnCall:
+ .@gid = getgroupid();
+
+ if (!debug && .@gid < 3)
+ {
+ dispbottom l("You do not have the required access privileges to use the Super Menu.");
+ end;
+ }
+
+ SuperMenu;
+ closedialog;
+ end;
+
+OnInit:
+ bindatcmd "numa", "@numa::OnCall", 0, 99, 0;
+}