コード例 #1
0
ファイル: NewSpellBookGump.cs プロジェクト: Zilmerx/Temrael2
            public int Compare(object obj1, object obj2)
            {
                SpellBookEntry a = (SpellBookEntry)obj1;
                SpellBookEntry b = (SpellBookEntry)obj2;

                return(((int)a.SpellID).CompareTo(((int)b.SpellID)));
            }
コード例 #2
0
ファイル: QSLGump.cs プロジェクト: jicomub/Temrael
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID < 3000 && info.ButtonID != 0)
            {
                if (Book[from] != null && (Book[from].Parent == from || (from.Backpack != null && Book[from].Parent == from.Backpack)))
                {
                    if (Book[from].HasSpell(info.ButtonID))
                    {
                        Spell spell = SpellRegistry.NewSpell(info.ButtonID, from, null);

                        try
                        {
                            spell.Cast();
                        }
                        catch (Exception e)
                        {
                            Misc.ExceptionLogging.WriteLine(e);
                        }
                    }

                    if (from is PlayerMobile)
                    {
                        from.SendGump(new QuickSpellLaunchGump((PlayerMobile)from, m_List));
                    }
                }
                else
                {
                    from.SendMessage("L'objet doit rester dans votre sac en tout temps !");
                }
            }
            else if (info.ButtonID >= 3000 && info.ButtonID != 0)
            {
                if (Book[from] != null && (Book[from].Parent == from || (from.Backpack != null && Book[from].Parent == from.Backpack)))
                {
                    string name = "Nom inconnu";

                    SpellBookEntry entry = (SpellBookEntry)NewSpellbookGump.FindEntryBySpellID(info.ButtonID - 2000);

                    if (entry != null && Book[from].HasSpell(entry.SpellID))
                    {
                        name = entry.Nom;
                    }

                    from.SendMessage(name);

                    if (from is PlayerMobile)
                    {
                        from.SendGump(new QuickSpellLaunchGump((PlayerMobile)from, m_List));
                    }
                }
                else
                {
                    from.SendMessage("L'objet doit rester dans votre sac en tout temps !");
                }
            }
        }
コード例 #3
0
ファイル: NewSpellBookGump.cs プロジェクト: Zilmerx/Temrael2
        public static SpellBookEntry FindEntryBySpellID(int spellID)
        {
            for (int i = 0; i < m_SpellBookEntry.Length; i++)
            {
                SpellBookEntry info = (SpellBookEntry)m_SpellBookEntry[i];

                if (info.SpellID == spellID)
                {
                    return(info);
                }
            }

            return(null);
        }
コード例 #4
0
ファイル: QSLGump.cs プロジェクト: jicomub/Temrael
        public static ArrayList GetSpellList(PlayerMobile from, NewSpellbook book)
        {
            ArrayList list = new ArrayList();

            for (int i = 0; i < from.QuickSpells.Count; i++)
            {
                int val = (int)from.QuickSpells[i];

                SpellBookEntry entry = NewSpellbookGump.FindEntryBySpellID(val);

                if (entry != null && book.HasSpell(entry.SpellID))
                {
                    list.Add(entry);
                }
            }

            return(list);
        }
コード例 #5
0
ファイル: QSLGump.cs プロジェクト: jicomub/Temrael
        public QuickSpellLaunchGump(PlayerMobile from, BaseInstrument instrument, ArrayList list)
            : base(150, 200)
        {
            try
            {
                if (list != null)
                {
                    m_List = list;

                    m_From       = from;
                    m_Instrument = instrument;

                    //m_From.Validate(ValidateType.Connaissances);

                    Closable   = true;
                    Disposable = true;
                    Dragable   = true;
                    Resizable  = false;

                    AddPage(0);

                    //AddBackground(69, 35, 44 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 44, 146, 2620);
                    AddBackground(69, 35, 54 + ((list.Count / 3) * 44), 146, 2620);

                    /*AddBackground(69, 35, 63 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 198, 9260);
                     * AddBackground(92, 59, 19 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 154, 9270);
                     * AddImageTiled(111, 34, 0 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 17, 10250);
                     * AddImage(35, 40, 10421);
                     * AddImage(111 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 40, 10431);
                     * AddImage(59, 22, 10420);
                     * AddImage(94 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 22, 10430);
                     * AddImage(19, 172, 10402);
                     * AddImage(100 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 57, 172, 10412);
                     *
                     * AddLabel(60 + ((list.Count / 3 + 1) < 3 ? 3 : (list.Count / 3 + 1)) * 26, 32, 50, "Lancement rapide");*/

                    int hindex = 0;
                    int vindex = 0;

                    for (int i = 0; i < list.Count; i++)
                    {
                        if (vindex > 2)
                        {
                            hindex++;
                            vindex = 0;
                        }

                        object obj = (object)list[i];

                        if (obj is SpellBookEntry)
                        {
                            SpellBookEntry entry = (SpellBookEntry)obj;

                            if (entry != null)
                            {
                                AddButton(74 + hindex * 44, 42 + vindex * 44, entry.ImageID, entry.ImageID, entry.SpellID, GumpButtonType.Reply, 0);
                                //AddButton(102 + hindex * 57, 71 + vindex * 45, 2103, 2104, entry.SpellID + 2000, GumpButtonType.Reply, 0);
                            }
                        }


                        vindex++;
                    }
                }
            }
            catch (Exception ex)
            {
                Misc.ExceptionLogging.WriteLine(ex);
            }
        }
コード例 #6
0
ファイル: NewSpellBookGump.cs プロジェクト: Zilmerx/Temrael2
        public NewSpellbookGump(Mobile from, NewSpellbook book)
            : base(150, 200)
        {
            InitializeHashtable();

            m_Book = book;
            int vindex  = 0;
            int totpage = 0;
            int hindex  = 0;

            if (!(from is PlayerMobile))
            {
                return;
            }

            PlayerMobile m = (PlayerMobile)from;

            AddPage(0);
            AddImage(100, 10, 2201);

            int oldReqSkill = -1;
            int newReqSkill = -1;

            int value    = 0;
            int addition = 0;

            //Pour tous les sorts
            for (int i = 0; i < m_SpellBookEntry.Length; i++)
            {
                SpellBookEntry info = (SpellBookEntry)m_SpellBookEntry[i];

                newReqSkill = (int)info.Skill;

                if (newReqSkill == oldReqSkill)
                {
                    addition += 1;
                }
                else
                {
                    addition = 0;
                }

                //on fait la comparaison des skills pour savoir si on a changé de skills
                if ((newReqSkill != -1 && newReqSkill != oldReqSkill) || (addition == 9) || (addition == 18))
                {
                    value++;

                    if (value % 2 == 1)
                    {
                        totpage++;
                        AddPage(totpage);
                        hindex = 0;
                    }
                    else
                    {
                        hindex = 1;
                    }

                    // On ajoute le nom du skill en haut de page
                    AddHtml(160 + hindex * 145, 32, 200, 20, "<h3><basefont color=#025a>" + (string)m_Names[info.Skill] + "<basefont></h3>", false, false);

                    // Séparateurs
                    AddImageTiled(130 + hindex * 165, 40, 130, 10, 0x3A);

                    //On remet à 0 pour la nouvelle page
                    vindex = 0;

                    //On ajoute les boutons de changement de page
                    AddButton(396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, totpage + 1);
                    AddButton(123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, totpage - 1);
                }

                //Si le livre possède le sort
                if (this.HasSpell(from, info.SpellID))
                {
                    int buttonID = 2224;

                    if (m.QuickSpells.Contains(info.SpellID))
                    {
                        buttonID = 2223;
                    }

                    //On ajoute l'information et les boutons
                    AddHtml(162 + hindex * 160, 54 + (vindex * 17), 200, 20, "<h3><basefont color=#5A4A31>" + info.Nom + "<basefont></h3>", false, false);

                    AddButton(127 + hindex * 160, 59 + (vindex * 17), 2103, 2104, info.SpellID, GumpButtonType.Reply, 0);
                    AddButton(140 + hindex * 160, 58 + (vindex * 17), buttonID, buttonID, info.SpellID + 1000, GumpButtonType.Reply, 0);
                    vindex++;
                }

                oldReqSkill = (int)info.Skill;
            }

            value = 0;

            //Pour tous les sorts
            for (int i = 0; i < m_SpellBookEntry.Length; i++)
            {
                SpellBookEntry info = (SpellBookEntry)m_SpellBookEntry[i];

                //Si le livre possède le sort
                if (this.HasSpell(from, info.SpellID))
                {
                    //Si le # du sort est pair...
                    if (value % 2 == 0)
                    {
                        //On fait une page
                        totpage++;
                        AddPage(totpage);
                        hindex = 0;

                        //On ajoute les boutons de pages
                        AddButton(123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, totpage - 1);
                        AddButton(396, 14, 0x89E, 0x89E, 18, GumpButtonType.Page, totpage + 1);
                    }
                    else
                    {
                        hindex = 1;
                    }

                    //int namecolor = 0;
                    string name = "...";

                    if (m_Names.Contains(info.Skill))
                    {
                        name = (string)m_Names[info.Skill];
                    }

                    //On ajoute le nom
                    AddHtml(158 + hindex * 145, 32, 200, 20, "<h3><basefont color=#025a>" + info.Nom + "<basefont></h3>", false, false);

                    //On ajoute les séparateurs
                    AddImageTiled(130 + hindex * 165, 40, 130, 10, 0x3A);

                    //On ajoute l'icone en tant que bouton pour lancer le sort
                    AddButton(140 + hindex * 165, 60, info.ImageID, info.ImageID, info.SpellID, GumpButtonType.Reply, 0);

                    AddHtml(190 + hindex * 165, 63, 200, 20, "<h3><basefont color=#5A4A31>" + name.Substring(0, 5) + ". " + info.Cercle + "<basefont></h3>", false, false);

                    int buttonID = 2224;

                    if (m.QuickSpells.Contains(info.SpellID))
                    {
                        buttonID = 2223;
                    }

                    // Boutons pour le lancement rapide
                    AddHtml(210 + hindex * 165, 83, 200, 20, "<h3><basefont color=#5A4A31>Rapide<basefont></h3>", false, false);
                    AddButton(190 + hindex * 165, 84, buttonID, buttonID, info.SpellID + 1000, GumpButtonType.Reply, 0);

                    // Ingrédients
                    AddHtml(130 + hindex * 165, 105, 200, 20, "<h3><basefont color=#025a>Ingrédients<basefont></h3>", false, false);
                    for (int j = 0; j < info.Reagents.Length; j++)
                    {
                        Type type = (Type)info.Reagents[j];
                        //AddLabel(130 + hindex * 165, 123 + j * 18, 0, type.Name);
                        AddHtml(130 + hindex * 165, 123 + j * 18, 200, 20, "<h3><basefont color=#5A4A31>" + type.Name + "<basefont></h3>", false, false);
                    }

                    //On augmente le nombre de sort de 1 pour le prochain sort.
                    value++;
                }
            }

            totpage++;
            AddPage(totpage);
            AddButton(123, 15, 0x89D, 0x89D, 19, GumpButtonType.Page, totpage - 1);
        }