diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 428ccbcb..18aff7b5 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -1427,4 +1427,13 @@ void SlashCommandHandler::Startup() { .requiredLevel = eGameMasterLevel::CIVILIAN }; RegisterCommand(removeIgnoreCommand); + + Command itemDescriptionCommand{ + .help = "Special UI command, does nothing when used in chat.", + .info = "Special UI command, does nothing when used in chat.", + .aliases = {"d"}, + .handle = GMZeroCommands::ItemDescription, + .requiredLevel = eGameMasterLevel::CIVILIAN + }; + RegisterCommand(itemDescriptionCommand); } diff --git a/dGame/dUtilities/SlashCommands/GMZeroCommands.cpp b/dGame/dUtilities/SlashCommands/GMZeroCommands.cpp index 6c9811c2..3b943b8c 100644 --- a/dGame/dUtilities/SlashCommands/GMZeroCommands.cpp +++ b/dGame/dUtilities/SlashCommands/GMZeroCommands.cpp @@ -225,6 +225,36 @@ namespace GMZeroCommands { ChatPackets::SendSystemMessage(sysAddr, u"Map: " + (GeneralUtils::to_u16string(zoneId.GetMapID())) + u"\nClone: " + (GeneralUtils::to_u16string(zoneId.GetCloneID())) + u"\nInstance: " + (GeneralUtils::to_u16string(zoneId.GetInstanceID()))); } + void ItemDescription(Entity* entity, const SystemAddress& sysAddr, const std::string args) { + auto splitArgs = GeneralUtils::SplitString(args, ' '); + if (splitArgs.empty()) return; + + auto requestId = GeneralUtils::TryParse(splitArgs[0]); + + if (!requestId.has_value()) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid item ID."); + return; + } + + auto itemId = GeneralUtils::TryParse(splitArgs[1]); + + if (!itemId.has_value()) { + ChatPackets::SendSystemMessage(sysAddr, u"Invalid item ID."); + return; + } + + std::stringstream messageName; + messageName << "desc" << requestId.value(); + + AMFArrayValue amfArgs; + + amfArgs.Insert("t", true); + amfArgs.Insert("d", "Test description"); + amfArgs.Insert("n", messageName.str()); + + GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, messageName.str(), amfArgs); + } + //For client side commands void ClientHandled(Entity* entity, const SystemAddress& sysAddr, const std::string args) {} diff --git a/dGame/dUtilities/SlashCommands/GMZeroCommands.h b/dGame/dUtilities/SlashCommands/GMZeroCommands.h index d3f6753d..64d71d46 100644 --- a/dGame/dUtilities/SlashCommands/GMZeroCommands.h +++ b/dGame/dUtilities/SlashCommands/GMZeroCommands.h @@ -15,6 +15,7 @@ namespace GMZeroCommands { void LeaveZone(Entity* entity, const SystemAddress& sysAddr, const std::string args); void Resurrect(Entity* entity, const SystemAddress& sysAddr, const std::string args); void InstanceInfo(Entity* entity, const SystemAddress& sysAddr, const std::string args); + void ItemDescription(Entity* entity, const SystemAddress& sysAddr, const std::string args); void ClientHandled(Entity* entity, const SystemAddress& sysAddr, const std::string args); }