public bool Link(GDragable g, int Dock, int TheirDock) { int count = this.m_Linked.Count; for (int i = 0; i < count; i++) { Client.Linked linked = (Client.Linked) this.m_Linked[i]; if (linked.Gump == g) { return(false); } } this.m_Linked.Add(new Client.Linked(g, Dock, TheirDock)); return(true); }
public void UpdateLink(Gump gOld, GDragable gNew) { int count = this.m_Linked.Count; for (int i = 0; i < count; i++) { Client.Linked linked2 = (Client.Linked) this.m_Linked[i]; if (linked2.Gump == gOld) { linked2 = (Client.Linked) this.m_Linked[i]; linked2 = (Client.Linked) this.m_Linked[i]; Client.Linked linked = new Client.Linked(gNew, linked2.Dock, linked2.TheirDock); this.m_Linked.RemoveAt(i); this.m_Linked.Add(linked); break; } } }
public bool Link(GDragable g, int Dock, int TheirDock) { int count = this.m_Linked.Count; for (int i = 0; i < count; i++) { Client.Linked linked = (Client.Linked) this.m_Linked[i]; if (linked.Gump == g) { return false; } } this.m_Linked.Add(new Client.Linked(g, Dock, TheirDock)); return true; }
public static Gump OpenSpellbook(int circle, int lastSpell, Item container) { SpellList necromancerList; container.OpenSB = true; container.Circle = circle; container.LastSpell = lastSpell; circle &= -2; Engine.Sounds.PlaySound(0x55); Engine.DoEvents(); GDragable dragable = new GDragable(GetBookIndex(container.ID), 0, 0); dragable.SetTag("Container", container); dragable.SetTag("Dispose", "Spellbook"); dragable.Children.Add(new GMinimizer()); if (container.SpellbookOffset == 0x65) { necromancerList = NecromancerList; } else if (container.SpellbookOffset == 0xc9) { necromancerList = PaladinList; } else { necromancerList = RegularList; } if ((lastSpell >= necromancerList.Start) && (lastSpell < (necromancerList.Start + necromancerList.Spells.Length))) { int num = (lastSpell - necromancerList.Start) / necromancerList.SpellsPerCircle; int num2 = (lastSpell - necromancerList.Start) % necromancerList.SpellsPerCircle; if ((num >= 0) && (num < necromancerList.Circles)) { if (num == circle) { dragable.Children.Add(new GImage(0x8ad, 0xb8, 2)); dragable.Children.Add(new GImage(0x8af, 0xb7, 0x34 + (num2 * 15))); } else if (num == (circle + 1)) { dragable.Children.Add(new GImage(0x8ae, 0xcc, 3)); dragable.Children.Add(new GImage(0x8b0, 0xcc, 0x34 + (num2 * 15))); } } } dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x6a, 10)); dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x10d, 10)); OnClick clickHandler = new OnClick(Spells.ChangeCircle_OnClick); int[] numArray = new int[] { 0x3a, 0x5d, 130, 0xa4, 0xe3, 260, 0x129, 0x14c }; int[] numArray2 = new int[] { 0x34, 0x34 }; if (necromancerList.DisplayIndex) { for (int j = 0; j < necromancerList.Circles; j++) { GButton toAdd = new GButton(0x8b1 + j, 0x8b1 + j, 0x8b1 + j, numArray[j], 0xaf, clickHandler); toAdd.SetTag("Circle", j); dragable.Children.Add(toAdd); } } if (necromancerList.DisplayCircles) { if (circle > 0) { GButton button2 = new GButton(0x8bb, 0x8bb, 0x8bb, 50, 8, clickHandler); button2.SetTag("Circle", circle - 1); dragable.Children.Add(button2); } if (circle < ((necromancerList.Circles - 1) & -2)) { GButton button3 = new GButton(0x8bc, 0x8bc, 0x8bc, 0x141, 8, clickHandler); button3.SetTag("Circle", circle + 2); dragable.Children.Add(button3); } for (int k = circle; k < (circle + 2); k++) { string str; int x = ((k & 1) == 0) ? 0x3e : 0xe1; if ((k < 0) || (k >= m_Numbers.Length)) { str = "Bad"; } else { str = m_Numbers[k]; } dragable.Children.Add(new GLabel(string.Format("{0} Circle", str), Engine.GetFont(6), Hues.Default, x, 30)); } } int num6 = circle * necromancerList.SpellsPerCircle; int num7 = (circle + 2) * necromancerList.SpellsPerCircle; for (int i = num6; i < num7; i++) { if (((i >= num6) && (i < num7)) && container.GetSpellContained(i)) { int num9 = i / necromancerList.SpellsPerCircle; Spell spellByID = GetSpellByID(container.SpellbookOffset + i); if (spellByID != null) { IntPtr ptr; GSpellName name = new GSpellName(container.SpellbookOffset + i, spellByID.Name, Engine.GetFont(9), Hues.Load(0x288), Hues.Load(0x28b), 0x3e + ((num9 & 1) * 0xa3), numArray2[num9 & 1]); numArray2[(int)(ptr = (IntPtr)(num9 & 1))] = numArray2[(int)ptr] + 15; string str2 = string.Format("{0}\n", spellByID.Name); StringBuilder builder = new StringBuilder(); builder.Append(spellByID.Name); builder.Append('\n'); for (int m = 0; m < spellByID.Power.Length; m++) { builder.Append(spellByID.Power[m].Name); builder.Append(' '); } for (int n = 0; n < spellByID.Reagents.Count; n++) { builder.Append('\n'); Reagent reagent = (Reagent)spellByID.Reagents[n]; builder.Append(reagent.Name); } if (spellByID.Tithing > 0) { builder.Append('\n'); builder.AppendFormat("Tithing: {0}", spellByID.Tithing); } if (spellByID.Mana > 0) { builder.Append('\n'); builder.AppendFormat("Mana: {0}", spellByID.Mana); } if (spellByID.Skill > 0) { builder.Append('\n'); builder.AppendFormat("Skill: {0}", spellByID.Skill); } Tooltip tooltip = new Tooltip(builder.ToString(), true); name.Tooltip = tooltip; dragable.Children.Add(name); } } } return(dragable); }
private static void StringQuery(PacketReader pvSrc) { GDragable dragable; GWrappedLabel label2; int num = pvSrc.ReadInt32(); short num2 = pvSrc.ReadInt16(); int fixedLength = pvSrc.ReadInt16(); string text = pvSrc.ReadString(fixedLength); bool flag = pvSrc.ReadBoolean(); byte num4 = pvSrc.ReadByte(); int num5 = pvSrc.ReadInt32(); int num6 = pvSrc.ReadInt16(); string str2 = pvSrc.ReadString(num6); dragable = new GDragable(0x474, 0, 0) { CanClose = false, Modal = true, X = (Engine.ScreenWidth - dragable.Width) / 2, Y = (Engine.ScreenHeight - dragable.Height) / 2 }; GButton toAdd = new GButton(0x47b, 0x47d, 0x47c, 0x75, 190, new OnClick(Engine.StringQueryOkay_OnClick)); GButton button2 = new GButton(0x478, 0x47a, 0x479, 0xcc, 190, flag ? new OnClick(Engine.StringQueryCancel_OnClick) : null); if (!flag) { button2.Enabled = false; } GImage image = new GImage(0x477, 60, 0x91); GWrappedLabel label = new GWrappedLabel(text, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110); label2 = new GWrappedLabel(str2, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110) { Y = image.Y - label2.Height }; GTextBox box = new GTextBox(0, false, 0x44, 140, image.Width - 8, image.Height, "", Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455)); box.Focus(); if (num4 == 1) { box.MaxChars = num5; } toAdd.SetTag("Dialog", dragable); toAdd.SetTag("Serial", num); toAdd.SetTag("Type", num2); toAdd.SetTag("Text", box); button2.SetTag("Dialog", dragable); button2.SetTag("Serial", num); button2.SetTag("Type", num2); dragable.Children.Add(label); dragable.Children.Add(label2); dragable.Children.Add(image); dragable.Children.Add(box); dragable.Children.Add(button2); dragable.Children.Add(toAdd); dragable.m_CanDrag = true; Gumps.Desktop.Children.Add(dragable); }
private static void LinkDocked(GDragable g) { if (g != null) { ArrayList dockers = g.Dockers; if (dockers.Count != 0) { int count = dockers.Count; for (int i = 0; i < count; i++) { Point point = new Point((Point) dockers[i], g.X, g.Y); int num3 = m_Desktop.Children.Count; for (int j = 0; j < num3; j++) { if (((m_Desktop.Children[j] != null) && (m_Desktop.Children[j] != g)) && (m_Desktop.Children[j].GetType() == typeof(GDragable))) { ArrayList list2 = ((GDragable) m_Desktop.Children[j]).Dockers; Point[] pointArray = (Point[]) list2.ToArray(typeof(Point)); int num5 = list2.Count; for (int k = 0; k < num5; k++) { pointArray[k] = new Point(pointArray[k], m_Desktop.Children[j].X, m_Desktop.Children[j].Y); if (point == pointArray[k]) { if (((GDragable) m_Desktop.Children[j]).Link(g, k, i)) { LinkDocked((GDragable) m_Desktop.Children[j]); } break; } } } } } } } }
public Linked(GDragable g, int d, int d2) { this.Gump = g; this.Dock = d; this.TheirDock = d2; }
public static Gump OpenSpellbook(int circle, int lastSpell, Item container) { SpellList necromancerList; container.OpenSB = true; container.Circle = circle; container.LastSpell = lastSpell; circle &= -2; Engine.Sounds.PlaySound(0x55); Engine.DoEvents(); GDragable dragable = new GDragable(GetBookIndex(container.ID), 0, 0); dragable.SetTag("Container", container); dragable.SetTag("Dispose", "Spellbook"); dragable.Children.Add(new GMinimizer()); if (container.SpellbookOffset == 0x65) { necromancerList = NecromancerList; } else if (container.SpellbookOffset == 0xc9) { necromancerList = PaladinList; } else { necromancerList = RegularList; } if ((lastSpell >= necromancerList.Start) && (lastSpell < (necromancerList.Start + necromancerList.Spells.Length))) { int num = (lastSpell - necromancerList.Start) / necromancerList.SpellsPerCircle; int num2 = (lastSpell - necromancerList.Start) % necromancerList.SpellsPerCircle; if ((num >= 0) && (num < necromancerList.Circles)) { if (num == circle) { dragable.Children.Add(new GImage(0x8ad, 0xb8, 2)); dragable.Children.Add(new GImage(0x8af, 0xb7, 0x34 + (num2 * 15))); } else if (num == (circle + 1)) { dragable.Children.Add(new GImage(0x8ae, 0xcc, 3)); dragable.Children.Add(new GImage(0x8b0, 0xcc, 0x34 + (num2 * 15))); } } } dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x6a, 10)); dragable.Children.Add(new GLabel("INDEX", Engine.GetFont(6), Hues.Default, 0x10d, 10)); OnClick clickHandler = new OnClick(Spells.ChangeCircle_OnClick); int[] numArray = new int[] { 0x3a, 0x5d, 130, 0xa4, 0xe3, 260, 0x129, 0x14c }; int[] numArray2 = new int[] { 0x34, 0x34 }; if (necromancerList.DisplayIndex) { for (int j = 0; j < necromancerList.Circles; j++) { GButton toAdd = new GButton(0x8b1 + j, 0x8b1 + j, 0x8b1 + j, numArray[j], 0xaf, clickHandler); toAdd.SetTag("Circle", j); dragable.Children.Add(toAdd); } } if (necromancerList.DisplayCircles) { if (circle > 0) { GButton button2 = new GButton(0x8bb, 0x8bb, 0x8bb, 50, 8, clickHandler); button2.SetTag("Circle", circle - 1); dragable.Children.Add(button2); } if (circle < ((necromancerList.Circles - 1) & -2)) { GButton button3 = new GButton(0x8bc, 0x8bc, 0x8bc, 0x141, 8, clickHandler); button3.SetTag("Circle", circle + 2); dragable.Children.Add(button3); } for (int k = circle; k < (circle + 2); k++) { string str; int x = ((k & 1) == 0) ? 0x3e : 0xe1; if ((k < 0) || (k >= m_Numbers.Length)) { str = "Bad"; } else { str = m_Numbers[k]; } dragable.Children.Add(new GLabel(string.Format("{0} Circle", str), Engine.GetFont(6), Hues.Default, x, 30)); } } int num6 = circle * necromancerList.SpellsPerCircle; int num7 = (circle + 2) * necromancerList.SpellsPerCircle; for (int i = num6; i < num7; i++) { if (((i >= num6) && (i < num7)) && container.GetSpellContained(i)) { int num9 = i / necromancerList.SpellsPerCircle; Spell spellByID = GetSpellByID(container.SpellbookOffset + i); if (spellByID != null) { IntPtr ptr; GSpellName name = new GSpellName(container.SpellbookOffset + i, spellByID.Name, Engine.GetFont(9), Hues.Load(0x288), Hues.Load(0x28b), 0x3e + ((num9 & 1) * 0xa3), numArray2[num9 & 1]); numArray2[(int) (ptr = (IntPtr) (num9 & 1))] = numArray2[(int) ptr] + 15; string str2 = string.Format("{0}\n", spellByID.Name); StringBuilder builder = new StringBuilder(); builder.Append(spellByID.Name); builder.Append('\n'); for (int m = 0; m < spellByID.Power.Length; m++) { builder.Append(spellByID.Power[m].Name); builder.Append(' '); } for (int n = 0; n < spellByID.Reagents.Count; n++) { builder.Append('\n'); Reagent reagent = (Reagent) spellByID.Reagents[n]; builder.Append(reagent.Name); } if (spellByID.Tithing > 0) { builder.Append('\n'); builder.AppendFormat("Tithing: {0}", spellByID.Tithing); } if (spellByID.Mana > 0) { builder.Append('\n'); builder.AppendFormat("Mana: {0}", spellByID.Mana); } if (spellByID.Skill > 0) { builder.Append('\n'); builder.AppendFormat("Skill: {0}", spellByID.Skill); } Tooltip tooltip = new Tooltip(builder.ToString(), true); name.Tooltip = tooltip; dragable.Children.Add(name); } } } return dragable; }
private static bool Parse_Image(XmlTextReader xml, Gump Parent, string Name) { Gump gump; int gumpID = 0; int x = 0; int y = 0; bool @bool = false; float num4 = 1f; bool isEmptyElement = xml.IsEmptyElement; while (xml.MoveToNextAttribute()) { switch (xml.Name) { case "GumpID": { gumpID = GetInt(xml.Value); continue; } case "GumpIDi": { gumpID = Convert.ToInt32(xml.Value); continue; } case "GumpIDh": { gumpID = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "X": { x = GetInt(xml.Value); continue; } case "Xi": { x = Convert.ToInt32(xml.Value); continue; } case "Xh": { x = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "Y": { y = GetInt(xml.Value); continue; } case "Yi": { y = Convert.ToInt32(xml.Value); continue; } case "Yh": { y = Convert.ToInt32(xml.Value.Substring(2), 0x10); continue; } case "HitTest": { @bool = GetBool(xml.Value); continue; } case "HitTestb": { @bool = Convert.ToBoolean(xml.Value); continue; } case "Alpha": { num4 = ((float) GetInt(xml.Value)) / 255f; continue; } case "Alphai": { num4 = ((float) Convert.ToInt32(xml.Value)) / 255f; continue; } case "Alphah": { num4 = ((float) Convert.ToInt32(xml.Value.Substring(2), 0x10)) / 255f; continue; } } return false; } if (!@bool) { gump = new GImage(gumpID, x, y); ((GImage) gump).Alpha = num4; } else { gump = new GDragable(gumpID, x, y) { m_CanDrag = false }; ((GDragable) gump).Alpha = num4; } Parent.Children.Add(gump); if (isEmptyElement) { return true; } while (xml.Read()) { XmlNodeType nodeType = xml.NodeType; if (nodeType != XmlNodeType.Element) { if (nodeType != XmlNodeType.Comment) { return (nodeType == XmlNodeType.EndElement); } } else if (!Parse_Element(xml, gump, Name)) { return false; } } return false; }