public bool RemoveAuction(AuctionEntry auction) { bool wasInMap = AuctionsMap.Remove(auction.Id) ? true : false; Global.ScriptMgr.OnAuctionRemove(this, auction); // we need to delete the entry, it is not referenced any more auction = null; return(wasInMap); }
public void Update() { long curTime = GameTime.GetGameTime(); // Handle expired auctions // If storage is empty, no need to update. next == NULL in this case. if (AuctionsMap.Empty()) { return; } SQLTransaction trans = new SQLTransaction(); foreach (var auction in AuctionsMap.Values) { // filter auctions expired on next update if (auction.expire_time > curTime + 60) { continue; } // Either cancel the auction if there was no bidder if (auction.bidder == 0 && auction.bid == 0) { Global.AuctionMgr.SendAuctionExpiredMail(auction, trans); Global.ScriptMgr.OnAuctionExpire(this, auction); } // Or perform the transaction else { //we should send an "item sold" message if the seller is online //we send the item to the winner //we send the money to the seller Global.AuctionMgr.SendAuctionSuccessfulMail(auction, trans); Global.AuctionMgr.SendAuctionWonMail(auction, trans); Global.ScriptMgr.OnAuctionSuccessful(this, auction); } // In any case clear the auction auction.DeleteFromDB(trans); Global.AuctionMgr.RemoveAItem(auction.itemGUIDLow); RemoveAuction(auction); } // Run DB changes DB.Characters.CommitTransaction(trans); }
public AuctionEntry GetAuction(uint id) { return(AuctionsMap.LookupByKey(id)); }
public bool RemoveAuction(AuctionEntry auction) { Global.ScriptMgr.OnAuctionRemove(this, auction); return(AuctionsMap.TryRemove(auction.Id, out AuctionEntry removedItem)); }