Наследование: Server.Items.Item, IChopable
Пример #1
0
 public virtual void OnComponentUsed(AddonContainerComponent c, Mobile from)
 {
     if (!Deleted)
     {
         OnDoubleClick(from);
     }
 }
Пример #2
0
		public void AddComponent( AddonContainerComponent c, int x, int y, int z )
		{
			if ( Deleted )
				return;

			m_Components.Add( c );

			c.Addon = this;
			c.Offset = new Point3D( x, y, z );
			c.MoveToWorld( new Point3D( X + x, Y + y, Z + z ), Map );
		}
Пример #3
0
        public virtual void OnChop(Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && house.IsOwner(from))
            {
                if (!IsSecure)
                {
                    Effects.PlaySound(GetWorldLocation(), Map, 0x3B3);
                    from.SendLocalizedMessage(500461);                       // You destroy the item.

                    int hue = 0;

                    if (RetainDeedHue)
                    {
                        for (int i = 0; hue == 0 && i < m_Components.Count; ++i)
                        {
                            AddonContainerComponent c = m_Components[i];

                            if (c.Hue != 0)
                            {
                                hue = c.Hue;
                            }
                        }
                    }

                    DropItemsToGround();

                    Delete();

                    house.Addons.Remove(this);

                    BaseAddonContainerDeed deed = Deed;

                    if (deed != null)
                    {
                        deed.Resource = Resource;

                        if (RetainDeedHue)
                        {
                            deed.Hue = hue;
                        }

                        from.AddToBackpack(deed);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1074870);                       // This item must be unlocked/unsecured before re-deeding it.
                }
            }
        }
Пример #4
0
        public void AddComponent(AddonContainerComponent c, int x, int y, int z)
        {
            if (this.Deleted)
            {
                return;
            }

            this.m_Components.Add(c);

            c.Addon  = this;
            c.Offset = new Point3D(x, y, z);
            c.MoveToWorld(new Point3D(this.X + x, this.Y + y, this.Z + z), this.Map);
        }
Пример #5
0
        public virtual void OnChop(Mobile from)
        {
            var house = HousingHelper.FindHouseAt(this);

            if (house != null && house.IsOwner(from) && house.Addons.Contains(this))
            {
                Effects.PlaySound(GetWorldLocation(), Map, 0x3B3);
                from.SendLocalizedMessage(500461);                   // You destroy the item.

                int hue = 0;

                if (RetainDeedHue)
                {
                    for (int i = 0; hue == 0 && i < m_Components.Count; ++i)
                    {
                        AddonContainerComponent c = (AddonContainerComponent)m_Components[i];

                        if (c.Hue != 0)
                        {
                            hue = c.Hue;
                        }
                    }
                }

                Delete();

                house.Addons.Remove(this);

                BaseAddonContainerDeed deed = Deed;

                if (deed != null)
                {
                    if (RetainDeedHue)
                    {
                        deed.Hue = hue;
                    }

                    from.AddToBackpack(deed);
                }
            }
        }
Пример #6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item && InteriorDecorator.CheckUse(this.m_Decorator, from))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);
                    Item      item  = (Item)targeted;

                    bool isDecorableComponent = false;

                    if (item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer)
                    {
                        object addon = null;
                        int    count = 0;

                        if (item is AddonComponent)
                        {
                            AddonComponent component = (AddonComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is AddonContainerComponent)
                        {
                            AddonContainerComponent component = (AddonContainerComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is BaseAddonContainer)
                        {
                            BaseAddonContainer container = (BaseAddonContainer)item;
                            count = container.Components.Count;
                            addon = container;
                        }

                        if (count == 1 && Core.SE)
                        {
                            isDecorableComponent = true;
                        }

                        if (this.m_Decorator.Command == DecorateCommand.Turn)
                        {
                            FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[])addon.GetType().GetCustomAttributes(typeof(FlipableAddonAttribute), false);

                            if (attributes.Length > 0)
                            {
                                isDecorableComponent = true;
                            }
                        }
                    }

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do this.
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270); // That is not in your house.
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item) && !isDecorableComponent)
                    {
                        if (item is AddonComponent && this.m_Decorator.Command == DecorateCommand.Up)
                        {
                            from.SendLocalizedMessage(1042274); // You cannot raise it up any higher.
                        }
                        else if (item is AddonComponent && this.m_Decorator.Command == DecorateCommand.Down)
                        {
                            from.SendLocalizedMessage(1042275); // You cannot lower it down any further.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042271); // That is not locked down.
                        }
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object.
                    }

                    /*else if (item.TotalWeight + item.PileWeight > 100)
                     * {
                     *  from.SendLocalizedMessage(1042272); // That is too heavy.
                     * }*/
                    else
                    {
                        switch (this.m_Decorator.Command)
                        {
                        case DecorateCommand.Up:
                            Up(item, from);
                            break;

                        case DecorateCommand.Down:
                            Down(item, from);
                            break;

                        case DecorateCommand.Turn:
                            Turn(item, from);
                            break;
                        }
                    }
                }

                from.Target = new InternalTarget(this.m_Decorator);
            }
Пример #7
0
 public virtual void OnComponentUsed(AddonContainerComponent c, Mobile from)
 {
 }
Пример #8
0
 public virtual void OnComponentLoaded(AddonContainerComponent c)
 {
 }
Пример #9
0
		public virtual void OnComponentUsed( AddonContainerComponent c, Mobile from )
		{
		}
Пример #10
0
		public virtual void OnComponentLoaded( AddonContainerComponent c )
		{
		}
Пример #11
0
		public void AddComponent( AddonContainerComponent c, int x, int y, int z )
		{
			if ( Deleted )
				return;

			m_Components.Add( c );

			c.Addon = this;
			c.Offset = new Point3D( x, y, z );
			c.MoveToWorld( new Point3D( X + x, Y + y, Z + z ), Map );
		}
Пример #12
0
 public virtual void GetProperties(ObjectPropertyList list, AddonContainerComponent c)
 {
 }
Пример #13
0
        public void AddComponent(AddonContainerComponent c, int x, int y, int z)
        {
            if (this.Deleted)
                return;

            this.m_Components.Add(c);

            c.Addon = this;
            c.Offset = new Point3D(x, y, z);
            c.MoveToWorld(new Point3D(this.X + x, this.Y + y, this.Z + z), this.Map);
        }
Пример #14
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Decorator.Command == DecorateCommand.GetHue)
                {
                    int hue = 0;

                    if (targeted is Item)
                    {
                        hue = ((Item)targeted).Hue;
                    }
                    else if (targeted is Mobile)
                    {
                        hue = ((Mobile)targeted).Hue;
                    }
                    else
                    {
                        from.Target = new InternalTarget(m_Decorator);
                        return;
                    }

                    from.SendLocalizedMessage(1158862, string.Format("{0}", hue)); // That object is hue ~1_HUE~
                }
                else if (targeted is Item && CheckUse(m_Decorator, from))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);
                    Item      item  = (Item)targeted;

                    bool isDecorableComponent = false;

                    if (m_Decorator.Command == DecorateCommand.Turn && IsSpecialTypes(item))
                    {
                        isDecorableComponent = true;
                    }
                    else if (item is AddonComponent || item is AddonContainerComponent || item is BaseAddonContainer || item is TrophyAddon)
                    {
                        object addon = null;
                        int    count = 0;

                        if (item is AddonComponent)
                        {
                            AddonComponent component = (AddonComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is AddonContainerComponent)
                        {
                            AddonContainerComponent component = (AddonContainerComponent)item;
                            count = component.Addon.Components.Count;
                            addon = component.Addon;
                        }
                        else if (item is BaseAddonContainer)
                        {
                            BaseAddonContainer container = (BaseAddonContainer)item;
                            count = container.Components.Count;
                            addon = container;
                        }

                        if (count == 1)
                        {
                            isDecorableComponent = true;
                        }

                        if (item is TrophyAddon)
                        {
                            isDecorableComponent = true;
                        }

                        if (item is EnormousVenusFlytrapAddon)
                        {
                            isDecorableComponent = true;
                        }

                        if (m_Decorator.Command == DecorateCommand.Turn)
                        {
                            if (addon != null)
                            {
                                FlipableAddonAttribute[] attributes = (FlipableAddonAttribute[])addon.GetType().GetCustomAttributes(typeof(FlipableAddonAttribute), false);

                                if (attributes.Length > 0)
                                {
                                    isDecorableComponent = true;
                                }
                            }
                        }
                    }
                    else if (item is Banner && m_Decorator.Command != DecorateCommand.Turn)
                    {
                        isDecorableComponent = true;
                    }

                    if (house == null || !house.IsCoOwner(from))
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do
                    }
                    else if (item.Parent != null || !house.IsInside(item))
                    {
                        from.SendLocalizedMessage(1042270); // That is not in your house.
                    }
                    else if (!house.IsLockedDown(item) && !house.IsSecure(item) && !isDecorableComponent)
                    {
                        if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Turn)
                        {
                            from.SendLocalizedMessage(1042273); // You cannot turn that.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Up)
                        {
                            from.SendLocalizedMessage(1042274); // You cannot raise it up any higher.
                        }
                        else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Down)
                        {
                            from.SendLocalizedMessage(1042275); // You cannot lower it down any further.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1042271); // That is not locked down.
                        }
                    }
                    else if (item is VendorRentalContract)
                    {
                        from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object.
                    }
                    else
                    {
                        switch (m_Decorator.Command)
                        {
                        case DecorateCommand.Up:
                            Up(item, from);
                            break;

                        case DecorateCommand.Down:
                            Down(item, from);
                            break;

                        case DecorateCommand.Turn:
                            Turn(item, from);
                            break;
                        }
                    }
                }

                from.Target = new InternalTarget(m_Decorator);
            }