File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2523,8 +2523,16 @@ void GameObject::SetLootState(LootState state, Unit* unit)
25232523 AI ()->OnLootStateChanged (state, unit);
25242524
25252525 // Start restock timer if the chest is partially looted or not looted at all
2526- if (GetGoType () == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED && GetGOInfo ()->chest .chestRestockTime > 0 && m_restockTime == 0 )
2527- m_restockTime = GameTime::GetGameTime () + GetGOInfo ()->chest .chestRestockTime ;
2526+ if (GetGoType () == GAMEOBJECT_TYPE_CHEST && state == GO_ACTIVATED)
2527+ {
2528+ GameObjectTemplate const * goInfo = GetGOInfo ();
2529+ if (goInfo->chest .chestRestockTime > 0 && m_restockTime == 0 )
2530+ m_restockTime = GameTime::GetGameTime () + goInfo->chest .chestRestockTime ;
2531+
2532+ // If world chests were opened, despawn them after 5 minutes
2533+ if (goInfo->chest .chestRestockTime == 0 && GetMap ()->IsWorldMap ())
2534+ DespawnOrUnsummon (5min);
2535+ }
25282536
25292537 if (GetGoType () == GAMEOBJECT_TYPE_DOOR) // only set collision for doors on SetGoState
25302538 return ;
Original file line number Diff line number Diff line change @@ -4226,6 +4226,11 @@ bool Map::Instanceable() const
42264226 return i_mapEntry && i_mapEntry->Instanceable ();
42274227}
42284228
4229+ bool Map::IsWorldMap () const
4230+ {
4231+ return i_mapEntry && i_mapEntry->IsWorldMap ();
4232+ }
4233+
42294234bool Map::IsDungeon () const
42304235{
42314236 return i_mapEntry && i_mapEntry->IsDungeon ();
Original file line number Diff line number Diff line change @@ -419,6 +419,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
419419 MapDifficulty const * GetMapDifficulty () const ;
420420
421421 bool Instanceable () const ;
422+ bool IsWorldMap () const ;
422423 bool IsDungeon () const ;
423424 bool IsNonRaidDungeon () const ;
424425 bool IsRaid () const ;
You can’t perform that action at this time.
0 commit comments