From e9be2d76c3609a77570587950d680e475738bbbf Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sat, 2 Aug 2025 20:15:44 -0400 Subject: [PATCH] [Commands] Add #show keyring Subcommand (#4973) --- .../command_subsettings_repository.h | 1 + zone/client.cpp | 18 +++++++++++++++--- zone/client.h | 2 +- zone/client_packet.cpp | 2 +- zone/gm_commands/show.cpp | 2 ++ zone/gm_commands/show/keyring.cpp | 12 ++++++++++++ zone/lua_client.cpp | 9 ++++++++- zone/lua_client.h | 1 + zone/perl_client.cpp | 10 ++++++++-- 9 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 zone/gm_commands/show/keyring.cpp diff --git a/common/repositories/command_subsettings_repository.h b/common/repositories/command_subsettings_repository.h index 7faaf76b1..963bcee91 100644 --- a/common/repositories/command_subsettings_repository.h +++ b/common/repositories/command_subsettings_repository.h @@ -142,6 +142,7 @@ public: {.parent_command = "show", .sub_command = "hatelist", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "hatelist"}, {.parent_command = "show", .sub_command = "inventory", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "peekinv"}, {.parent_command = "show", .sub_command = "ip_lookup", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "iplookup"}, + {.parent_command = "show", .sub_command = "keyring", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showkeyring"}, {.parent_command = "show", .sub_command = "line_of_sight", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "checklos"}, {.parent_command = "show", .sub_command = "network", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "network"}, {.parent_command = "show", .sub_command = "network_stats", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "netstats"}, diff --git a/zone/client.cpp b/zone/client.cpp index f296f2729..17eb2bac5 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4780,9 +4780,21 @@ bool Client::KeyRingClear() ); } -void Client::KeyRingList() +void Client::KeyRingList(Client* c) { - Message(Chat::LightBlue, "Keys on Keyring:"); + if (!c) { + return; + } + + std::string message = "Keys on Keyring:"; + if (c != this) { + message = fmt::format( + "Keys on Keyring for {}:", + GetCleanName() + ); + } + + c->Message(Chat::LightBlue, message.c_str()); const EQ::ItemData *item = nullptr; @@ -4795,7 +4807,7 @@ void Client::KeyRingList() item->Name ); - Message(Chat::LightBlue, item_string.c_str()); + c->Message(Chat::LightBlue, item_string.c_str()); } } } diff --git a/zone/client.h b/zone/client.h index b75fb56f0..8bf808b1d 100644 --- a/zone/client.h +++ b/zone/client.h @@ -331,7 +331,7 @@ public: bool KeyRingCheck(uint32 item_id); bool KeyRingClear(); bool KeyRingRemove(uint32 item_id); - void KeyRingList(); + void KeyRingList(Client* c = nullptr); bool IsNameChangeAllowed(); void InvokeChangeNameWindow(bool immediate = true); bool ClearNameChange(); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 3bbfc7cb5..5ee5fb709 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9782,7 +9782,7 @@ void Client::Handle_OP_Jump(const EQApplicationPacket *app) void Client::Handle_OP_KeyRing(const EQApplicationPacket *app) { - KeyRingList(); + KeyRingList(this); } void Client::Handle_OP_KickPlayers(const EQApplicationPacket *app) diff --git a/zone/gm_commands/show.cpp b/zone/gm_commands/show.cpp index 8f45ee869..5a5de4560 100755 --- a/zone/gm_commands/show.cpp +++ b/zone/gm_commands/show.cpp @@ -15,6 +15,7 @@ #include "show/group_info.cpp" #include "show/hatelist.cpp" #include "show/inventory.cpp" +#include "show/keyring.cpp" #include "show/ip_lookup.cpp" #include "show/line_of_sight.cpp" #include "show/network.cpp" @@ -78,6 +79,7 @@ void command_show(Client *c, const Seperator *sep) Cmd{.cmd = "hatelist", .u = "hatelist", .fn = ShowHateList, .a = {"#hatelist"}}, Cmd{.cmd = "inventory", .u = "inventory", .fn = ShowInventory, .a = {"#peekinv"}}, Cmd{.cmd = "ip_lookup", .u = "ip_lookup", .fn = ShowIPLookup, .a = {"#iplookup"}}, + Cmd{.cmd = "keyring", .u = "keyring", .fn = ShowKeyring, .a = {"#showkeyring"}}, Cmd{.cmd = "line_of_sight", .u = "line_of_sight", .fn = ShowLineOfSight, .a = {"#checklos"}}, Cmd{.cmd = "network", .u = "network", .fn = ShowNetwork, .a = {"#network"}}, Cmd{.cmd = "network_stats", .u = "network_stats", .fn = ShowNetworkStats, .a = {"#netstats"}}, diff --git a/zone/gm_commands/show/keyring.cpp b/zone/gm_commands/show/keyring.cpp new file mode 100644 index 000000000..39552f8cc --- /dev/null +++ b/zone/gm_commands/show/keyring.cpp @@ -0,0 +1,12 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowKeyring(Client *c, const Seperator *sep) +{ + Client* t = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + t = c->GetTarget()->CastToClient(); + } + + t->KeyRingList(c); +} diff --git a/zone/lua_client.cpp b/zone/lua_client.cpp index b99636f19..a295f5c6d 100644 --- a/zone/lua_client.cpp +++ b/zone/lua_client.cpp @@ -3575,7 +3575,13 @@ bool Lua_Client::KeyRingClear() void Lua_Client::KeyRingList() { Lua_Safe_Call_Void(); - self->KeyRingList(); + self->KeyRingList(self); +} + +void Lua_Client::KeyRingList(Lua_Client c) +{ + Lua_Safe_Call_Void(); + self->KeyRingList(self); } bool Lua_Client::KeyRingRemove(uint32 item_id) @@ -3932,6 +3938,7 @@ luabind::scope lua_register_client() { .def("KeyRingCheck", (bool(Lua_Client::*)(uint32))&Lua_Client::KeyRingCheck) .def("KeyRingClear", (bool(Lua_Client::*)(void))&Lua_Client::KeyRingClear) .def("KeyRingList", (void(Lua_Client::*)(void))&Lua_Client::KeyRingList) + .def("KeyRingList", (void(Lua_Client::*)(Lua_Client))&Lua_Client::KeyRingList) .def("KeyRingRemove", (bool(Lua_Client::*)(uint32))&Lua_Client::KeyRingRemove) .def("Kick", (void(Lua_Client::*)(void))&Lua_Client::Kick) .def("LearnDisciplines", (uint16(Lua_Client::*)(uint8,uint8))&Lua_Client::LearnDisciplines) diff --git a/zone/lua_client.h b/zone/lua_client.h index 04b9da273..583589910 100644 --- a/zone/lua_client.h +++ b/zone/lua_client.h @@ -521,6 +521,7 @@ public: bool KeyRingCheck(uint32 item_id); bool KeyRingClear(); void KeyRingList(); + void KeyRingList(Lua_Client c); bool KeyRingRemove(uint32 item_id); bool CompleteTask(int task_id); bool UncompleteTask(int task_id); diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 2f853c9cb..d4a73c851 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -3328,7 +3328,12 @@ bool Perl_Client_KeyRingClear(Client* self) void Perl_Client_KeyRingList(Client* self) { - self->KeyRingList(); + self->KeyRingList(self); +} + +void Perl_Client_KeyRingList(Client* self, Client* c) +{ + self->KeyRingList(c); } bool Perl_Client_KeyRingRemove(Client* self, uint32 item_id) @@ -3675,7 +3680,8 @@ void perl_register_client() package.add("KeyRingAdd", &Perl_Client_KeyRingAdd); package.add("KeyRingCheck", &Perl_Client_KeyRingCheck); package.add("KeyRingClear", &Perl_Client_KeyRingClear); - package.add("KeyRingList", &Perl_Client_KeyRingList); + package.add("KeyRingList", (void(*)(Client*))&Perl_Client_KeyRingList); + package.add("KeyRingList", (void(*)(Client*, Client*))&Perl_Client_KeyRingList); package.add("KeyRingRemove", &Perl_Client_KeyRingRemove); package.add("Kick", &Perl_Client_Kick); package.add("LearnDisciplines", &Perl_Client_LearnDisciplines);