feat(Core/Players): PlayerFlag helpers (#11294)

* feat(Core/Players): PlayerFlag helpers

* Update Player.h

* fix build
This commit is contained in:
Kitzunu
2022-04-05 18:53:50 +02:00
committed by GitHub
parent 9f234ea489
commit b709a22ddc
19 changed files with 83 additions and 74 deletions
@@ -1077,7 +1077,7 @@ void Battleground::StartBattleground()
void Battleground::AddPlayer(Player* player) void Battleground::AddPlayer(Player* player)
{ {
// remove afk from player // remove afk from player
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK)) if (player->HasPlayerFlag(PLAYER_FLAGS_AFK))
player->ToggleAFK(); player->ToggleAFK();
sScriptMgr->OnBattlegroundBeforeAddPlayer(this, player); sScriptMgr->OnBattlegroundBeforeAddPlayer(this, player);
+16 -16
View File
@@ -894,7 +894,7 @@ void Player::HandleDrowning(uint32 time_diff)
uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1); uint32 damage = GetMaxHealth() / 5 + urand(0, getLevel() - 1);
EnvironmentalDamage(DAMAGE_EXHAUSTED, damage); EnvironmentalDamage(DAMAGE_EXHAUSTED, damage);
} }
else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard else if (HasPlayerFlag(PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard
RepopAtGraveyard(); RepopAtGraveyard();
} }
else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER)) else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER))
@@ -1066,14 +1066,14 @@ void Player::SetRestState(uint32 triggerId)
{ {
_innTriggerId = triggerId; _innTriggerId = triggerId;
_restTime = GameTime::GetGameTime().count(); _restTime = GameTime::GetGameTime().count();
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetPlayerFlag(PLAYER_FLAGS_RESTING);
} }
void Player::RemoveRestState() void Player::RemoveRestState()
{ {
_innTriggerId = 0; _innTriggerId = 0;
_restTime = 0; _restTime = 0;
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); RemovePlayerFlag(PLAYER_FLAGS_RESTING);
} }
bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
@@ -2172,7 +2172,7 @@ void Player::SetGameMaster(bool on)
m_ExtraFlags |= PLAYER_EXTRA_GM_ON; m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
if (AccountMgr::IsGMAccount(GetSession()->GetSecurity())) if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
SetFaction(FACTION_FRIENDLY); SetFaction(FACTION_FRIENDLY);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); SetPlayerFlag(PLAYER_FLAGS_GM);
SetUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS); SetUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
@@ -2203,7 +2203,7 @@ void Player::SetGameMaster(bool on)
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON; m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
SetFactionForRace(getRace(true)); SetFactionForRace(getRace(true));
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM); RemovePlayerFlag(PLAYER_FLAGS_GM);
RemoveUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS); RemoveUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
@@ -2337,7 +2337,7 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
return; return;
} }
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN)) if (HasPlayerFlag(PLAYER_FLAGS_NO_XP_GAIN))
{ {
return; return;
} }
@@ -2654,7 +2654,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);// must be set SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);// must be set
// cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example. // cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST | PLAYER_ALLOW_ONLY_ABILITY); RemovePlayerFlag(PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST | PLAYER_ALLOW_ONLY_ABILITY);
RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SANCTUARY); RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SANCTUARY);
@@ -4497,9 +4497,9 @@ Corpse* Player::CreateCorpse()
corpse->SetUInt32Value(CORPSE_FIELD_BYTES_2, _cfb2); corpse->SetUInt32Value(CORPSE_FIELD_BYTES_2, _cfb2);
uint32 flags = CORPSE_FLAG_UNK2; uint32 flags = CORPSE_FLAG_UNK2;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) if (HasPlayerFlag(PLAYER_FLAGS_HIDE_HELM))
flags |= CORPSE_FLAG_HIDE_HELM; flags |= CORPSE_FLAG_HIDE_HELM;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) if (HasPlayerFlag(PLAYER_FLAGS_HIDE_CLOAK))
flags |= CORPSE_FLAG_HIDE_CLOAK; flags |= CORPSE_FLAG_HIDE_CLOAK;
// Xinef: Player can loop corpses while in BG or in WG // Xinef: Player can loop corpses while in BG or in WG
@@ -4842,7 +4842,7 @@ void Player::RepopAtGraveyard()
else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY())) else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation()); TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS); RemovePlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
} }
bool Player::CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone) bool Player::CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone)
@@ -14301,7 +14301,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
stmt->SetData(index++, GetUInt32Value(PLAYER_FLAGS)); stmt->SetData(index++, (uint32)GetPlayerFlags());
stmt->SetData(index++, (uint16)GetMapId()); stmt->SetData(index++, (uint16)GetMapId());
stmt->SetData(index++, (uint32)GetInstanceId()); stmt->SetData(index++, (uint32)GetInstanceId());
stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4)); stmt->SetData(index++, (uint8(GetDungeonDifficulty()) | uint8(GetRaidDifficulty()) << 4));
@@ -14332,7 +14332,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]); stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->SetData(index++, finiteAlways(_restBonus)); stmt->SetData(index++, finiteAlways(_restBonus));
stmt->SetData(index++, uint32(GameTime::GetGameTime().count())); stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
stmt->SetData(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0)); stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city //save, far from tavern/city
//save, but in tavern/city //save, but in tavern/city
stmt->SetData(index++, m_resetTalentsCost); stmt->SetData(index++, m_resetTalentsCost);
@@ -14418,7 +14418,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 0));
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 2));
stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3)); stmt->SetData(index++, GetByteValue(PLAYER_BYTES_2, 3));
stmt->SetData(index++, GetUInt32Value(PLAYER_FLAGS)); stmt->SetData(index++, GetPlayerFlags());
if (!IsBeingTeleported()) if (!IsBeingTeleported())
{ {
@@ -14471,7 +14471,7 @@ void Player::_SaveCharacter(bool create, CharacterDatabaseTransaction trans)
stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]); stmt->SetData(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->SetData(index++, finiteAlways(_restBonus)); stmt->SetData(index++, finiteAlways(_restBonus));
stmt->SetData(index++, uint32(GameTime::GetGameTime().count())); stmt->SetData(index++, uint32(GameTime::GetGameTime().count()));
stmt->SetData(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0)); stmt->SetData(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city //save, far from tavern/city
//save, but in tavern/city //save, but in tavern/city
stmt->SetData(index++, m_resetTalentsCost); stmt->SetData(index++, m_resetTalentsCost);
@@ -15733,7 +15733,7 @@ void Player::SetRestFlag(RestFlag restFlag, uint32 triggerId /*= 0*/)
if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
{ {
_restTime = GameTime::GetGameTime().count(); _restTime = GameTime::GetGameTime().count();
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetPlayerFlag(PLAYER_FLAGS_RESTING);
} }
if (triggerId) if (triggerId)
@@ -15748,7 +15748,7 @@ void Player::RemoveRestFlag(RestFlag restFlag)
if (oldRestMask && !_restFlagMask) // only remove flag/time on the last rest state remove if (oldRestMask && !_restFlagMask) // only remove flag/time on the last rest state remove
{ {
_restTime = 0; _restTime = 0;
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); RemovePlayerFlag(PLAYER_FLAGS_RESTING);
} }
} }
+14 -5
View File
@@ -24,6 +24,7 @@
#include "CinematicMgr.h" #include "CinematicMgr.h"
#include "DBCStores.h" #include "DBCStores.h"
#include "DatabaseEnvFwd.h" #include "DatabaseEnvFwd.h"
#include "EnumFlag.h"
#include "GroupReference.h" #include "GroupReference.h"
#include "InstanceSaveMgr.h" #include "InstanceSaveMgr.h"
#include "Item.h" #include "Item.h"
@@ -464,7 +465,7 @@ enum DrunkenState
#define MAX_DRUNKEN 4 #define MAX_DRUNKEN 4
enum PlayerFlags enum PlayerFlags : uint32
{ {
PLAYER_FLAGS_GROUP_LEADER = 0x00000001, PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
PLAYER_FLAGS_AFK = 0x00000002, PLAYER_FLAGS_AFK = 0x00000002,
@@ -500,6 +501,8 @@ enum PlayerFlags
PLAYER_FLAGS_UNK31 = 0x80000000, PLAYER_FLAGS_UNK31 = 0x80000000,
}; };
DEFINE_ENUM_FLAG(PlayerFlags);
enum PlayerBytesOffsets //@todo: Implement enum PlayerBytesOffsets //@todo: Implement
{ {
PLAYER_BYTES_OFFSET_SKIN_ID = 0, PLAYER_BYTES_OFFSET_SKIN_ID = 0,
@@ -1078,6 +1081,12 @@ public:
void Update(uint32 time) override; void Update(uint32 time) override;
PlayerFlags GetPlayerFlags() const { return PlayerFlags(GetUInt32Value(PLAYER_FLAGS)); }
bool HasPlayerFlag(PlayerFlags flags) const { return HasFlag(PLAYER_FLAGS, flags) != 0; }
void SetPlayerFlag(PlayerFlags flags) { SetFlag(PLAYER_FLAGS, flags); }
void RemovePlayerFlag(PlayerFlags flags) { RemoveFlag(PLAYER_FLAGS, flags); }
void ReplaceAllPlayerFlags(PlayerFlags flags) { SetUInt32Value(PLAYER_FLAGS, flags); }
static bool BuildEnumData(PreparedQueryResult result, WorldPacket* data); static bool BuildEnumData(PreparedQueryResult result, WorldPacket* data);
void SetInWater(bool apply); void SetInWater(bool apply);
@@ -1097,8 +1106,8 @@ public:
void ToggleAFK(); void ToggleAFK();
void ToggleDND(); void ToggleDND();
[[nodiscard]] bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); } [[nodiscard]] bool isAFK() const { return HasPlayerFlag(PLAYER_FLAGS_AFK); }
[[nodiscard]] bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); } [[nodiscard]] bool isDND() const { return HasPlayerFlag(PLAYER_FLAGS_DND); }
[[nodiscard]] uint8 GetChatTag() const; [[nodiscard]] uint8 GetChatTag() const;
std::string autoReplyMsg; std::string autoReplyMsg;
@@ -1114,7 +1123,7 @@ public:
void ContinueTaxiFlight(); void ContinueTaxiFlight();
// mount_id can be used in scripting calls // mount_id can be used in scripting calls
[[nodiscard]] bool IsDeveloper() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER); } [[nodiscard]] bool IsDeveloper() const { return HasPlayerFlag(PLAYER_FLAGS_DEVELOPER); }
void SetDeveloper(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER, on); } void SetDeveloper(bool on) { ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER, on); }
[[nodiscard]] bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; } [[nodiscard]] bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
@@ -1802,7 +1811,7 @@ public:
void ResetContestedPvP() void ResetContestedPvP()
{ {
ClearUnitState(UNIT_STATE_ATTACK_PLAYER); ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); RemovePlayerFlag(PLAYER_FLAGS_CONTESTED_PVP);
m_contestedPvPTimer = 0; m_contestedPvPTimer = 0;
} }
@@ -353,8 +353,8 @@ void Player::UpdatePvPFlag(time_t currTime)
if (currTime < (pvpInfo.EndTimer + 300 + 5)) if (currTime < (pvpInfo.EndTimer + 300 + 5))
{ {
if (currTime > (pvpInfo.EndTimer + 4) && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER)) if (currTime > (pvpInfo.EndTimer + 4) && !HasPlayerFlag(PLAYER_FLAGS_PVP_TIMER))
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); SetPlayerFlag(PLAYER_FLAGS_PVP_TIMER);
return; return;
} }
@@ -5053,7 +5053,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
SetByteValue(PLAYER_BYTES_2, 3, fields[15].Get<uint8>()); SetByteValue(PLAYER_BYTES_2, 3, fields[15].Get<uint8>());
SetByteValue(PLAYER_BYTES_3, 0, fields[5].Get<uint8>()); SetByteValue(PLAYER_BYTES_3, 0, fields[5].Get<uint8>());
SetByteValue(PLAYER_BYTES_3, 1, fields[54].Get<uint8>()); SetByteValue(PLAYER_BYTES_3, 1, fields[54].Get<uint8>());
SetUInt32Value(PLAYER_FLAGS, fields[16].Get<uint32>()); ReplaceAllPlayerFlags((PlayerFlags)fields[16].Get<uint32>());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[53].Get<uint32>()); SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[53].Get<uint32>());
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[52].Get<uint64>()); SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[52].Get<uint64>());
@@ -5460,7 +5460,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
_LoadGlyphAuras(); _LoadGlyphAuras();
_LoadAuras(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff); _LoadAuras(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff);
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura) // add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (HasPlayerFlag(PLAYER_FLAGS_GHOST))
{ {
m_deathState = DEAD; m_deathState = DEAD;
AddUnitState(UNIT_STATE_ISOLATED); AddUnitState(UNIT_STATE_ISOLATED);
@@ -6514,7 +6514,7 @@ void Player::_LoadGroup()
{ {
if (group->IsLeader(GetGUID())) if (group->IsLeader(GetGUID()))
{ {
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); SetPlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
} }
uint8 subgroup = group->GetMemberGroup(GetGUID()); uint8 subgroup = group->GetMemberGroup(GetGUID());
@@ -6528,7 +6528,7 @@ void Player::_LoadGroup()
} }
if (!GetGroup() || !GetGroup()->IsLeader(GetGUID())) if (!GetGroup() || !GetGroup()->IsLeader(GetGUID()))
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); RemovePlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
} }
void Player::BindToInstance() void Player::BindToInstance()
@@ -232,7 +232,7 @@ void Player::Update(uint32 p_time)
} }
} }
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) if (HasPlayerFlag(PLAYER_FLAGS_RESTING))
{ {
if (now > lastTick && _restTime > 0) // freeze update if (now > lastTick && _restTime > 0) // freeze update
{ {
@@ -1384,7 +1384,7 @@ void Player::UpdatePvPState()
} }
else // in friendly area else // in friendly area
{ {
if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) && if (IsPvP() && !HasPlayerFlag(PLAYER_FLAGS_IN_PVP) &&
pvpInfo.EndTimer == 0) pvpInfo.EndTimer == 0)
pvpInfo.EndTimer = GameTime::GetGameTime().count(); // start toggle-off pvpInfo.EndTimer = GameTime::GetGameTime().count(); // start toggle-off
} }
@@ -1472,7 +1472,7 @@ void Player::UpdatePvP(bool state, bool _override)
SetPvP(state); SetPvP(state);
} }
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); RemovePlayerFlag(PLAYER_FLAGS_PVP_TIMER);
sScriptMgr->OnPlayerPVPFlagChange(this, state); sScriptMgr->OnPlayerPVPFlagChange(this, state);
} }
+4 -4
View File
@@ -9674,7 +9674,7 @@ ReputationRank Unit::GetReactionTo(Unit const* target, bool checkOriginalFaction
{ {
// check contested flags // check contested flags
if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
&& selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
return REP_HOSTILE; return REP_HOSTILE;
// if faction has reputation, hostile state depends only from AtWar state // if faction has reputation, hostile state depends only from AtWar state
@@ -9747,7 +9747,7 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem
{ {
// check contested flags // check contested flags
if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
&& targetPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
return REP_HOSTILE; return REP_HOSTILE;
if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry)) if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
return *repRank; return *repRank;
@@ -13251,7 +13251,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
if (Player const* playerAttacker = ToPlayer()) if (Player const* playerAttacker = ToPlayer())
{ {
if (playerAttacker->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator()) if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
return false; return false;
} }
// check flags // check flags
@@ -16778,7 +16778,7 @@ void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuar
if (!player->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) if (!player->HasUnitState(UNIT_STATE_ATTACK_PLAYER))
{ {
player->AddUnitState(UNIT_STATE_ATTACK_PLAYER); player->AddUnitState(UNIT_STATE_ATTACK_PLAYER);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); player->SetPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP);
// call MoveInLineOfSight for nearby contested guards // call MoveInLineOfSight for nearby contested guards
AddToNotify(NOTIFY_AI_RELOCATION); AddToNotify(NOTIFY_AI_RELOCATION);
} }
+3 -3
View File
@@ -112,7 +112,7 @@ bool Group::Create(Player* leader)
m_guid = ObjectGuid::Create<HighGuid::Group>(lowguid); m_guid = ObjectGuid::Create<HighGuid::Group>(lowguid);
m_leaderGuid = leaderGuid; m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName(); m_leaderName = leader->GetName();
leader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); leader->SetPlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
if (isBGGroup() || isBFGroup()) if (isBGGroup() || isBFGroup())
m_groupType = GROUPTYPE_BGRAID; m_groupType = GROUPTYPE_BGRAID;
@@ -725,9 +725,9 @@ void Group::ChangeLeader(ObjectGuid newLeaderGuid)
} }
if (Player* oldLeader = ObjectAccessor::FindConnectedPlayer(m_leaderGuid)) if (Player* oldLeader = ObjectAccessor::FindConnectedPlayer(m_leaderGuid))
oldLeader->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); oldLeader->RemovePlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
newLeader->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GROUP_LEADER); newLeader->SetPlayerFlag(PLAYER_FLAGS_GROUP_LEADER);
m_leaderGuid = newLeader->GetGUID(); m_leaderGuid = newLeader->GetGUID();
m_leaderName = newLeader->GetName(); m_leaderName = newLeader->GetName();
ToggleGroupMemberFlag(slot, MEMBER_FLAG_ASSISTANT, false); ToggleGroupMemberFlag(slot, MEMBER_FLAG_ASSISTANT, false);
@@ -948,10 +948,10 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
} }
// Set FFA PvP for non GM in non-rest mode // Set FFA PvP for non GM in non-rest mode
if (sWorld->IsFFAPvPRealm() && !pCurrChar->IsGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) if (sWorld->IsFFAPvPRealm() && !pCurrChar->IsGameMaster() && !pCurrChar->HasPlayerFlag(PLAYER_FLAGS_RESTING))
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) if (pCurrChar->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
{ {
pCurrChar->SetContestedPvP(nullptr, false); pCurrChar->SetContestedPvP(nullptr, false);
} }
@@ -1062,8 +1062,8 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
} }
// pussywizard: pvp mode // pussywizard: pvp mode
pCurrChar->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER); pCurrChar->RemovePlayerFlag(PLAYER_FLAGS_PVP_TIMER);
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) if (pCurrChar->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
pCurrChar->UpdatePvP(true, true); pCurrChar->UpdatePvP(true, true);
// pussywizard: on login it's not possible to go back to arena as a spectator, HandleMoveWorldportAckOpcode is not sent, so call it here // pussywizard: on login it's not possible to go back to arena as a spectator, HandleMoveWorldportAckOpcode is not sent, so call it here
@@ -1307,17 +1307,17 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
void WorldSession::HandleShowingHelmOpcode(WorldPackets::Character::ShowingHelm& packet) void WorldSession::HandleShowingHelmOpcode(WorldPackets::Character::ShowingHelm& packet)
{ {
if (packet.ShowHelm) if (packet.ShowHelm)
_player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); _player->RemovePlayerFlag(PLAYER_FLAGS_HIDE_HELM);
else else
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); _player->SetPlayerFlag(PLAYER_FLAGS_HIDE_HELM);
} }
void WorldSession::HandleShowingCloakOpcode(WorldPackets::Character::ShowingCloak& packet) void WorldSession::HandleShowingCloakOpcode(WorldPackets::Character::ShowingCloak& packet)
{ {
if (packet.ShowCloak) if (packet.ShowCloak)
_player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); _player->RemovePlayerFlag(PLAYER_FLAGS_HIDE_CLOAK);
else else
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); _player->SetPlayerFlag(PLAYER_FLAGS_HIDE_CLOAK);
} }
void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
+2 -2
View File
@@ -812,7 +812,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
if (!player->IsAlive()) if (!player->IsAlive())
{ {
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (player->HasPlayerFlag(PLAYER_FLAGS_GHOST))
playerStatus |= MEMBER_STATUS_GHOST; playerStatus |= MEMBER_STATUS_GHOST;
else else
playerStatus |= MEMBER_STATUS_DEAD; playerStatus |= MEMBER_STATUS_DEAD;
@@ -1014,7 +1014,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
if (!player->IsAlive()) if (!player->IsAlive())
{ {
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (player->HasPlayerFlag(PLAYER_FLAGS_GHOST))
playerStatus |= MEMBER_STATUS_GHOST; playerStatus |= MEMBER_STATUS_GHOST;
else else
playerStatus |= MEMBER_STATUS_DEAD; playerStatus |= MEMBER_STATUS_DEAD;
+6 -6
View File
@@ -60,7 +60,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
recv_data.read_skip<uint8>(); recv_data.read_skip<uint8>();
if (GetPlayer()->IsAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (GetPlayer()->IsAlive() || GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
return; return;
if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
@@ -417,7 +417,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
DoLootRelease(lguid); DoLootRelease(lguid);
bool instantLogout = ((GetSecurity() >= 0 && uint32(GetSecurity()) >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT)) bool instantLogout = ((GetSecurity() >= 0 && uint32(GetSecurity()) >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT))
|| (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight(); || (GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight();
bool preventAfkSanctuaryLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 1 bool preventAfkSanctuaryLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 1
&& GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary(); && GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary();
@@ -426,7 +426,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
&& GetPlayer()->isAFK(); && GetPlayer()->isAFK();
/// TODO: Possibly add RBAC permission to log out in combat /// TODO: Possibly add RBAC permission to log out in combat
bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); bool canLogoutInCombat = GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_RESTING);
uint32 reason = 0; uint32 reason = 0;
if (GetPlayer()->IsInCombat() && !canLogoutInCombat) if (GetPlayer()->IsInCombat() && !canLogoutInCombat)
@@ -501,7 +501,7 @@ void WorldSession::HandleTogglePvP(WorldPacket& recv_data)
else else
GetPlayer()->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); GetPlayer()->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP);
if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) if (GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
GetPlayer()->UpdatePvP(true, true); GetPlayer()->UpdatePvP(true, true);
else if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP()) // pussywizard: in pvp mode, but doesn't want to be and not in hostile territory, so start timer else if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP()) // pussywizard: in pvp mode, but doesn't want to be and not in hostile territory, so start timer
GetPlayer()->UpdatePvP(true, false); GetPlayer()->UpdatePvP(true, false);
@@ -645,7 +645,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
return; return;
// body not released yet // body not released yet
if (!_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (!_player->HasPlayerFlag(PLAYER_FLAGS_GHOST))
return; return;
Corpse* corpse = _player->GetCorpse(); Corpse* corpse = _player->GetCorpse();
@@ -1549,7 +1549,7 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data)
uint8 mode; uint8 mode;
recv_data >> mode; recv_data >> mode;
mode ? _player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK) : _player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); mode ? _player->SetPlayerFlag(PLAYER_FLAGS_TAXI_BENCHMARK) : _player->RemovePlayerFlag(PLAYER_FLAGS_TAXI_BENCHMARK);
LOG_DEBUG("network", "Client used \"/timetest {}\" command", mode); LOG_DEBUG("network", "Client used \"/timetest {}\" command", mode);
} }
+4 -4
View File
@@ -237,7 +237,7 @@ void WorldSession::HandleMoveWorldportAck()
GetPlayer()->CastSpell(GetPlayer(), 2479, true); GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// in friendly area // in friendly area
else if (GetPlayer()->IsPvP() && !GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) else if (GetPlayer()->IsPvP() && !GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
GetPlayer()->UpdatePvP(false, false); GetPlayer()->UpdatePvP(false, false);
// resummon pet // resummon pet
@@ -297,7 +297,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
plMover->CastSpell(plMover, 2479, true); plMover->CastSpell(plMover, 2479, true);
// in friendly area // in friendly area
else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP)) else if (plMover->IsPvP() && !plMover->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
plMover->UpdatePvP(false, false); plMover->UpdatePvP(false, false);
} }
} }
@@ -570,13 +570,13 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{ {
if (plrMover->IsAlive()) if (plrMover->IsAlive())
{ {
plrMover->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS); plrMover->SetPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// player can be alive if GM // player can be alive if GM
if (plrMover->IsAlive()) if (plrMover->IsAlive())
plrMover->KillPlayer(); plrMover->KillPlayer();
} }
else if (!plrMover->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS)) else if (!plrMover->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
{ {
GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId()); GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId());
if (grave) if (grave)
+2 -2
View File
@@ -689,9 +689,9 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
// Display items in visible slots // Display items in visible slots
for (EquipmentSlots const* itr = &itemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr) for (EquipmentSlots const* itr = &itemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr)
{ {
if (*itr == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) if (*itr == EQUIPMENT_SLOT_HEAD && player->HasPlayerFlag(PLAYER_FLAGS_HIDE_HELM))
data << uint32(0); data << uint32(0);
else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) else if (*itr == EQUIPMENT_SLOT_BACK && player->HasPlayerFlag(PLAYER_FLAGS_HIDE_CLOAK))
data << uint32(0); data << uint32(0);
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr)) else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
{ {
@@ -328,7 +328,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
player->SetFallInformation(GameTime::GetGameTime().count(), player->GetPositionZ()); player->SetFallInformation(GameTime::GetGameTime().count(), player->GetPositionZ());
} }
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); player->RemovePlayerFlag(PLAYER_FLAGS_TAXI_BENCHMARK);
} }
#define PLAYER_FLIGHT_SPEED 32.0f #define PLAYER_FLIGHT_SPEED 32.0f
@@ -1764,7 +1764,7 @@ void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool
if (apply) if (apply)
{ {
target->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); target->ToPlayer()->SetPlayerFlag(PLAYER_FLAGS_GHOST);
target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
} }
@@ -1773,7 +1773,7 @@ void AuraEffect::HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool
if (target->HasAuraType(SPELL_AURA_GHOST)) if (target->HasAuraType(SPELL_AURA_GHOST))
return; return;
target->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); target->ToPlayer()->RemovePlayerFlag(PLAYER_FLAGS_GHOST);
target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
} }
@@ -2671,13 +2671,13 @@ void AuraEffect::HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8
if (target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
{ {
if (apply) if (apply)
target->SetFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY); target->ToPlayer()->SetPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY);
else else
{ {
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY)) if (target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
return; return;
target->RemoveFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY); target->ToPlayer()->RemovePlayerFlag(PLAYER_ALLOW_ONLY_ABILITY);
} }
} }
} }
+1 -1
View File
@@ -5392,7 +5392,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
//can cast triggered (by aura only?) spells while have this flag //can cast triggered (by aura only?) spells while have this flag
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY)) if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY))
return SPELL_FAILED_SPELL_IN_PROGRESS; return SPELL_FAILED_SPELL_IN_PROGRESS;
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id)) if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
+1 -1
View File
@@ -4230,7 +4230,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)
return; return;
// xinef: player is in corpse // xinef: player is in corpse
if (!target->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) if (!target->HasPlayerFlag(PLAYER_FLAGS_GHOST))
target->BuildPlayerRepop(); target->BuildPlayerRepop();
target->RepopAtGraveyard(); target->RepopAtGraveyard();
return; return;
@@ -345,7 +345,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
nodes[0] = FlightPathStartNodes[NA_ROOST_N]; nodes[0] = FlightPathStartNodes[NA_ROOST_N];
nodes[1] = FlightPathEndNodes[NA_ROOST_N]; nodes[1] = FlightPathEndNodes[NA_ROOST_N];
player->ActivateTaxiPathTo(nodes); player->ActivateTaxiPathTo(nodes);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); player->SetPlayerFlag(PLAYER_FLAGS_IN_PVP);
player->UpdatePvP(true, true); player->UpdatePvP(true, true);
retval = true; retval = true;
break; break;
@@ -353,7 +353,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
nodes[0] = FlightPathStartNodes[NA_ROOST_S]; nodes[0] = FlightPathStartNodes[NA_ROOST_S];
nodes[1] = FlightPathEndNodes[NA_ROOST_S]; nodes[1] = FlightPathEndNodes[NA_ROOST_S];
player->ActivateTaxiPathTo(nodes); player->ActivateTaxiPathTo(nodes);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); player->SetPlayerFlag(PLAYER_FLAGS_IN_PVP);
player->UpdatePvP(true, true); player->UpdatePvP(true, true);
retval = true; retval = true;
break; break;
@@ -361,7 +361,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
nodes[0] = FlightPathStartNodes[NA_ROOST_W]; nodes[0] = FlightPathStartNodes[NA_ROOST_W];
nodes[1] = FlightPathEndNodes[NA_ROOST_W]; nodes[1] = FlightPathEndNodes[NA_ROOST_W];
player->ActivateTaxiPathTo(nodes); player->ActivateTaxiPathTo(nodes);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); player->SetPlayerFlag(PLAYER_FLAGS_IN_PVP);
player->UpdatePvP(true, true); player->UpdatePvP(true, true);
retval = true; retval = true;
break; break;
@@ -369,7 +369,7 @@ bool OPvPCapturePointNA::HandleCustomSpell(Player* player, uint32 spellId, GameO
nodes[0] = FlightPathStartNodes[NA_ROOST_E]; nodes[0] = FlightPathStartNodes[NA_ROOST_E];
nodes[1] = FlightPathEndNodes[NA_ROOST_E]; nodes[1] = FlightPathEndNodes[NA_ROOST_E];
player->ActivateTaxiPathTo(nodes); player->ActivateTaxiPathTo(nodes);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP); player->SetPlayerFlag(PLAYER_FLAGS_IN_PVP);
player->UpdatePvP(true, true); player->UpdatePvP(true, true);
retval = true; retval = true;
break; break;
+3 -3
View File
@@ -1984,7 +1984,7 @@ public:
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
{ {
ClearGossipMenuFor(player); ClearGossipMenuFor(player);
bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); bool noXPGain = player->HasPlayerFlag(PLAYER_FLAGS_NO_XP_GAIN);
bool doSwitch = false; bool doSwitch = false;
auto toggleXpCost = sWorld->getIntConfig(CONFIG_TOGGLE_XP_COST); auto toggleXpCost = sWorld->getIntConfig(CONFIG_TOGGLE_XP_COST);
@@ -2012,12 +2012,12 @@ public:
else if (noXPGain) else if (noXPGain)
{ {
player->ModifyMoney(-toggleXpCost); player->ModifyMoney(-toggleXpCost);
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); player->RemovePlayerFlag(PLAYER_FLAGS_NO_XP_GAIN);
} }
else if (!noXPGain) else if (!noXPGain)
{ {
player->ModifyMoney(-toggleXpCost); player->ModifyMoney(-toggleXpCost);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); player->SetPlayerFlag(PLAYER_FLAGS_NO_XP_GAIN);
} }
} }
player->PlayerTalkClass->SendCloseGossip(); player->PlayerTalkClass->SendCloseGossip();