From 1e01423a935058edb7b1bc78dca20cc34e5ca467 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Mon, 24 Jan 2022 05:57:50 -0800 Subject: [PATCH] Added support for flags in macros (#410) --- dGame/dUtilities/SlashCommandHandler.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 0217554e..5779fe3f 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -671,6 +671,21 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit 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) { uint32_t flagId;