aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp45
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp2
2 files changed, 26 insertions, 21 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 7e4b8295f4b..eb839fb2945 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -12099,16 +12099,16 @@ Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool updat
Item* item = Item::CreateItem(itemId, count, context, this);
if (item)
{
- ItemAddedQuestCheck(itemId, count);
- UpdateCriteria(CriteriaType::ObtainAnyItem, itemId, count);
- UpdateCriteria(CriteriaType::AcquireItem, itemId, count);
-
item->AddItemFlag(ITEM_FIELD_FLAG_NEW_ITEM);
item->SetBonuses(bonusListIDs);
item = StoreItem(pos, item, update);
+ ItemAddedQuestCheck(itemId, count);
+ UpdateCriteria(CriteriaType::ObtainAnyItem, itemId, count);
+ UpdateCriteria(CriteriaType::AcquireItem, itemId, count);
+
item->SetFixedLevel(GetLevel());
item->SetItemRandomBonusList(randomBonusListId);
@@ -12289,9 +12289,10 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, ItemContext context, bool up
{
if (Item* pItem = Item::CreateItem(item, 1, context, this))
{
- ItemAddedQuestCheck(item, 1);
UpdateCriteria(CriteriaType::ObtainAnyItem, item, 1);
- return EquipItem(pos, pItem, update);
+ Item* equippedItem = EquipItem(pos, pItem, update);
+ ItemAddedQuestCheck(item, 1);
+ return equippedItem;
}
return nullptr;
@@ -12671,8 +12672,8 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
{
if (Item* it = GetItemByPos(bag, slot))
{
- ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
RemoveItem(bag, slot, update);
+ ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
it->SetNotRefundable(this, false, nullptr, false);
RemoveItemFromUpdateQueueOf(it, this);
GetSession()->GetCollectionMgr()->RemoveTemporaryAppearance(it);
@@ -12687,9 +12688,8 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
// Common operation need to add item from inventory without delete in trade, guild bank, mail....
void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB)
{
- // update quest counters
- ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
- UpdateCriteria(CriteriaType::ObtainAnyItem, pItem->GetEntry(), pItem->GetCount());
+ uint32 itemId = pItem->GetEntry();
+ uint32 count = pItem->GetCount();
// store item
Item* pLastItem = StoreItem(dest, pItem, update);
@@ -12708,6 +12708,10 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
if (pLastItem->IsBOPTradeable())
AddTradeableItem(pLastItem);
}
+
+ // update quest counters
+ ItemAddedQuestCheck(itemId, count);
+ UpdateCriteria(CriteriaType::ObtainAnyItem, itemId, count);
}
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
@@ -12741,7 +12745,6 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
ApplyItemObtainSpells(pItem, false);
- ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
sScriptMgr->OnItemRemove(this, pItem);
ItemTemplate const* pProto = pItem->GetTemplate();
@@ -12790,6 +12793,8 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
if (pProto->HasFlag(ITEM_FLAG_HAS_LOOT))
sLootItemStorage->RemoveStoredLootForContainer(pItem->GetGUID().GetCounter());
+ ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
+
if (IsInWorld() && update)
{
pItem->RemoveFromWorld();
@@ -12833,8 +12838,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -12866,8 +12871,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -12899,8 +12904,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -12926,8 +12931,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -12959,8 +12964,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -12991,8 +12996,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -13019,8 +13024,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -13047,8 +13052,8 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
else
{
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
item->SetCount(item->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
if (IsInWorld() && update)
item->SendUpdateToPlayer(this);
item->SetState(ITEM_CHANGED, this);
@@ -13165,8 +13170,8 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update)
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count);
pItem->SetCount(pItem->GetCount() - count);
+ ItemRemovedQuestCheck(pItem->GetEntry(), count);
count = 0;
if (IsInWorld() && update)
pItem->SendUpdateToPlayer(this);
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 6dd5fd3b3a7..c148f4b4a81 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -489,8 +489,8 @@ void WorldSession::HandleSellItemOpcode(WorldPackets::Item::SellItem& packet)
}
else
{
- _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
_player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
+ _player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
RemoveItemFromUpdateQueueOf(pItem, _player);
_player->AddItemToBuyBackSlot(pItem);
}