fix(Core/Loot): Fixed processing duplicated loot item within different groups. (#13038)

Fixes #13038
This commit is contained in:
UltraNix
2022-11-12 13:31:29 +01:00
committed by GitHub
parent c1c9dc6105
commit 6278072b16
3 changed files with 4 additions and 1 deletions

View File

@@ -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);

View File

@@ -71,7 +71,7 @@ struct LootGroupInvalidSelector : public Acore::unary_function<LootStoreItem*, b
uint8 foundDuplicates = 0;
for (std::vector<LootItem>::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

View File

@@ -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)