public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); AuctionItems = new List <AuctionEntry>(); switch (version) { case 0: { int toread = reader.ReadInt(); for (int i = 0; i < toread; i++) { AuctionEntry ae = new AuctionEntry(); ae.Bids = new List <Bid>(); ae.Owner = reader.ReadMobile(); int bids = reader.ReadInt(); for (int j = 0; j < bids; j++) { ae.Bids.Add(new Bid(reader.ReadMobile(), reader.ReadInt())); } ae.Item = reader.ReadItem(); ae.Name = reader.ReadString(); ae.Description = reader.ReadString(); ae.EndDate = reader.ReadDeltaTime(); ae.StartPrice = reader.ReadInt(); AuctionItems.Add(ae); } break; } } }
public override void OnResponse(Network.NetState sender, RelayInfo info) { if (info.ButtonID == 0) { return; } if (info.ButtonID == 0xffff) { sender.Mobile.Target = new AddAuctionTarget(cont); sender.Mobile.SendMessage(StringList.SelectItem); return; } if (info.ButtonID - 1 >= cont.AuctionItems.Count) { sender.Mobile.SendMessage("Bad selection - ERROR: 0x2"); sender.Mobile.SendGump(new AuctionGump(sender.Mobile, cont)); return; } AuctionEntry tobid = cont.AuctionItems[info.ButtonID - 1]; if (cont.AuctionItems.Contains(tobid)) { ViewItemGump gump = new ViewItemGump(tobid, cont, sender.Mobile); sender.Mobile.SendGump(gump); //gump.bag.DisplayTo(sender.Mobile); } else { sender.Mobile.SendMessage("Bad Selection - ERROR: 0x3"); sender.Mobile.SendGump(new AuctionGump(sender.Mobile, cont)); } }
void Accepted(Mobile from, bool ok, object o) { ObjectHolder oh = (ObjectHolder)o; if (ok) { if (oh.item.ParentEntity != oh.mob.Backpack) { oh.mob.SendMessage(StringList.MustBeOnPack); string[] param = { oh.name, oh.desc, oh.price.ToString(), oh.days.ToString() }; oh.mob.SendGump(new AddAuctionGump(oh.mob, oh.cont, oh.item, param)); return; } DateTime enddate = DateTime.Now + TimeSpan.FromDays(oh.days); AuctionEntry ae = new AuctionEntry(oh.mob, oh.item, oh.name, oh.desc, enddate, oh.price); oh.cont.AuctionItems.Add(ae); oh.mob.SendGump(new AuctionGump(oh.mob, oh.cont)); oh.cont.AddItem(oh.item); oh.item.Movable = false; } else { string[] param = { oh.name, oh.desc, oh.price.ToString(), oh.days.ToString() }; oh.mob.SendGump(new AddAuctionGump(oh.mob, oh.cont, oh.item, param)); } }
public ViewItemGump(AuctionEntry tobid, AuctionContainer c, Mobile ToDisplay) : base(50, 50) { bid = tobid; cont = c; if (ToDisplay != null) { bag = new Backpack(); item = new VirtualItem(bid.Item); //bag.Layer = Layer.Invalid; bag.AddItem(item); bag.MoveToWorld(ToDisplay.Location, ToDisplay.Map); bag.Z -= 10; Timer.DelayCall(TimeSpan.FromSeconds(15), delegate { bag.Delete(); }); bag.Movable = false; //ToDisplay.AddItem( bag ); bag.DisplayTo(ToDisplay); } AddNewPage(); AddEntryHtml(500, tobid.Owner.Name); AddNewLine(); AddEntryHtml(500, tobid.Name); AddNewLine(); AddEntryHtml(500, tobid.Description); AddNewLine(); int minprice = 0; if (bid.Bids.Count == 0) { minprice = bid.StartPrice; } else { minprice = bid.Bids[bid.Bids.Count - 1].Value + 1; } AddEntryButton(20, ArrowRightID1, ArrowRightID2, 1, ArrowRightWidth, ArrowRightHeight); AddEntryHtml(479, "VIEW ITEM"); AddNewLine(); AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight); AddEntryHtml(59, "BID"); AddEntryText(119, 0, (minprice).ToString()); AddEntryHeader(299); for (int i = 1; i <= 10; i++) { if (bid.Bids.Count - i < bid.Bids.Count && bid.Bids.Count - i >= 0) { AddNewLine(); AddEntryLabel(100, bid.Bids[bid.Bids.Count - i].From.Name); AddEntryLabel(099, bid.Bids[bid.Bids.Count - i].Value.ToString()); AddEntryHeader(299); } } FinishPage(); }