Make sure a to be traded item ends up in the item update queue for the correct player.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-03-20 16:42:22 +01:00
parent a0d8b0be48
commit d21f0c3ce8
3 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -1069,12 +1069,14 @@ 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);
// Following is not applicable in the trading procedure
if (changestate)
SetState(ITEM_CHANGED, owner);
SetRefundRecipient(0);
+1 -1
View File
@@ -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; }
+2 -2
View File
@@ -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);
}
}