Test for reactive item descriptions

This commit is contained in:
wincent 2024-05-24 15:06:40 +02:00
parent f0960d48b2
commit 7845131649
3 changed files with 40 additions and 0 deletions

View File

@ -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);
}

View File

@ -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<int32_t>(splitArgs[0]);
if (!requestId.has_value()) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid item ID.");
return;
}
auto itemId = GeneralUtils::TryParse<int32_t>(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) {}

View File

@ -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);
}