// Script by Sirens Song (ie, Matron de Winter) 2004 // Feel free to distribute this, as long as you do NOT // Claim it as your own. www.runuo.com // Age Of Wonders Shard Opening Soon // Temporary PlaceHolder Website - http://home.comcast.net/~jliddell21/Home.Html using System; using Server; using Server.Network; using Server.Mobiles; using System.Collections; using Server.Targeting; using Server.Items; using Server.Gumps; namespace Server.Items { public class ControlTarget : Target { private Item m_Item; public ControlTarget( Item item ) : base( 20, true, TargetFlags.None ) { m_Item = item; } protected override void OnTarget( Mobile from, object to ) { if ( to is Mobile ) { Mobile Controlled = to as Mobile; if ( Controlled != from ) { from.SendMessage("Now controlling " + Controlled.Name); Controlled.CantWalk = true; from.SendGump ( new MobileControl( to, from ) ); } else { from.SendMessage("You already have control of your actions!"); } } else { from.SendMessage("You cant control something that cant move on its own!"); } } } public class MobileController : Item { [Constructable] public MobileController() : base( 0x1F19 ) { Name = "a Mobile Controller"; Hue = 2129; Weight = 1.0; } public override void OnDoubleClick( Mobile from ) { from.Target = new ControlTarget( this ); from.SendMessage("Select a Mobile to Control."); } public MobileController( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); } } public class MobileControl : Gump { private object m_to; public MobileControl( object to, Mobile from ) : base( 200, 150 ) { m_to = to; this.Closable=true; this.Disposable=true; this.Dragable=true; this.Resizable=false; this.AddPage(0); this.AddBackground(193, 206, 150, 25, 9200); this.AddBackground(255, 145, 25, 150, 9200); this.AddImage(167, 119, 9007); this.AddImage(227, 180, 1417); this.AddImage(236, 189, 5582); this.AddButton(276, 161, 4501, 4501, 1, GumpButtonType.Reply, 0); this.AddButton(272, 227, 4503, 4503, 2, GumpButtonType.Reply, 0); this.AddButton(210, 227, 4505, 4505, 3, GumpButtonType.Reply, 0); this.AddButton(210, 161, 4507, 4507, 4, GumpButtonType.Reply, 0); } public enum Buttons { NORTH, EAST, SOUTH, WEST, } public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; Mobile toMobile = ( m_to as Mobile ); string m_dir = null; switch ( info.ButtonID ) { case 0 : from.SendMessage("You finish controlling " + toMobile.Name ); toMobile.CantWalk = false; break; case 1 : m_dir = "north"; break; case 2 : m_dir = "east"; break; case 3 : m_dir = "south"; break; case 4 : m_dir = "west"; break; } if ( m_dir != null ) { if ( m_dir == "north" ) { toMobile.Direction = Direction.North; toMobile.Y = ( toMobile.Y - 1); from.SendGump ( new MobileControl( toMobile, from ) ); } else if ( m_dir == "south" ) { toMobile.Direction = Direction.South; toMobile.Y = ( toMobile.Y + 1); from.SendGump ( new MobileControl( toMobile, from ) ); } else if ( m_dir == "east" ) { toMobile.Direction = Direction.East; toMobile.X = ( toMobile.X + 1); from.SendGump ( new MobileControl( toMobile, from ) ); } else if ( m_dir == "west" ) { toMobile.Direction = Direction.West; toMobile.X = ( toMobile.X - 1); from.SendGump ( new MobileControl( toMobile, from ) ); } else { from.SendMessage("The Controller Malfunctions."); } } else { //debug error here for m_dir = Null } } } }