Core/Player: Fix item refund exploit
This commit is contained in:
@@ -1130,12 +1130,13 @@ void Item::SaveRefundDataToDB()
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void Item::DeleteRefundDataFromDB()
|
||||
void Item::DeleteRefundDataFromDB(SQLTransaction* trans)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow());
|
||||
if (trans && !trans->null())
|
||||
(*trans)->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow());
|
||||
}
|
||||
|
||||
void Item::SetNotRefundable(Player *owner, bool changestate)
|
||||
void Item::SetNotRefundable(Player *owner, bool changestate /*=true*/, SQLTransaction* trans /*=NULL*/)
|
||||
{
|
||||
if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
|
||||
return;
|
||||
@@ -1144,11 +1145,11 @@ void Item::SetNotRefundable(Player *owner, bool changestate)
|
||||
// Following is not applicable in the trading procedure
|
||||
if (changestate)
|
||||
SetState(ITEM_CHANGED, owner);
|
||||
|
||||
|
||||
SetRefundRecipient(0);
|
||||
SetPaidMoney(0);
|
||||
SetPaidExtendedCost(0);
|
||||
DeleteRefundDataFromDB();
|
||||
DeleteRefundDataFromDB(trans);
|
||||
|
||||
owner->DeleteRefundReference(GetGUIDLow());
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ class Item : public Object
|
||||
static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid);
|
||||
void DeleteFromInventoryDB(SQLTransaction& trans);
|
||||
void SaveRefundDataToDB();
|
||||
void DeleteRefundDataFromDB();
|
||||
void DeleteRefundDataFromDB(SQLTransaction* trans);
|
||||
|
||||
Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
|
||||
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
|
||||
@@ -339,7 +339,7 @@ class Item : public Object
|
||||
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
|
||||
|
||||
// Item Refund system
|
||||
void SetNotRefundable(Player *owner, bool changestate = true);
|
||||
void SetNotRefundable(Player *owner, bool changestate = true, SQLTransaction* trans = NULL);
|
||||
void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; }
|
||||
void SetPaidMoney(uint32 money) { m_paidMoney = money; }
|
||||
void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; }
|
||||
|
||||
Reference in New Issue
Block a user