public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: StatSkillHelper.IncreaseStrengthByOne(from); from.SendGump(new StatPurchaseGump(from)); break; case 2: StatSkillHelper.IncreaseDexterityByOne(from); from.SendGump(new StatPurchaseGump(from)); break; case 3: StatSkillHelper.IncreaseIntelligenceByOne(from); from.SendGump(new StatPurchaseGump(from)); break; default: break; } }
// if (skill.SkillName == SkillName.Ninjitsu || skill.SkillName == SkillName.Bushido) // { // AddLabelCropped(182, 33 + (index * 22), 234, 21, 0, "(UNUSED)"); // } // else if (skill.SkillName == SkillName.Fletching) // { // AddLabelCropped(130, 33 + (index * 22), 234, 21, 0, "(Merged 2 Carpentry)"); // } // else // { // AddLabelCropped(182, 35 + (index * 22), 234, 21, 0, skill.Base.ToString("F1")); // if (skill.Base < StatSkillHelper.m_PurchaseSkillCap) // { // AddButton(231, 35 + (index * 22), 0x15E0, 0x15E4, i + 1, GumpButtonType.Reply, 0); // int price = StatSkillHelper.GoldForGainOneTenth(skill.Base); // AddLabelCropped(270, 33 + (index * 22), 150, 21, 0, "0.1 (" + price.ToString() + " gp)"); // } public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; // turning page if (info.ButtonID >= 200 && info.ButtonID <= 203) { from.SendGump(new SkillPurchaseGump(from, info.ButtonID - 200)); return; } // buying a skill if (info.ButtonID > 0) { StatSkillHelper.IncreaseSkillByOneTenth(from, info.ButtonID - 1); from.SendGump(new SkillPurchaseGump(from, m_Page)); } }
public SkillPurchaseGump(Mobile from, int page) : base(20, 30) { if (page < 0 || page > 3) { return; } from.CloseGump(typeof(StatSkillPurchaseGump)); from.CloseGump(typeof(StatPurchaseGump)); from.CloseGump(typeof(SkillPurchaseGump)); m_Page = page; AddPage(0); AddBackground(0, 0, 460, 351, 5054); AddImageTiled(10, 10, 440, 23, 0x52); AddImageTiled(11, 11, 438, 21, 0xBBC); AddLabel(65, 11, 0, "Buy skills by 0.1 up to 90 Cost"); Skills skills = from.Skills; int number; if (Core.AOS) { number = 0; } else { number = 3; } int startI = m_Page * FieldsPerPage; int endI = Math.Min((m_Page + 1) * FieldsPerPage, (skills.Length - number)); int index = 0; for (int i = startI; i < endI; ++i) { if (m_Page > 0) { AddButton(413, 13, 0x15E3, 0x15E7, 200 + page - 1, GumpButtonType.Reply, 0); } if (m_Page < 3) { AddButton(431, 13, 0x15E1, 0x15E5, 200 + page + 1, GumpButtonType.Reply, 0); } Skill skill = skills[i]; AddImageTiled(10, 32 + (index * 22), 440, 23, 0x52); AddImageTiled(11, 33 + (index * 22), 438, 21, 0xBBC); AddLabelCropped(13, 33 + (index * 22), 150, 21, 0, skill.Name); AddImageTiled(180, 34 + (index * 22), 50, 19, 0x52); AddImageTiled(181, 35 + (index * 22), 48, 17, 0xBBC); AddLabelCropped(182, 35 + (index * 22), 234, 21, 0, skill.Base.ToString("F1")); if (skill.Base < StatSkillHelper.m_PurchaseSkillCap) { AddButton(231, 35 + (index * 22), 0x15E0, 0x15E4, i + 1, GumpButtonType.Reply, 0); int price = StatSkillHelper.GoldForGainOneTenth(skill.Base); AddLabelCropped(270, 33 + (index * 22), 150, 21, 0, "0.1 (" + price.ToString() + " gp)"); } ++index; } }