mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Auction: wrap item deletions from AHBot auction on a transaction
This speeds up the query execution time tremendously
Refs #19182
(cherry picked from commit ae9995f463)
This commit is contained in:
@@ -653,7 +653,7 @@ void AuctionHouseMgr::AddAItem(Item* item)
|
||||
_itemsByGuid[item->GetGUID()] = item;
|
||||
}
|
||||
|
||||
bool AuctionHouseMgr::RemoveAItem(ObjectGuid id, bool deleteItem)
|
||||
bool AuctionHouseMgr::RemoveAItem(ObjectGuid id, bool deleteItem /*= false*/, CharacterDatabaseTransaction* trans /*= nullptr*/)
|
||||
{
|
||||
auto i = _itemsByGuid.find(id);
|
||||
if (i == _itemsByGuid.end())
|
||||
@@ -661,9 +661,9 @@ bool AuctionHouseMgr::RemoveAItem(ObjectGuid id, bool deleteItem)
|
||||
|
||||
if (deleteItem)
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ASSERT(trans);
|
||||
i->second->FSetState(ITEM_REMOVED);
|
||||
i->second->SaveToDB(trans);
|
||||
i->second->SaveToDB(*trans);
|
||||
}
|
||||
|
||||
_itemsByGuid.erase(i);
|
||||
@@ -1850,7 +1850,7 @@ void AuctionHouseObject::SendAuctionWon(AuctionPosting const* auction, Player* b
|
||||
{
|
||||
// bidder doesn't exist, delete the item
|
||||
for (Item* item : auction->Items)
|
||||
sAuctionMgr->RemoveAItem(item->GetGUID(), true);
|
||||
sAuctionMgr->RemoveAItem(item->GetGUID(), true, &trans);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1902,7 +1902,7 @@ void AuctionHouseObject::SendAuctionExpired(AuctionPosting const* auction, Chara
|
||||
{
|
||||
// owner doesn't exist, delete the item
|
||||
for (Item* item : auction->Items)
|
||||
sAuctionMgr->RemoveAItem(item->GetGUID(), true);
|
||||
sAuctionMgr->RemoveAItem(item->GetGUID(), true, &trans);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ class TC_GAME_API AuctionHouseMgr
|
||||
void LoadAuctions();
|
||||
|
||||
void AddAItem(Item* item);
|
||||
bool RemoveAItem(ObjectGuid itemGuid, bool deleteItem = false);
|
||||
bool RemoveAItem(ObjectGuid itemGuid, bool deleteItem = false, CharacterDatabaseTransaction* trans = nullptr);
|
||||
bool PendingAuctionAdd(Player* player, uint32 auctionHouseId, uint32 auctionId, uint64 deposit);
|
||||
std::size_t PendingAuctionCount(Player const* player) const;
|
||||
void PendingAuctionProcess(Player* player);
|
||||
|
||||
Reference in New Issue
Block a user