コード例 #1
2
ファイル: Plank.cs プロジェクト: jsrn/MidnightWatchServer
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Boat = reader.ReadItem() as BaseBoat;
					m_Side = (PlankSide) reader.ReadInt();
					m_Locked = reader.ReadBool();
					m_KeyValue = reader.ReadUInt();

					if ( m_Boat == null )
						Delete();

					break;
				}
			}

			if ( IsOpen )
			{
				m_CloseTimer = new CloseTimer( this );
				m_CloseTimer.Start();
			}
		}
コード例 #2
1
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 1:
				case 0:
				{
					m_MultiID = reader.ReadInt();
					m_Offset = reader.ReadPoint3D();
					m_ShipName = reader.ReadString();

					if ( version == 0 )
						reader.ReadUInt();

					break;
				}
			}

			if ( LootType == LootType.Newbied )
				LootType = LootType.Blessed;

			if ( Weight == 0.0 )
				Weight = 1.0;
		}
コード例 #3
0
ファイル: BoatRope.cs プロジェクト: greeduomacro/UO-Forever
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Locked = reader.ReadBool();
                        m_KeyValue = reader.ReadUInt();

                        break;
                    }
            }

            if (!Deleted && IsOpen)
            {
                m_CloseTimer = new CloseTimer(this);
                m_CloseTimer.Start();
            }
        }
コード例 #4
0
ファイル: MultiData.cs プロジェクト: RedArcaneArcher/ServUO
        public MultiComponentList(GenericReader reader)
        {
            var version = reader.ReadInt();

            m_Min    = reader.ReadPoint2D();
            m_Max    = reader.ReadPoint2D();
            m_Center = reader.ReadPoint2D();
            Width    = reader.ReadInt();
            Height   = reader.ReadInt();

            var length = reader.ReadInt();

            var allTiles = m_List = new MultiTileEntry[length];

            if (version == 0)
            {
                for (var i = 0; i < length; ++i)
                {
                    int id = reader.ReadShort();

                    if (id >= 0x4000)
                    {
                        id -= 0x4000;
                    }

                    allTiles[i].m_ItemID  = (ushort)id;
                    allTiles[i].m_OffsetX = reader.ReadShort();
                    allTiles[i].m_OffsetY = reader.ReadShort();
                    allTiles[i].m_OffsetZ = reader.ReadShort();

                    allTiles[i].m_Flags = (TileFlag)reader.ReadUInt();
                }
            }
            else
            {
                for (var i = 0; i < length; ++i)
                {
                    allTiles[i].m_ItemID  = reader.ReadUShort();
                    allTiles[i].m_OffsetX = reader.ReadShort();
                    allTiles[i].m_OffsetY = reader.ReadShort();
                    allTiles[i].m_OffsetZ = reader.ReadShort();

                    if (version > 1)
                    {
                        allTiles[i].m_Flags = (TileFlag)reader.ReadULong();
                    }
                    else
                    {
                        allTiles[i].m_Flags = (TileFlag)reader.ReadUInt();
                    }
                }
            }

            var tiles = new TileList[Width][];

            Tiles = new StaticTile[Width][][];

            for (var x = 0; x < Width; ++x)
            {
                tiles[x] = new TileList[Height];
                Tiles[x] = new StaticTile[Height][];

                for (var y = 0; y < Height; ++y)
                {
                    tiles[x][y] = new TileList();
                }
            }

            for (var i = 0; i < allTiles.Length; ++i)
            {
                if (i == 0 || allTiles[i].m_Flags != 0)
                {
                    var xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
                    var yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
                    var itemID  = (allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000;

                    tiles[xOffset][yOffset].Add((ushort)itemID, (sbyte)allTiles[i].m_OffsetZ);
                }
            }

            for (var x = 0; x < Width; ++x)
            {
                for (var y = 0; y < Height; ++y)
                {
                    Tiles[x][y] = tiles[x][y].ToArray();
                }
            }
        }
コード例 #5
0
		public void Deserialize( GenericReader reader )
		{
			int version = reader.ReadEncodedInt();

			m_Combination = reader.ReadString();
			m_Area = reader.ReadString();
			m_Design = DesignTypes.FindDesign( reader.ReadString() );
			m_NormalHue = reader.ReadInt();
			m_ActivateHue = reader.ReadInt();
			m_DeactivateHue = reader.ReadInt();
			m_StartingPos = reader.ReadUInt();
			m_Reversed = reader.ReadBool();
			m_DropChance = reader.ReadDouble();
			m_GateHue = reader.ReadInt();
		}
コード例 #6
0
ファイル: BaseHouse.cs プロジェクト: Godkong/RunUO
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

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

            switch ( version )
            {
                case 14:
                {
                    m_RelativeBanLocation = reader.ReadPoint3D();
                    goto case 13;
                }
                case 13: // removed ban location serialization
                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.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_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_Chest = reader.ReadItem() as TentChest;
                    m_KeyOwner = reader.ReadUInt();

                    m_SmallForge = reader.ReadItem() as SmallForgeAddon;
                    m_LargeForge = reader.ReadItem() as LargeForgeSouthHouseAddon;
                    m_Anvil = reader.ReadItem() as AnvilEastAddon;
                    m_Loom = reader.ReadItem() as LoomSouthAddon;
                    m_SpinningWheel1 = reader.ReadItem() as SpinningwheelEastAddon;
                    m_SpinningWheel2 = reader.ReadItem() as SpinningwheelSouthAddon;
                    m_Oven = reader.ReadItem() as StoneOvenSouthAddon;
                    m_Fireplace = reader.ReadItem() as GrayBrickFireplaceSouthAddon;
                    m_Mill = reader.ReadItem() as FlourMillSouthAddon;
                    m_Training1 = reader.ReadItem() as TrainingDummyEastAddon;
                    m_Training2 = reader.ReadItem() as TrainingDummySouthAddon;
                    m_Pick1 = reader.ReadItem() as PickpocketDipEastAddon;
                    m_Pick2 = reader.ReadItem() as PickpocketDipSouthAddon;

                    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 )
                    {
                        List<BaseHouse> list = null;
                        m_Table.TryGetValue( m_Owner, out list );

                        if ( list == null )
                            m_Table[m_Owner] = list = new List<BaseHouse>();

                        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 < 11 )
                m_LastRefreshed = DateTime.Now + TimeSpan.FromHours( 24 * Utility.RandomDouble() );

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

                if ( m_Owner == null && m_Friends.Count == 0 && m_CoOwners.Count == 0 )
                    Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( Delete ) );
            }
        }
コード例 #7
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 2:
				case 1:
				{
					key_KeyVal = reader.ReadUInt();
					key_Description = reader.ReadString();
					key_Max = reader.ReadInt();
					key_Delay = TimeSpan.Parse(reader.ReadString());
					i_Door = reader.ReadItem();

					goto case 0;
				}
				case 0:
				{
                    m_WalkingRange = reader.ReadInt();
					m_WayPoint = reader.ReadItem() as WayPoint;
					m_MinDelay = reader.ReadTimeSpan();
					m_MaxDelay = reader.ReadTimeSpan();
					m_Count = reader.ReadInt();
					m_Team = reader.ReadInt();
					m_HomeRange = reader.ReadInt();
					m_Running = reader.ReadBool();

                    if (version == 1)
                        m_WalkingRange = m_HomeRange;

					TimeSpan ts = TimeSpan.Zero;

					if ( m_Running )
						ts = reader.ReadDeltaTime() - DateTime.Now;
					
					int size = reader.ReadInt();

					m_CreaturesName = new ArrayList( size );

					for ( int i = 0; i < size; ++i )
					{
						string typeName = reader.ReadString();

						m_CreaturesName.Add( typeName );

						if ( SpawnerType.GetType( typeName ) == null )
						{
							if ( m_WarnTimer == null )
								m_WarnTimer = new gWarnTimer();

							m_WarnTimer.Add( Location, Map, typeName );
						}
					}

					int count = reader.ReadInt();

					m_Creatures = new ArrayList( count );

					for ( int i = 0; i < count; ++i )
					{
						IEntity e = World.FindEntity( reader.ReadInt() );

						if ( e != null )
							m_Creatures.Add( e );
					}

					if ( m_Running )
						DoTimer( ts );

					break;
				}
			}
		}
コード例 #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        i_Description = reader.ReadString();
                        i_KeyVal = reader.ReadUInt();
                        i_Uses = reader.ReadInt();
                        i_Max = reader.ReadInt();
                        i_Delay = TimeSpan.Parse(reader.ReadString());
                        break;
                    }
            }
        }
コード例 #9
0
		public BaseAttributes( Item owner, GenericReader reader )
		{
			m_Owner = owner;

			int version = reader.ReadByte();

			switch( version )
			{
				case 1:
				{
					m_Names = reader.ReadUInt();
					m_Values = new int[reader.ReadEncodedInt()];

					for( int i = 0; i < m_Values.Length; ++i )
						m_Values[i] = reader.ReadEncodedInt();

					break;
				}
				case 0:
				{
					m_Names = reader.ReadUInt();
					m_Values = new int[reader.ReadInt()];

					for( int i = 0; i < m_Values.Length; ++i )
						m_Values[i] = reader.ReadInt();

					break;
				}
			}
		}
コード例 #10
0
ファイル: BaseHouse.cs プロジェクト: FreeReign/Rebirth-Repack
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_Region = new HouseRegion( this );

            switch ( version )
            {
                case 0:
                {
                    m_KeyValue = reader.ReadUInt();
                    m_Visits = reader.ReadInt();
                    m_Price = reader.ReadInt();
                    m_BuiltOn = reader.ReadDateTime();
                    m_LastTraded = reader.ReadDateTime();
                    m_Public = reader.ReadBool();
                    m_Region.GoLocation = reader.ReadPoint3D();
                    if ( version < 8 )
                        m_Price = DefaultPrice;

                    m_Owner = reader.ReadMobile();

                    UpdateRegionArea();

                    Region.AddRegion( m_Region );

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

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

                    if ( (Map == null || Map == Map.Internal) && Location == Point3D.Zero )
                        Delete();
                    break;
                }
            }
        }
コード例 #11
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    m_KeyValue = reader.ReadUInt();
                    break;
            }
        }
コード例 #12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    m_KeyValue = reader.ReadUInt();
                    m_original = (TransferChest)reader.ReadItem();
                    break;
            }
        }
コード例 #13
0
ファイル: HouseSign.cs プロジェクト: Godkong/RunUO
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Owner = reader.ReadItem() as BaseHouse;
                    m_OrgOwner = reader.ReadMobile();
                    m_KeyOwner = reader.ReadUInt();

                    break;
                }
            }

            if ( this.Name == "a house sign" )
                this.Name = null;
        }
コード例 #14
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			m_Combination = reader.ReadString();
			m_Area = reader.ReadString();
			m_Design = DesignTypes.FindDesign( reader.ReadString() );
			m_StartingPos = reader.ReadUInt();
			m_Reversed = reader.ReadBool();
		}
コード例 #15
0
ファイル: BaseDockedBoat.cs プロジェクト: Crome696/ServUO
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
                case 5:
                    {
                        m_MultiID = reader.ReadInt();
                        m_Offset = reader.ReadPoint3D();
                        m_ShipName = reader.ReadString();
                        m_BoatItem = reader.ReadItem() as BaseBoat;
                        break;
                    }
                case 4:
                    {
                        switch (reader.ReadInt())
                        {
                            default:
                            case 0: break;
                            case 1: m_PilotEntry = new PilotEntry(reader);
                                break;
                        }
                        goto case 3;
                    }
                case 3:
                    {
                        m_BaseHue = reader.ReadInt();

                        if(version < 5)
                        reader.ReadItem();
                        reader.ReadItem();
                        m_Owner = reader.ReadMobile();
                        goto case 2;
                    }
                case 2:
                    {
                        switch (reader.ReadInt())
                        {
                            default:
                            case 0: break;
                            case 1: m_SecurityEntry = new SecurityEntry(null, reader);
                                break;
                        }
                        goto case 1;
                    }
				case 1:
				case 0:
				{
					m_MultiID = reader.ReadInt();
					m_Offset = reader.ReadPoint3D();
					m_ShipName = reader.ReadString();

					if ( version == 0 )
						reader.ReadUInt();

					break;
				}
			}

			if ( LootType == LootType.Newbied )
				LootType = LootType.Blessed;

			if ( Weight == 0.0 )
				Weight = 1.0;
		}
コード例 #16
0
ファイル: BaseDockedBoat.cs プロジェクト: Ravenwolfe/xrunuo
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                case 0:
                    {
                        m_MultiID = reader.ReadInt();
                        m_Offset = reader.ReadPoint3D();
                        m_ShipName = reader.ReadString();

                        if ( version == 0 )
                            reader.ReadUInt();

                        break;
                    }
            }
        }