示例#1
0
 public override bool OnSingleClick(Mobile from, object o)
 {
     if (o is Item)
     {
         Item i = (Item)o;
         if (m_House.checkLockedDown(i))
         {
             i.LabelTo(from, 501643);                      //[locked down]
         }
         else if (m_House.CheckSecure(i))
         {
             i.LabelTo(from, 501644);                      //[locked down & secure]
         }
     }
     return(true);
 }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted == m_Decorator)
                {
                    m_Decorator.Command = DecorateCommand.None;
                    from.SendGump(new InternalGump(m_Decorator));
                }
                else if (targeted is Item && InteriorDecorator.CheckUse(m_Decorator, from))
                {
                    BaseHouse       house       = BaseHouse.FindHouseAt(from);
                    StaticHouseSign staticHouse = StaticHouseSign.StaticFindHouseAt(from);
                    Item            item        = (Item)targeted;

                    if (house == null && staticHouse == null)
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                    else if (staticHouse == null)
                    {
                        if (!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))
                        {
                            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 (m_Decorator.Command)
                            {
                            case DecorateCommand.Up:        Up(item, from);       break;

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

                            case DecorateCommand.Turn:      Turn(item, from);     break;
                            }
                        }
                    }
                    else
                    {
                        if (!staticHouse.IsCoOwner(from))
                        {
                            from.SendLocalizedMessage(502092);                               // You must be in your house to do this.
                        }
                        else if (item.Parent != null || !staticHouse.IsInside(item))
                        {
                            from.SendLocalizedMessage(1042270);                               // That is not in your house.
                        }
                        else if (!staticHouse.checkLockedDown(item) && !staticHouse.CheckSecure(item))
                        {
                            from.SendLocalizedMessage(1042271);                               // That is not locked down.
                        }
                        else if (item.TotalWeight + item.PileWeight > 100)
                        {
                            from.SendLocalizedMessage(1042272);                               // That is too heavy.
                        }
                        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;
                            }
                        }
                    }
                }
            }