示例#1
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);
                }
            }
		public SiegeMachineControlGump( SiegeMachine tower )
			: base( 10, 10 )
		{
			m_Tower = tower;

			AddPage( 0 );

			AddImage( 5, 5, 9007 );

			AddButton( 82, 32, 4500, 4500, 1, GumpButtonType.Reply, 0 );
			AddButton( 115, 48, 4501, 4501, 2, GumpButtonType.Reply, 0 );
			AddButton( 128, 81, 4502, 4502, 3, GumpButtonType.Reply, 0 );
			AddButton( 111, 114, 4503, 4503, 4, GumpButtonType.Reply, 0 );
			AddButton( 81, 129, 4504, 4504, 5, GumpButtonType.Reply, 0 );
			AddButton( 46, 114, 4505, 4505, 6, GumpButtonType.Reply, 0 );
			AddButton( 33, 81, 4506, 4506, 7, GumpButtonType.Reply, 0 );
			AddButton( 46, 46, 4507, 4507, 8, GumpButtonType.Reply, 0 );

			AddImage( 66, 66, 1417 );
		}
示例#3
0
 public InternalTarget(SiegeMachine tower)
     : base(-1, false, TargetFlags.None)
 {
     m_Tower = tower;
 }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			if( version >= 0 )
			{
				m_Tower = (SiegeMachine)reader.ReadItem();
			}

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

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

					m_Items = new List<Item>( count );

					for( int i = 0; i < count; i++ )
					{
						Item item = reader.ReadItem();

						if( item != null )
							m_Items.Add( item );
					}
				}
				else
				{
					m_Items = new List<Item>();
				}
			}

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

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

					m_Mobiles = new List<Mobile>( count );

					for( int i = 0; i < count; i++ )
					{
						Mobile m = reader.ReadMobile();

						if( m != null )
							m_Mobiles.Add( m );
					}
				}
				else
				{
					m_Mobiles = new List<Mobile>();
				}
			}
		}
示例#5
0
			public InternalTarget( SiegeMachine tower )
				: base( -1, false, TargetFlags.None )
			{
				m_Tower = tower;
			}
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (version >= 0)
            {
                m_Tower = (SiegeMachine)reader.ReadItem();
            }

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

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

                    m_Items = new List <Item>(count);

                    for (int i = 0; i < count; i++)
                    {
                        Item item = reader.ReadItem();

                        if (item != null)
                        {
                            m_Items.Add(item);
                        }
                    }
                }
                else
                {
                    m_Items = new List <Item>();
                }
            }

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

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

                    m_Mobiles = new List <Mobile>(count);

                    for (int i = 0; i < count; i++)
                    {
                        Mobile m = reader.ReadMobile();

                        if (m != null)
                        {
                            m_Mobiles.Add(m);
                        }
                    }
                }
                else
                {
                    m_Mobiles = new List <Mobile>();
                }
            }
        }