Breakout rest of the enums from dCommonVars and clean it up (#1061)

* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
This commit is contained in:
Aaron Kimbrell
2023-05-02 17:39:21 -05:00
committed by GitHub
parent e8590a5853
commit 6aa90ad5b2
161 changed files with 960 additions and 776 deletions

View File

@@ -78,6 +78,7 @@
#include "eObjectBits.h"
#include "eGameMasterLevel.h"
#include "eReplicaComponentType.h"
#include "eControlScheme.h"
#include "CDObjectsTable.h"
#include "CDZoneTableTable.h"
@@ -497,7 +498,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
const auto state = !entity->GetVar<bool>(u"freecam");
entity->SetVar<bool>(u"freecam", state);
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(state ? 9 : 1));
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlScheme>(state ? 9 : 1));
ChatPackets::SendSystemMessage(sysAddr, u"Toggled freecam.");
return;
@@ -511,7 +512,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
return;
}
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlSceme>(scheme));
GameMessages::SendSetPlayerControlScheme(entity, static_cast<eControlScheme>(scheme));
ChatPackets::SendSystemMessage(sysAddr, u"Switched control scheme.");
return;
@@ -653,7 +654,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}
if (chatCommand == "setflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
uint32_t flagId;
int32_t flagId;
if (!GeneralUtils::TryParse(args[0], flagId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
@@ -664,7 +665,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}
if (chatCommand == "setflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 2) {
uint32_t flagId;
int32_t flagId;
std::string onOffFlag = args[0];
if (!GeneralUtils::TryParse(args[1], flagId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
@@ -677,7 +678,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
entity->GetCharacter()->SetPlayerFlag(flagId, onOffFlag == "on");
}
if (chatCommand == "clearflag" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() == 1) {
uint32_t flagId;
int32_t flagId;
if (!GeneralUtils::TryParse(args[0], flagId)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid flag id.");
@@ -793,7 +794,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
inventory->AddItem(itemLOT, 1, eLootSourceType::LOOT_SOURCE_MODERATION);
inventory->AddItem(itemLOT, 1, eLootSourceType::MODERATION);
} else if (args.size() == 2) {
uint32_t itemLOT;
@@ -811,7 +812,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(eReplicaComponentType::INVENTORY));
inventory->AddItem(itemLOT, count, eLootSourceType::LOOT_SOURCE_MODERATION);
inventory->AddItem(itemLOT, count, eLootSourceType::MODERATION);
} else {
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /gmadditem <lot>");
}
@@ -1346,9 +1347,9 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
if (character) character->SetUScore(character->GetUScore() + uscore);
// LOOT_SOURCE_MODERATION should work but it doesn't. Relog to see uscore changes
// MODERATION should work but it doesn't. Relog to see uscore changes
eLootSourceType lootType = eLootSourceType::LOOT_SOURCE_MODERATION;
eLootSourceType lootType = eLootSourceType::MODERATION;
int32_t type;
if (args.size() >= 2 && GeneralUtils::TryParse(args[1], type)) {
@@ -1466,7 +1467,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}
auto* ch = entity->GetCharacter();
ch->SetCoins(ch->GetCoins() + money, eLootSourceType::LOOT_SOURCE_MODERATION);
ch->SetCoins(ch->GetCoins() + money, eLootSourceType::MODERATION);
}
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
@@ -1478,7 +1479,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}
auto* ch = entity->GetCharacter();
ch->SetCoins(money, eLootSourceType::LOOT_SOURCE_MODERATION);
ch->SetCoins(money, eLootSourceType::MODERATION);
}
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
@@ -1727,7 +1728,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
std::vector<LDFBaseData*> data{};
data.push_back(new LDFData<int32_t>(u"reforgedLOT", reforgedItem));
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::LOOT_SOURCE_MODERATION, eInventoryType::INVALID, data);
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::MODERATION, eInventoryType::INVALID, data);
}
if (chatCommand == "crash" && entity->GetGMLevel() >= eGameMasterLevel::OPERATOR) {