mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Core): fix chests not despawning when opened in group (#5371)
This commit is contained in:
@@ -60,6 +60,7 @@ GameObject::GameObject() : WorldObject(false), MovableMapObject(),
|
|||||||
m_lootGenerationTime = 0;
|
m_lootGenerationTime = 0;
|
||||||
|
|
||||||
ResetLootMode(); // restore default loot mode
|
ResetLootMode(); // restore default loot mode
|
||||||
|
loot.sourceGameObject = this;
|
||||||
m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1494,6 +1494,15 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
|
|||||||
item->is_blocked = false;
|
item->is_blocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Loot* loot = roll->getLoot();
|
||||||
|
if (loot->isLooted() && loot->sourceGameObject != nullptr && loot->sourceGameObject->GetGOInfo()->type == GAMEOBJECT_TYPE_CHEST)
|
||||||
|
{
|
||||||
|
// Deactivate chest if the last item was rolled in group
|
||||||
|
loot->sourceGameObject->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RollId.erase(rollI);
|
RollId.erase(rollI);
|
||||||
delete roll;
|
delete roll;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ enum LootSlotType
|
|||||||
class Player;
|
class Player;
|
||||||
class LootStore;
|
class LootStore;
|
||||||
class ConditionMgr;
|
class ConditionMgr;
|
||||||
|
class GameObject;
|
||||||
struct Loot;
|
struct Loot;
|
||||||
|
|
||||||
struct LootStoreItem
|
struct LootStoreItem
|
||||||
@@ -311,6 +312,7 @@ struct Loot
|
|||||||
|
|
||||||
// GUIDLow of container that holds this loot (item_instance.entry), set for items that can be looted
|
// GUIDLow of container that holds this loot (item_instance.entry), set for items that can be looted
|
||||||
uint32 containerId{0};
|
uint32 containerId{0};
|
||||||
|
GameObject* sourceGameObject;
|
||||||
|
|
||||||
Loot(uint32 _gold = 0) : gold(_gold) { }
|
Loot(uint32 _gold = 0) : gold(_gold) { }
|
||||||
~Loot() { clear(); }
|
~Loot() { clear(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user