breakout gmlevel into a scoped enum (#996)

* breakout gmlevel enum and make it a class
tested that things still work
slash command,
chat restrictions,
packets and serializations

* fix GM level for some slash commands

* fix new use of this enum
This commit is contained in:
Aaron Kimbrell
2023-03-24 18:16:45 -05:00
committed by GitHub
parent b967cc57d1
commit 72ca0f13ff
24 changed files with 184 additions and 159 deletions

View File

@@ -18,6 +18,7 @@
#include "InventoryComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "eGameMasterLevel.h"
Character::Character(uint32_t id, User* parentUser) {
//First load the name, etc:
@@ -204,7 +205,9 @@ void Character::DoQuickXMLDataParse() {
tinyxml2::XMLElement* character = m_Doc->FirstChildElement("obj")->FirstChildElement("char");
if (character) {
character->QueryAttribute("cc", &m_Coins);
character->QueryAttribute("gm", &m_GMLevel);
int32_t gm_level = 0;
character->QueryAttribute("gm", &gm_level);
m_GMLevel = static_cast<eGameMasterLevel>(gm_level);
uint64_t lzidConcat = 0;
if (character->FindAttribute("lzid")) {
@@ -304,7 +307,7 @@ void Character::SaveXMLToDatabase() {
tinyxml2::XMLElement* character = m_Doc->FirstChildElement("obj")->FirstChildElement("char");
if (character) {
character->SetAttribute("gm", m_GMLevel);
character->SetAttribute("gm", static_cast<uint32_t>(m_GMLevel));
character->SetAttribute("cc", m_Coins);
auto zoneInfo = dZoneManager::Instance()->GetZone()->GetZoneID();
@@ -545,7 +548,7 @@ void Character::OnZoneLoad() {
const auto maxGMLevel = m_ParentUser->GetMaxGMLevel();
// This does not apply to the GMs
if (maxGMLevel > GAME_MASTER_LEVEL_CIVILIAN) {
if (maxGMLevel > eGameMasterLevel::CIVILIAN) {
return;
}