diff options
| author | Shauren <shauren.trinity@gmail.com> | 2023-07-03 00:17:17 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2023-07-03 00:17:17 +0200 |
| commit | a3ef01f87bd56e553972277a38cf9a98a3397495 (patch) | |
| tree | 6660b5d730181e073a80f28b63d150984f823f3f /src/server/game/Entities/GameObject | |
| parent | 36ecc2d8cb8d913a6ac0936031de47b18c69a90d (diff) | |
Core/GameObjects: Only start loot restock timer if loot contents were modified and ignore it for personal loot
Closes #29023
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index e7726b1f595..72bb7094edc 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1210,19 +1210,21 @@ void GameObject::Update(uint32 diff) break; case GAMEOBJECT_TYPE_CHEST: if (m_loot) + { m_loot->Update(); + // Non-consumable chest was partially looted and restock time passed, restock all loot now + if (GetGOInfo()->chest.consumable == 0 && GetGOInfo()->chest.chestRestockTime && GameTime::GetGameTime() >= m_restockTime) + { + m_restockTime = 0; + m_lootState = GO_READY; + ClearLoot(); + UpdateDynamicFlagsForNearbyPlayers(); + } + } + for (auto&& [playerOwner, loot] : m_personalLoot) loot->Update(); - - // Non-consumable chest was partially looted and restock time passed, restock all loot now - if (GetGOInfo()->chest.consumable == 0 && GetGOInfo()->chest.chestRestockTime && GameTime::GetGameTime() >= m_restockTime) - { - m_restockTime = 0; - m_lootState = GO_READY; - ClearLoot(); - UpdateDynamicFlagsForNearbyPlayers(); - } break; case GAMEOBJECT_TYPE_TRAP: { @@ -3310,7 +3312,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) AI()->OnLootStateChanged(state, unit); // Start restock timer if the chest is partially looted or not looted at all - if (GetGoType() == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED && GetGOInfo()->chest.chestRestockTime > 0 && m_restockTime == 0) + if (GetGoType() == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED && GetGOInfo()->chest.chestRestockTime > 0 && m_restockTime == 0 && m_loot && m_loot->IsChanged()) m_restockTime = GameTime::GetGameTime() + GetGOInfo()->chest.chestRestockTime; if (GetGoType() == GAMEOBJECT_TYPE_DOOR) // only set collision for doors on SetGoState |
