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;
|
return getMSTimeDiff(m_lastManaUse, World::GetGameTimeMS()) < 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SetContestedPvP(Player* attackedPlayer)
|
void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuards)
|
||||||
{
|
{
|
||||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||||
|
|
||||||
@@ -16399,15 +16399,18 @@ void Unit::SetContestedPvP(Player* attackedPlayer)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// check if there any guards that should care about the contested flag on player
|
// check if there any guards that should care about the contested flag on player
|
||||||
std::list<Unit*> targets;
|
if (lookForNearContestedGuards)
|
||||||
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;
|
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);
|
player->SetContestedPvPTimer(30000);
|
||||||
|
|||||||
@@ -2296,7 +2296,7 @@ public:
|
|||||||
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
|
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
|
||||||
[[nodiscard]] bool IsUnderLastManaUseEffect() const;
|
[[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;
|
uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime) const;
|
||||||
float CalculateDefaultCoefficient(SpellInfo const* spellInfo, DamageEffectType damagetype) 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);
|
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
|
||||||
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
||||||
pCurrChar->SetContestedPvP();
|
{
|
||||||
|
pCurrChar->SetContestedPvP(nullptr, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply at_login requests
|
// Apply at_login requests
|
||||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
||||||
|
|||||||
Reference in New Issue
Block a user