mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
fix(Core/Entities): fix contested flag timer when logging out and in (#8558)
This commit is contained in:
@@ -16391,7 +16391,7 @@ bool Unit::IsUnderLastManaUseEffect() const
|
||||
return getMSTimeDiff(m_lastManaUse, World::GetGameTimeMS()) < 5000;
|
||||
}
|
||||
|
||||
void Unit::SetContestedPvP(Player* attackedPlayer)
|
||||
void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuards)
|
||||
{
|
||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
|
||||
@@ -16399,15 +16399,18 @@ void Unit::SetContestedPvP(Player* attackedPlayer)
|
||||
return;
|
||||
|
||||
// check if there any guards that should care about the contested flag on player
|
||||
std::list<Unit*> targets;
|
||||
Acore::NearestVisibleDetectableContestedGuardUnitCheck u_check(this);
|
||||
Acore::UnitListSearcher<Acore::NearestVisibleDetectableContestedGuardUnitCheck> searcher(this, targets, u_check);
|
||||
Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS);
|
||||
|
||||
// return if there are no contested guards found
|
||||
if (!targets.size())
|
||||
if (lookForNearContestedGuards)
|
||||
{
|
||||
return;
|
||||
std::list<Unit*> targets;
|
||||
Acore::NearestVisibleDetectableContestedGuardUnitCheck u_check(this);
|
||||
Acore::UnitListSearcher<Acore::NearestVisibleDetectableContestedGuardUnitCheck> searcher(this, targets, u_check);
|
||||
Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS);
|
||||
|
||||
// return if there are no contested guards found
|
||||
if (!targets.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player->SetContestedPvPTimer(30000);
|
||||
|
||||
@@ -2296,7 +2296,7 @@ public:
|
||||
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
|
||||
[[nodiscard]] bool IsUnderLastManaUseEffect() const;
|
||||
|
||||
void SetContestedPvP(Player* attackedPlayer = nullptr);
|
||||
void SetContestedPvP(Player* attackedPlayer = nullptr, bool lookForNearContestedGuards = true);
|
||||
|
||||
uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const;
|
||||
float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) const;
|
||||
|
||||
@@ -951,7 +951,9 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||
|
||||
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
||||
pCurrChar->SetContestedPvP();
|
||||
{
|
||||
pCurrChar->SetContestedPvP(nullptr, false);
|
||||
}
|
||||
|
||||
// Apply at_login requests
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
||||
|
||||
Reference in New Issue
Block a user