Core/Players: use CharacterFlags enums to store player information in database and set player flags accordingly

This commit is contained in:
Ovahlord committed 2026-03-22 18:07:14 +01:00
1 parent 9c96064c11
commit db7998ae28
13 files changed
+243 -124

No files matched your search

+122 -61
View File
@@ -93,6 +93,7 @@
#include "QuestPools.h"
#include "Realm.h"
#include "ReputationMgr.h"
#include "SharedDefines.h"
#include "SkillDiscovery.h"
#include "SocialMgr.h"
#include "Spell.h"
@@ -145,7 +146,8 @@ std::array<uint32, MAX_CLASSES> const MasterySpells =
uint64 const MAX_MONEY_AMOUNT = 9999999999ULL;
Player::Player(WorldSession* session): Unit(true)
Player::Player(WorldSession* session) : Unit(true),
_characterFlags(CHARACTER_FLAG_NONE), _characterFlags2(CHARACTER_FLAG_2_NONE)
{
m_objectType |= TYPEMASK_PLAYER;
m_objectTypeId = TYPEID_PLAYER;
@@ -161,11 +163,10 @@ Player::Player(WorldSession* session): Unit(true)
m_ExtraFlags = 0;
m_spellModTakingSpell = nullptr;
//m_pad = 0;
// m_pad = 0;
// players always accept
if (!GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS))
SetAcceptWhispers(true);
if (!GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS)) SetAcceptWhispers(true);
m_comboPoints = 0;
@@ -218,7 +219,7 @@ Player::Player(WorldSession* session): Unit(true)
// Init rune flags
m_runeGraceCooldown.fill(0xFFFFFFFF);
m_lastRuneGraceTimers = { };
m_lastRuneGraceTimers = {};
m_MirrorTimer.fill(DISABLED_MIRROR_TIMER);
@@ -239,7 +240,7 @@ Player::Player(WorldSession* session): Unit(true)
m_logintime = GameTime::GetGameTime();
m_Last_tick = m_logintime;
m_Played_time = { };
m_Played_time = {};
m_WeaponProficiency = 0;
m_ArmorProficiency = 0;
m_canParry = false;
@@ -248,9 +249,9 @@ Player::Player(WorldSession* session): Unit(true)
m_titanGripPenaltySpellId = 0;
m_temporaryUnsummonedPetNumber = 0;
//cache for UNIT_CREATED_BY_SPELL to allow
//returning reagents for temporarily removed pets
//when dying/logging out
// cache for UNIT_CREATED_BY_SPELL to allow
// returning reagents for temporarily removed pets
// when dying/logging out
m_oldpetspell = 0;
m_lastpetnumber = 0;
@@ -283,7 +284,7 @@ Player::Player(WorldSession* session): Unit(true)
m_auraBaseFlatMod.fill(0.0f);
m_auraBasePctMod.fill(1.0f);
m_baseRatingValue = { };
m_baseRatingValue = {};
m_baseSpellPower = 0;
m_baseManaRegen = 0;
@@ -2020,6 +2021,7 @@ void Player::SetGameMaster(bool on)
{
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
SetFaction(FACTION_FRIENDLY);
AddCharacterFlag(CHARACTER_FLAG_GM_MODE);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
@@ -2040,6 +2042,7 @@ void Player::SetGameMaster(bool on)
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
SetFactionForRace(getRace());
RemoveCharacterFlag(CHARACTER_FLAG_GM_MODE);
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
@@ -6944,6 +6947,45 @@ void Player::UpdateConquestCurrencyCap(uint32 currency)
SendDirectMessage(&packet);
}
}
void Player::InitializePlayerFlags()
{
uint32 flags = PLAYER_FLAGS_NONE;
if (HasCharacterFlag(CHARACTER_FLAG_HIDE_CLOAK))
flags |= PLAYER_FLAGS_HIDE_CLOAK;
if (HasCharacterFlag(CHARACTER_FLAG_HIDE_HELM))
flags |= PLAYER_FLAGS_HIDE_HELM;
if (HasCharacterFlag(CHARACTER_FLAG_GM_MODE))
flags |= PLAYER_FLAGS_GM;
if (HasCharacterFlag(CHARACTER_FLAG_GHOST))
flags |= PLAYER_FLAGS_GHOST;
if (HasCharacterFlag(CHARACTER_FLAG_RESTING))
flags |= PLAYER_FLAGS_RESTING;
if (HasCharacterFlag(CHARACTER_FLAG_PVP_ENABLED))
flags |= PLAYER_FLAGS_CONTESTED_PVP;
if (HasCharacterFlag(CHARACTER_FLAG_PVP_DESIRED))
flags |= PLAYER_FLAGS_IN_PVP;
if (HasCharacterFlag(CHARACTER_FLAG_2_NO_XP_GAIN))
flags |= PLAYER_FLAGS_NO_XP_GAIN;
if (HasCharacterFlag(CHARACTER_FLAG_2_CAN_USE_VOID_STORAGE_FEATURE))
flags |= PLAYER_FLAGS_VOID_UNLOCKED;
if (HasCharacterFlag(CHARACTER_FLAG_2_AUTO_DECLINE_GUILD))
flags |= PLAYER_FLAGS_AUTO_DECLINE_GUILD;
if (HasCharacterFlag(CHARACTER_FLAG_2_LOW_LEVEL_RAID_ENABLED))
flags |= PLAYER_FLAGS_LOW_LEVEL_RAID_ENABLED;
SetUInt32Value(PLAYER_FLAGS, flags);
}
void Player::SetInGuild(uint32 guildId)
{
@@ -16423,17 +16465,17 @@ bool Player::IsLoading() const
bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& holder)
{
//// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
//QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, playerFlags, "
// 17 18 19 20 21 22 23 24 25 26 27 28 29
//"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
// 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
//// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, "
// 16, 17 18 19 20 21 22 23 24 25 26 27 28 29 30
//" characterFlags, characterFlags2, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
// 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
//"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, "
// 45 46 47 48 49 50
// 46 47 48 49 50 51
//"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
// 51 52 53 54 55 56 57 58 59 60 61
// 52 53 54 55 56 57 58 59 60 61 62
//"health, power1, power2, power3, power4, power5, instance_id, speccount, activespec, exploredZones, equipmentCache, "
// 62 63 64 65
// 63 64 65 66
//"knownTitles, actionBars, grantableLevels, fishing_steps FROM characters WHERE guid = '%u'", guid);
PreparedQueryResult result = holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
@@ -16503,11 +16545,11 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
if (!_LoadIntoDataField(fields[60].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE))
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid exploredzones data (%s). Forcing partial load.", guid.ToString().c_str(), fields[60].GetCString());
if (!_LoadIntoDataField(fields[61].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE))
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid exploredzones data (%s). Forcing partial load.", guid.ToString().c_str(), fields[61].GetCString());
if (!_LoadIntoDataField(fields[62].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2))
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid knowntitles mask (%s). Forcing partial load.", guid.ToString().c_str(), fields[62].GetCString());
if (!_LoadIntoDataField(fields[63].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2))
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid knowntitles mask (%s). Forcing partial load.", guid.ToString().c_str(), fields[63].GetCString());
SetObjectScale(1.0f);
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
@@ -16528,7 +16570,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
SetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS, fields[14].GetUInt8());
SetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_REST_STATE, fields[15].GetUInt8());
SetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_GENDER, fields[5].GetUInt8());
SetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION, fields[50].GetUInt8());
SetByteValue(PLAYER_BYTES_3, PLAYER_BYTES_3_OFFSET_INEBRIATION, fields[51].GetUInt8());
if (!ValidateAppearance(
fields[3].GetUInt8(), // race
@@ -16544,13 +16586,17 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
return false;
}
SetUInt32Value(PLAYER_FLAGS, fields[16].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[49].GetUInt32());
_characterFlags = static_cast<CharacterFlags>(fields[16].GetUInt32());
_characterFlags2 = static_cast<CharacterFlags2>(fields[17].GetUInt32());
InitializePlayerFlags();
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[50].GetUInt32());
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
SetByteValue(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES, fields[63].GetUInt8());
SetByteValue(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTES_OFFSET_ACTION_BAR_TOGGLES, fields[64].GetUInt8());
m_fishingSteps = fields[65].GetUInt8();
m_fishingSteps = fields[66].GetUInt8();
InitDisplayIds();
@@ -16579,23 +16625,23 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
InitPrimaryProfessions(); // to max set before any spell loaded
// init saved position, and fix it later if problematic
ObjectGuid::LowType transLowGUID = fields[36].GetUInt32();
ObjectGuid::LowType transLowGUID = fields[37].GetUInt32();
Relocate(fields[17].GetFloat(), fields[18].GetFloat(), fields[19].GetFloat(), fields[21].GetFloat());
Relocate(fields[18].GetFloat(), fields[19].GetFloat(), fields[20].GetFloat(), fields[22].GetFloat());
uint32 mapId = fields[20].GetUInt16();
uint32 instanceId = fields[57].GetUInt32();
uint32 mapId = fields[21].GetUInt16();
uint32 instanceId = fields[58].GetUInt32();
uint32 dungeonDiff = fields[44].GetUInt8() & 0x0F;
uint32 dungeonDiff = fields[45].GetUInt8() & 0x0F;
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
dungeonDiff = DUNGEON_DIFFICULTY_NORMAL;
uint32 raidDiff = (fields[44].GetUInt8() >> 4) & 0x0F;
uint32 raidDiff = (fields[45].GetUInt8() >> 4) & 0x0F;
if (raidDiff >= MAX_RAID_DIFFICULTY)
raidDiff = RAID_DIFFICULTY_10MAN_NORMAL;
SetDungeonDifficulty(Difficulty(dungeonDiff)); // may be changed in _LoadGroup
SetRaidDifficulty(Difficulty(raidDiff)); // may be changed in _LoadGroup
std::string taxi_nodes = fields[43].GetString();
std::string taxi_nodes = fields[44].GetString();
#define RelocateToHomebind(){ mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); }
@@ -16620,9 +16666,9 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
}
_LoadCurrency(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CURRENCY));
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[45].GetUInt32());
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[46].GetUInt16());
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[47].GetUInt16());
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[46].GetUInt32());
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[47].GetUInt16());
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[48].GetUInt16());
_LoadBoundInstances(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES));
_LoadInstanceTimeRestrictions(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES));
@@ -16716,7 +16762,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
if (transport)
{
float x = fields[32].GetFloat(), y = fields[33].GetFloat(), z = fields[34].GetFloat(), o = fields[35].GetFloat();
float x = fields[33].GetFloat(), y = fields[34].GetFloat(), z = fields[35].GetFloat(), o = fields[36].GetFloat();
m_movementInfo.transport.pos.Relocate(x, y, z, o);
transport->CalculatePassengerPosition(x, y, z, &o);
@@ -16911,7 +16957,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
SaveRecallPosition();
time_t now = GameTime::GetGameTime();
time_t logoutTime = time_t(fields[27].GetUInt32());
time_t logoutTime = time_t(fields[28].GetUInt32());
// since last logout (in seconds)
uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
@@ -16924,15 +16970,15 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
SetDrunkValue(newDrunkValue);
m_cinematic = fields[23].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[24].GetUInt32();
m_Played_time[PLAYED_TIME_LEVEL]= fields[25].GetUInt32();
m_cinematic = fields[24].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[25].GetUInt32();
m_Played_time[PLAYED_TIME_LEVEL]= fields[26].GetUInt32();
SetTalentResetCost(fields[29].GetUInt32());
SetTalentResetTime(time_t(fields[30].GetUInt32()));
SetTalentResetCost(fields[30].GetUInt32());
SetTalentResetTime(time_t(fields[31].GetUInt32()));
SetSpecsCount(fields[58].GetUInt8());
SetActiveSpec(fields[59].GetUInt8());
SetSpecsCount(fields[59].GetUInt8());
SetActiveSpec(fields[60].GetUInt8());
// sanity check
if (GetSpecsCount() > MAX_TALENT_SPECS || GetActiveSpec() > MAX_TALENT_SPEC || GetSpecsCount() < MIN_TALENT_SPECS)
@@ -16942,7 +16988,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
}
// Only load selected specializations, learning mastery spells requires this
std::vector<std::string_view> talentTrees = Trinity::Tokenize(fields[31].GetStringView(), ' ', false);
std::vector<std::string_view> talentTrees = Trinity::Tokenize(fields[32].GetStringView(), ' ', false);
for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
{
if (i >= talentTrees.size())
@@ -16953,12 +16999,12 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
SetPrimaryTalentTree(i, *talentTree);
}
if (!m_taxi.LoadTaxiMask(fields[22].GetString())) // must be before InitTaxiNodesForLevel
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid taximask (%s) in DB. Forced partial load.", GetGUID().ToString().c_str(), fields[22].GetString().c_str());
if (!m_taxi.LoadTaxiMask(fields[23].GetString())) // must be before InitTaxiNodesForLevel
TC_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player (%s) has invalid taximask (%s) in DB. Forced partial load.", GetGUID().ToString().c_str(), fields[23].GetString().c_str());
uint32 extraflags = fields[37].GetUInt16();
uint32 extraflags = fields[38].GetUInt16();
m_stableSlots = fields[38].GetUInt8();
m_stableSlots = fields[39].GetUInt8();
if (m_stableSlots > MAX_PET_STABLES)
{
TC_LOG_ERROR("entities.player.loading", "Player::LoadFromDB: Player (%s) can't have more stable slots than %u, but has %u in DB",
@@ -16966,7 +17012,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
m_stableSlots = MAX_PET_STABLES;
}
m_atLoginFlags = fields[39].GetUInt16();
m_atLoginFlags = fields[40].GetUInt16();
if (HasAtLoginFlag(AT_LOGIN_RENAME))
{
@@ -16979,7 +17025,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
m_lastHonorUpdateTime = logoutTime;
UpdateHonorFields();
m_deathExpireTime = time_t(fields[42].GetUInt32());
m_deathExpireTime = time_t(fields[43].GetUInt32());
if (m_deathExpireTime > now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP)
m_deathExpireTime = now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP - 1;
@@ -17016,7 +17062,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
InitRunes();
// rest bonus can only be calculated after InitStatsForLevel()
m_rest_bonus = fields[26].GetFloat();
m_rest_bonus = fields[27].GetFloat();
if (time_diff > 0)
{
@@ -17024,7 +17070,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
float bubble0 = 0.031f;
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
float bubble1 = 0.125f;
float bubble = fields[28].GetUInt8() > 0
float bubble = fields[29].GetUInt8() > 0
? bubble1*sWorld->getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
: bubble0*sWorld->getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
@@ -17087,7 +17133,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
uint32 curTitle = fields[48].GetUInt32();
uint32 curTitle = fields[49].GetUInt32();
if (curTitle && !HasTitle(curTitle))
curTitle = 0;
@@ -17098,7 +17144,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
GetSpellHistory()->LoadFromDB<Player>(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS));
uint32 savedHealth = fields[51].GetUInt32();
uint32 savedHealth = fields[52].GetUInt32();
if (!savedHealth)
m_deathState = CORPSE;
@@ -17120,7 +17166,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
{
if (GetPowerIndex(Powers(i)) != MAX_POWERS)
{
uint32 savedPower = fields[52 + loadedPowers].GetUInt32();
uint32 savedPower = fields[53 + loadedPowers].GetUInt32();
uint32 maxPower = GetUInt32Value(UNIT_FIELD_MAXPOWER1 + loadedPowers);
SetPower(Powers(i), (savedPower > maxPower) ? maxPower : savedPower);
if (++loadedPowers >= MAX_POWERS_PER_CLASS)
@@ -17200,7 +17246,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
}
// RaF stuff.
m_grantableLevels = fields[64].GetUInt8();
m_grantableLevels = fields[65].GetUInt8();
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);
@@ -18938,7 +18984,8 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE));
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS));
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_REST_STATE));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
stmt->setUInt32(index++, GetCharacterFlags().AsUnderlyingType());
stmt->setUInt32(index++, GetCharacterFlags2().AsUnderlyingType());
stmt->setUInt16(index++, (uint16)GetMapId());
stmt->setUInt32(index++, (uint32)GetInstanceId());
stmt->setUInt8(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
@@ -19058,7 +19105,8 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE));
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_BANK_BAG_SLOTS));
stmt->setUInt8(index++, GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_REST_STATE));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FLAGS));
stmt->setUInt32(index++, GetCharacterFlags().AsUnderlyingType());
stmt->setUInt32(index++, GetCharacterFlags2().AsUnderlyingType());
if (!IsBeingTeleported())
{
@@ -27307,6 +27355,17 @@ std::string Player::GetCoordsMapAreaAndZoneString() const
return str.str();
}
void Player::UnlockVoidStorage()
{
AddCharacterFlag(CHARACTER_FLAG_2_CAN_USE_VOID_STORAGE_FEATURE);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED);
}
void Player::LockVoidStorage()
{
RemoveCharacterFlag(CHARACTER_FLAG_2_CAN_USE_VOID_STORAGE_FEATURE);
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_VOID_UNLOCKED);
}
Guild* Player::GetGuild()
{
uint32 guildId = GetGuildId();
@@ -27933,6 +27992,7 @@ void Player::SetRestFlag(RestFlag restFlag)
if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
{
_restTime = GameTime::GetGameTime();
AddCharacterFlag(CHARACTER_FLAG_RESTING);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
}
}
@@ -27945,6 +28005,7 @@ void Player::RemoveRestFlag(RestFlag restFlag)
if (oldRestMask && !_restFlagMask) // only remove flag/time on the last rest state remove
{
_restTime = 0;
RemoveCharacterFlag(CHARACTER_FLAG_RESTING);
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
}
}