Пример #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseMount)
                {
                    BaseMount mount = (BaseMount)targeted;

                    Item[] items = from.Backpack.FindItemsByType(typeof(HitchItem));
                    foreach (HitchItem hi in items)
                    {
                        if (hi.Hitch == mount)
                        {
                            from.SendMessage("You can only hitch 1 cannon per mount.");
                            return;
                        }
                    }

                    if (mount.ControlMaster == from)
                    {
                        MovableCannon mc = new MovableCannon(from, mount);
                        mc.HitsMax = m_comp.HitsMax;
                        mc.Hits    = m_comp.Hits;
                        m_comp.Delete();
                    }
                }
            }
Пример #2
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize(reader);
			int version = reader.ReadInt();
			m_Mobile = reader.ReadMobile();
			m_Hitch = reader.ReadMobile();
			m_MCannon = (MovableCannon)reader.ReadItem();
		}
Пример #3
0
		public HitchItem(Mobile from, Mobile hitch, MovableCannon mcan ) : base( 0x1f13 )
		{
			Visible = false;
			Movable = false;
			Weight = 0.0001;
			m_Mobile = from;
			m_Hitch = hitch;
			m_MCannon = mcan;
		}
Пример #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Owner   = reader.ReadMobile();
            m_Hitch   = reader.ReadMobile();
            m_MCannon = (MovableCannon)reader.ReadItem();
        }
Пример #5
0
 public HitchItem(Mobile from, Mobile hitch, MovableCannon mcan) : base(0x1f13)
 {
     Visible   = false;
     Movable   = false;
     Weight    = 200.0;
     m_Owner   = from;
     m_Hitch   = hitch;
     m_MCannon = mcan;
 }
Пример #6
0
		public void UnHitch()
		{
			Mobile from = m_Owner;
			Mobile mount = m_Hitch;
			Map map = Map;
			Point3D p = Location;
			BaseCannon cn = null;
			switch( Direction )
			{
				case Direction.Up:
				case Direction.North:
					{
						cn = new CannonNorth(m_Owner);
						break;
					}
				case Direction.Down:
				case Direction.South:
					{
						cn = new CannonSouth(m_Owner);
						break;
					}
				case Direction.Right:
				case Direction.East:
					{
						cn = new CannonEast(m_Owner);
						break;
					}
				case Direction.Left:
				case Direction.West:
					{
						cn = new CannonWest(m_Owner);
						break;
					}
			}
			cn.CCom.HitsMax = m_HitsMax;
			cn.CCom.Hits = m_Hits;
			Delete();
			bool canspawn = true;
			if( !mount.Deleted && mount != null && !mount.IsDeadBondedPet && mount.Map != Map.Internal && from.InRange(p,5) && ((BaseCreature)m_Hitch).ControlMaster == m_Owner )
			{
				foreach( AddonComponent ac in cn.Components )
				{
					if( !map.CanSpawnMobile(new Point3D(p.X + ac.Offset.X,p.Y + ac.Offset.Y,p.Z + ac.Offset.Z) ) )
						canspawn = false;
				}
			}
			if( !canspawn )
			{
				from.SendLocalizedMessage( 1011578 ); // There is an obstacle blocking this location or part of the structure would be on invalid terrain.
				MovableCannon mc = new MovableCannon(from,mount);
				mc.HitsMax = cn.CCom.HitsMax;
				mc.Hits = cn.CCom.Hits;
				mc.Location = p;
				cn.Delete();
			}
			else
			{
				from.SendMessage("The Cannon has been unhitched.");
				cn.MoveToWorld(p,map);
			}
		}
Пример #7
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if( targeted is BaseMount )
				{
					BaseMount mount = (BaseMount)targeted;
					
					Item[] items = from.Backpack.FindItemsByType( typeof(HitchItem) );
					foreach( HitchItem hi in items )
					{
						if( hi.Hitch == mount )
						{
							from.SendMessage("You can only hitch 1 cannon per mount.");
							return;
						}
					}
					
					if( mount.ControlMaster == from )
					{
						MovableCannon mc = new MovableCannon(from,mount);
						mc.HitsMax = m_comp.HitsMax;
						mc.Hits = m_comp.Hits;
						m_comp.Delete();
					}
				}
			}
Пример #8
0
        public void UnHitch()
        {
            Mobile     from  = m_Owner;
            Mobile     mount = m_Hitch;
            Map        map   = Map;
            Point3D    p     = Location;
            BaseCannon cn    = null;

            switch (Direction)
            {
            case Direction.Up:
            case Direction.North:
            {
                cn = new CannonNorth(m_Owner);
                break;
            }

            case Direction.Down:
            case Direction.South:
            {
                cn = new CannonSouth(m_Owner);
                break;
            }

            case Direction.Right:
            case Direction.East:
            {
                cn = new CannonEast(m_Owner);
                break;
            }

            case Direction.Left:
            case Direction.West:
            {
                cn = new CannonWest(m_Owner);
                break;
            }
            }
            Delete();
            bool canspawn = true;

            if (!mount.Deleted && mount != null && !mount.IsDeadBondedPet && mount.Map != Map.Internal && from.InRange(p, 5) && ((BaseCreature)m_Hitch).ControlMaster == m_Owner)
            {
                foreach (AddonComponent ac in cn.Components)
                {
                    if (!map.CanSpawnMobile(new Point3D(p.X + ac.Offset.X, p.Y + ac.Offset.Y, p.Z + ac.Offset.Z)))
                    {
                        canspawn = false;
                    }
                }
            }
            if (!canspawn)
            {
                from.SendLocalizedMessage(1011578);                   // There is an obstacle blocking this location or part of the structure would be on invalid terrain.
                MovableCannon mc = new MovableCannon(from, mount);
                mc.Location = p;
                cn.Delete();
            }
            else
            {
                from.SendMessage("The Cannon has been unhitched.");
                cn.MoveToWorld(p, map);
            }
        }