Skip to content

Commit

Permalink
Merge pull request #5468 from Elron103/pull-requests
Browse files Browse the repository at this point in the history
Core/Auction House: Delete item_instance entries correctly, prevent invalid entries
  • Loading branch information
Subv committed Mar 3, 2012
2 parents cbee39a + c044eb5 commit 6df9adf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/server/game/Handlers/AuctionHouseHandler.cpp
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6df9adf

Please sign in to comment.