mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-23 05:53:34 +00:00
Test for reactive item descriptions
This commit is contained in:
parent
f0960d48b2
commit
7845131649
@ -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);
|
||||
}
|
||||
|
@ -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) {}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user