aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/AuctionHouseHandler.cpp7
-rw-r--r--src/game/AuctionHouseMgr.cpp14
2 files changed, 10 insertions, 11 deletions
diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp
index efa4184b393..2a2308019fd 100644
--- a/src/game/AuctionHouseHandler.cpp
+++ b/src/game/AuctionHouseHandler.cpp
@@ -382,6 +382,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
// after this update we should save player's money ...
+ CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("UPDATE auctionhouse SET buyguid = '%u',lastbid = '%u' WHERE id = '%u'", auction->bidder, auction->bid, auction->Id);
SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0);
@@ -406,12 +407,13 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
auctionmgr.SendAuctionWonMail(auction);
SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK);
+
+ CharacterDatabase.BeginTransaction();
auction->DeleteFromDB();
uint32 item_template = auction->item_template;
auctionmgr.RemoveAItem(auction->item_guidlow);
auctionHouse->RemoveAuction(auction, item_template);
}
- CharacterDatabase.BeginTransaction();
pl->SaveInventoryAndGoldToDB();
CharacterDatabase.CommitTransaction();
}
@@ -481,14 +483,15 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
//inform player, that auction is removed
SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, AUCTION_OK);
+
// Now remove the auction
CharacterDatabase.BeginTransaction();
pl->SaveInventoryAndGoldToDB();
- CharacterDatabase.CommitTransaction();
auction->DeleteFromDB();
uint32 item_template = auction->item_template;
auctionmgr.RemoveAItem(auction->item_guidlow);
auctionHouse->RemoveAuction(auction, item_template);
+ CharacterDatabase.CommitTransaction();
}
//called when player lists his bids
diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp
index 1f952e249c3..6a64f58487b 100644
--- a/src/game/AuctionHouseMgr.cpp
+++ b/src/game/AuctionHouseMgr.cpp
@@ -77,20 +77,15 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
else
deposit = 0;
- sLog.outDebug("SellPrice:\t\t%u", MSV);
- sLog.outDebug("Deposit Percent:\t%f", ((double)entry->depositPercent / 100.0f));
- sLog.outDebug("Auction Time1:\t\t%u", time);
- sLog.outDebug("Auction Time2:\t\t%u", MIN_AUCTION_TIME);
- sLog.outDebug("Auction Time3:\t\t%u", timeHr);
- sLog.outDebug("Count:\t\t\t%u", pItem->GetCount());
+ sLog.outDebug("Sellprice: %u / Depositpercent: %f / AT1: %u / AT2: %u / AT3: %u / Count: %u", MSV, ((double)entry->depositPercent / 100.0f), time, MIN_AUCTION_TIME, timeHr, pItem->GetCount() );
if (deposit > 0)
{
- sLog.outDebug("Deposit:\t\t%u", deposit);
+ sLog.outDebug("Deposit: %u", deposit);
return deposit;
}
else
{
- sLog.outDebug("Deposit:\t\t0");
+ sLog.outDebug("Deposit: 0");
return 0;
}
}
@@ -155,7 +150,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction)
// set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'",auction->bidder,pItem->GetGUIDLow());
- CharacterDatabase.CommitTransaction();
if (bidder)
bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
@@ -539,10 +533,12 @@ void AuctionHouseObject::Update()
}
///- In any case clear the auction
+ CharacterDatabase.BeginTransaction();
auction->DeleteFromDB();
uint32 item_template = auction->item_template;
auctionmgr.RemoveAItem(auction->item_guidlow);
RemoveAuction(auction, item_template);
+ CharacterDatabase.CommitTransaction();
}
}