/// <summary> /// Writes the end of the auction to the log /// </summary> /// <param name="auction">The auction ending</param> /// <param name="reason">The AuctionResult stating why the auction is ending</param> /// <param name="m">The Mobile forcing the end of the auction (can be null)</param> /// <param name="comments">Additional comments on the ending (can be null)</param> public static void WriteEnd(AuctionItem auction, AuctionResult reason, Mobile m, string comments) { if (!m_Enabled || m_Writer == null) { return; } try { m_Writer.WriteLine("## Ending Auction {0}", auction.ID.ToString()); m_Writer.WriteLine("# Status : {0}", reason.ToString()); if (m != null) { m_Writer.WriteLine("# Ended by {0} [{1}], {2}, Account : {3}", m.Name, m.Serial.ToString(), m.AccessLevel.ToString(), (m.Account as Server.Accounting.Account).Username); } if (comments != null) { m_Writer.WriteLine("# Comments : {0}", comments); } m_Writer.WriteLine(); } catch {} }
//GetAuctionResult //UpdateAuctionBiddingResult public void UpdateAuctionBiddingResult(long auction_id, long user_id, decimal currentbid, decimal maxbid) { try { var ar = GetAuctionResult(auction_id); if (ar == null) { ar = new AuctionResult(); dataContext.AuctionResults.InsertOnSubmit(ar); ar.Auction_ID = auction_id; ar.User_ID = user_id; ar.CurrentBid = 0; ar.MaxBid = 0; ar.Bids = 0; SubmitChanges(); CacheRepository.Put(new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONS, "GETAUCTIONRESULT", new object[] {auction_id}, CachingExpirationTime.Minutes_01, ar)); } ar.Auction_ID = auction_id; ar.User_ID = user_id; ar.CurrentBid = currentbid; ar.MaxBid = maxbid; ar.Bids = dataContext.spBid_LogCount(auction_id).FirstOrDefault().LogCount.GetValueOrDefault(0); dataContext.spUpdate_AuctionResults(ar.ID, ar.Auction_ID, ar.User_ID, ar.CurrentBid, ar.Bids, ar.MaxBid); var dco = new DataCacheObject(DataCacheType.RESOURCE, DataCacheRegions.AUCTIONS, "GETAUCTIONRESULT", new object[] {auction_id}, CachingExpirationTime.Minutes_01, ar); CacheRepository.Put(dco); dco.Method = "GETAUCTIONDETAILRESULT"; var result = CacheRepository.Get(dco) as AuctionShort; if (result != null) { result.Bids = ar.Bids; result.CurrentBid = ar.CurrentBid; dco.Data = result; CacheRepository.Put(dco); } } catch (Exception ex) { Logger.LogException( String.Format("[auction_id={0}; user={1}; cb={2}; maxbid={3}", auction_id, user_id, currentbid, maxbid), ex); } }
/// <summary> /// Creates a check that will deliver an item for the auction system /// </summary> /// <param name="auction">The auction generating this check</param> /// <param name="result">Specifies the reason for the generation of this check</param> public AuctionItemCheck( AuctionItem auction, AuctionResult result ) { Name = auction.Creature ? AuctionSystem.ST[ 131 ] : AuctionSystem.ST[ 132 ]; m_Auction = auction.ID; m_ItemName = auction.ItemName; m_Item = auction.Item; /*if ( m_Item != null ) { AuctionSystem.ControlStone.RemoveItem( m_Item ); m_Item.Parent = this; // This will avoid cleanup }*/ switch ( result ) { // Returning the item to the owner case AuctionResult.NoBids: case AuctionResult.PendingRefused: case AuctionResult.SystemStopped: case AuctionResult.PendingTimedOut: case AuctionResult.ItemDeleted: case AuctionResult.StaffRemoved: m_Owner = auction.Owner; Hue = ItemReturnedHue; switch ( result ) { case AuctionResult.NoBids: m_Message = string.Format( AuctionSystem.ST[ 133 ], m_ItemName ); break; case AuctionResult.PendingRefused: m_Message = string.Format( AuctionSystem.ST[ 134 ], m_ItemName ); break; case AuctionResult.SystemStopped: m_Message = string.Format( AuctionSystem.ST[ 135 ], m_ItemName ); break; case AuctionResult.PendingTimedOut: m_Message = AuctionSystem.ST[ 127 ]; break; case AuctionResult.ItemDeleted: m_Message = AuctionSystem.ST[ 136 ]; break; case AuctionResult.StaffRemoved: m_Message = AuctionSystem.ST[ 203 ]; break; } break; case AuctionResult.PendingAccepted: case AuctionResult.Succesful: case AuctionResult.BuyNow: m_Owner = auction.HighestBid.Mobile; Hue = ItemSoldHue; m_Message = string.Format( AuctionSystem.ST[ 137 ] , m_ItemName, auction.HighestBid.Amount.ToString("#,0" )); break; default: throw new Exception( string.Format( AuctionSystem.ST[ 138 ] , result.ToString() ) ); } }
public abstract void ShowAuctionResult(AuctionRequest request, AuctionResult result);
/// <summary> /// Creates a check delivering gold for the auction system /// </summary> /// <param name="auction">The auction originating this check</param> /// <param name="result">Specifies the reason for the creation of this check</param> public AuctionGoldCheck( AuctionItem auction, AuctionResult result ) { Name = AuctionSystem.ST[ 122 ]; m_Auction = auction.ID; m_ItemName = auction.ItemName; if ( result != AuctionResult.BuyNow ) m_GoldAmount = auction.HighestBid.Amount; else m_GoldAmount = auction.BuyNow; switch ( result ) { case AuctionResult.Outbid: case AuctionResult.SystemStopped: case AuctionResult.PendingRefused: case AuctionResult.ReserveNotMet: case AuctionResult.PendingTimedOut: case AuctionResult.StaffRemoved: case AuctionResult.ItemDeleted: m_Owner = auction.HighestBid.Mobile; Hue = OutbidHue; switch ( result ) { case AuctionResult.Outbid : m_Message = string.Format( AuctionSystem.ST[ 123 ] , m_ItemName, m_GoldAmount.ToString( "#,0" )); break; case AuctionResult.SystemStopped: m_Message = string.Format( AuctionSystem.ST[ 124 ] , m_ItemName, m_GoldAmount.ToString( "#,0" ) ); break; case AuctionResult.PendingRefused: m_Message = string.Format( AuctionSystem.ST[ 125 ] , m_ItemName ) ; break; case AuctionResult.ReserveNotMet: m_Message = string.Format( AuctionSystem.ST[ 126 ] , m_GoldAmount.ToString( "#,0" ), m_ItemName ); break; case AuctionResult.PendingTimedOut: m_Message = AuctionSystem.ST[ 127 ] ; break; case AuctionResult.ItemDeleted: m_Message = AuctionSystem.ST[ 128 ] ; break; case AuctionResult.StaffRemoved: m_Message = AuctionSystem.ST[ 202 ]; break; } break; case AuctionResult.PendingAccepted: case AuctionResult.Succesful: case AuctionResult.BuyNow: m_Owner = auction.Owner; Hue = SoldHue; m_Message = string.Format( AuctionSystem.ST[ 129 ] , m_ItemName, m_GoldAmount.ToString( "#,0" ) ); break; default: throw new Exception( string.Format( "{0} is not a valid reason for an auction gold check", result.ToString() ) ); } }
public override void ShowAuctionResult(AuctionRequest request, AuctionResult result) { throw new NotImplementedException( ); }
/// <summary> /// Creates a check that will deliver an item for the auction system /// </summary> /// <param name="auction">The auction generating this check</param> /// <param name="result">Specifies the reason for the generation of this check</param> public AuctionItemCheck(AuctionItem auction, AuctionResult result) { Name = auction.Creature ? AuctionSystem.ST[131] : AuctionSystem.ST[132]; m_Auction = auction.ID; m_ItemName = auction.ItemName; m_Item = auction.Item; /*if ( m_Item != null ) * { * AuctionSystem.ControlStone.RemoveItem( m_Item ); * m_Item.Parent = this; // This will avoid cleanup * }*/ switch (result) { // Returning the item to the owner case AuctionResult.NoBids: case AuctionResult.PendingRefused: case AuctionResult.SystemStopped: case AuctionResult.PendingTimedOut: case AuctionResult.ItemDeleted: case AuctionResult.StaffRemoved: m_Owner = auction.Owner; Hue = ItemReturnedHue; switch (result) { case AuctionResult.NoBids: m_Message = string.Format(AuctionSystem.ST[133], m_ItemName); break; case AuctionResult.PendingRefused: m_Message = string.Format(AuctionSystem.ST[134], m_ItemName); break; case AuctionResult.SystemStopped: m_Message = string.Format(AuctionSystem.ST[135], m_ItemName); break; case AuctionResult.PendingTimedOut: m_Message = AuctionSystem.ST[127]; break; case AuctionResult.ItemDeleted: m_Message = AuctionSystem.ST[136]; break; case AuctionResult.StaffRemoved: m_Message = AuctionSystem.ST[203]; break; } break; case AuctionResult.PendingAccepted: case AuctionResult.Succesful: case AuctionResult.BuyNow: m_Owner = auction.HighestBid.Mobile; Hue = ItemSoldHue; m_Message = string.Format(AuctionSystem.ST[137], m_ItemName, auction.HighestBid.Amount.ToString("#,0")); break; default: throw new Exception(string.Format(AuctionSystem.ST[138], result.ToString())); } }
/// <summary> /// Creates a check delivering gold for the auction system /// </summary> /// <param name="auction">The auction originating this check</param> /// <param name="result">Specifies the reason for the creation of this check</param> public AuctionGoldCheck(AuctionItem auction, AuctionResult result) { Name = AuctionSystem.ST[122]; m_Auction = auction.ID; m_ItemName = auction.ItemName; if (result != AuctionResult.BuyNow) { m_GoldAmount = auction.HighestBid.Amount; } else { m_GoldAmount = auction.BuyNow; } switch (result) { case AuctionResult.Outbid: case AuctionResult.SystemStopped: case AuctionResult.PendingRefused: case AuctionResult.ReserveNotMet: case AuctionResult.PendingTimedOut: case AuctionResult.StaffRemoved: case AuctionResult.ItemDeleted: m_Owner = auction.HighestBid.Mobile; Hue = OutbidHue; switch (result) { case AuctionResult.Outbid: m_Message = string.Format(AuctionSystem.ST[123], m_ItemName, m_GoldAmount); break; case AuctionResult.SystemStopped: m_Message = string.Format(AuctionSystem.ST[124], m_ItemName, m_GoldAmount); break; case AuctionResult.PendingRefused: m_Message = string.Format(AuctionSystem.ST[125], m_ItemName); break; case AuctionResult.ReserveNotMet: m_Message = string.Format(AuctionSystem.ST[126], m_GoldAmount, m_ItemName); break; case AuctionResult.PendingTimedOut: m_Message = AuctionSystem.ST[127]; break; case AuctionResult.ItemDeleted: m_Message = AuctionSystem.ST[128]; break; case AuctionResult.StaffRemoved: m_Message = AuctionSystem.ST[202]; break; } break; case AuctionResult.PendingAccepted: case AuctionResult.Succesful: case AuctionResult.BuyNow: m_Owner = auction.Owner; Hue = SoldHue; m_Message = string.Format(AuctionSystem.ST[129], m_ItemName, m_GoldAmount); break; default: throw new Exception(string.Format("{0} is not a valid reason for an auction gold check", result.ToString())); } }
/// <summary> /// Writes the end of the auction to the log /// </summary> /// <param name="auction">The auction ending</param> /// <param name="reason">The AuctionResult stating why the auction is ending</param> /// <param name="m">The Mobile forcing the end of the auction (can be null)</param> /// <param name="comments">Additional comments on the ending (can be null)</param> public static void WriteEnd( AuctionItem auction, AuctionResult reason, Mobile m, string comments ) { if ( !m_Enabled || m_Writer == null ) return; try { m_Writer .WriteLine( "## Ending Auction {0}", auction.ID.ToString() ); m_Writer .WriteLine( "# Status : {0}", reason.ToString() ); if ( m != null ) m_Writer .WriteLine( "# Ended by {0} [{1}], {2}, Account : {3}", m.Name, m.Serial.ToString(), m.AccessLevel.ToString(), ( m.Account as Server.Accounting.Account ).Username ); if ( comments != null ) m_Writer .WriteLine( "# Comments : {0}", comments ); m_Writer .WriteLine(); } catch {} }