Core/Player: moved the periodic group update mechanic into heartbeat handling

This commit is contained in:
Ovahlord
2024-04-26 01:37:27 +02:00
parent bf9cd88ceb
commit 80d72a2c91
2 changed files with 10 additions and 12 deletions

View File

@@ -349,8 +349,6 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
for (uint8 i = 0; i < MAX_CUF_PROFILES; ++i)
_CUFProfiles[i] = nullptr;
m_groupUpdateTimer.Reset(5000);
_advancedCombatLoggingEnabled = false;
_restMgr = std::make_unique<RestMgr>(this);
@@ -1137,14 +1135,6 @@ void Player::Update(uint32 p_time)
}
}
// group update
m_groupUpdateTimer.Update(p_time);
if (m_groupUpdateTimer.Passed())
{
SendUpdateToOutOfRangeGroupMembers();
m_groupUpdateTimer.Reset(5000);
}
Pet* pet = GetPet();
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityRange()) && !pet->isPossessed())
//if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
@@ -1168,6 +1158,14 @@ void Player::Update(uint32 p_time)
TeleportTo(m_teleport_dest, m_teleport_options);
}
void Player::Heartbeat()
{
Unit::Heartbeat();
// Group update
SendUpdateToOutOfRangeGroupMembers();
}
void Player::setDeathState(DeathState s)
{
bool oldIsAlive = IsAlive();

View File

@@ -1137,6 +1137,8 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
void Update(uint32 time) override;
void Heartbeat() override;
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const override;
bool IsInAreaTriggerRadius(AreaTriggerEntry const* trigger) const;
@@ -3142,8 +3144,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;
TimeTracker m_groupUpdateTimer;
private:
// internal common parts for CanStore/StoreItem functions
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;