aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Player/Player.cpp46
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp2
2 files changed, 27 insertions, 21 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 595614ce777..f0638cd7efc 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -11948,13 +11948,15 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
Item* pItem = Item::CreateItem(item, count, this);
if (pItem)
{
- ItemAddedQuestCheck(item, count);
- UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
- UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, count);
if (randomPropertyId)
pItem->SetItemRandomProperties(randomPropertyId);
+
pItem = StoreItem(dest, pItem, update);
+ ItemAddedQuestCheck(item, count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, count);
+
if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
{
pItem->SetSoulboundTradeable(allowedLooters);
@@ -12111,9 +12113,10 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
{
if (Item* pItem = Item::CreateItem(item, 1, this))
{
- ItemAddedQuestCheck(item, 1);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
- return EquipItem(pos, pItem, update);
+ Item* equippedItem = EquipItem(pos, pItem, update);
+ ItemAddedQuestCheck(item, 1);
+ return equippedItem;
}
return nullptr;
@@ -12385,8 +12388,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);
RemoveItemFromUpdateQueueOf(it, this);
if (it->IsInWorld())
@@ -12400,9 +12403,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());
- UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
+ uint32 itemId = pItem->GetEntry();
+ uint32 count = pItem->GetCount();
// store item
Item* pLastItem = StoreItem(dest, pItem, update);
@@ -12421,6 +12423,10 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
if (pLastItem->IsBOPTradeable())
AddTradeableItem(pLastItem);
}
+
+ // update quest counters
+ ItemAddedQuestCheck(itemId, count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, itemId, count);
}
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
@@ -12454,7 +12460,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();
@@ -12504,6 +12509,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();
@@ -12541,8 +12548,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);
@@ -12569,8 +12576,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);
@@ -12602,8 +12609,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);
@@ -12635,8 +12642,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);
@@ -12662,8 +12669,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);
@@ -12695,8 +12702,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);
@@ -12813,8 +12820,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);
@@ -16355,8 +16362,6 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count)
}
if (CanCompleteQuest(questid))
CompleteQuest(questid);
- else if (q_status.ItemCount[j] == reqitemcount) // Send quest update when an objective is completed
- UpdateVisibleGameobjectsOrSpellClicks();
}
}
}
@@ -23531,7 +23536,8 @@ void Player::UpdateVisibleGameobjectsOrSpellClicks()
if (itr->IsGameObject())
{
if (GameObject* obj = ObjectAccessor::GetGameObject(*this, *itr))
- obj->BuildValuesUpdateBlockForPlayer(&udata, this);
+ if (sObjectMgr->IsGameObjectForQuests(obj->GetEntry()))
+ obj->BuildValuesUpdateBlockForPlayer(&udata, this);
}
else if (itr->IsCreatureOrVehicle())
{
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 62e4ac001e5..f4558493589 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -464,8 +464,8 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
}
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);
}