Store refundable items for Player class instance per lowguid instead of fullguid.
--HG-- branch : trunk
This commit is contained in:
@@ -635,7 +635,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer)
|
|||||||
{
|
{
|
||||||
// pretend the item never existed
|
// pretend the item never existed
|
||||||
RemoveFromUpdateQueueOf(forplayer);
|
RemoveFromUpdateQueueOf(forplayer);
|
||||||
forplayer->DeleteRefundReference(GetGUID());
|
forplayer->DeleteRefundReference(GetGUIDLow());
|
||||||
delete this;
|
delete this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1108,7 +1108,7 @@ void Item::SetNotRefundable(Player *owner, bool changestate)
|
|||||||
SetPaidExtendedCost(0);
|
SetPaidExtendedCost(0);
|
||||||
DeleteRefundDataFromDB();
|
DeleteRefundDataFromDB();
|
||||||
|
|
||||||
owner->DeleteRefundReference(GetGUID());
|
owner->DeleteRefundReference(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::UpdatePlayedTime(Player *owner)
|
void Item::UpdatePlayedTime(Player *owner)
|
||||||
|
|||||||
@@ -12151,7 +12151,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count)
|
|||||||
BankItem(dest, pNewItem, true);
|
BankItem(dest, pNewItem, true);
|
||||||
if (isRefundable)
|
if (isRefundable)
|
||||||
{
|
{
|
||||||
AddRefundReference(pNewItem->GetGUID());
|
AddRefundReference(pNewItem->GetGUIDLow());
|
||||||
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
pNewItem->SetPaidExtendedCost(pSrcItem->GetPaidExtendedCost());
|
||||||
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
pNewItem->SetPaidMoney(pSrcItem->GetPaidMoney());
|
||||||
pNewItem->SetRefundRecipient(GetGUIDLow());
|
pNewItem->SetRefundRecipient(GetGUIDLow());
|
||||||
@@ -16633,7 +16633,7 @@ void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
|
|||||||
item->SetRefundRecipient(fields[0].GetUInt32());
|
item->SetRefundRecipient(fields[0].GetUInt32());
|
||||||
item->SetPaidMoney(fields[1].GetUInt32());
|
item->SetPaidMoney(fields[1].GetUInt32());
|
||||||
item->SetPaidExtendedCost(fields[2].GetUInt32());
|
item->SetPaidExtendedCost(fields[2].GetUInt32());
|
||||||
AddRefundReference(item->GetGUID());
|
AddRefundReference(item->GetGUIDLow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17794,14 +17794,14 @@ void Player::_SaveInventory()
|
|||||||
// the client auto counts down in real time after having received the initial played time on the first
|
// the client auto counts down in real time after having received the initial played time on the first
|
||||||
// SMSG_ITEM_REFUND_INFO_RESPONSE packet.
|
// SMSG_ITEM_REFUND_INFO_RESPONSE packet.
|
||||||
// Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests.
|
// Item::UpdatePlayedTime is only called when needed, which is in DB saves, and item refund info requests.
|
||||||
std::set<uint64>::iterator i_next;
|
std::set<uint32>::iterator i_next;
|
||||||
for (std::set<uint64>::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next)
|
for (std::set<uint32>::iterator itr = m_refundableItems.begin(); itr!= m_refundableItems.end(); itr = i_next)
|
||||||
{
|
{
|
||||||
// use copy iterator because itr may be invalid after operations in this loop
|
// use copy iterator because itr may be invalid after operations in this loop
|
||||||
i_next = itr;
|
i_next = itr;
|
||||||
++i_next;
|
++i_next;
|
||||||
|
|
||||||
Item* iPtr = GetItemByGuid(*itr);
|
Item* iPtr = GetItemByGuid(MAKE_NEW_GUID(*itr, 0, HIGHGUID_ITEM));
|
||||||
if (iPtr)
|
if (iPtr)
|
||||||
{
|
{
|
||||||
iPtr->UpdatePlayedTime(this);
|
iPtr->UpdatePlayedTime(this);
|
||||||
@@ -17809,7 +17809,7 @@ void Player::_SaveInventory()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outError("Can't find item guid " UI64FMTD " but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
|
sLog.outError("Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
|
||||||
m_refundableItems.erase(itr);
|
m_refundableItems.erase(itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19670,7 +19670,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||||||
it->SetPaidMoney(price);
|
it->SetPaidMoney(price);
|
||||||
it->SetPaidExtendedCost(crItem->GetExtendedCostId());
|
it->SetPaidExtendedCost(crItem->GetExtendedCostId());
|
||||||
it->SaveRefundDataToDB();
|
it->SaveRefundDataToDB();
|
||||||
AddRefundReference(it->GetGUID());
|
AddRefundReference(it->GetGUIDLow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19728,7 +19728,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
|||||||
it->SetPaidMoney(price);
|
it->SetPaidMoney(price);
|
||||||
it->SetPaidExtendedCost(crItem->GetExtendedCostId());
|
it->SetPaidExtendedCost(crItem->GetExtendedCostId());
|
||||||
it->SaveRefundDataToDB();
|
it->SaveRefundDataToDB();
|
||||||
AddRefundReference(it->GetGUID());
|
AddRefundReference(it->GetGUIDLow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23752,14 +23752,14 @@ void Player::SendDuelCountdown(uint32 counter)
|
|||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::AddRefundReference(uint64 it)
|
void Player::AddRefundReference(uint32 it)
|
||||||
{
|
{
|
||||||
m_refundableItems.insert(it);
|
m_refundableItems.insert(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::DeleteRefundReference(uint64 it)
|
void Player::DeleteRefundReference(uint32 it)
|
||||||
{
|
{
|
||||||
std::set<uint64>::iterator itr = m_refundableItems.find(it);
|
std::set<uint32>::iterator itr = m_refundableItems.find(it);
|
||||||
if (itr != m_refundableItems.end())
|
if (itr != m_refundableItems.end())
|
||||||
{
|
{
|
||||||
m_refundableItems.erase(itr);
|
m_refundableItems.erase(itr);
|
||||||
|
|||||||
@@ -1137,8 +1137,8 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||||
uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||||
|
|
||||||
void AddRefundReference(uint64 it);
|
void AddRefundReference(uint32 it);
|
||||||
void DeleteRefundReference(uint64 it);
|
void DeleteRefundReference(uint32 it);
|
||||||
|
|
||||||
void ApplyEquipCooldown(Item * pItem);
|
void ApplyEquipCooldown(Item * pItem);
|
||||||
void SetAmmo(uint32 item);
|
void SetAmmo(uint32 item);
|
||||||
@@ -2535,7 +2535,7 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||||
Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update);
|
Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update);
|
||||||
|
|
||||||
std::set<uint64> m_refundableItems;
|
std::set<uint32> m_refundableItems;
|
||||||
void SendRefundInfo(Item* item);
|
void SendRefundInfo(Item* item);
|
||||||
void RefundItem(Item* item);
|
void RefundItem(Item* item);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user