*Never add the same loot item twice.
--HG-- branch : trunk
This commit is contained in:
@@ -381,7 +381,7 @@ void Loot::AddItem(LootStoreItem const & item)
|
|||||||
if( !item.conditionId )
|
if( !item.conditionId )
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid);
|
ItemPrototype const* proto = objmgr.GetItemPrototype(item.itemid);
|
||||||
if( !proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT)==0 )
|
if (!proto || (proto->Flags & ITEM_FLAGS_PARTY_LOOT) == 0)
|
||||||
++unlootedCount;
|
++unlootedCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -508,7 +508,7 @@ QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player)
|
|||||||
if(!item.is_counted)
|
if(!item.is_counted)
|
||||||
{
|
{
|
||||||
++unlootedCount;
|
++unlootedCount;
|
||||||
item.is_counted=true;
|
item.is_counted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -957,7 +957,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rolling non-grouped items
|
// Rolling non-grouped items
|
||||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i )
|
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
|
||||||
{
|
{
|
||||||
if (i->lootmode &~ lootMode) // Do not add if mode mismatch
|
if (i->lootmode &~ lootMode) // Do not add if mode mismatch
|
||||||
continue;
|
continue;
|
||||||
@@ -965,6 +965,10 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16
|
|||||||
if (!i->Roll(rate))
|
if (!i->Roll(rate))
|
||||||
continue; // Bad luck for the entry
|
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 (i->mincountOrRef < 0) // References processing
|
if (i->mincountOrRef < 0) // References processing
|
||||||
{
|
{
|
||||||
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
||||||
@@ -972,7 +976,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint16
|
|||||||
if(!Referenced)
|
if(!Referenced)
|
||||||
continue; // Error message already printed at loading stage
|
continue; // Error message already printed at loading stage
|
||||||
|
|
||||||
for (uint32 loop=0; loop < i->maxcount; ++loop) // Ref multiplicator
|
for (uint32 loop = 0; loop < i->maxcount; ++loop) // Ref multiplicator
|
||||||
Referenced->Process(loot, store, rate, lootMode, i->group);
|
Referenced->Process(loot, store, rate, lootMode, i->group);
|
||||||
}
|
}
|
||||||
else // Plain entries (not a reference, not grouped)
|
else // Plain entries (not a reference, not grouped)
|
||||||
|
|||||||
+2
-1
@@ -137,6 +137,7 @@ struct Loot;
|
|||||||
class LootTemplate;
|
class LootTemplate;
|
||||||
|
|
||||||
typedef std::vector<QuestItem> QuestItemList;
|
typedef std::vector<QuestItem> QuestItemList;
|
||||||
|
typedef std::vector<LootItem> LootItemList;
|
||||||
typedef std::map<uint32, QuestItemList *> QuestItemMap;
|
typedef std::map<uint32, QuestItemList *> QuestItemMap;
|
||||||
typedef std::vector<LootStoreItem> LootStoreItemList;
|
typedef std::vector<LootStoreItem> LootStoreItemList;
|
||||||
typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap;
|
typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap;
|
||||||
@@ -153,7 +154,7 @@ class LootStore
|
|||||||
void Verify() const;
|
void Verify() const;
|
||||||
|
|
||||||
void LoadAndCollectLootIds(LootIdSet& ids_set);
|
void LoadAndCollectLootIds(LootIdSet& ids_set);
|
||||||
void CheckLootRefs(LootIdSet* ref_set = NULL) const;// check existence reference and remove it from ref_set
|
void CheckLootRefs(LootIdSet* ref_set = NULL) const; // check existence reference and remove it from ref_set
|
||||||
void ReportUnusedIds(LootIdSet const& ids_set) const;
|
void ReportUnusedIds(LootIdSet const& ids_set) const;
|
||||||
void ReportNotExistedId(uint32 id) const;
|
void ReportNotExistedId(uint32 id) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user