mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 07:06:23 +00:00
fix(Core/LootMgr): add startup error for unsupported reference minCou… (#20725)
This commit is contained in:
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
void Verify(LootStore const& lootstore, uint32 id, uint8 group_id) const;
|
||||
void CollectLootIds(LootIdSet& set) const;
|
||||
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const;
|
||||
void CheckLootRefs(LootStore const& lootstore, uint32 Id, LootIdSet* ref_set) const;
|
||||
LootStoreItemList* GetExplicitlyChancedItemList() { return &ExplicitlyChanced; }
|
||||
LootStoreItemList* GetEqualChancedItemList() { return &EqualChanced; }
|
||||
void CopyConditions(ConditionList conditions);
|
||||
@@ -277,7 +277,7 @@ uint32 LootStore::LoadAndCollectLootIds(LootIdSet& lootIdSet)
|
||||
void LootStore::CheckLootRefs(LootIdSet* ref_set) const
|
||||
{
|
||||
for (LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr)
|
||||
ltItr->second->CheckLootRefs(m_LootTemplates, ref_set);
|
||||
ltItr->second->CheckLootRefs(*this, ltItr->first, ref_set);
|
||||
}
|
||||
|
||||
void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
|
||||
@@ -297,6 +297,11 @@ void LootStore::ReportNonExistingId(uint32 lootId, const char* ownerType, uint32
|
||||
LOG_ERROR("sql.sql", "Table '{}' Entry {} does not exist but it is used by {} {}", GetName(), lootId, ownerType, ownerId);
|
||||
}
|
||||
|
||||
void LootStore::ReportInvalidCount(uint32 lootId, const char* ownerType, uint32 ownerId, uint32 itemId, uint8 minCount, uint8 maxCount) const
|
||||
{
|
||||
LOG_ERROR("sql.sql", "Table '{}' Entry {} used by {} entry {} item {} has minCount ( {} ) != maxCount ( {} ) which is not supported for this loot type.", GetName(), lootId, ownerType, ownerId, itemId, minCount, maxCount);
|
||||
}
|
||||
|
||||
//
|
||||
// --------- LootStoreItem ---------
|
||||
//
|
||||
@@ -1502,21 +1507,20 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
|
||||
}
|
||||
}
|
||||
|
||||
void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, LootIdSet* ref_set) const
|
||||
void LootTemplate::LootGroup::CheckLootRefs(LootStore const& lootstore, uint32 Id, LootIdSet* ref_set) const
|
||||
{
|
||||
for (LootStoreItemList::const_iterator ieItr = ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
|
||||
{
|
||||
LootStoreItem* item = *ieItr;
|
||||
if (item->reference)
|
||||
{
|
||||
if (item->mincount != item->maxcount)
|
||||
LootTemplates_Reference.ReportInvalidCount(std::abs(item->reference), lootstore.GetName(), Id, item->itemid, item->mincount, item->maxcount);
|
||||
|
||||
if (!LootTemplates_Reference.GetLootFor(std::abs(item->reference)))
|
||||
{
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), "Reference", item->itemid);
|
||||
}
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), lootstore.GetName(), item->itemid);
|
||||
else if (ref_set)
|
||||
{
|
||||
ref_set->erase(std::abs(item->reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1525,14 +1529,13 @@ void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, Lo
|
||||
LootStoreItem* item = *ieItr;
|
||||
if (item->reference)
|
||||
{
|
||||
if (item->mincount != item->maxcount)
|
||||
LootTemplates_Reference.ReportInvalidCount(std::abs(item->reference), lootstore.GetName(), Id, item->itemid, item->mincount, item->maxcount);
|
||||
|
||||
if (!LootTemplates_Reference.GetLootFor(std::abs(item->reference)))
|
||||
{
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), "Reference", item->itemid);
|
||||
}
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), lootstore.GetName(), item->itemid);
|
||||
else if (ref_set)
|
||||
{
|
||||
ref_set->erase(std::abs(item->reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1864,27 +1867,26 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const
|
||||
/// @todo: References validity checks
|
||||
}
|
||||
|
||||
void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const
|
||||
void LootTemplate::CheckLootRefs(LootStore const& lootstore, uint32 Id, LootIdSet* ref_set) const
|
||||
{
|
||||
for (LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
|
||||
{
|
||||
LootStoreItem* item = *ieItr;
|
||||
if (item->reference)
|
||||
{
|
||||
if (item->mincount != item->maxcount)
|
||||
LootTemplates_Reference.ReportInvalidCount(std::abs(item->reference), lootstore.GetName(), Id, item->itemid, item->mincount, item->maxcount);
|
||||
|
||||
if (!LootTemplates_Reference.GetLootFor(std::abs(item->reference)))
|
||||
{
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), "Reference", item->itemid);
|
||||
}
|
||||
LootTemplates_Reference.ReportNonExistingId(std::abs(item->reference), lootstore.GetName(), item->itemid);
|
||||
else if (ref_set)
|
||||
{
|
||||
ref_set->erase(std::abs(item->reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
|
||||
if (LootGroup* group = *grItr)
|
||||
group->CheckLootRefs(store, ref_set);
|
||||
group->CheckLootRefs(lootstore, Id, ref_set);
|
||||
}
|
||||
|
||||
bool LootTemplate::addConditionItem(Condition* cond)
|
||||
|
||||
@@ -219,6 +219,7 @@ public:
|
||||
void ReportUnusedIds(LootIdSet const& ids_set) const;
|
||||
void ReportNonExistingId(uint32 lootId) const;
|
||||
void ReportNonExistingId(uint32 lootId, const char* ownerType, uint32 ownerId) const;
|
||||
void ReportInvalidCount(uint32 lootId, const char* ownerType, uint32 ownerId, uint32 itemId, uint8 minCount, uint8 maxCount) const;
|
||||
|
||||
[[nodiscard]] bool HaveLootFor(uint32 loot_id) const { return m_LootTemplates.find(loot_id) != m_LootTemplates.end(); }
|
||||
[[nodiscard]] bool HaveQuestLootFor(uint32 loot_id) const;
|
||||
@@ -263,7 +264,7 @@ public:
|
||||
|
||||
// Checks integrity of the template
|
||||
void Verify(LootStore const& store, uint32 Id) const;
|
||||
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const;
|
||||
void CheckLootRefs(LootStore const& lootstore, uint32 Id, LootIdSet* ref_set) const;
|
||||
bool addConditionItem(Condition* cond);
|
||||
[[nodiscard]] bool isReference(uint32 id) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user