mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Core/Auction House: Delete item_instance entries correctly, prevent invalid entries
This commit is contained in:
@@ -241,6 +241,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
else
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
|
||||
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
||||
if (itemsCount == 1 && item->GetCount() == count[i])
|
||||
{
|
||||
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||
@@ -278,7 +279,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
|
||||
return;
|
||||
}
|
||||
else
|
||||
else // Required stack size of auction does not match to current item stack size, clone item and set correct stack size
|
||||
{
|
||||
Item* newItem = item->CloneItem(finalCount, _player);
|
||||
if (!newItem)
|
||||
@@ -313,16 +314,17 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
||||
{
|
||||
Item* item2 = items[j];
|
||||
|
||||
// Item stack count equals required count, ready to delete item - cloned item will be used for auction
|
||||
if (item2->GetCount() == count[j])
|
||||
{
|
||||
_player->MoveItemFromInventory(item2->GetBagSlot(), item2->GetSlot(), true);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
item2->DeleteFromInventoryDB(trans);
|
||||
item2->SaveToDB(trans);
|
||||
item2->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
else
|
||||
else // Item stack count is bigger than required count, update item stack count and save to database - cloned item will be used for auction
|
||||
{
|
||||
item2->SetCount(item2->GetCount() - count[j]);
|
||||
item2->SetState(ITEM_CHANGED, _player);
|
||||
|
||||
Reference in New Issue
Block a user