Added support for flags in macros (#410)

This commit is contained in:
David Markowitz 2022-01-24 05:57:50 -08:00 committed by GitHub
parent 20037d12f7
commit 1e01423a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -671,6 +671,21 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
entity->GetCharacter()->SetPlayerFlag(flagId, true); entity->GetCharacter()->SetPlayerFlag(flagId, true);
} }
if (chatCommand == "setflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 2)
{
uint32_t flagId;
std::string onOffFlag = args[0];
if (!GeneralUtils::TryParse(args[1], flagId))
{
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
return;
}
if (onOffFlag != "off" && onOffFlag != "on") {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag type.");
return;
}
entity->GetCharacter()->SetPlayerFlag(flagId, onOffFlag == "on");
}
if (chatCommand == "clearflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) if (chatCommand == "clearflag" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1)
{ {
uint32_t flagId; uint32_t flagId;