Core/GameObject: do not allow consumable chests to restock while partially looted.

Port From (https://github.com/TrinityCore/TrinityCore/commit/2fea2a1e8104856587d0eff651eb2199dfcd0513)
This commit is contained in:
hondacrx
2021-12-24 21:22:21 -05:00
parent 5c4a42317e
commit 5c41122916
@@ -538,6 +538,7 @@ namespace Game.Entities
if (m_restockTime > GameTime.GetGameTime()) if (m_restockTime > GameTime.GetGameTime())
return; return;
// If there is no restock timer, or if the restock timer passed, the chest becomes ready to loot // If there is no restock timer, or if the restock timer passed, the chest becomes ready to loot
m_restockTime = 0;
m_lootState = LootState.Ready; m_lootState = LootState.Ready;
AddToObjectUpdateIfNeeded(); AddToObjectUpdateIfNeeded();
break; break;
@@ -725,9 +726,10 @@ namespace Game.Entities
m_groupLootTimer -= diff; m_groupLootTimer -= diff;
} }
// Gameobject was partially looted and restock time passed, restock all loot now // Non-consumable chest was partially looted and restock time passed, restock all loot now
if (GameTime.GetGameTime() >= m_restockTime) if (GetGoInfo().Chest.consumable == 0 && GameTime.GetGameTime() >= m_restockTime)
{ {
m_restockTime = 0;
m_lootState = LootState.Ready; m_lootState = LootState.Ready;
AddToObjectUpdateIfNeeded(); AddToObjectUpdateIfNeeded();
} }