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

@@ -20,6 +20,7 @@
#include "eMissionState.h"
#include "eObjectBits.h"
#include "eGameMasterLevel.h"
#include "ePlayerFlag.h"
Character::Character(uint32_t id, User* parentUser) {
//First load the name, etc:
@@ -362,9 +363,9 @@ void Character::SaveXMLToDatabase() {
}
// Prevents the news feed from showing up on world transfers
if (GetPlayerFlag(ePlayerFlags::IS_NEWS_SCREEN_VISIBLE)) {
if (GetPlayerFlag(ePlayerFlag::IS_NEWS_SCREEN_VISIBLE)) {
auto* s = m_Doc->NewElement("s");
s->SetAttribute("si", ePlayerFlags::IS_NEWS_SCREEN_VISIBLE);
s->SetAttribute("si", ePlayerFlag::IS_NEWS_SCREEN_VISIBLE);
flags->LinkEndChild(s);
}
@@ -417,7 +418,7 @@ void Character::WriteToDatabase() {
delete printer;
}
void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
void Character::SetPlayerFlag(const int32_t flagId, const bool value) {
// If the flag is already set, we don't have to recalculate it
if (GetPlayerFlag(flagId) == value) return;
@@ -464,7 +465,7 @@ void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
GameMessages::SendNotifyClientFlagChange(m_ObjectID, flagId, value, m_ParentUser->GetSystemAddress());
}
bool Character::GetPlayerFlag(const uint32_t flagId) const {
bool Character::GetPlayerFlag(const int32_t flagId) const {
// Calculate the index first
const auto flagIndex = uint32_t(std::floor(flagId / 64));
@@ -481,8 +482,8 @@ bool Character::GetPlayerFlag(const uint32_t flagId) const {
void Character::SetRetroactiveFlags() {
// Retroactive check for if player has joined a faction to set their 'joined a faction' flag to true.
if (GetPlayerFlag(ePlayerFlags::VENTURE_FACTION) || GetPlayerFlag(ePlayerFlags::ASSEMBLY_FACTION) || GetPlayerFlag(ePlayerFlags::PARADOX_FACTION) || GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) {
SetPlayerFlag(ePlayerFlags::JOINED_A_FACTION, true);
if (GetPlayerFlag(ePlayerFlag::VENTURE_FACTION) || GetPlayerFlag(ePlayerFlag::ASSEMBLY_FACTION) || GetPlayerFlag(ePlayerFlag::PARADOX_FACTION) || GetPlayerFlag(ePlayerFlag::SENTINEL_FACTION)) {
SetPlayerFlag(ePlayerFlag::JOINED_A_FACTION, true);
}
}
@@ -542,7 +543,7 @@ void Character::OnZoneLoad() {
if (missionComponent != nullptr) {
// Fix the monument race flag
if (missionComponent->GetMissionState(319) >= eMissionState::READY_TO_COMPLETE) {
SetPlayerFlag(33, true);
SetPlayerFlag(ePlayerFlag::AG_FINISH_LINE_BUILT, true);
}
}
@@ -558,7 +559,7 @@ void Character::OnZoneLoad() {
*/
if (HasPermission(ePermissionMap::Old)) {
if (GetCoins() > 1000000) {
SetCoins(1000000, eLootSourceType::LOOT_SOURCE_NONE);
SetCoins(1000000, eLootSourceType::NONE);
}
}
@@ -636,7 +637,7 @@ void Character::SetBillboardVisible(bool visible) {
// The GameMessage we send for turning the nameplate off just deletes the BillboardSubcomponent from the parent component.
// Because that same message does not allow for custom parameters, we need to create the BillboardSubcomponent a different way
// This workaround involves sending an unrelated GameMessage that does not apply to player entites,
// This workaround involves sending an unrelated GameMessage that does not apply to player entites,
// but forces the client to create the necessary SubComponent that controls the billboard.
GameMessages::SendShowBillboardInteractIcon(UNASSIGNED_SYSTEM_ADDRESS, m_OurEntity->GetObjectID());