aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp52
1 files changed, 34 insertions, 18 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 35079e4ee4b..f78ab5a5eee 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -12012,17 +12012,22 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
if (IsInventoryPos(dst))
{
+ bool isRefundable = pSrcItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
+ if (isRefundable)
+ AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
+
// change item amount before check (for unique max count check)
- AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
pSrcItem->SetCount(pSrcItem->GetCount() - count);
ItemPosCountVec dest;
uint8 msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false);
if (msg != EQUIP_ERR_OK)
{
+ if (isRefundable)
+ AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
+
delete pNewItem;
pSrcItem->SetCount(pSrcItem->GetCount() + count);
- AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
SendEquipError(msg, pSrcItem, NULL);
return;
}
@@ -12031,26 +12036,34 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
pSrcItem->SendUpdateToPlayer(this);
pSrcItem->SetState(ITEM_CHANGED, this);
StoreItem(dest, pNewItem, true);
- AddRefundReference(pNewItem->GetGUID(), count);
- pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
- pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
- pNewItem->SetRefundRecipient(GetGUIDLow());
- pNewItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, pSrcItem->GetPlayedTime());
- pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
- pNewItem->SaveRefundDataToDB(count);
+ if (isRefundable)
+ {
+ AddRefundReference(pNewItem->GetGUID(), count);
+ pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
+ pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
+ pNewItem->SetRefundRecipient(GetGUIDLow());
+ pNewItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, pSrcItem->GetPlayedTime());
+ pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
+ pNewItem->SaveRefundDataToDB(count);
+ }
}
else if (IsBankPos (dst))
{
+ bool isRefundable = pSrcItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
+ if (isRefundable)
+ AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
+
// change item amount before check (for unique max count check)
- AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
pSrcItem->SetCount(pSrcItem->GetCount() - count);
ItemPosCountVec dest;
uint8 msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false);
if (msg != EQUIP_ERR_OK)
{
+ if (isRefundable)
+ AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
+
delete pNewItem;
- AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
pSrcItem->SetCount(pSrcItem->GetCount() + count);
SendEquipError(msg, pSrcItem, NULL);
return;
@@ -12060,13 +12073,16 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
pSrcItem->SendUpdateToPlayer(this);
pSrcItem->SetState(ITEM_CHANGED, this);
BankItem(dest, pNewItem, true);
- AddRefundReference(pNewItem->GetGUID(), count);
- pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
- pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
- pNewItem->SetRefundRecipient(GetGUIDLow());
- pNewItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, pSrcItem->GetPlayedTime());
- pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
- pNewItem->SaveRefundDataToDB(count);
+ if (isRefundable)
+ {
+ AddRefundReference(pNewItem->GetGUID(), count);
+ pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
+ pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
+ pNewItem->SetRefundRecipient(GetGUIDLow());
+ pNewItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, pSrcItem->GetPlayedTime());
+ pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
+ pNewItem->SaveRefundDataToDB(count);
+ }
}
else if (IsEquipmentPos (dst))
{