protected override void OnTarget( Mobile from, object targeted ) { if (m_Ball.IsChildOf( m_From.Backpack ) ) { if ( targeted is Mobile ) { if ( targeted is BaseCreature ) { BaseCreature creature = (BaseCreature)targeted; if( !creature.Tamable ){ from.SendMessage("That creature is not tameable."); } else if( !creature.Controlled || creature.ControlMaster != from ){ from.SendMessage("That creature is not controlled by you."); } else if ( creature.Summoned ){ from.SendMessage("Cannot modify summoned creatures skills."); } else if ( creature.Body.IsHuman ){ from.SendMessage("Cannot bond humanoids."); } else { from.SendGump( new PetBallGump( (PlayerMobile)from, (BaseCreature)creature, m_Ball ) ); } } else{ from.SendMessage("Target must be an creature."); } } else{ from.SendMessage("Target must not be an item."); } } else{ from.SendMessage("The Pet Skill Ball must be in your backpack."); } }
public override void OnResponse( NetState sender, RelayInfo info ) { if ( m_Ball.Deleted ) return; if (info.ButtonID == 9) { TextRelay w = null; if ( info.GetTextEntry( 1 ) != null ) w = info.GetTextEntry( 1 ); if ( w != null ) { try { Wrestling = Convert.ToDouble(w.Text); } catch { m_From.SendMessage("Bad wrestling entry. A number was expected."); } } TextRelay t = null; if ( info.GetTextEntry( 2 ) != null ) t = info.GetTextEntry( 2 ); if ( t != null ) { try { Tactics = Convert.ToDouble(t.Text); } catch { m_From.SendMessage("Bad tactics entry. A number was expected."); } } TextRelay r = null; if ( info.GetTextEntry( 3 ) != null ) r = info.GetTextEntry( 3 ); if ( r != null ) { try { ResistingSpells = Convert.ToDouble(r.Text); } catch { m_From.SendMessage("Bad resisting spells entry. A number was expected."); } } TextRelay a = null; if ( info.GetTextEntry( 4 ) != null ) a = info.GetTextEntry( 4 ); if ( a != null ) { try { Anatomy = Convert.ToDouble(a.Text); } catch { m_From.SendMessage("Bad anatomy entry. A number was expected."); } } TextRelay p = null; if ( info.GetTextEntry( 5 ) != null ) p = info.GetTextEntry( 5 ); if ( p != null ) { try { Poisoning = Convert.ToDouble(p.Text); } catch { m_From.SendMessage("Bad poisoning entry. A number was expected."); } } TextRelay mag = null; if ( info.GetTextEntry( 6 ) != null ) mag = info.GetTextEntry( 6 ); if ( mag != null ) { try { Magery = Convert.ToDouble(mag.Text); } catch { m_From.SendMessage("Bad magery entry. A number was expected."); } } TextRelay e = null; if ( info.GetTextEntry( 7 ) != null ) e = info.GetTextEntry( 7 ); if ( e != null ) { try { EvaluatingIntelligence = Convert.ToDouble(e.Text); } catch { m_From.SendMessage("Bad evaluating intelligence entry. A number was expected."); } } TextRelay med = null; if ( info.GetTextEntry( 8 ) != null ) med = info.GetTextEntry( 8 ); if ( med != null ) { try { Meditation = Convert.ToDouble(med.Text); } catch { m_From.SendMessage("Bad meditation entry. A number was expected."); } } if ( !m_Pet.Deleted || m_Pet.Alive == true ) { if ( m_Pet.Controlled && m_Pet.ControlMaster == m_From ) { if(m_Ball.IsChildOf( m_From.Backpack )) { if(( Wrestling >= 0 && Wrestling <= 100 ) && ( Tactics >= 0 && Tactics <= 100 ) && ( ResistingSpells >= 0 && ResistingSpells <= 100 ) && ( Anatomy >= 0 && Anatomy <= 100 ) && ( Poisoning >= 0 && Poisoning <= 100 ) && ( Magery >= 0 && Magery <= 100 ) && ( EvaluatingIntelligence >= 0 && EvaluatingIntelligence <= 100 ) && ( Meditation >= 0 && Meditation <= 100 )) { m_Pet.Skills[SkillName.Wrestling].Base = Wrestling; m_Pet.Skills[SkillName.Tactics].Base = Tactics; m_Pet.Skills[SkillName.MagicResist].Base = ResistingSpells; m_Pet.Skills[SkillName.Anatomy].Base = Anatomy; m_Pet.Skills[SkillName.Poisoning].Base = Poisoning; m_Pet.Skills[SkillName.Magery].Base = Magery; m_Pet.Skills[SkillName.EvalInt].Base = EvaluatingIntelligence; m_Pet.Skills[SkillName.Meditation].Base = Meditation; m_Ball.Delete(); m_From.SendMessage( "The skills of {0} are changed!", m_Pet.Name ); } else { m_From.SendMessage( "Your skill values are too high or too low keep it between 0 and 100. Please try again!" ); } } else { m_From.SendMessage( "The Skill Ball must remain in your Backpack. Please try again!" ); } } else { m_From.SendMessage( "You do not control that pet. Please try again!" ); } } else { m_From.SendMessage( "Your pet has died... Please try again!" ); } } }