aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-03-20 16:42:22 +0100
committerMachiavelli <none@none>2010-03-20 16:42:22 +0100
commitd21f0c3ce857699950b978f33163fc6e7b18a067 (patch)
treefc176362d51e7adb56c29d4f1159c681d4575b97
parenta0d8b0be48ea0419d6014d0a54256f4ef278c860 (diff)
Make sure a to be traded item ends up in the item update queue for the correct player.
--HG-- branch : trunk
-rw-r--r--src/game/Item.cpp6
-rw-r--r--src/game/Item.h2
-rw-r--r--src/game/TradeHandler.cpp4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 639ec842342..cc19585fcde 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -1069,13 +1069,15 @@ void Item::DeleteRefundDataFromDB()
CharacterDatabase.PExecute("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow());
}
-void Item::SetNotRefundable(Player *owner)
+void Item::SetNotRefundable(Player *owner, bool changestate)
{
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE))
return;
RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
- SetState(ITEM_CHANGED, owner);
+ // Following is not applicable in the trading procedure
+ if (changestate)
+ SetState(ITEM_CHANGED, owner);
SetRefundRecipient(0);
SetPaidMoney(0);
diff --git a/src/game/Item.h b/src/game/Item.h
index c2519433733..f1fd798d1e8 100644
--- a/src/game/Item.h
+++ b/src/game/Item.h
@@ -323,7 +323,7 @@ class Item : public Object
bool IsConjuredConsumable() const { return GetProto()->IsConjuredConsumable(); }
// Item Refund system
- void SetNotRefundable(Player *owner);
+ void SetNotRefundable(Player *owner, bool changestate = true);
void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; }
void SetPaidMoney(uint32 money) { m_paidMoney = money; }
void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; }
diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp
index d64b2f04d2f..23800b81aed 100644
--- a/src/game/TradeHandler.cpp
+++ b/src/game/TradeHandler.cpp
@@ -371,16 +371,16 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
if (myItems[i])
{
myItems[i]->SetUInt64Value( ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
+ myItems[i]->SetNotRefundable(_player, false);
iPtr = _player->GetItemByGuid(_player->tradeItems[i]);
_player->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true);
- myItems[i]->SetNotRefundable(_player);
}
if (hisItems[i])
{
hisItems[i]->SetUInt64Value( ITEM_FIELD_GIFTCREATOR,_player->pTrader->GetGUID());
+ hisItems[i]->SetNotRefundable(_player->pTrader, false);
iPtr = _player->pTrader->GetItemByGuid(_player->pTrader->tradeItems[i]);
_player->pTrader->MoveItemFromInventory(iPtr->GetBagSlot(), iPtr->GetSlot(), true);
- hisItems[i]->SetNotRefundable(_player->pTrader);
}
}