Don´t inherit refund data when cloning when original item is not refundable.
--HG-- branch : trunk
This commit is contained in:
+20
-4
@@ -12012,17 +12012,22 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
|
|
||||||
if (IsInventoryPos(dst))
|
if (IsInventoryPos(dst))
|
||||||
{
|
{
|
||||||
// change item amount before check (for unique max count check)
|
bool isRefundable = pSrcItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
||||||
|
if (isRefundable)
|
||||||
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
|
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
|
||||||
|
|
||||||
|
// change item amount before check (for unique max count check)
|
||||||
pSrcItem->SetCount(pSrcItem->GetCount() - count);
|
pSrcItem->SetCount(pSrcItem->GetCount() - count);
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint8 msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false);
|
uint8 msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
|
if (isRefundable)
|
||||||
|
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
|
||||||
|
|
||||||
delete pNewItem;
|
delete pNewItem;
|
||||||
pSrcItem->SetCount(pSrcItem->GetCount() + count);
|
pSrcItem->SetCount(pSrcItem->GetCount() + count);
|
||||||
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
|
|
||||||
SendEquipError(msg, pSrcItem, NULL);
|
SendEquipError(msg, pSrcItem, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -12031,6 +12036,8 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
pSrcItem->SendUpdateToPlayer(this);
|
pSrcItem->SendUpdateToPlayer(this);
|
||||||
pSrcItem->SetState(ITEM_CHANGED, this);
|
pSrcItem->SetState(ITEM_CHANGED, this);
|
||||||
StoreItem(dest, pNewItem, true);
|
StoreItem(dest, pNewItem, true);
|
||||||
|
if (isRefundable)
|
||||||
|
{
|
||||||
AddRefundReference(pNewItem->GetGUID(), count);
|
AddRefundReference(pNewItem->GetGUID(), count);
|
||||||
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
||||||
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
||||||
@@ -12039,18 +12046,24 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
||||||
pNewItem->SaveRefundDataToDB(count);
|
pNewItem->SaveRefundDataToDB(count);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (IsBankPos (dst))
|
else if (IsBankPos (dst))
|
||||||
{
|
{
|
||||||
// change item amount before check (for unique max count check)
|
bool isRefundable = pSrcItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
||||||
|
if (isRefundable)
|
||||||
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
|
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() - count);
|
||||||
|
|
||||||
|
// change item amount before check (for unique max count check)
|
||||||
pSrcItem->SetCount(pSrcItem->GetCount() - count);
|
pSrcItem->SetCount(pSrcItem->GetCount() - count);
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint8 msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false);
|
uint8 msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false);
|
||||||
if (msg != EQUIP_ERR_OK)
|
if (msg != EQUIP_ERR_OK)
|
||||||
{
|
{
|
||||||
delete pNewItem;
|
if (isRefundable)
|
||||||
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
|
AlterRefundReferenceCount(pSrcItem->GetGUID(), pSrcItem->GetCount() + count);
|
||||||
|
|
||||||
|
delete pNewItem;
|
||||||
pSrcItem->SetCount(pSrcItem->GetCount() + count);
|
pSrcItem->SetCount(pSrcItem->GetCount() + count);
|
||||||
SendEquipError(msg, pSrcItem, NULL);
|
SendEquipError(msg, pSrcItem, NULL);
|
||||||
return;
|
return;
|
||||||
@@ -12060,6 +12073,8 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
pSrcItem->SendUpdateToPlayer(this);
|
pSrcItem->SendUpdateToPlayer(this);
|
||||||
pSrcItem->SetState(ITEM_CHANGED, this);
|
pSrcItem->SetState(ITEM_CHANGED, this);
|
||||||
BankItem(dest, pNewItem, true);
|
BankItem(dest, pNewItem, true);
|
||||||
|
if (isRefundable)
|
||||||
|
{
|
||||||
AddRefundReference(pNewItem->GetGUID(), count);
|
AddRefundReference(pNewItem->GetGUID(), count);
|
||||||
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
||||||
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
||||||
@@ -12068,6 +12083,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
pNewItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_REFUNDABLE);
|
||||||
pNewItem->SaveRefundDataToDB(count);
|
pNewItem->SaveRefundDataToDB(count);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (IsEquipmentPos (dst))
|
else if (IsEquipmentPos (dst))
|
||||||
{
|
{
|
||||||
// change item amount before check (for unique max count check), provide space for splitted items
|
// change item amount before check (for unique max count check), provide space for splitted items
|
||||||
|
|||||||
Reference in New Issue
Block a user