Example #1
0
        public void GenerateTent()
        {
            TentWalls walls = new TentWalls(TentStyle.Newbie);
            TentRoof  roof  = new TentRoof(m_RoofHue);
            //TentTrim trim = new TentTrim();
            TentFloor floor = new TentFloor();

            walls.MoveToWorld(this.Location, this.Map);
            roof.MoveToWorld(this.Location, this.Map);
            //trim.MoveToWorld( this.Location, this.Map );
            floor.MoveToWorld(this.Location, this.Map);

            Addons.Add(walls);
            Addons.Add(roof);
            //Addons.Add( trim );
            Addons.Add(floor);

            // Create tent bed
            m_Tentbed = new TentBedRoll(this);
            m_Tentbed.MoveToWorld(new Point3D(this.X, this.Y + 1, this.Z), this.Map);
            m_Tentbed.Movable = false;

            // Create secute tent pack within the tent
            m_Tentpack = new TentBackpack(this);
            m_Tentpack.MoveToWorld(new Point3D(this.X - 1, this.Y - 1, this.Z), this.Map);
            SecureInfo info = new SecureInfo((Container)m_Tentpack, SecureLevel.Anyone);

            m_Tentpack.IsSecure = true;
            this.Secures.Add(info);
            m_Tentpack.Movable = false;
            m_Tentpack.Hue     = m_RoofHue;
        }
Example #2
0
        public virtual void OnItemDropped(Mobile from, Item item, BaseHouse house)
        {
            SecureInfo secure = house.GetSecureInfoFor(this);

            if (secure != null && !house.HasSecureAccess(from, secure))
            {
                item.InvalidateProperties();
            }
        }
Example #3
0
        public virtual void OnItemDropped(Mobile from, Item item, BaseHouse house)
        {
            SecureInfo secure = house.GetSecureInfoFor(this);

            if (secure != null && !house.HasSecureAccess(from, secure))
            {
                if (Contents == null)
                {
                    Contents = new Dictionary <Item, Mobile>();
                }

                Contents[item] = from;
                item.InvalidateProperties();
            }
        }
Example #4
0
        public override bool CheckLift(Mobile from, Item item, ref LRReason reject)
        {
            if (item == this)
            {
                return(base.CheckLift(from, item, ref reject));
            }

            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (house != null && IsSecure)
            {
                SecureInfo secure = house.GetSecureInfoFor(this);

                return(secure != null && house.HasSecureAccess(from, secure));
            }

            return(base.CheckLift(from, item, ref reject));
        }
Example #5
0
            private bool CheckHouse(Item stolen, object root)
            {
                var house = BaseHouse.FindHouseAt(stolen);

                if (house != null)
                {
                    var rootItem = root as Item;

                    if (rootItem != null)
                    {
                        SecureInfo secure = house.GetSecureInfoFor(rootItem);

                        return(secure != null && house.HasSecureAccess(m_Thief, secure));
                    }
                }

                return(true);
            }
        public static void ConvertItems()
        {
            foreach (IConvertableItem ci in ItemConversionList)
            {
                Item before = ci as Item;                 //Always an item
                Item after  = ci.Convert();

                if (after != null)
                {
                    if (before.Parent is Container)
                    {
                        after.Location = new Point3D(before.X, before.Y, 0);
                        ((Container)before.Parent).AddItem(after);
                    }
                    else if (before.Parent is Mobile)
                    {
                        ((Mobile)before.Parent).AddItem(after);
                    }
                    else
                    {
                        after.MoveToWorld(before.Location, before.Map);
                    }

                    //Is it in a house?
                    BaseHouse house = BaseHouse.FindHouseAt(before);
                    if (house != null && house.Owner != null)
                    {
                        if (before is Container && before.IsSecure)
                        {
                            SecureLevel level = SecureLevel.Owner;

                            for (int i = 0; i < house.Secures.Count; i++)
                            {
                                SecureInfo info = house.Secures[i];
                                if (info.Item == before)
                                {
                                    level = info.Level;
                                    break;
                                }
                            }

                            SecureInfo si = new SecureInfo((Container)after, level);

                            after.IsLockedDown = false;
                            after.IsSecure     = true;

                            house.Secures.Add(si);
                            house.LockDowns.Remove(after);
                            after.Movable = false;
                        }
                        else if (before.IsLockedDown)
                        {
                            house.LockDowns.Add(after);
                            after.IsLockedDown = true;
                            after.Movable      = false;
                        }
                    }

                    if (before.Movable)
                    {
                        after.Movable = true;
                    }

                    before.Delete();
                }
            }

            ItemConversionList.Clear();

            if (MobileConversionList.Count > 0)               //Do we have mobiles to convert?
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(ConvertMobiles));
            }
        }
Example #7
0
        public void AddSecure( Mobile m, Item item )
        {
            if ( m_Secures == null || !IsOwner( m ) || !IsActive )
            {
                return;
            }

            if ( !IsInside( item ) )
            {
                m.SendLocalizedMessage( 1005525 ); // That is not in your house
            }
            else if ( IsLockedDown( item ) )
            {
                m.SendLocalizedMessage( 1010550 ); // This is already locked down and cannot be secured.
            }
            else if ( !( item is Container ) )
            {
                LockDown( m, item );
            }
            else
            {
                SecureInfo info = null;

                for ( int i = 0; info == null && i < m_Secures.Count; ++i )
                {
                    if ( ( (SecureInfo) m_Secures[i] ).Item == item )
                    {
                        info = (SecureInfo) m_Secures[i];
                    }
                }

                if ( info != null )
                {
                    m.SendGump( new SetSecureLevelGump( m_Owner, info ) );
                }
                else if ( item.Parent != null )
                {
                    m.SendLocalizedMessage( 1010423 ); // You cannot secure this, place it on the ground first.
                }
                else if ( !item.Movable )
                {
                    m.SendLocalizedMessage( 1010424 ); // You cannot secure this.
                }
                else if ( !CheckAosLockdowns( 1 ) )
                {
                    m.SendLocalizedMessage( 1005379 ); // That would exceed the maximum lock down limit for this house
                }
                else if ( !CheckAosStorage( item.TotalItems ) )
                {
                    m.SendLocalizedMessage( 1061839 ); // This action would exceed the secure storage limit of the house.
                }
                else
                {
                    info = new SecureInfo( (Container) item, SecureLevel.CoOwners );

                    item.IsLockedDown = false;
                    item.IsSecure = true;

                    m_Secures.Add( info );
                    m_LockDowns.Remove( item );
                    item.Movable = false;

                    m.SendGump( new SetSecureLevelGump( m_Owner, info ) );
                }
            }
        }
Example #8
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
            int count;

            switch ( version )
            {
                case 15:
                    {
                        m_CurrentStage = (DecayLevel) reader.ReadInt();
                        m_NextDecayStage = reader.ReadDateTime();
                        goto case 14;
                    }
                case 14:
                    {
                        m_Carpets = reader.ReadItemList();
                        goto case 13;
                    }
                case 13:
                    {
                        m_RelativeBanLocation = reader.ReadPoint3D();
                        goto case 12;
                    }
                case 12:
                    {
                        m_VendorRentalContracts = reader.ReadItemList();
                        m_InternalizedVendors = reader.ReadMobileList();

                        int relocatedCount = reader.ReadEncodedInt();
                        for ( int i = 0; i < relocatedCount; i++ )
                        {
                            Point3D relLocation = reader.ReadPoint3D();
                            IEntity entity = World.Instance.FindEntity( reader.ReadInt() );

                            if ( entity != null )
                                m_RelocatedEntities.Add( new RelocatedEntity( entity, relLocation ) );
                        }

                        int inventoryCount = reader.ReadEncodedInt();
                        for ( int i = 0; i < inventoryCount; i++ )
                        {
                            VendorInventory inventory = new VendorInventory( this, reader );
                            m_VendorInventories.Add( inventory );
                        }

                        goto case 11;
                    }
                case 11:
                    {
                        m_LastRefreshed = reader.ReadDateTime();
                        m_RestrictDecay = reader.ReadBool();
                        goto case 10;
                    }
                case 10: // just a signal for updates
                case 9:
                    {
                        m_Visits = reader.ReadInt();
                        goto case 8;
                    }
                case 8:
                    {
                        m_Price = reader.ReadInt();
                        goto case 7;
                    }
                case 7:
                    {
                        m_Access = reader.ReadMobileList();
                        goto case 6;
                    }
                case 6:
                    {
                        m_BuiltOn = reader.ReadDateTime();
                        m_LastTraded = reader.ReadDateTime();
                        goto case 5;
                    }
                case 5: // just removed fields
                case 4:
                    {
                        m_Addons = reader.ReadItemList();
                        goto case 3;
                    }
                case 3:
                    {
                        count = reader.ReadInt();
                        m_Secures = new ArrayList( count );

                        for ( int i = 0; i < count; ++i )
                        {
                            SecureInfo info = new SecureInfo( reader );

                            if ( info.Item != null )
                            {
                                info.Item.IsSecure = true;
                                m_Secures.Add( info );
                            }
                        }

                        goto case 2;
                    }
                case 2:
                    {
                        m_Public = reader.ReadBool();
                        goto case 1;
                    }
                case 1:
                    {
                        if ( version < 13 )
                            reader.ReadPoint3D(); // house ban location
                        goto case 0;
                    }
                case 0:
                    {
                        if ( version < 14 )
                            m_Carpets = new ArrayList();

                        if ( version < 13 )
                            m_RelativeBanLocation = this.BaseBanLocation;

                        if ( version < 12 )
                        {
                            m_VendorRentalContracts = new ArrayList();
                            m_InternalizedVendors = new ArrayList();
                        }

                        if ( version < 4 )
                        {
                            m_Addons = new ArrayList();
                        }

                        if ( version < 7 )
                        {
                            m_Access = new ArrayList();
                        }

                        if ( version < 8 )
                        {
                            m_Price = DefaultPrice;
                        }

                        m_Owner = reader.ReadMobile();

                        if ( version < 5 )
                        {
                            count = reader.ReadInt();

                            for ( int i = 0; i < count; i++ )
                            {
                                reader.ReadRect2D();
                            }
                        }

                        UpdateRegion();

                        m_CoOwners = reader.ReadMobileList();
                        m_Friends = reader.ReadMobileList();
                        m_Bans = reader.ReadMobileList();

                        m_Sign = reader.ReadItem() as HouseSign;
                        m_Trash = reader.ReadItem() as TrashBarrel;

                        m_Doors = reader.ReadItemList();
                        m_LockDowns = reader.ReadItemList();

                        for ( int i = 0; i < m_LockDowns.Count; ++i )
                        {
                            ( (Item) m_LockDowns[i] ).IsLockedDown = true;
                        }

                        for ( int i = 0; i < m_VendorRentalContracts.Count; ++i )
                        {
                            ( (Item) m_VendorRentalContracts[i] ).IsLockedDown = true;
                        }

                        if ( version < 3 )
                        {
                            ArrayList items = reader.ReadItemList();
                            m_Secures = new ArrayList( items.Count );

                            for ( int i = 0; i < items.Count; ++i )
                            {
                                Container c = items[i] as Container;

                                if ( c != null )
                                {
                                    c.IsSecure = true;
                                    m_Secures.Add( new SecureInfo( c, SecureLevel.CoOwners ) );
                                }
                            }
                        }

                        m_MaxLockDowns = reader.ReadInt();
                        m_MaxSecures = reader.ReadInt();

                        if ( ( Map == null || Map == Map.Internal ) && Location == Point3D.Zero )
                        {
                            Delete();
                        }

                        if ( m_Owner != null )
                        {
                            ArrayList list = (ArrayList) m_Table[m_Owner];

                            if ( list == null )
                            {
                                m_Table[m_Owner] = list = new ArrayList();
                            }

                            list.Add( this );
                        }
                        break;
                    }
            }

            if ( version <= 1 )
            {
                ChangeSignType( 0xBD2 ); //private house, plain brass sign
            }

            if ( version < 10 )
            {
                /* NOTE: This can exceed the house lockdown limit. It must be this way, because
                 * we do not want players' items to decay without them knowing. Or not even
                 * having a chance to fix it themselves.
                 */

                Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixLockdowns_Sandbox ) );
            }

            if ( version < 15 )
            {
                DecayLevel old = GetOldDecayLevel();

                if ( old == DecayLevel.DemolitionPending )
                    old = DecayLevel.Collapsed;

                SetDynamicDecay( old );
            }

            if ( version < 11 )
            {
                m_LastRefreshed = DateTime.Now + TimeSpan.FromHours( 24 * Utility.RandomDouble() );
            }

            if ( !CheckDecay() )
            {
                if ( RelocatedEntities.Count > 0 )
                    Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RestoreRelocatedEntities ) );
            }
        }