public SkillBallGump(Mobile from, Mobile target, SkillBall ball) : base(20, 30) { m_SkillBall = ball; m_Target = target; AddPage(0); AddBackground(0, 0, 260, 351, 5054); AddImageTiled(10, 10, 240, 23, 0x52); AddImageTiled(11, 11, 238, 21, 0xBBC); AddLabel(45, 11, 0, "Select a skill to raise"); AddPage(1); int page = 1; int index = 0; Skills skills = m_Target.Skills; SkillName[] allowedskills = m_SkillBall.GetAllowedSkills(); for (int i = 0; i < allowedskills.Length; ++i) { if (index >= FieldsPerPage) { AddButton(231, 13, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1); ++page; index = 0; AddPage(page); AddButton(213, 13, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1); } Skill skill = skills[allowedskills[i]]; if (m_SkillBall.NewbieBall && skill.Base > 0) { } else if ((skill.Base + m_SkillBall.SkillBonus) <= skill.Cap && skill.Lock == SkillLock.Up) { AddImageTiled(10, 32 + (index * 22), 240, 23, 0x52); AddImageTiled(11, 33 + (index * 22), 238, 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")); AddButton(231, 35 + (index * 22), 0x15E1, 0x15E5, i + 1, GumpButtonType.Reply, 0); ++index; } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from == null || m_SkillBall.Deleted) { return; } if (m_SkillBall.Expires && DateTime.UtcNow >= m_SkillBall.ExpireDate) { m_SkillBall.SendLocalizedMessageTo(from, 1042544); // This item is out of charges. } else if (!m_SkillBall.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (info.ButtonID > 0) { SkillName skillname = (m_SkillBall.GetAllowedSkills())[info.ButtonID - 1]; m_Skill = m_Target.Skills[skillname]; if (m_Skill == null) { return; } double count = m_Target.Skills.Total / 10; double cap = m_Target.SkillsCap / 10; double decreaseamount; int bonus = m_SkillBall.SkillBonus; List <Skill> decreased = m_SkillBall.GetDecreasableSkills(from, m_Target, count, cap, out decreaseamount); if (decreased.Count > 0 && decreaseamount <= 0) { from.SendMessage("You have exceeded the skill cap and do not have a skill set to be decreased."); } else if (m_SkillBall.NewbieBall && m_Skill.Base > 0) { from.SendMessage("You may only choose skills which are at zero."); } else if ((m_Skill.Base + bonus) > m_Skill.Cap) { from.SendMessage("Your skill is too high to raise it further."); } else if (m_Skill.Lock != SkillLock.Up) { from.SendMessage("You must set the skill to be increased in order to raise it further."); } else { if ((cap - count + decreaseamount) >= bonus) { m_SkillBall.DecreaseSkills(from, m_Target, decreased, count, cap, decreaseamount); m_SkillBall.IncreaseSkill(from, m_Target, m_Skill); if (!m_SkillBall.Rechargable) { m_SkillBall.Delete(); } } else { from.SendMessage("You have exceeded the skill cap and do not have enough skill set to be decreased."); } } } }
public SkillBallGump( Mobile from, Mobile target, SkillBall ball ) : base(20, 30) { m_SkillBall = ball; m_Target = target; AddPage ( 0 ); AddBackground( 0, 0, 260, 351, 5054 ); AddImageTiled( 10, 10, 240, 23, 0x52 ); AddImageTiled( 11, 11, 238, 21, 0xBBC ); AddLabel( 45, 11, 0, "Select a skill to raise" ); AddPage( 1 ); int page = 1; int index = 0; Skills skills = m_Target.Skills; SkillName[] allowedskills = m_SkillBall.GetAllowedSkills( m_Target ); for ( int i = 0; i < allowedskills.Length; ++i ) { if ( index >= FieldsPerPage ) { AddButton( 231, 13, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1 ); ++page; index = 0; AddPage( page ); AddButton( 213, 13, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1 ); } Skill skill = skills[allowedskills[i]]; int skillcur = skill.BaseFixedPoint; int skillamt = skillcur + m_SkillBall.SkillBonusFixedPoint; int skillmax = m_SkillBall.MaxCapFixedPoint; int skillmin = m_SkillBall.MinCapFixedPoint; // SILVER: replaced skillamt requirement by skillcur. added red texthue for skills with high skillamt if ( skillcur <= skillmin && skillcur < skillmax && skillcur < skill.CapFixedPoint && skill.Lock == SkillLock.Up && ( allowedskills[i] != SkillName.Stealth || target.Skills.Hiding.BaseFixedPoint >= 800 ) ) { int textHue = 0; if( skillamt > skillmax || skillamt > skill.CapFixedPoint ) textHue = 33; AddImageTiled( 10, 32 + (index * 22), 240, 23, 0x52 ); AddImageTiled( 11, 33 + (index * 22), 238, 21, 0xBBC ); AddLabelCropped( 13, 33 + (index * 22), 150, 21, textHue, 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, textHue, skill.Base.ToString( "F1" ) ); AddButton( 231, 35 + (index * 22), 0x15E1, 0x15E5, i + 1, GumpButtonType.Reply, 0 ); ++index; } } }