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); }
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); }