protected override void OnTarget( Mobile from, object target ) { if( target is BaseCreature ) { BaseCreature pet = (BaseCreature)target; m_ai = pet.AIObject; if( pet.Body.IsHuman ) from.SendMessage("The person looks at you in disgust."); else if( pet.ControlMaster != from ) from.SendMessage("That is not your pet."); else if( pet.Combatant != null && pet.InRange(pet.Combatant, 12) ) from.SendMessage("You cannot do that while your pet is fighting."); else if( pet.Controlled == true && pet.ControlMaster == from ) { if( Utility.Random(15) == 1 ) { m_ai.DoMove(Direction.South); m_ai.DoMove(Direction.South); m_ai.DoMove(Direction.East); m_ai.DoMove(Direction.South); m_ai.NextMove = DateTime.Now; from.SendMessage("Your pet shies away from the rope."); pet.PlaySound(pet.GetAngerSound()); } else { if( pet.Blessed == false ) { pet.Blessed = true; pet.CantWalk = true; pet.ControlOrder = OrderType.Stay; pet.Combatant = null; pet.Loyalty = 85; from.LocalOverheadMessage(MessageType.Regular, from.EmoteHue, false, "*attaches the rope to the animal*"); from.Backpack.ConsumeTotal(typeof(HitchingRope), 1); from.SendMessage("Your pet has been hitched to the post."); } } } } }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; BaseCreature toMobile = m_to; if( toMobile.Alive ) { m_ai = toMobile.AIObject; if( m_ai == null ) { from.SendMessage( "Mobile AI is null or unavailable. Unable to process with this item." ); return; } toMobile.CantWalk = false; m_ai.NextMove = DateTime.Now + TimeSpan.FromSeconds( 60 ); DateTime delay = DateTime.Now + TimeSpan.FromSeconds( 60 ); if( info.ButtonID == 0 ) { from.SendMessage( "You finish controlling " + toMobile.Name ); m_ai.NextMove = DateTime.Now; } if( info.ButtonID == 1 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.North ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 2 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.East ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 3 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.South ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 4 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.West ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 5 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.Up ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 6 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.Right ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 7 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.Down ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 8 ) { m_ai.NextMove = DateTime.Now; m_ai.DoMove( Direction.Left ); m_ai.NextMove = delay; from.SendGump( new CreatureControl( toMobile, from ) ); } if( info.ButtonID == 9 ) { from.SendMessage( "Who would you like this creature to attack?" ); from.Target = new CombatTarget( m_ai, toMobile ); } } }