feat(Core/Maps): Implement dynamic respawn rates (#21417)

Co-authored-by: r00ty-tc <r00ty-tc@users.noreply.github.com>
Co-authored-by: Jelle Meeus <sogladev@gmail.com>
Co-authored-by Treeston

This is a partial cherry-pick of: https://github.com/TrinityCore/TrinityCore/pull/19056/commits/59db2eeea0a35028779fd76372ae06cc98c8086f
This commit is contained in:
Andrew
2025-02-12 15:06:42 -03:00
committed by GitHub
parent 5421f13c13
commit 16fa25b7a9
8 changed files with 118 additions and 2 deletions
@@ -1974,6 +1974,7 @@ void Creature::setDeathState(DeathState state, bool despawn)
if (state == DeathState::JustDied)
{
m_corpseRemoveTime = GameTime::GetGameTime().count() + m_corpseDelay;
GetMap()->ApplyDynamicModeRespawnScaling(this, m_respawnDelay);
m_respawnTime = GameTime::GetGameTime().count() + m_respawnDelay + m_corpseDelay;
// always save boss respawn time at death to prevent crash cheating
@@ -897,6 +897,7 @@ void GameObject::Update(uint32 diff)
return;
}
GetMap()->ApplyDynamicModeRespawnScaling(this, m_respawnDelayTime);
m_respawnTime = GameTime::GetGameTime().count() + m_respawnDelayTime;
// if option not set then object will be saved at grid unload
@@ -1245,9 +1245,7 @@ void Player::UpdateArea(uint32 newArea)
void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
if (!newZone)
{
return;
}
if (m_zoneUpdateId != newZone)
{
@@ -1264,6 +1262,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
guild->UpdateMemberData(this, GUILD_MEMBER_DATA_ZONEID, newZone);
}
GetMap()->UpdatePlayerZoneStats(m_zoneUpdateId, newZone);
// group update
if (GetGroup())
SetGroupUpdateFlag(GROUP_UPDATE_FULL);