public GPaperdollItem(int X, int Y, int GumpID, int Serial, IHue Hue, int Layer, Mobile owner, bool canDrag) : base(X, Y) { this.m_fAlpha = 1f; this.m_GumpID = GumpID; this.m_Serial = Serial; this.m_Hue = Hue; this.m_Layer = Layer; this.m_Item = World.FindItem(this.m_Serial); if ((this.m_Item != null) && Engine.Features.AOS) { base.Tooltip = new ItemTooltip(this.m_Item); } this.m_Image = this.m_Hue.GetGump(this.m_GumpID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; this.m_Draw = this.m_Item != null; } else { this.m_Width = 0; this.m_Height = 0; this.m_Draw = false; } base.m_ITranslucent = true; this.m_ValidDrag = (((canDrag && (this.m_Layer >= 1)) && ((this.m_Layer <= 0x18) && (this.m_Layer != 11))) && (this.m_Layer != 0x10)) && (this.m_Layer != 0x15); base.m_CanDrag = true; base.m_QuickDrag = (((this.m_Layer < 1) || (this.m_Layer > 0x18)) || (this.m_Layer == 11)) || (this.m_Layer == 0x10); }
protected internal override void OnDragDrop(Gump g) { if ((g != null) && (g.GetType() == typeof(GDraggedItem))) { GDraggedItem item = (GDraggedItem)g; Client.Item item2 = item.Item; if (((GContainer)base.m_Parent).m_HitTest) { TileFlags flags = Map.m_ItemFlags[this.m_Item.ID & 0x3fff]; if (flags[TileFlag.Container]) { Network.Send(new PDropItem(item2.Serial, -1, -1, 0, this.m_Item.Serial)); Gumps.Destroy(item); } else if ((flags[TileFlag.Generic] && (item2.ID == this.m_Item.ID)) && (item2.Hue == this.m_Item.Hue)) { Point point = ((GContainer)base.m_Parent).Clip(item.Image, item.Double, base.m_Parent.PointToClient(new Point(Engine.m_xMouse - item.m_OffsetX, Engine.m_yMouse - item.m_OffsetY)), item.m_OffsetX, item.m_OffsetY); Network.Send(new PDropItem(item2.Serial, (short)point.X, (short)point.Y, 0, this.m_Item.Serial)); Gumps.Destroy(item); } else { base.m_Parent.OnDragDrop(item); } } else { base.m_Parent.OnDragDrop(item); } } }
public void OnItemRemove(Client.Item item) { GContainerItem g = (GContainerItem)this.m_Hash[item]; if (g != null) { Gumps.Destroy(g); this.m_Hash[item] = null; } }
public GDraggedItem(Client.Item item) : base(0, 0) { this.m_vCache = new VertexCache(); this.m_Item = item; int index = this.m_Item.ID & 0x3fff; int amount = (ushort) this.m_Item.Amount; this.m_Double = Map.m_ItemFlags[index][TileFlag.Generic] && (amount > 1); if ((index >= 0xeea) && (index <= 0xef2)) { int num3 = (index - 0xeea) / 3; num3 *= 3; num3 += 0xeea; this.m_Double = false; if (amount <= 1) { index = num3; } else if ((amount >= 2) && (amount <= 5)) { index = num3 + 1; } else { index = num3 + 2; } } this.m_Hue = Hues.GetItemHue(index, this.m_Item.Hue); this.m_Image = this.m_Hue.GetItem(index); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; int num4 = this.m_Double ? 6 : 1; this.m_xOffset = base.m_OffsetX = this.m_Image.xMin + (((this.m_Image.xMax - this.m_Image.xMin) + num4) / 2); this.m_yOffset = this.m_Image.yMin; base.m_OffsetY = this.m_yOffset + (((this.m_Image.yMax - this.m_Image.yMin) + num4) / 2); if (this.m_Double) { this.m_Width += 5; this.m_Height += 5; } } base.m_DragCursor = false; base.m_CanDrag = true; base.m_QuickDrag = true; base.m_IsDragging = true; Gumps.Drag = this; Gumps.LastOver = this; base.m_X = Engine.m_xMouse - base.m_OffsetX; base.m_Y = Engine.m_yMouse - base.m_OffsetY; }
public GDraggedItem(Client.Item item) : base(0, 0) { this.m_vCache = new VertexCache(); this.m_Item = item; int index = this.m_Item.ID & 0x3fff; int amount = (ushort)this.m_Item.Amount; this.m_Double = Map.m_ItemFlags[index][TileFlag.Generic] && (amount > 1); if ((index >= 0xeea) && (index <= 0xef2)) { int num3 = (index - 0xeea) / 3; num3 *= 3; num3 += 0xeea; this.m_Double = false; if (amount <= 1) { index = num3; } else if ((amount >= 2) && (amount <= 5)) { index = num3 + 1; } else { index = num3 + 2; } } this.m_Hue = Hues.GetItemHue(index, this.m_Item.Hue); this.m_Image = this.m_Hue.GetItem(index); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; int num4 = this.m_Double ? 6 : 1; this.m_xOffset = base.m_OffsetX = this.m_Image.xMin + (((this.m_Image.xMax - this.m_Image.xMin) + num4) / 2); this.m_yOffset = this.m_Image.yMin; base.m_OffsetY = this.m_yOffset + (((this.m_Image.yMax - this.m_Image.yMin) + num4) / 2); if (this.m_Double) { this.m_Width += 5; this.m_Height += 5; } } base.m_DragCursor = false; base.m_CanDrag = true; base.m_QuickDrag = true; base.m_IsDragging = true; Gumps.Drag = this; Gumps.LastOver = this; base.m_X = Engine.m_xMouse - base.m_OffsetX; base.m_Y = Engine.m_yMouse - base.m_OffsetY; }
public BuyInfo(Client.Item item, int price, string name) { this.m_Item = item; this.m_Price = price; try { this.m_Name = Localization.GetString(Convert.ToInt32(name)); } catch { this.m_Name = name; } }
public void OnItemAdd(Client.Item item) { if (((base.m_GumpID != 9) || ((item.ID & 0x3fff) < 0x2006)) || ((item.ID & 0x3fff) > 0x2050)) { GContainerItem g = (GContainerItem)this.m_Hash[item]; if (g != null) { Gumps.Destroy(g); } this.m_Hash[item] = g = new GContainerItem(item, this.m_Item); g.m_CanDrag = !this.m_TradeContainer; base.m_Children.Add(g); } }
public GContainerItem(Client.Item Item, Client.Item Container) : base(Item.ContainerX, Item.ContainerY) { this.m_Item = Item; this.m_Container = Container; this.m_TileID = this.m_Item.ID; this.m_Hue = Hues.GetItemHue(this.m_TileID, this.m_Item.Hue); this.State = 0; base.m_CanDrag = true; base.m_CanDrop = true; base.m_QuickDrag = false; base.m_DragCursor = false; if (Engine.Features.AOS) { base.Tooltip = new ItemTooltip(this.m_Item); } }
public SellInfo(Client.Item item, int itemID, int hue, int amount, int price, string name) { this.m_Item = item; this.m_ItemID = itemID; this.m_Amount = amount; this.m_Price = price; try { this.m_Name = Localization.GetString(Convert.ToInt32(name)); } catch { this.m_Name = name; } if (!Map.m_ItemFlags[itemID & 0x3fff][TileFlag.PartialHue]) { hue ^= 0x8000; } this.m_Hue = Hues.Load(hue); }
public GDragAmount(Client.Item item) : base(0x85c, 0, 0) { GTextBox box; this.m_First = true; this.m_Item = item; int amount = (ushort)this.m_Item.Amount; this.m_Amount = amount; this.m_Okay = new GButtonNew(0x81a, 0x81c, 0x81b, 0x66, 0x25); this.m_Okay.CanEnter = true; this.m_Okay.Clicked += new EventHandler(this.Okay_Clicked); base.m_Children.Add(this.m_Okay); GSlider toAdd = new GSlider(0x845, 0x23, 0x10, 0x5f, 15, (double)amount, 0.0, (double)amount, 1.0) { OnValueChange = new OnValueChange(this.Slider_OnValueChange) }; base.m_Children.Add(toAdd); this.m_Slider = toAdd; GHotspot hotspot = new GHotspot(0x1c, 0x10, 0x6d, 15, toAdd); base.m_Children.Add(hotspot); box = new GTextBox(0, false, 0x1a, 0x2b, 0x42, 15, amount.ToString(), Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455)) { OnTextChange = (OnTextChange)Delegate.Combine(box.OnTextChange, new OnTextChange(this.TextBox_OnTextChange)), OnBeforeTextChange = (OnBeforeTextChange)Delegate.Combine(box.OnBeforeTextChange, new OnBeforeTextChange(this.TextBox_OnBeforeTextChange)), EnterButton = this.m_Okay }; base.m_Children.Add(box); this.m_TextBox = box; box.Focus(); base.m_IsDragging = true; base.m_OffsetX = this.Width / 2; base.m_OffsetY = this.Height / 2; Gumps.LastOver = this; Gumps.Drag = this; Gumps.Focus = this; base.m_X = Engine.m_xMouse - base.m_OffsetX; base.m_Y = Engine.m_yMouse - base.m_OffsetY; }
private void Okay_Clicked(object sender, EventArgs e) { try { int amount = Convert.ToInt32(this.m_TextBox.String); if (amount <= 0) { Gumps.Destroy(this); } else { if (amount > this.m_Amount) { amount = this.m_Amount; } base.m_IsDragging = false; Network.Send(new PPickupItem(this.m_Item, (short)((ushort)amount))); this.m_Item.Amount = (short)((ushort)amount); Gumps.Desktop.Children.Add(new GDraggedItem(this.m_Item)); if (this.m_ToDestroy is Gump) { if (((Gump)this.m_ToDestroy).Parent is GContainer) { ((GContainer)((Gump)this.m_ToDestroy).Parent).m_Hash[this.m_Item] = null; } Gumps.Destroy((Gump)this.m_ToDestroy); } else if (this.m_ToDestroy is Client.Item) { Client.Item toDestroy = (Client.Item) this.m_ToDestroy; toDestroy.RestoreInfo = new RestoreInfo(toDestroy); World.Remove(toDestroy); } Gumps.Destroy(this); } } catch { } }
public void OnItemRefresh(Client.Item item) { if (((base.m_GumpID == 9) && ((item.ID & 0x3fff) >= 0x2006)) && ((item.ID & 0x3fff) <= 0x2050)) { this.OnItemRemove(item); } else { GContainerItem toAdd = (GContainerItem)this.m_Hash[item]; if (toAdd == null) { toAdd = new GContainerItem(item, this.m_Item); this.m_Hash[item] = toAdd; base.m_Children.Add(toAdd); } else { toAdd.Refresh(); } toAdd.m_CanDrag = !this.m_TradeContainer; } }
public GContainer(Client.Item container, int gumpID, IHue hue) : base(0.25f, 0.25f, 0.6f, gumpID, 50, 50, hue) { this.m_HitTest = true; this.m_Hash = new Hashtable(); this.m_Item = container; base.m_CanDrop = true; this.GetBounds(gumpID); base.m_NonRestrictivePicking = true; ArrayList items = container.Items; int count = items.Count; for (int i = 0; i < count; i++) { Client.Item item = (Client.Item) items[i]; if (((base.m_GumpID != 9) || ((item.ID & 0x3fff) < 0x2006)) || ((item.ID & 0x3fff) > 0x2050)) { Client.Gump toAdd = new GContainerItem(item, this.m_Item); this.m_Hash[item] = toAdd; toAdd.m_CanDrag = !this.m_TradeContainer; base.m_Children.Add(toAdd); } } }
public GContainer(Client.Item container, int gumpID, IHue hue) : base(0.25f, 0.25f, 0.6f, gumpID, 50, 50, hue) { this.m_HitTest = true; this.m_Hash = new Hashtable(); this.m_Item = container; base.m_CanDrop = true; this.GetBounds(gumpID); base.m_NonRestrictivePicking = true; ArrayList items = container.Items; int count = items.Count; for (int i = 0; i < count; i++) { Client.Item item = (Client.Item)items[i]; if (((base.m_GumpID != 9) || ((item.ID & 0x3fff) < 0x2006)) || ((item.ID & 0x3fff) > 0x2050)) { Client.Gump toAdd = new GContainerItem(item, this.m_Item); this.m_Hash[item] = toAdd; toAdd.m_CanDrag = !this.m_TradeContainer; base.m_Children.Add(toAdd); } } }
public GDragAmount(Client.Item item) : base(0x85c, 0, 0) { GTextBox box; this.m_First = true; this.m_Item = item; int amount = (ushort) this.m_Item.Amount; this.m_Amount = amount; this.m_Okay = new GButtonNew(0x81a, 0x81c, 0x81b, 0x66, 0x25); this.m_Okay.CanEnter = true; this.m_Okay.Clicked += new EventHandler(this.Okay_Clicked); base.m_Children.Add(this.m_Okay); GSlider toAdd = new GSlider(0x845, 0x23, 0x10, 0x5f, 15, (double) amount, 0.0, (double) amount, 1.0) { OnValueChange = new OnValueChange(this.Slider_OnValueChange) }; base.m_Children.Add(toAdd); this.m_Slider = toAdd; GHotspot hotspot = new GHotspot(0x1c, 0x10, 0x6d, 15, toAdd); base.m_Children.Add(hotspot); box = new GTextBox(0, false, 0x1a, 0x2b, 0x42, 15, amount.ToString(), Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455)) { OnTextChange = (OnTextChange) Delegate.Combine(box.OnTextChange, new OnTextChange(this.TextBox_OnTextChange)), OnBeforeTextChange = (OnBeforeTextChange) Delegate.Combine(box.OnBeforeTextChange, new OnBeforeTextChange(this.TextBox_OnBeforeTextChange)), EnterButton = this.m_Okay }; base.m_Children.Add(box); this.m_TextBox = box; box.Focus(); base.m_IsDragging = true; base.m_OffsetX = this.Width / 2; base.m_OffsetY = this.Height / 2; Gumps.LastOver = this; Gumps.Drag = this; Gumps.Focus = this; base.m_X = Engine.m_xMouse - base.m_OffsetX; base.m_Y = Engine.m_yMouse - base.m_OffsetY; }
public GContainer(Client.Item container, int gumpID) : this(container, gumpID, Hues.Default) { }
public dynamic ToClient(dynamic d = null) { dynamic result = null; if (d is EquipmentSlots) { result = new Client.Equipment(); } else { result = new Client.Item(); } result.ID = ID; /* * result.ID += (ushort)(Bonus * 2 << 12); * result.ID += (ushort)(IsBound << 12); * * if (Upgrades != 0) * { * result.Upgrade1 = Upgrade1; * result.Upgrade1 += 1 << 4; * * if (!(Upgrades > 1)) * return result; * * if (Upgrade2 == Upgrade1) * result.Upgrade1 += 1 << 4; * else * { * result.Upgrade2 = Upgrade2; * result.Upgrade2 += 1 << 4; * } * * if (!(Upgrades > 2)) * return result; * * if (Upgrade3 == Upgrade1) * result.Upgrade1 += 1 << 4; * else if (Upgrade3 == Upgrade2) * result.Upgrade2 += 1 << 4; * * if (!(Upgrades > 3)) * return result; * * if (Upgrade4 == Upgrade1) * result.Upgrade1 += 1 << 4; * else if (Upgrade4 == Upgrade2) * result.Upgrade2 += 1 << 4; * } * * result.Craft = CraftType; * result.Craft += (byte)(CraftBonus << 4); * * result.Upgrades = (byte)(Upgrades << 4); */ //result.Craft += (byte)(CraftBonus << 4); if (d is EquipmentSlots) { result.Slot = (byte)d; } else { result.Slot = (ushort)d; } result.ExpirationDate = ExpirationDate; return(result); }
public Appraisal(Client.Item item, int[] worth) { this.m_Item = item; this.m_Worth = worth; }