public override void Execute( CommandEventArgs args, object o )
        {
            if( o is Item && !(o is AddonComponent) && !(o is BaseAddon) )
            {
                Item i = (Item)o;
                SiegeMachineComponent newComponent = new SiegeMachineComponent(i.ItemID);

                newComponent.Hue = i.Hue;
                newComponent.Light = i.Light;
                newComponent.Movable = false;
                newComponent.Name = i.Name;
                newComponent.MoveToWorld(i.Location, i.Map);

                if( i.Parent == args.Mobile )
                    newComponent.Bounce(args.Mobile);

                if( i is Container )
                    ((Container)i).Destroy();
                else
                    i.Delete();

                AddResponse("The item has been converted to a siege machine component.");
            }
            else
            {
                LogFailure("This command only works with items (no addons).");
            }
        }
예제 #2
0
		public bool RemoveTowerPart( SiegeMachineComponent comp )
		{
			if( m_Collection == null )
				return false;

			return m_Collection.Remove( comp );
		}
예제 #3
0
        public bool RemoveTowerPart(SiegeMachineComponent comp)
        {
            if (m_Collection == null)
            {
                return(false);
            }

            return(m_Collection.Remove(comp));
        }
예제 #4
0
		public bool AddTowerPart( SiegeMachineComponent comp, Point3D offset )
		{
			if( m_Collection == null )
				return false;

			if( m_Collection.ContainsKey( comp ) )
				m_Collection.Remove( comp );

			m_Collection.Add( comp, offset );

			return m_Collection.ContainsKey( comp );
		}
예제 #5
0
        public bool AddTowerPart(SiegeMachineComponent comp, Point3D offset)
        {
            if (m_Collection == null)
            {
                return(false);
            }

            if (m_Collection.ContainsKey(comp))
            {
                m_Collection.Remove(comp);
            }

            m_Collection.Add(comp, offset);

            return(m_Collection.ContainsKey(comp));
        }
예제 #6
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is SiegeMachine)
                {
                    SiegeMachine st = target as SiegeMachine;

                    if (st == m_Tower)
                    {
                        m_Tower.Open = false;

                        from.SendMessage("This tower will no longer accept design pieces.");
                        return;
                    }
                }
                else if (target is SiegeMachineComponent)
                {
                    SiegeMachineComponent comp = target as SiegeMachineComponent;
                    Point3D offset;
                    int     x = 0, y = 0, z = 0;

                    if (m_Tower.Contains(comp))
                    {
                        m_Tower.RemoveTowerPart(comp);
                    }

                    x = (comp.X - m_Tower.X);
                    y = (comp.Y - m_Tower.Y);
                    z = (comp.Z - m_Tower.Z);

                    offset = new Point3D(x, y, z);

                    comp.Tower = m_Tower;
                    m_Tower.AddTowerPart(comp, offset);

                    from.SendMessage("The component has been added to the tower design. Select another, or press Esc to cancel.");
                    from.Target = new InternalTarget(m_Tower);
                }
                else
                {
                    from.SendMessage("You can only insert items of type \'SiegeMachineComponent\' into the tower design.");
                    from.Target = new InternalTarget(m_Tower);
                }
            }
예제 #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (version >= 0)
            {
                bool notNull = reader.ReadBool();

                if (notNull)
                {
                    int count = reader.ReadInt();

                    for (int i = 0; i < count; i++)
                    {
                        SiegeMachineComponent comp = reader.ReadItem() as SiegeMachineComponent;
                        Point3D offset             = reader.ReadPoint3D();

                        if (comp != null && !comp.Deleted)
                        {
                            m_Collection.Add(comp, offset);
                        }
                    }
                }
                else
                {
                    m_Collection = new Dictionary <SiegeMachineComponent, Point3D>();
                }

                m_Open = reader.ReadBool();
            }

            if (version >= 1)
            {
                m_MoveSound = reader.ReadInt();
                m_StopSound = reader.ReadInt();
            }
        }
예제 #8
0
 public bool Contains(SiegeMachineComponent comp)
 {
     return(m_Collection.ContainsKey(comp));
 }
예제 #9
0
			public InternalTarget( SiegeMachineComponent smc )
				: base( 12, false, TargetFlags.None )
			{
				m_Component = smc;
			}
예제 #10
0
			public InternalContextMenu( Mobile from, SiegeMachineComponent smc )
				: base( 175, 12 )
			{
				m_From = from;
				m_Component = smc;
			}
예제 #11
0
		public bool Contains( SiegeMachineComponent comp )
		{
			return m_Collection.ContainsKey( comp );
		}
예제 #12
0
 public InternalTarget(SiegeMachineComponent smc)
     : base(12, false, TargetFlags.None)
 {
     m_Component = smc;
 }
예제 #13
0
 public InternalContextMenu(Mobile from, SiegeMachineComponent smc)
     : base(175, 12)
 {
     m_From      = from;
     m_Component = smc;
 }