예제 #1
0
		public AnimalLoreGump(BaseCreature c, Mobile user, int page)
			: base(250, 50)
		{
			m_User = user;
			m_Target = c;
			m_Page = page;
			if (m_Page < 0)
				m_Page = 0;
			if (m_Page >= NumTotalPages)
				m_Page = NumTotalPages - 1;

			AddPage(0);

			AddImage(100, 100, 2080);
			AddImage(118, 137, 2081);
			AddImage(118, 207, 2081);
			AddImage(118, 277, 2081);
			AddImage(118, 347, 2083);

			AddHtml(147, 108, 210, 18, String.Format("<center><i>{0}</i></center>", c.Name), false, false);

			AddButton(240, 77, 2093, 2093, 2, GumpButtonType.Reply, 0);

			AddImage(140, 138, 2091);
			AddImage(140, 335, 2091);

			AddPage(0);
			switch (m_Page)
			{
				case 0:
				{
					#region Attributes
					AddImage(128, 152, 2086);
					AddHtmlLocalized(147, 150, 160, 18, 1049593, 200, false, false); // Attributes

					AddHtmlLocalized(153, 168, 160, 18, 1049578, LabelColor, false, false); // Hits
					AddHtml(280, 168, 75, 18, FormatAttributes(c.Hits, c.HitsMax), false, false);

					AddHtmlLocalized(153, 186, 160, 18, 1049579, LabelColor, false, false); // Stamina
					AddHtml(280, 186, 75, 18, FormatAttributes(c.Stam, c.StamMax), false, false);

					AddHtmlLocalized(153, 204, 160, 18, 1049580, LabelColor, false, false); // Mana
					AddHtml(280, 204, 75, 18, FormatAttributes(c.Mana, c.ManaMax), false, false);

					AddHtmlLocalized(153, 222, 160, 18, 1028335, LabelColor, false, false); // Strength
					AddHtml(320, 222, 35, 18, FormatStat(c.Str), false, false);
					AddStatLock(355, 222, c.StrLock, ButtonID.StrLock);

					AddHtmlLocalized(153, 240, 160, 18, 3000113, LabelColor, false, false); // Dexterity
					AddHtml(320, 240, 35, 18, FormatStat(c.Dex), false, false);
					AddStatLock(355, 240, c.DexLock, ButtonID.DexLock);

					AddHtmlLocalized(153, 258, 160, 18, 3000112, LabelColor, false, false); // Intelligence
					AddHtml(320, 258, 35, 18, FormatStat(c.Int), false, false);
					AddStatLock(355, 258, c.IntLock, ButtonID.IntLock);

					AddImage(128, 278, 2086);
					AddHtmlLocalized(147, 276, 160, 18, 3001016, 200, false, false); // Miscellaneous

					AddHtmlLocalized(153, 294, 160, 18, 1049581, LabelColor, false, false); // Armor Rating
					AddHtml(320, 294, 35, 18, FormatStat(c.VirtualArmor), false, false);

					AddHtmlLocalized(153, 312, 160, 18, 3000120, LabelColor, false, false); // Gender
					AddHtml(280, 312, 75, 18, String.Format("<div align=right>{0}</div>", c.Female ? "Female" : "Male"), false, false);

					break;
					#endregion
				}
				case 1:
				{
					#region Skills
					AddImage(128, 152, 2086);
					AddHtmlLocalized(147, 150, 160, 18, 3001030, 200, false, false); // Combat Ratings

					AddHtmlLocalized(153, 168, 160, 18, 1044103, LabelColor, false, false); // Wrestling
					AddHtml(320, 168, 35, 18, FormatSkill(c, SkillName.Wrestling), false, false);
					AddSkillLock(355, 168, c, SkillName.Wrestling, ButtonID.SkillLock + (int)SkillName.Wrestling);

					AddHtmlLocalized(153, 186, 160, 18, 1044087, LabelColor, false, false); // Tactics
					AddHtml(320, 186, 35, 18, FormatSkill(c, SkillName.Tactics), false, false);
					AddSkillLock(355, 186, c, SkillName.Tactics, ButtonID.SkillLock + (int)SkillName.Tactics);

					AddHtmlLocalized(153, 204, 160, 18, 1044086, LabelColor, false, false); // Magic Resistance
					AddHtml(320, 204, 35, 18, FormatSkill(c, SkillName.MagicResist), false, false);
					AddSkillLock(355, 204, c, SkillName.MagicResist, ButtonID.SkillLock + (int)SkillName.MagicResist);

					AddHtmlLocalized(153, 222, 160, 18, 1044061, LabelColor, false, false); // Anatomy
					AddHtml(320, 222, 35, 18, FormatSkill(c, SkillName.Anatomy), false, false);
					AddSkillLock(355, 222, c, SkillName.Anatomy, ButtonID.SkillLock + (int)SkillName.Anatomy);

					AddHtmlLocalized(153, 240, 160, 18, 1044090, LabelColor, false, false); // Poisoning
					AddHtml(320, 240, 35, 18, FormatSkill(c, SkillName.Poisoning), false, false);
					AddSkillLock(355, 240, c, SkillName.Poisoning, ButtonID.SkillLock + (int)SkillName.Poisoning);

					AddImage(128, 260, 2086);
					AddHtmlLocalized(147, 258, 160, 18, 3001032, 200, false, false); // Lore & Knowledge

					AddHtmlLocalized(153, 276, 160, 18, 1044085, LabelColor, false, false); // Magery
					AddHtml(320, 276, 35, 18, FormatSkill(c, SkillName.Magery), false, false);
					AddSkillLock(355, 276, c, SkillName.Magery, ButtonID.SkillLock + (int)SkillName.Magery);

					AddHtmlLocalized(153, 294, 160, 18, 1044076, LabelColor, false, false); // Evaluating Intelligence
					AddHtml(320, 294, 35, 18, FormatSkill(c, SkillName.EvalInt), false, false);
					AddSkillLock(355, 294, c, SkillName.EvalInt, ButtonID.SkillLock + (int)SkillName.EvalInt);

					AddHtmlLocalized(153, 312, 160, 18, 1044106, LabelColor, false, false); // Meditation
					AddHtml(320, 312, 35, 18, FormatSkill(c, SkillName.Meditation), false, false);
					AddSkillLock(355, 312, c, SkillName.Meditation, ButtonID.SkillLock + (int)SkillName.Meditation);

					break;
					#endregion
				}
				case 2:
				{
					#region Misc
					AddImage(128, 152, 2086);
					AddHtmlLocalized(147, 150, 160, 18, 1049563, 200, false, false); // Preferred Foods

					int foodPref = 3000340;

					if ((c.FavoriteFood & FoodType.FruitsAndVegies) != 0)
						foodPref = 1049565; // Fruits and Vegetables
					else if ((c.FavoriteFood & FoodType.GrainsAndHay) != 0)
						foodPref = 1049566; // Grains and Hay
					else if ((c.FavoriteFood & FoodType.Fish) != 0)
						foodPref = 1049568; // Fish
					else if ((c.FavoriteFood & FoodType.Meat) != 0)
						foodPref = 1049564; // Meat

					AddHtmlLocalized(153, 168, 160, 18, foodPref, LabelColor, false, false);

					AddImage(128, 188, 2086);
					AddHtmlLocalized(147, 186, 160, 18, 1049569, 200, false, false); // Pack Instincts

					int packInstinct = 3000340;

					if ((c.PackInstinct & PackInstinct.Canine) != 0)
						packInstinct = 1049570; // Canine
					else if ((c.PackInstinct & PackInstinct.Ostard) != 0)
						packInstinct = 1049571; // Ostard
					else if ((c.PackInstinct & PackInstinct.Feline) != 0)
						packInstinct = 1049572; // Feline
					else if ((c.PackInstinct & PackInstinct.Arachnid) != 0)
						packInstinct = 1049573; // Arachnid
					else if ((c.PackInstinct & PackInstinct.Daemon) != 0)
						packInstinct = 1049574; // Daemon
					else if ((c.PackInstinct & PackInstinct.Bear) != 0)
						packInstinct = 1049575; // Bear
					else if ((c.PackInstinct & PackInstinct.Equine) != 0)
						packInstinct = 1049576; // Equine
					else if ((c.PackInstinct & PackInstinct.Bull) != 0)
						packInstinct = 1049577; // Bull

					AddHtmlLocalized(153, 204, 160, 18, packInstinct, LabelColor, false, false);

					AddImage(128, 224, 2086);
					AddHtmlLocalized(147, 222, 160, 18, 1049594, 200, false, false); // Loyalty Rating

					// loyalty redo
					int loyaltyval = (int)c.Loyalty / 10;
					if (loyaltyval < 0)
						loyaltyval = 0;
					if (loyaltyval > 11)
						loyaltyval = 11;
					AddHtmlLocalized(153, 240, 160, 18, (!c.Controlled || c.Loyalty == PetLoyalty.None) ? 1061643 : 1049594 + loyaltyval, LabelColor, false, false);

					break;
					#endregion
				}
				default: // rest of the pages are filled with genes - be sure to adjust "pg" calc in here when adding pages
				{
                    int nextpage = 3;

                    // idea for later - flesh out custom pages more, a string[] is hackish

                    //List<string[]> custompages = c.GetAnimalLorePages();
                    //if (custompages != null && page >= nextpage && page < (nextpage + custompages.Count))
                    //{
                    //    foreach (string[] s in custompages)
                    //    {
                    //        for (int i = 0; i < s.Length; i++)
                    //        {
                    //            AddHtml(153, 168 + 18 * i, 150, 18, s[i], false, false);
                    //        }
                    //    }

                    //    nextpage += custompages.Count;
                    //}

					#region Genetics
                    if (page >= nextpage)
                    {
                        List<PropertyInfo> genes = new List<PropertyInfo>();

                        foreach (PropertyInfo pi in c.GetType().GetProperties())
                        {
                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(pi, typeof(GeneAttribute), true);
                            if (attr == null)
                                continue;
                            if (m_User.AccessLevel < AccessLevel.Counselor && !Server.Misc.TestCenter.Enabled)
                            {
                                if (attr.Visibility == GeneVisibility.Invisible)
                                    continue;
                                if (attr.Visibility == GeneVisibility.Tame && m_User != c.ControlMaster)
                                    continue;
                            }

                            genes.Add(pi);
                        }

                        int pg = m_Page - nextpage;

                        AddImage(128, 152, 2086);
                        AddHtml(147, 150, 160, 18, "Genetics", false, false);

                        for (int i = 0; i < 9; i++)
                        {
                            if (pg * 9 + i >= genes.Count)
                                break;

                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(genes[pg * 9 + i], typeof(GeneAttribute), true);
                            AddHtml(153, 168 + 18 * i, 120, 18, attr.Name, false, false);
                            AddHtml(240, 168 + 18 * i, 115, 18, String.Format("<div align=right>{0:G3}</div>", c.DescribeGene(genes[pg * 9 + i], attr)), false, false);
                        }
                    }
					break;
					#endregion
				}
			}

			if (m_Page < NumTotalPages - 1)
				AddButton(340, 358, 5601, 5605, (int)ButtonID.NextPage, GumpButtonType.Reply, 0);
			if (m_Page > 0)
				AddButton(317, 358, 5603, 5607, (int)ButtonID.PrevPage, GumpButtonType.Reply, 0);
		}