Exemple #1
0
 public static Spell GetSpellByPower(string power)
 {
     return((Spells.GetSpellByPower(Spells.RegularList, power) ?? Spells.GetSpellByPower(Spells.PaladinList, power)) ?? Spells.GetSpellByPower(Spells.NecromancerList, power));
 }
Exemple #2
0
 public static Spell GetSpellByName(string name)
 {
     return((Spells.GetSpellByName(Spells.RegularList, name) ?? Spells.GetSpellByName(Spells.PaladinList, name)) ?? Spells.GetSpellByName(Spells.NecromancerList, name));
 }
Exemple #3
0
        public static Gump OpenSpellbook(int circle, int lastSpell, Item container)
        {
            container.OpenSB    = true;
            container.Circle    = circle;
            container.LastSpell = lastSpell;
            circle &= -2;
            Engine.Sounds.PlaySound(85, -1, -1, -1, 0.75f, 0.0f);
            Engine.DoEvents();
            GDragable gdragable = new GDragable(Spells.GetBookIndex(container.ID), 0, 0);

            gdragable.SetTag("Container", (object)container);
            gdragable.SetTag("Dispose", (object)"Spellbook");
            gdragable.Children.Add((Gump) new Spells.GMinimizer());
            SpellList spellList = container.SpellbookOffset != 101 ? (container.SpellbookOffset != 201 ? Spells.RegularList : Spells.PaladinList) : Spells.NecromancerList;

            if (lastSpell >= spellList.Start && lastSpell < spellList.Start + spellList.Spells.Length)
            {
                int num1 = (lastSpell - spellList.Start) / spellList.SpellsPerCircle;
                int num2 = (lastSpell - spellList.Start) % spellList.SpellsPerCircle;
                if (num1 >= 0 && num1 < spellList.Circles)
                {
                    if (num1 == circle)
                    {
                        gdragable.Children.Add((Gump) new GImage(2221, 184, 2));
                        gdragable.Children.Add((Gump) new GImage(2223, 183, 52 + num2 * 15));
                    }
                    else if (num1 == circle + 1)
                    {
                        gdragable.Children.Add((Gump) new GImage(2222, 204, 3));
                        gdragable.Children.Add((Gump) new GImage(2224, 204, 52 + num2 * 15));
                    }
                }
            }
            gdragable.Children.Add((Gump) new GLabel("INDEX", (IFont)Engine.GetFont(6), Hues.Default, 106, 10));
            gdragable.Children.Add((Gump) new GLabel("INDEX", (IFont)Engine.GetFont(6), Hues.Default, 269, 10));
            OnClick ClickHandler = new OnClick(Spells.ChangeCircle_OnClick);

            int[] numArray1 = new int[8] {
                58, 93, 130, 164, 227, 260, 297, 332
            };
            int[] numArray2 = new int[2] {
                52, 52
            };
            if (spellList.DisplayIndex)
            {
                for (int index = 0; index < spellList.Circles; ++index)
                {
                    GButton gbutton = new GButton(2225 + index, 2225 + index, 2225 + index, numArray1[index], 175, ClickHandler);
                    gbutton.SetTag("Circle", (object)index);
                    gdragable.Children.Add((Gump)gbutton);
                }
            }
            if (spellList.DisplayCircles)
            {
                if (circle > 0)
                {
                    GButton gbutton = new GButton(2235, 2235, 2235, 50, 8, ClickHandler);
                    gbutton.SetTag("Circle", (object)(circle - 1));
                    gdragable.Children.Add((Gump)gbutton);
                }
                if (circle < (spellList.Circles - 1 & -2))
                {
                    GButton gbutton = new GButton(2236, 2236, 2236, 321, 8, ClickHandler);
                    gbutton.SetTag("Circle", (object)(circle + 2));
                    gdragable.Children.Add((Gump)gbutton);
                }
                for (int index = circle; index < circle + 2; ++index)
                {
                    int    X   = (index & 1) == 0 ? 62 : 225;
                    string str = index < 0 || index >= Spells.m_Numbers.Length ? "Bad" : Spells.m_Numbers[index];
                    gdragable.Children.Add((Gump) new GLabel(string.Format("{0} Circle", (object)str), (IFont)Engine.GetFont(6), Hues.Default, X, 30));
                }
            }
            int num3 = circle * spellList.SpellsPerCircle;
            int num4 = (circle + 2) * spellList.SpellsPerCircle;

            for (int index1 = num3; index1 < num4; ++index1)
            {
                if (index1 >= num3 && index1 < num4 && container.GetSpellContained(index1))
                {
                    int   num1      = index1 / spellList.SpellsPerCircle;
                    Spell spellById = Spells.GetSpellByID(container.SpellbookOffset + index1);
                    if (spellById != null)
                    {
                        GSpellName gspellName = new GSpellName(container.SpellbookOffset + index1, spellById.Name, (IFont)Engine.GetFont(9), Hues.Load(648), Hues.Load(651), 62 + (num1 & 1) * 163, numArray2[num1 & 1]);
                        numArray2[num1 & 1] += 15;
                        string.Format("{0}\n", (object)spellById.Name);
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append(spellById.Name);
                        stringBuilder.Append('\n');
                        for (int index2 = 0; index2 < spellById.Power.Length; ++index2)
                        {
                            stringBuilder.Append(spellById.Power[index2].Name);
                            stringBuilder.Append(' ');
                        }
                        for (int index2 = 0; index2 < spellById.Reagents.Count; ++index2)
                        {
                            stringBuilder.Append('\n');
                            stringBuilder.Append(((Reagent)spellById.Reagents[index2]).Name);
                        }
                        if (spellById.Tithing > 0)
                        {
                            stringBuilder.Append('\n');
                            stringBuilder.AppendFormat("Tithing: {0}", (object)spellById.Tithing);
                        }
                        if (spellById.Mana > 0)
                        {
                            stringBuilder.Append('\n');
                            stringBuilder.AppendFormat("Mana: {0}", (object)spellById.Mana);
                        }
                        if (spellById.Skill > 0)
                        {
                            stringBuilder.Append('\n');
                            stringBuilder.AppendFormat("Skill: {0}", (object)spellById.Skill);
                        }
                        Tooltip tooltip = new Tooltip(stringBuilder.ToString(), true);
                        gspellName.Tooltip = (ITooltip)tooltip;
                        gdragable.Children.Add((Gump)gspellName);
                    }
                }
            }
            return((Gump)gdragable);
        }
Exemple #4
0
 public static Spell GetSpellByID(int spellID)
 {
     return((Spells.GetSpellByID(Spells.RegularList, spellID) ?? Spells.GetSpellByID(Spells.PaladinList, spellID)) ?? Spells.GetSpellByID(Spells.NecromancerList, spellID));
 }