Core/Items: Fix money refund amount. Also fix a possible exploit possibility of redeeming both vendor sellprice and money refund price in one go.
This commit is contained in:
@@ -24424,14 +24424,16 @@ void Player::RefundItem(Item *item)
|
|||||||
data << uint32(iece->reqarenapoints); // arena point cost
|
data << uint32(iece->reqarenapoints); // arena point cost
|
||||||
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
|
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i) // item cost data
|
||||||
{
|
{
|
||||||
data << iece->reqitem[i];
|
data << uint32(iece->reqitem[i]);
|
||||||
data << (iece->reqitemcount[i]);
|
data << uint32(iece->reqitemcount[i]);
|
||||||
}
|
}
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
// Delete any references to the refund data
|
// Delete any references to the refund data
|
||||||
item->SetNotRefundable(this);
|
item->SetNotRefundable(this);
|
||||||
|
|
||||||
|
uint32 moneyRefund = item->GetPaidMoney(); // item-> will be invalidated in DestroyItem
|
||||||
|
|
||||||
// Destroy item
|
// Destroy item
|
||||||
DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||||
|
|
||||||
@@ -24451,7 +24453,7 @@ void Player::RefundItem(Item *item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grant back money
|
// Grant back money
|
||||||
if (uint32 moneyRefund = item->GetPaidMoney())
|
if (moneyRefund)
|
||||||
ModifyMoney(moneyRefund);
|
ModifyMoney(moneyRefund);
|
||||||
|
|
||||||
// Grant back Honor points
|
// Grant back Honor points
|
||||||
|
|||||||
@@ -529,6 +529,12 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prevent selling item for sellprice when the item is still refundable
|
||||||
|
// this probably happens when right clicking a refundable item, the client sends both
|
||||||
|
// CMSG_SELL_ITEM and CMSG_REFUND_ITEM (unverified)
|
||||||
|
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||||
|
return; // Therefore, no feedback to client
|
||||||
|
|
||||||
// special case at auto sell (sell all)
|
// special case at auto sell (sell all)
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user