From cd808416c85d871d9fe11f2e43f691a5402b3e78 Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sat, 29 Mar 2025 14:22:14 -0500 Subject: [PATCH] [Command] Add #show zone_variables (#4812) --- zone/gm_commands/show.cpp | 2 ++ zone/gm_commands/show/zone_variables.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 zone/gm_commands/show/zone_variables.cpp diff --git a/zone/gm_commands/show.cpp b/zone/gm_commands/show.cpp index 342eaae46..8f45ee869 100755 --- a/zone/gm_commands/show.cpp +++ b/zone/gm_commands/show.cpp @@ -49,6 +49,7 @@ #include "show/zone_loot.cpp" #include "show/zone_points.cpp" #include "show/zone_status.cpp" +#include "show/zone_variables.cpp" void command_show(Client *c, const Seperator *sep) { @@ -110,6 +111,7 @@ void command_show(Client *c, const Seperator *sep) Cmd{.cmd = "zone_loot", .u = "zone_loot", .fn = ShowZoneLoot, .a = {"#viewzoneloot"}}, Cmd{.cmd = "zone_points", .u = "zone_points", .fn = ShowZonePoints, .a = {"#showzonepoints"}}, Cmd{.cmd = "zone_status", .u = "zone_status", .fn = ShowZoneStatus, .a = {"#zonestatus"}}, + Cmd{.cmd = "zone_variables", .u = "zone_variables", .fn = ShowZoneVariables}, }; // Check for arguments diff --git a/zone/gm_commands/show/zone_variables.cpp b/zone/gm_commands/show/zone_variables.cpp new file mode 100644 index 000000000..4af24fa0b --- /dev/null +++ b/zone/gm_commands/show/zone_variables.cpp @@ -0,0 +1,16 @@ +#include "../../client.h" +#include "../../zone.h" + +extern Zone* zone; + +void ShowZoneVariables(Client *c, const Seperator *sep) +{ + if (!zone->GetVariables().empty()) { + c->Message(Chat::White, "Zone Variables:"); + for (auto &key: zone->GetVariables()) { + c->Message(Chat::White, fmt::format("{}: {}", key, zone->GetVariable(key)).c_str()); + } + } else { + c->Message(Chat::White, "No zone variables set."); + } +}