diff options
| author | Shauren <shauren.trinity@gmail.com> | 2022-09-01 20:07:58 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-09-01 20:07:58 +0200 |
| commit | 7957e2d380e08fa831765f610c0e29d2f3e11a04 (patch) | |
| tree | 55632f7f94edb3096360c983abbdd448d8dc79d7 /src/server/game/Entities/GameObject | |
| parent | 62e5b52d2b91832889f02edc7bbd83ad474923e3 (diff) | |
Core/Loot: Allocate Loot separately from objects
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 5 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index a3c199a4a1a..c789fc6f64b 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -825,10 +825,6 @@ bool GameObject::Create(uint32 entry, Map* map, Position const& pos, QuaternionD LastUsedScriptID = GetGOInfo()->ScriptId; AIM_Initialize(); - // Initialize loot duplicate count depending on raid difficulty - if (map->Is25ManRaid()) - loot.maxDuplicates = 3; - if (spawnid) m_spawnId = spawnid; @@ -1177,12 +1173,12 @@ void GameObject::Update(uint32 diff) } break; case GAMEOBJECT_TYPE_CHEST: - if (m_groupLootTimer) + if (m_loot && m_groupLootTimer) { if (m_groupLootTimer <= diff) { if (Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID)) - group->EndRoll(&loot, GetMap()); + group->EndRoll(m_loot.get(), GetMap()); m_groupLootTimer = 0; lootingGroupLowGUID.Clear(); @@ -1269,7 +1265,7 @@ void GameObject::Update(uint32 diff) return; } - loot.clear(); + m_loot = nullptr; // Do not delete chests or goobers that are not consumed on loot, while still allowing them to despawn when they expire if summoned bool isSummonedAndExpired = (GetOwner() || GetSpellId()) && m_respawnTime == 0; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index e345f9a147d..133c1c4e460 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -21,7 +21,6 @@ #include "Object.h" #include "GridObject.h" #include "GameObjectData.h" -#include "Loot.h" #include "MapObject.h" #include "SharedDefines.h" @@ -33,6 +32,7 @@ class OPvPCapturePoint; class Transport; class TransportBase; class Unit; +struct Loot; struct TransportAnimation; enum TriggerCastFlags : uint32; @@ -279,13 +279,14 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject> void SaveRespawnTime(uint32 forceDelay = 0); - Loot loot; + std::unique_ptr<Loot> m_loot; Player* GetLootRecipient() const; Group* GetLootRecipientGroup() const; void SetLootRecipient(Unit* unit, Group* group = nullptr); bool IsLootAllowedFor(Player const* player) const; bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); } + Loot* GetLootForPlayer(Player const* /*player*/) const override { return m_loot.get(); } uint32 m_groupLootTimer; // (msecs)timer used for group loot ObjectGuid lootingGroupLowGUID; // used to find group which is looting |
