mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
Merge branch 'master' into questXPHook
This commit is contained in:
@@ -248,7 +248,10 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
m_swingErrorMsg = 0;
|
||||
|
||||
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
|
||||
m_bgBattlegroundQueueID[j] = BATTLEGROUND_QUEUE_NONE;
|
||||
{
|
||||
_BgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
_BgBattlegroundQueueID[j].invitedToInstance = 0;
|
||||
}
|
||||
|
||||
m_logintime = GameTime::GetGameTime().count();
|
||||
m_Last_tick = m_logintime;
|
||||
@@ -11025,6 +11028,8 @@ void Player::LeaveBattleground(Battleground* bg)
|
||||
sScriptMgr->OnBattlegroundDesertion(this, BG_DESERTION_TYPE_LEAVE_BG);
|
||||
}
|
||||
|
||||
bg->RemovePlayerAtLeave(this);
|
||||
|
||||
// xinef: reset corpse reclaim time
|
||||
m_deathExpireTime = GameTime::GetGameTime().count();
|
||||
|
||||
@@ -11853,10 +11858,102 @@ Battleground* Player::GetBattleground(bool create) const
|
||||
if (GetBattlegroundId() == 0)
|
||||
return nullptr;
|
||||
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(GetBattlegroundId());
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(GetBattlegroundId(), GetBattlegroundTypeId());
|
||||
return (create || (bg && bg->FindBgMap()) ? bg : nullptr);
|
||||
}
|
||||
|
||||
bool Player::InBattlegroundQueue(bool ignoreArena) const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE &&
|
||||
(!ignoreArena || (_BgBattlegroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_2v2 &&
|
||||
_BgBattlegroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_3v3 &&
|
||||
_BgBattlegroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_5v5)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BattlegroundQueueTypeId Player::GetBattlegroundQueueTypeId(uint32 index) const
|
||||
{
|
||||
return _BgBattlegroundQueueID[index].bgQueueTypeId;
|
||||
}
|
||||
|
||||
uint32 Player::GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
return i;
|
||||
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
bool Player::IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
return _BgBattlegroundQueueID[i].invitedToInstance != 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
return GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
uint32 Player::AddBattlegroundQueueId(BattlegroundQueueTypeId val)
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || _BgBattlegroundQueueID[i].bgQueueTypeId == val)
|
||||
{
|
||||
_BgBattlegroundQueueID[i].bgQueueTypeId = val;
|
||||
_BgBattlegroundQueueID[i].invitedToInstance = 0;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
bool Player::HasFreeBattlegroundQueueId() const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Player::RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == val)
|
||||
{
|
||||
_BgBattlegroundQueueID[i].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
_BgBattlegroundQueueID[i].invitedToInstance = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId)
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
_BgBattlegroundQueueID[i].invitedToInstance = instanceId;
|
||||
}
|
||||
|
||||
bool Player::IsInvitedForBattlegroundInstance(uint32 instanceId) const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (_BgBattlegroundQueueID[i].invitedToInstance == instanceId)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::InArena() const
|
||||
{
|
||||
Battleground* bg = GetBattleground();
|
||||
@@ -11868,16 +11965,6 @@ bool Player::InArena() const
|
||||
|
||||
void Player::SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId)
|
||||
{
|
||||
// if leaving current bg (and was invited) - decrease invited count for current one
|
||||
if (m_bgData.bgInstanceID && m_bgData.isInvited)
|
||||
if (Battleground* bg = sBattlegroundMgr->GetBattleground(m_bgData.bgInstanceID))
|
||||
bg->DecreaseInvitedCount(m_bgData.bgTeamId);
|
||||
|
||||
// if entering new bg (and is invited) - increase invited count for new one
|
||||
if (id && invited)
|
||||
if (Battleground* bg = sBattlegroundMgr->GetBattleground(id))
|
||||
bg->IncreaseInvitedCount(teamId);
|
||||
|
||||
m_bgData.bgInstanceID = id;
|
||||
m_bgData.bgTypeID = bgTypeId;
|
||||
m_bgData.bgQueueSlot = queueSlot;
|
||||
|
||||
@@ -177,7 +177,7 @@ enum TalentTree // talent tabs
|
||||
// Spell modifier (used for modify other spells)
|
||||
struct SpellModifier
|
||||
{
|
||||
SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), mask(), ownerAura(_ownerAura) {}
|
||||
SpellModifier(Aura* _ownerAura = nullptr) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), mask(), ownerAura(_ownerAura) {}
|
||||
SpellModOp op : 8;
|
||||
SpellModType type : 8;
|
||||
int16 charges : 16;
|
||||
@@ -2188,59 +2188,20 @@ public:
|
||||
void SetBGData(BGData& bgdata) { m_bgData = bgdata; }
|
||||
[[nodiscard]] Battleground* GetBattleground(bool create = false) const;
|
||||
|
||||
[[nodiscard]] bool InBattlegroundQueue() const
|
||||
{
|
||||
for (auto i : m_bgBattlegroundQueueID)
|
||||
if (i != BATTLEGROUND_QUEUE_NONE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
[[nodiscard]] bool InBattlegroundQueue(bool ignoreArena = false) const;
|
||||
[[nodiscard]] bool IsDeserter() const { return HasAura(26013); }
|
||||
|
||||
[[nodiscard]] BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const { return m_bgBattlegroundQueueID[index]; }
|
||||
|
||||
[[nodiscard]] uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattlegroundQueueID[i] == bgQueueTypeId)
|
||||
return i;
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
return GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
[[nodiscard]] BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const;
|
||||
[[nodiscard]] uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const;
|
||||
[[nodiscard]] bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
|
||||
[[nodiscard]] bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const;
|
||||
|
||||
void SetBattlegroundId(uint32 id, BattlegroundTypeId bgTypeId, uint32 queueSlot, bool invited, bool isRandom, TeamId teamId);
|
||||
|
||||
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val)
|
||||
{
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattlegroundQueueID[i] == BATTLEGROUND_QUEUE_NONE || m_bgBattlegroundQueueID[i] == val)
|
||||
{
|
||||
m_bgBattlegroundQueueID[i] = val;
|
||||
return i;
|
||||
}
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
|
||||
bool HasFreeBattlegroundQueueId()
|
||||
{
|
||||
for (auto & i : m_bgBattlegroundQueueID)
|
||||
if (i == BATTLEGROUND_QUEUE_NONE)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
|
||||
{
|
||||
for (auto & i : m_bgBattlegroundQueueID)
|
||||
if (i == val)
|
||||
{
|
||||
i = BATTLEGROUND_QUEUE_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val);
|
||||
bool HasFreeBattlegroundQueueId() const;
|
||||
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val);
|
||||
void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId);
|
||||
bool IsInvitedForBattlegroundInstance(uint32 instanceId) const;
|
||||
|
||||
[[nodiscard]] TeamId GetBgTeamId() const { return m_bgData.bgTeamId != TEAM_NEUTRAL ? m_bgData.bgTeamId : GetTeamId(); }
|
||||
|
||||
@@ -2601,7 +2562,13 @@ public:
|
||||
/*** BATTLEGROUND SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
BattlegroundQueueTypeId m_bgBattlegroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
|
||||
struct BgBattlegroundQueueID_Rec
|
||||
{
|
||||
BattlegroundQueueTypeId bgQueueTypeId;
|
||||
uint32 invitedToInstance;
|
||||
};
|
||||
|
||||
std::array<BgBattlegroundQueueID_Rec, PLAYER_MAX_BATTLEGROUND_QUEUES> _BgBattlegroundQueueID;
|
||||
BGData m_bgData;
|
||||
bool m_IsBGRandomWinner;
|
||||
|
||||
|
||||
@@ -7233,6 +7233,12 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
if (!victim)
|
||||
return false;
|
||||
|
||||
// Do not proc from Glyph of Holy Light and Judgement of Light
|
||||
if (procSpell->Id == 20267 || procSpell->Id == 54968)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* beaconTarget = triggeredByAura->GetBase()->GetCaster();
|
||||
if (!beaconTarget || beaconTarget == this || !beaconTarget->GetAura(53563, victim->GetGUID()))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user