From 6278072b16f8e7db2490ff889b7623367cdb28fb Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sat, 12 Nov 2022 13:31:29 +0100 Subject: [PATCH] fix(Core/Loot): Fixed processing duplicated loot item within different groups. (#13038) Fixes #13038 --- src/server/game/Loot/LootItemStorage.cpp | 1 + src/server/game/Loot/LootMgr.cpp | 3 ++- src/server/game/Loot/LootMgr.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/game/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index 3f111a842..1c490f13a 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.cpp @@ -197,6 +197,7 @@ bool LootItemStorage::LoadStoredLoot(Item* item, Player* player) li.randomPropertyId = it2->randomPropertyId; li.randomSuffix = it2->randomSuffix; li.rollWinnerGUID = ObjectGuid::Empty; + li.groupid = 0; // Copy the extra loot conditions from the item in the loot template lt->CopyConditions(&li, it2->conditionLootId); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index d2736ad01..c45c86b5c 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -71,7 +71,7 @@ struct LootGroupInvalidSelector : public Acore::unary_function::const_iterator itr = _loot.items.begin(); itr != _loot.items.end(); ++itr) - if (itr->itemid == item->itemid) + if (itr->itemid == item->itemid && itr->groupid == item->groupid) { ++foundDuplicates; if (_proto->InventoryType == 0 && foundDuplicates == 3 && _proto->ItemId != 47242 /*Trophy of the Crusade*/) // Non-equippable items are limited to 3 drops @@ -401,6 +401,7 @@ LootItem::LootItem(LootStoreItem const& li) is_underthreshold = 0; is_counted = 0; rollWinnerGUID = ObjectGuid::Empty; + groupid = li.groupid; } // Basic checks for player/item compatibility - if false no chance to see the item in the loot diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index ce03c8f40..74bc9d20c 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -168,6 +168,7 @@ struct LootItem bool is_counted : 1; bool needs_quest : 1; // quest drop bool follow_loot_rules : 1; + uint8 groupid : 7; // Constructor, copies most fields from LootStoreItem, generates random count and random suffixes/properties // Should be called for non-reference LootStoreItem entries only (reference = 0)