public GSellGump_InventoryItem(GSellGump owner, SellInfo si, int y, bool seperate) : base(0x20, y, 0xc3, 0) { this.m_Owner = owner; this.m_yBase = y; this.m_Info = si; IFont uniFont = Engine.GetUniFont(3); IHue hue = Hues.Load(0x288); this.m_Image = new GItemArt(0, 0, si.ItemID, si.Hue); this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", si.Name, si.Price), uniFont, hue, 0x3a, 0, 0x69); this.m_Available = new GLabel(si.Amount.ToString(), uniFont, hue, 0xc3, 0); int num = (this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1; base.m_Height = num; num = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1; if (num > base.m_Height) { base.m_Height = num; } num = (this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1; if (num > base.m_Height) { base.m_Height = num; } this.m_Image.X += (0x38 - ((this.m_Image.Image.xMax - this.m_Image.Image.xMin) + 1)) / 2; this.m_Image.Y += (base.m_Height - ((this.m_Image.Image.yMax - this.m_Image.Image.yMin) + 1)) / 2; this.m_Image.X -= this.m_Image.Image.xMin; this.m_Image.Y -= this.m_Image.Image.yMin; this.m_Description.X -= this.m_Description.Image.xMin; this.m_Description.Y += (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2; this.m_Description.Y -= this.m_Description.Image.yMin; this.m_Available.X -= this.m_Available.Image.xMax + 1; this.m_Available.Y += (base.m_Height - ((this.m_Available.Image.yMax - this.m_Available.Image.yMin) + 1)) / 2; this.m_Available.Y -= this.m_Available.Image.yMin; base.m_Children.Add(this.m_Image); base.m_Children.Add(this.m_Description); base.m_Children.Add(this.m_Available); this.m_xAvailable = si.Amount; if (seperate) { GImage image; this.m_Separator = new GImage[11]; this.m_Separator[0] = image = new GImage(0x39, 0, base.m_Height); base.m_Children.Add(image); for (int i = 0; i < 9; i++) { this.m_Separator[i + 1] = image = new GImage(0x3a, 30 + (i * 0x10), base.m_Height); base.m_Children.Add(image); } this.m_Separator[10] = image = new GImage(0x3b, 0xa5, base.m_Height); base.m_Children.Add(image); } else { this.m_Separator = new GImage[0]; } if (Engine.Features.AOS) { base.Tooltip = new ItemTooltip(si.Item); } }
public GSellGump_AmountButton(GSellGump owner, SellInfo info, int offset, int gumpID, int x) : base(gumpID, x, 0) { this.m_Owner = owner; this.m_Info = info; this.m_InitialOffset = offset; this.m_Offset = offset; this.m_Last = -1234.56; }
public GSellGump_OfferedItem(GSellGump owner, SellInfo si) : base(0x20, 0x43, 0xc4, 0) { this.m_OfferMenu = owner.OfferMenu; IFont uniFont = Engine.GetUniFont(3); IHue hue = Hues.Load(0x288); this.m_xAmount = si.ToSell; this.m_Amount = new GLabel(si.ToSell.ToString(), uniFont, hue, 0, 0); this.m_Description = new GWrappedLabel(string.Format("{0} at {1} gp", si.Name, si.Price), uniFont, hue, 0x29, 0, 0x69); this.m_More = new GSellGump_AmountButton(owner, si, 5, 0x37, 0x9b); this.m_Less = new GSellGump_AmountButton(owner, si, -5, 0x38, 0xad); int height = (this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1; base.m_Height = height; height = (this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1; if (height > base.m_Height) { base.m_Height = height; } height = this.m_More.Height; if (height > base.m_Height) { base.m_Height = height; } height = this.m_Less.Height; if (height > base.m_Height) { base.m_Height = height; } this.m_Amount.X -= this.m_Amount.Image.xMin; this.m_Amount.Y = (base.m_Height - ((this.m_Amount.Image.yMax - this.m_Amount.Image.yMin) + 1)) / 2; this.m_Description.X -= this.m_Description.Image.xMin; this.m_Description.Y = (base.m_Height - ((this.m_Description.Image.yMax - this.m_Description.Image.yMin) + 1)) / 2; if (this.m_Amount.Y > this.m_Description.Y) { this.m_Amount.Y = this.m_Description.Y; } this.m_Amount.Y -= this.m_Amount.Image.yMin; this.m_Description.Y -= this.m_Description.Image.yMin; this.m_More.Y = (base.m_Height - this.m_More.Height) / 2; this.m_Less.Y = (base.m_Height - this.m_Less.Height) / 2; base.m_Children.Add(this.m_Amount); base.m_Children.Add(this.m_Description); base.m_Children.Add(this.m_More); base.m_Children.Add(this.m_Less); this.Clipper = this.m_OfferMenu.ContentClipper; if (Engine.Features.AOS) { base.Tooltip = new ItemTooltip(si.Item); } }
public void Clear() { for (int i = 0; i < this.m_Info.Length; i++) { SellInfo info = this.m_Info[i]; if (info.ToSell > 0) { info.ToSell = 0; info.InventoryGump.Available = info.Amount; Gumps.Destroy(info.OfferedGump); info.OfferedGump = null; } } }
public PSellItems(int serial, SellInfo[] info) : base(0x9f, "Sell Items") { ArrayList dataStore = Engine.GetDataStore(); for (int i = 0; i < info.Length; i++) { if (info[i].ToSell > 0) { dataStore.Add(info[i]); } } base.m_Stream.Write(serial); base.m_Stream.Write((ushort) dataStore.Count); for (int j = 0; j < dataStore.Count; j++) { SellInfo info2 = (SellInfo) dataStore[j]; base.m_Stream.Write(info2.Item.Serial); base.m_Stream.Write((ushort) info2.ToSell); } Engine.ReleaseDataStore(dataStore); }
public PSellItems(int serial, SellInfo[] info) : base(0x9f, "Sell Items") { ArrayList dataStore = Engine.GetDataStore(); for (int i = 0; i < info.Length; i++) { if (info[i].ToSell > 0) { dataStore.Add(info[i]); } } base.m_Stream.Write(serial); base.m_Stream.Write((ushort)dataStore.Count); for (int j = 0; j < dataStore.Count; j++) { SellInfo info2 = (SellInfo)dataStore[j]; base.m_Stream.Write(info2.Item.Serial); base.m_Stream.Write((ushort)info2.ToSell); } Engine.ReleaseDataStore(dataStore); }
public GSellGump(int serial, SellInfo[] info) : base(0x872, 15, 15) { base.m_GUID = string.Format("GSellGump-{0}", serial); this.m_Serial = serial; this.m_Info = info; UnicodeFont uniFont = Engine.GetUniFont(3); IHue hue = Hues.Load(0x288); Array.Sort(info); int y = 0x42; for (int i = 0; i < info.Length; i++) { bool seperate = i != (info.Length - 1); SellInfo si = info[i]; GSellGump_InventoryItem toAdd = new GSellGump_InventoryItem(this, si, y, seperate); base.m_Children.Add(toAdd); si.InventoryGump = toAdd; y += toAdd.Height; if (seperate) { y += 0x10; } } if (y > 230) { GVSlider slider = new GVSlider(0x828, 0xed, 0x51, 0x22, 0x5c, 0.0, 0.0, (double)(y - 230), 1.0) { OnValueChange = new OnValueChange(this.Slider_OnValueChange) }; base.m_Children.Add(slider); base.m_Children.Add(new GHotspot(0xed, 0x42, 0x22, 0x7a, slider)); } base.m_NonRestrictivePicking = true; this.m_OfferMenu = new GSellGump_OfferMenu(this); base.m_Children.Add(this.m_OfferMenu); base.m_X = (Engine.ScreenWidth - (this.m_OfferMenu.X + this.m_OfferMenu.Width)) / 2; base.m_Y = (Engine.ScreenHeight - (this.m_OfferMenu.Y + this.m_OfferMenu.Height)) / 2; }
public GSellGump(int serial, SellInfo[] info) : base(0x872, 15, 15) { base.m_GUID = string.Format("GSellGump-{0}", serial); this.m_Serial = serial; this.m_Info = info; UnicodeFont uniFont = Engine.GetUniFont(3); IHue hue = Hues.Load(0x288); Array.Sort(info); int y = 0x42; for (int i = 0; i < info.Length; i++) { bool seperate = i != (info.Length - 1); SellInfo si = info[i]; GSellGump_InventoryItem toAdd = new GSellGump_InventoryItem(this, si, y, seperate); base.m_Children.Add(toAdd); si.InventoryGump = toAdd; y += toAdd.Height; if (seperate) { y += 0x10; } } if (y > 230) { GVSlider slider = new GVSlider(0x828, 0xed, 0x51, 0x22, 0x5c, 0.0, 0.0, (double) (y - 230), 1.0) { OnValueChange = new OnValueChange(this.Slider_OnValueChange) }; base.m_Children.Add(slider); base.m_Children.Add(new GHotspot(0xed, 0x42, 0x22, 0x7a, slider)); } base.m_NonRestrictivePicking = true; this.m_OfferMenu = new GSellGump_OfferMenu(this); base.m_Children.Add(this.m_OfferMenu); base.m_X = (Engine.ScreenWidth - (this.m_OfferMenu.X + this.m_OfferMenu.Width)) / 2; base.m_Y = (Engine.ScreenHeight - (this.m_OfferMenu.Y + this.m_OfferMenu.Height)) / 2; }
int IComparable.CompareTo(object x) { if (x == null) { return(1); } SellInfo info = x as SellInfo; if (info == null) { throw new ArgumentException(); } int num = Map.GetQuality(this.m_Item.ID).CompareTo(Map.GetQuality(info.m_Item.ID)); if (num == 0) { num = this.m_Item.ID.CompareTo(info.m_Item.ID); if (num == 0) { num = this.m_Item.Serial.CompareTo(info.m_Item.Serial); } } return(num); }
private static void SellContent(PacketReader pvSrc) { int serial = pvSrc.ReadInt32(); int num2 = pvSrc.ReadInt16(); SellInfo[] info = new SellInfo[num2]; bool flag = false; for (int i = 0; i < num2; i++) { Item item = World.WantItem(pvSrc.ReadInt32()); info[i] = new SellInfo(item, pvSrc.ReadInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadString(pvSrc.ReadUInt16())); } if (flag) { Engine.AddTextMessage("Selling items."); Network.Send(new PSellItems(serial, info)); } else { Gumps.Desktop.Children.Add(new GSellGump(serial, info)); } }