コード例 #1
0
		public SkillCapSelectionGump( Mobile from, SkillGroup selected )
			: base( 0, 0 ) {

			_from = from;
			_skillsGroup = selected;

			AddPage( 0 );
			AddBackground( 10, 10, 325, (205 + (SkillGroup.Groups.Length * 20) + ((selected == null ? 0 : selected.Skills.Length) * 20)), 9250 );
			AddLabel( 115, 20, 1152, "Skill Cap Overview" );

			AddHtml( 27, 45, 290, 105, String.Format( "By using Essence of Character your may increase your individual skillcaps, allowing you to further your training."
                                    + ""
                                    + " Please note: decreasing a skillcap does not refund Essence of Character."
									+ "", (from.SkillsCap / 10).ToString( "F1" ) ), false, true );
			AddAlphaRegion( 27, 45, 290, 105 );

			int y = 155;

			for( int i = 0; i < SkillGroup.Groups.Length; i++ ) {
				SkillGroup group = SkillGroup.Groups[i];

				if( group == selected )
					AddButton( 25, (y + 2), 9704, 9705, GetButtonID( 0, i ), GumpButtonType.Reply, 0 );
				else
					AddButton( 25, (y + 2), 9702, 9703, GetButtonID( 0, i ), GumpButtonType.Reply, 0 );

				AddLabel( 45, y, 1152, group.Name );

				if( group == selected ) {
					for( int j = 0; j < group.Skills.Length; j++ ) {
						Skill sk = _from.Skills[group.Skills[j]];

						if( sk != null ) {
							AddLabel( 55, (y + 20), 1152, sk.Name );
							AddLabel( 195, (y + 20), 1152, String.Format( "{0}", sk.Cap.ToString( "F0" ) ) );

							//increment btn
							AddButton( 265, (y + 25), 2435, 2436, GetButtonID( 1, j ), GumpButtonType.Reply, 0 );
							//decrement btn
							AddButton( 280, (y + 25), 2437, 2438, GetButtonID( 2, j ), GumpButtonType.Reply, 0 );

						}

						y += 20;
					}
				}

				y += 20;
			}

			AddLabel( 30, (y + 20), 1152, "Essence Of Character: " + GetRemainingPoints().ToString( "F1" ) );
			AddButton( 290, (y + 20), 4023, 4025, GetButtonID( 5, 1 ), GumpButtonType.Reply, 0 );
		}
コード例 #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int buttonID = info.ButtonID - 1;
            int index    = buttonID / 10;
            int type     = buttonID % 10;

            switch (type)
            {
            case 0: {
                if (index >= 0 && index < SkillGroup.Groups.Length)
                {
                    SkillGroup newGroup = SkillGroup.Groups[index];

                    if (_skillsGroup != newGroup)
                    {
                        Resend(newGroup);
                    }
                    else
                    {
                        Resend(null);
                    }
                }

                break;
            }

            case 1:
            case 2:
            case 3:
            case 4: {
                string mode = "inc";

                if (type == 2)
                {
                    mode = "dec";
                }
                else if (type == 3)
                {
                    mode = "maxInc";
                }
                else if (type == 4)
                {
                    mode = "maxDec";
                }

                if (_skillsGroup != null && (index >= 0 && index < _skillsGroup.Skills.Length))
                {
                    Skill sk = _from.Skills[_skillsGroup.Skills[index]];

                    if (sk != null)
                    {
                        switch (mode)
                        {
                        case "inc":
                        {
                            if (sk.Base >= sk.Cap)
                            {
                                _from.SendMessage("That skill is at its maximum level. It cannot be raised any further");
                            }

                            else if (((Player)_from).EoC < 2000)
                            {
                                _from.SendMessage("You need 2,000 Essence of Character to increase this skill's level.");
                            }

                            else
                            {
                                sk.Base             += 1.0;
                                ((Player)_from).EoC -= 2000;
                            }
                            break;
                        }

                        case "dec":
                        {
                            if (sk.Cap <= 0.0)
                            {
                                _from.SendMessage("That skill is at its minimum level. It cannot be lowered further.");
                            }

                            else
                            {
                                sk.Cap -= 1.0;
                                ((Player)_from).EoC += 2000;
                                if (sk.Base > sk.Cap)
                                {
                                    sk.Base = sk.Cap;
                                }
                            }

                            break;
                        }
                        }
                    }
                }

                Resend(_skillsGroup);

                break;
            }

            case 5: {
                if (GetRemainingPoints() > 0.0)
                {
                    Confirm();
                }
                else
                {
                    _from.CloseGump(typeof(SkillSelectionGump));
                }

                break;
            }
            }
        }
コード例 #3
0
		private void Resend( SkillGroup selection ) {
			_from.CloseGump( typeof( SkillCapSelectionGump ) );
			_from.SendGump( new SkillCapSelectionGump( _from, selection ) );
		}
コード例 #4
0
 private void Resend(SkillGroup selection)
 {
     _from.CloseGump(typeof(SkillSelectionGump));
     _from.SendGump(new SkillSelectionGump(_from, selection));
 }