fix(Core/Entities): Don't update owned item achievement criteria for refunded extended cost items. (#23947)

This commit is contained in:
Benjamin Jackson
2025-12-23 16:29:02 -05:00
committed by GitHub
parent 5558254825
commit 94a6c22a69
3 changed files with 13 additions and 8 deletions

View File

@@ -15807,7 +15807,7 @@ void Player::RefundItem(Item* item)
ItemPosCountVec dest;
InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count);
ASSERT(msg == EQUIP_ERR_OK); /// Already checked before
Item* it = StoreNewItem(dest, itemid, true);
Item* it = StoreNewItem(dest, itemid, true, true);
SendNewItem(it, count, true, false, true);
}
}

View File

@@ -1303,8 +1303,8 @@ public:
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
[[nodiscard]] InventoryResult CanUseAmmo(uint32 item) const;
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0);
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters);
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, bool refund = false);
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters, bool refund = false);
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
Item* EquipNewItem(uint16 pos, uint32 item, bool update);
Item* EquipItem(uint16 pos, Item* pItem, bool update);

View File

@@ -2528,14 +2528,14 @@ void Player::RemoveAmmo()
UpdateDamagePhysical(RANGED_ATTACK);
}
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId)
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, bool refund)
{
AllowedLooterSet allowedLooters;
return StoreNewItem(dest, item, update, randomPropertyId, allowedLooters);
return StoreNewItem(dest, item, update, randomPropertyId, allowedLooters, refund);
}
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters)
Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update, int32 randomPropertyId, AllowedLooterSet& allowedLooters, bool refund)
{
uint32 count = 0;
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
@@ -2550,8 +2550,13 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
AdditionalSavingAddMask(ADDITIONAL_SAVING_INVENTORY_AND_GOLD);
ItemAddedQuestCheck(item, count);
if (!refund)
{ // Don't update counter criteria for refunded items (primarily currencies)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, count);
}
pItem = StoreItem(dest, pItem, update);
if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound() && sWorld->getBoolConfig(CONFIG_SET_BOP_ITEM_TRADEABLE))