diff options
author | maximius <none@none> | 2009-11-10 13:31:29 -0800 |
---|---|---|
committer | maximius <none@none> | 2009-11-10 13:31:29 -0800 |
commit | bbe7de48b85ef0e82c7ad67cc88fbab468f2fb48 (patch) | |
tree | 6a43924e6e1e7bce48872b6e1433b45d2d5e65b5 /src | |
parent | 625b21264d23914e54b3b1c3f437562d0135445a (diff) |
*Limit non-equippable items to 3 drops, instead of only 1.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/LootMgr.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 2fca3981268..aacc4cf56dd 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -863,10 +863,22 @@ void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const LootStoreItem const * item = Roll(); if (item != NULL && item->lootmode & lootMode) // only add this item if roll succeeds and the mode matches { - for (LootItemList::const_iterator _item = loot.items.begin(); _item != loot.items.end(); ++_item) - if (_item->itemid == item->itemid) - return; // Never add the same item twice - + if (ItemPrototype const* _proto = sItemStorage.LookupEntry<ItemPrototype>(item->itemid)) + { + uint8 _item_counter = 0; + LootItemList::const_iterator _item = loot.items.begin(); + for (; _item != loot.items.end(); ++_item) + if (_item->itemid == item->itemid) + { + ++_item_counter; + if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops + return; + else if(_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop + return; + } + //if (_item != loot.items.end()) + // return; + } loot.AddItem(*item); } } @@ -971,15 +983,28 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16 if (!i->Roll(rate)) continue; // Bad luck for the entry - for (LootItemList::const_iterator _item = loot.items.begin(); _item != loot.items.end(); ++_item) - if (_item->itemid == i->itemid) - continue; // Never add the same item twice + if (ItemPrototype const* _proto = sItemStorage.LookupEntry<ItemPrototype>(i->itemid)) + { + uint8 _item_counter = 0; + LootItemList::const_iterator _item = loot.items.begin(); + for (; _item != loot.items.end(); ++_item) + if (_item->itemid == i->itemid) + { + ++_item_counter; + if (_proto->InventoryType == 0 && _item_counter == 3) // Non-equippable items are limited to 3 drops + continue; + else if(_proto->InventoryType != 0 && _item_counter == 1) // Equippable item are limited to 1 drop + continue; + } + if (_item != loot.items.end()) + continue; + } if (i->mincountOrRef < 0) // References processing { LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef); - if(!Referenced) + if (!Referenced) continue; // Error message already printed at loading stage for (uint32 loop = 0; loop < i->maxcount; ++loop) // Ref multiplicator |