IsSecure() public method

public IsSecure ( Item item ) : bool
item Item
return bool
Example #1
0
        private void Replace()
        {
            Container c = Parent as Container;

            if (c != null)
            {
                var deed = new DragonHeadAddonDeed();
                c.DropItem(deed);
            }
            else if (Parent == null)
            {
                Server.Multis.BaseHouse house = Server.Multis.BaseHouse.FindHouseAt(this);

                var deed = new DragonHeadAddonDeed();
                deed.MoveToWorld(Location, Map);

                deed.IsLockedDown = IsLockedDown;
                deed.IsSecure     = IsSecure;
                deed.Movable      = Movable;

                if (house != null && house.LockDowns.ContainsKey(this))
                {
                    house.LockDowns.Remove(this);
                    house.LockDowns.Add(deed, house.Owner);
                }
                else if (house != null && house.IsSecure(this))
                {
                    house.ReleaseSecure(house.Owner, this);
                    house.AddSecure(house.Owner, deed);
                }
            }

            Delete();
        }
Example #2
0
        public static void Replace(Item item1, Item item2)
        {
            Timer.DelayCall <Item, Item>(TimeSpan.FromSeconds(1), (oldItem, newItem) =>
            {
                var parent = oldItem.Parent;

                if (parent == null)
                {
                    Multis.BaseHouse house = Multis.BaseHouse.FindHouseAt(oldItem);

                    newItem.MoveToWorld(oldItem.Location, oldItem.Map);

                    newItem.IsLockedDown = oldItem.IsLockedDown;
                    newItem.IsSecure     = oldItem.IsSecure;
                    newItem.Movable      = oldItem.Movable;

                    if (house != null && house.LockDowns.ContainsKey(oldItem))
                    {
                        house.LockDowns.Remove(oldItem);
                        house.LockDowns.Add(newItem, house.Owner);
                    }
                    else if (house != null && house.IsSecure(oldItem))
                    {
                        house.ReleaseSecure(house.Owner, oldItem);
                        house.AddSecure(house.Owner, newItem);
                    }

                    oldItem.Delete();
                }
                else
                {
                    newItem.Movable = oldItem.Movable;

                    if (parent is Container)
                    {
                        oldItem.Delete();
                        ((Container)parent).DropItem(newItem);
                    }
                    else if (parent is Mobile)
                    {
                        oldItem.Delete();
                        ((Mobile)parent).AddItem(newItem);
                    }
                    else
                    {
                        newItem.Delete();
                        oldItem.Delete();

                        Console.WriteLine("Item replacement failed: {0}", newItem.GetType());
                    }
                }
            }, item1, item2);
        }