Example #1
0
 public void AddItem(string Text, Tooltip t)
 {
     GListItem toAdd = new GListItem(Text, this.m_Count++, this) {
         Tooltip = t
     };
     base.m_Children.Add(toAdd);
 }
Example #2
0
 private static bool Parse_Button(XmlTextReader xml, Gump Parent, string Name)
 {
     int gumpID = 0;
     int x = 0;
     int y = 0;
     string method = "";
     ITooltip tooltip = null;
     bool @bool = false;
     bool flag2 = true;
     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 "OnClick":
             {
                 method = GetString(xml.Value);
                 continue;
             }
             case "OnClicks":
             {
                 method = xml.Value;
                 continue;
             }
             case "Tooltip":
             {
                 tooltip = new Tooltip(GetString(xml.Value));
                 continue;
             }
             case "Tooltips":
             {
                 tooltip = new Tooltip(xml.Value);
                 continue;
             }
             case "CanEnter":
             {
                 @bool = GetBool(xml.Value);
                 continue;
             }
             case "CanEnterb":
             {
                 @bool = Convert.ToBoolean(xml.Value);
                 continue;
             }
             case "Enabled":
             {
                 flag2 = GetBool(xml.Value);
                 continue;
             }
             case "Enabledb":
             {
                 flag2 = Convert.ToBoolean(xml.Value);
                 continue;
             }
         }
         return false;
     }
     OnClick clickHandler = null;
     try
     {
         if (method.Length > 0)
         {
             clickHandler = (OnClick) Delegate.CreateDelegate(typeof(OnClick), typeof(Engine), method);
         }
     }
     catch
     {
         clickHandler = null;
     }
     GButton toAdd = new GButton(gumpID, x, y, clickHandler) {
         Tooltip = tooltip,
         CanEnter = @bool,
         Enabled = flag2
     };
     Parent.Children.Add(toAdd);
     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, toAdd, Name))
         {
             return false;
         }
     }
     return false;
 }
Example #3
0
 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;
 }
Example #4
0
 private static bool Parse_TextButton(XmlTextReader xml, Gump Parent, string Name)
 {
     string text = "";
     int x = 0;
     int y = 0;
     string method = "";
     ITooltip tooltip = null;
     IHue defaultHue = Engine.DefaultHue;
     IHue focusHue = Engine.DefaultHue;
     IFont defaultFont = Engine.DefaultFont;
     bool isEmptyElement = xml.IsEmptyElement;
     while (xml.MoveToNextAttribute())
     {
         switch (xml.Name)
         {
             case "Text":
             {
                 text = GetString(xml.Value);
                 continue;
             }
             case "RegularHue":
             {
                 defaultHue = GetHue(xml.Value);
                 continue;
             }
             case "OverHue":
             {
                 focusHue = GetHue(xml.Value);
                 continue;
             }
             case "Font":
             {
                 defaultFont = GetFont(xml.Value);
                 continue;
             }
             case "X":
             {
                 x = GetInt(xml.Value);
                 continue;
             }
             case "Y":
             {
                 y = GetInt(xml.Value);
                 continue;
             }
             case "OnClick":
             {
                 method = GetString(xml.Value);
                 continue;
             }
             case "Tooltip":
             {
                 tooltip = new Tooltip(GetString(xml.Value));
                 continue;
             }
         }
         return false;
     }
     OnClick onClick = null;
     try
     {
         if (method.Length > 0)
         {
             onClick = (OnClick) Delegate.CreateDelegate(typeof(OnClick), typeof(Engine), method);
         }
     }
     catch
     {
         onClick = null;
     }
     GTextButton toAdd = new GTextButton(text, defaultFont, defaultHue, focusHue, x, y, onClick) {
         Tooltip = tooltip
     };
     Parent.Children.Add(toAdd);
     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, toAdd, Name))
         {
             return false;
         }
     }
     return false;
 }