From da9172430d30c0ab2ca917b05dcff2f990716506 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 21 Apr 2021 22:11:47 -0400 Subject: [PATCH] Core/Items: Don't update average item level when obtaining/destroying non-equippable items Port From (https://github.com/TrinityCore/TrinityCore/commit/aa826993e2c5870d2aa7d029ea3c0d98687ee884) --- Source/Game/Entities/Player/Player.Items.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index c34d12a76..9eb18e941 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -1259,7 +1259,7 @@ namespace Game.Entities Log.outError(LogFilter.Player, "STORAGE: Can't equip or store initial item {0} for race {1} class {2}, error msg = {3}", titem_id, GetRace(), GetClass(), msg); return false; } - public Item StoreNewItem(List pos, uint itemId, bool update, uint randomPropertyId = 0, List allowedLooters = null, ItemContext context = 0, List bonusListIDs = null, bool addToCollection = true) + public Item StoreNewItem(List pos, uint itemId, bool update, uint randomBonusListId = 0, List allowedLooters = null, ItemContext context = 0, List bonusListIDs = null, bool addToCollection = true) { uint count = 0; foreach (var itemPosCount in pos) @@ -1279,7 +1279,7 @@ namespace Game.Entities item = StoreItem(pos, item, update); item.SetFixedLevel(GetLevel()); - item.SetItemRandomBonusList(randomPropertyId); + item.SetItemRandomBonusList(randomBonusListId); if (allowedLooters != null && allowedLooters.Count > 1 && item.GetTemplate().GetMaxStackSize() == 1 && item.IsSoulBound()) { @@ -1319,7 +1319,8 @@ namespace Game.Entities } } - UpdateAverageItemLevelTotal(); + if (item.GetTemplate().GetInventoryType() != InventoryType.NonEquip) + UpdateAverageItemLevelTotal(); } return item; } @@ -5408,7 +5409,9 @@ namespace Game.Entities pItem.SetSlot(ItemConst.NullSlot); pItem.SetState(ItemUpdateState.Removed, this); - UpdateAverageItemLevelTotal(); + if (pItem.GetTemplate().GetInventoryType() != InventoryType.NonEquip) + UpdateAverageItemLevelTotal(); + if (bag == InventorySlots.Bag0) UpdateAverageItemLevelEquipped(); }