mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
fix(Core/Loot): Fixed loading conditioned item loot. (#6337)
- Fixes #6326
This commit is contained in:
@@ -41,7 +41,7 @@ void LootItemStorage::LoadStorageFromDB()
|
||||
|
||||
StoredLootItemList& itemList = lootItemStore[ObjectGuid::Create<HighGuid::Item>(fields[0].GetUInt32())];
|
||||
itemList.push_back(StoredLootItem(fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetInt32(), fields[4].GetUInt32(), fields[5].GetBool(),
|
||||
fields[6].GetBool(), fields[7].GetBool(), fields[8].GetBool(), fields[9].GetBool(), fields[10].GetBool()));
|
||||
fields[6].GetBool(), fields[7].GetBool(), fields[8].GetBool(), fields[9].GetBool(), fields[10].GetBool(), fields[11].GetUInt32()));
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
@@ -79,7 +79,7 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/)
|
||||
// Gold at first
|
||||
if (loot->gold)
|
||||
{
|
||||
itemList.push_back(StoredLootItem(0, loot->gold, 0, 0, false, false, false, false, false, false));
|
||||
itemList.push_back(StoredLootItem(0, loot->gold, 0, 0, false, false, false, false, false, false, 0));
|
||||
|
||||
uint8 index = 0;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM);
|
||||
@@ -107,12 +107,18 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/)
|
||||
//if (!li->AllowedForPlayer(player))
|
||||
// continue;
|
||||
|
||||
const ItemTemplate* itemTemplate = sObjectMgr->GetItemTemplate(li->itemid);
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(li->itemid);
|
||||
if (!itemTemplate || itemTemplate->IsCurrencyToken())
|
||||
continue;
|
||||
|
||||
uint32 conditionLootId = 0;
|
||||
if (!li->conditions.empty())
|
||||
{
|
||||
conditionLootId = li->conditions.front()->SourceGroup;
|
||||
}
|
||||
|
||||
itemList.push_back(StoredLootItem(li->itemid, li->count, li->randomPropertyId, li->randomSuffix, li->follow_loot_rules, li->freeforall, li->is_blocked, li->is_counted,
|
||||
li->is_underthreshold, li->needs_quest));
|
||||
li->is_underthreshold, li->needs_quest, conditionLootId));
|
||||
|
||||
uint8 index = 0;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM);
|
||||
@@ -127,6 +133,8 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/)
|
||||
stmt->setBool(index++, li->is_counted);
|
||||
stmt->setBool(index++, li->is_underthreshold);
|
||||
stmt->setBool(index++, li->needs_quest);
|
||||
stmt->setUInt32(index++, conditionLootId);
|
||||
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -172,7 +180,7 @@ bool LootItemStorage::LoadStoredLoot(Item* item, Player* player)
|
||||
li.rollWinnerGUID = ObjectGuid::Empty;
|
||||
|
||||
// Copy the extra loot conditions from the item in the loot template
|
||||
lt->CopyConditions(&li);
|
||||
lt->CopyConditions(&li, it2->conditionLootId);
|
||||
|
||||
if (li.needs_quest)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user