mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/GameObject: Activated world chests will now despawn after 5 minutes (#30269)
Co-authored-by: Kaytotes <kaytotes@users.noreply.github.com>
This commit is contained in:
@@ -2523,8 +2523,16 @@ 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)
|
||||
m_restockTime = GameTime::GetGameTime() + GetGOInfo()->chest.chestRestockTime;
|
||||
if (GetGoType() == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED)
|
||||
{
|
||||
GameObjectTemplate const* goInfo = GetGOInfo();
|
||||
if (goInfo->chest.chestRestockTime > 0 && m_restockTime == 0)
|
||||
m_restockTime = GameTime::GetGameTime() + goInfo->chest.chestRestockTime;
|
||||
|
||||
// If world chests were opened, despawn them after 5 minutes
|
||||
if (goInfo->chest.chestRestockTime == 0 && GetMap()->IsWorldMap())
|
||||
DespawnOrUnsummon(5min);
|
||||
}
|
||||
|
||||
if (GetGoType() == GAMEOBJECT_TYPE_DOOR) // only set collision for doors on SetGoState
|
||||
return;
|
||||
|
||||
@@ -4226,6 +4226,11 @@ bool Map::Instanceable() const
|
||||
return i_mapEntry && i_mapEntry->Instanceable();
|
||||
}
|
||||
|
||||
bool Map::IsWorldMap() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsWorldMap();
|
||||
}
|
||||
|
||||
bool Map::IsDungeon() const
|
||||
{
|
||||
return i_mapEntry && i_mapEntry->IsDungeon();
|
||||
|
||||
@@ -419,6 +419,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
|
||||
MapDifficulty const* GetMapDifficulty() const;
|
||||
|
||||
bool Instanceable() const;
|
||||
bool IsWorldMap() const;
|
||||
bool IsDungeon() const;
|
||||
bool IsNonRaidDungeon() const;
|
||||
bool IsRaid() const;
|
||||
|
||||
Reference in New Issue
Block a user