コード例 #1
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);
        }