Core/Item: Fixed another possible container exploit due to invalid loading of stored loot items in DB (#26795)

(cherry picked from commit 1b9ee95253)
This commit is contained in:
robinsch
2021-08-09 14:47:35 +01:00
committed by Shauren
parent ca472c1871
commit 5f38fd2f2d
2 changed files with 3 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ namespace
std::unordered_map<uint64, StoredLootContainer> _lootItemStore;
}
StoredLootItem::StoredLootItem(LootItem const& lootItem) : ItemId(lootItem.itemid), Count(lootItem.count), FollowRules(lootItem.follow_loot_rules),
StoredLootItem::StoredLootItem(LootItem const& lootItem) : ItemId(lootItem.itemid), Count(lootItem.count), ItemIndex(lootItem.itemIndex), FollowRules(lootItem.follow_loot_rules),
FFA(lootItem.freeforall), Blocked(lootItem.is_blocked), Counted(lootItem.is_counted), UnderThreshold(lootItem.is_underthreshold),
NeedsQuest(lootItem.needs_quest), RandomBonusListId(lootItem.randomBonusListId), Context(lootItem.context), BonusListIDs(lootItem.BonusListIDs)
{
@@ -160,6 +160,7 @@ bool LootItemStorage::LoadStoredLoot(Item* item, Player* player)
LootItem li;
li.itemid = storedItemPair.first;
li.count = storedItemPair.second.Count;
li.itemIndex = storedItemPair.second.ItemIndex;
li.follow_loot_rules = storedItemPair.second.FollowRules;
li.freeforall = storedItemPair.second.FFA;
li.is_blocked = storedItemPair.second.Blocked;

View File

@@ -38,6 +38,7 @@ struct StoredLootItem
uint32 ItemId;
uint32 Count;
uint32 ItemIndex;
bool FollowRules;
bool FFA;
bool Blocked;