TrinityCore/TrinityCore — Issue #5428: [Fix] Auctionhouse item loss
Author: Elron103
Created: 2012-02-25 21:32:16+00:00
State: open

## Description ##
Commit https://github.com/TrinityCore/TrinityCore/commit/15a2acfb528728b824291cb49cdd9196e6f0d57d implemented the new packet structure for creating auctions. But it also implemented a heavy bug.

When inserting multiple stacks as an auction, the new method is not able to create the new entries in the item_instance table. This results in a heavy loss of items, since the server is not able to link the entries in auctionhouse with the item_instance anymore.

We get a lot of invalid auctions, select query:

select * from characters.auctionhouse where itemguid not in (select guid from characters.item_instance);

## Revisions ##
Trinity: https://github.com/TrinityCore/TrinityCore/commit/f0f68f15a86c5ac0c83c47c6db67786506f8460d
Database: TDB rev. 46

## Fix ##
http://paste2.org/p/1915792

```diff
diff -r 486cac4b9a9a src/server/game/Handlers/AuctionHouseHandler.cpp
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp	Sat Feb 25 00:26:02 2012 +0100
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp	Sat Feb 25 22:08:27 2012 +0100
@@ -341,6 +341,7 @@ void WorldSession::HandleAuctionSellItem
}

SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ newItem->SaveToDB(trans);
AH->SaveToDB(trans);
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
```