ReadInt32() public method

public ReadInt32 ( ) : int
return int
Exemplo n.º 1
0
        public static void Designer_Stairs( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to add stairs
                 *  - Read data detailing stair type and location
                 *  - Validate stair multi ID
                 *  - Add the stairs
                 *     - Load data describing the stair components
                 *     - Insert described components
                 *  - Update revision
                 */

                // Read data detailing stair type and location
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();

                // Validate stair multi ID
                DesignState design = context.Foundation.DesignState;

                if ( itemID < 0x1DB0 || itemID > 0x1DD7 )
                {
                    /* Specified multi ID is not a stair
                     *  - Resend design state
                     *  - Return without further processing
                     */

                    design.SendDetailedInfoTo( state );
                    return;
                }

                // Add the stairs
                MultiComponentList mcl = design.Components;

                // Add the stairs : Load data describing stair components
                MultiComponentList stairs = MultiData.GetComponents( itemID );

                // Add the stairs : Insert described components
                int z = GetLevelZ( context.Level );

                for ( int i = 0; i < stairs.List.Length; ++i )
                {
                    MultiTileEntry entry = stairs.List[i];

                    if ( (entry.m_ItemID & 0x3FFF) != 1 )
                        mcl.Add( entry.m_ItemID, x + entry.m_OffsetX, y + entry.m_OffsetY, z + entry.m_OffsetZ );
                }

                // Update revision
                design.OnRevised();
            }
        }
Exemplo n.º 2
0
        public static void Designer_Roof( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                // Read data detailing component graphic and location
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();
                int z = pvSrc.ReadInt32();

                // Add component
                DesignState design = context.Foundation.DesignState;

                if ( (TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.Roof) == 0 )
                {
                    design.SendDetailedInfoTo( state );
                    return;
                }

                MultiComponentList mcl = design.Components;

                if ( z < -3 || z > 12 || z % 3 > 0 )
                    z = 0;
                z += GetLevelZ( context.Level );

                MultiTileEntry[] list = mcl.List;
                for ( int i = 0; i < list.Length; i++ )
                {
                    MultiTileEntry mte = list[i];

                    if ( mte.m_OffsetX == x && mte.m_OffsetY == y && (TileData.ItemTable[mte.m_ItemID & 0x3FFF].Flags & TileFlag.Roof) != 0 )
                        mcl.Remove( mte.m_ItemID, x, y, mte.m_OffsetZ );
                }

                mcl.Add( itemID, x, y, z );

                // Update revision
                design.OnRevised();
            }
        }
Exemplo n.º 3
0
        public static void Designer_RoofDelete( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                // Read data detailing which component to delete
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();
                int z = pvSrc.ReadInt32();

                // Verify component is deletable
                DesignState design = context.Foundation.DesignState;
                MultiComponentList mcl = design.Components;

                if ( (TileData.ItemTable[itemID & 0x3FFF].Flags & TileFlag.Roof) == 0 )
                {
                    design.SendDetailedInfoTo( state );
                    return;
                }

                mcl.Remove( itemID, x, y, z );

                design.OnRevised();
            }
        }
Exemplo n.º 4
0
        public static void Designer_Delete( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to delete a component
                 *  - Read data detailing which component to delete
                 *  - Verify component is deletable
                 *  - Remove the component
                 *  - If needed, replace removed component with a dirt tile
                 *  - Update revision
                 */

                // Read data detailing which component to delete
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();
                int z = pvSrc.ReadInt32();

                // Verify component is deletable
                DesignState design = context.Foundation.DesignState;
                MultiComponentList mcl = design.Components;

                int ax = x + mcl.Center.X;
                int ay = y + mcl.Center.Y;

                if ( IsSignHanger( itemID ) || (z == 0 && ax >= 0 && ax < mcl.Width && ay >= 0 && ay < (mcl.Height - 1)) )
                {
                    /* Component is not deletable
                     *  - Resend design state
                     *  - Return without further processing
                     */

                    design.SendDetailedInfoTo( state );
                    return;
                }

                // Remove the component
                if ( !DeleteStairs( mcl, itemID, x, y, z ) )
                    mcl.Remove( itemID, x, y, z );

                // If needed, replace removed component with a dirt tile
                if ( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
                {
                    Tile[] tiles = mcl.Tiles[ax][ay];

                    bool hasBaseFloor = false;

                    for ( int i = 0; !hasBaseFloor && i < tiles.Length; ++i )
                        hasBaseFloor = ( tiles[i].Z == 7 && (tiles[i].ID & 0x3FFF) != 1 );

                    if ( !hasBaseFloor )
                    {
                        // Replace with a dirt tile
                        mcl.Add( 0x31F4, x, y, 7 );
                    }
                }

                // Update revision
                design.OnRevised();
            }
        }
Exemplo n.º 5
0
        public static void Designer_Level( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client is moving to a new floor level
                 *  - Read data detailing the target level
                 *  - Validate target level
                 *  - Update design context with new level
                 *  - Teleport mobile to new level
                 *  - Update client
                 *
                 * TODO: Proper validation for two-story homes
                 */

                // Read data detailing the target level
                int newLevel = pvSrc.ReadInt32();

                // Validate target level
                if ( newLevel < 1 || newLevel > 4 )
                    newLevel = 1;

                // Update design context with new level
                context.Level = newLevel;

                // Teleport mobile to new level
                from.Location = new Point3D( from.X, from.Y, context.Foundation.Z + GetLevelZ( newLevel ) );

                // Update client
                context.Foundation.SendInfoTo( state );
            }
        }
Exemplo n.º 6
0
		public static void SetAbility( NetState state, IEntity e, EncodedReader reader )
		{
			EventSink.InvokeSetAbility( new SetAbilityEventArgs( state.Mobile, reader.ReadInt32() ) );
		}
Exemplo n.º 7
0
        public static void Designer_Build( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to add a component
                 *  - Read data detailing component graphic and location
                 *  - Add component
                 *  - Update revision
                 */

                // Read data detailing component graphic and location
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();

                // Add component
                DesignState design = context.Foundation.DesignState;
                MultiComponentList mcl = design.Components;

                int z = GetLevelZ( context.Level );

                if ( (y + mcl.Center.Y) == (mcl.Height - 1) )
                    z = 0; // Tiles placed on the far-south of the house are at 0 Z

                mcl.Add( itemID, x, y, z );

                // Update revision
                design.OnRevised();
            }
        }
Exemplo n.º 8
0
		public static void Designer_RoofDelete( NetState state, IEntity e, EncodedReader pvSrc )
		{
			Mobile from = state.Mobile;
			DesignContext context = DesignContext.Find( from );

			if( context != null )	// No need to check for Core.SE if trying to remove something that shouldn't be able to be placed anyways
			{
				// Read data detailing which component to delete
				int itemID = pvSrc.ReadInt32();
				int x = pvSrc.ReadInt32();
				int y = pvSrc.ReadInt32();
				int z = pvSrc.ReadInt32();

				// Verify component is deletable
				DesignState design = context.Foundation.DesignState;
				MultiComponentList mcl = design.Components;

				if( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.Roof) == 0 )
				{
					design.SendDetailedInfoTo( state );
					return;
				}

				mcl.Remove( itemID, x, y, z );

				design.OnRevised();
			}
		}
Exemplo n.º 9
0
		public static void Designer_Roof( NetState state, IEntity e, EncodedReader pvSrc )
		{
			Mobile from = state.Mobile;
			DesignContext context = DesignContext.Find( from );

			if( context != null && (Core.SE || from.AccessLevel >= AccessLevel.GameMaster) )
			{
				// Read data detailing component graphic and location
				int itemID = pvSrc.ReadInt32();
				int x = pvSrc.ReadInt32();
				int y = pvSrc.ReadInt32();
				int z = pvSrc.ReadInt32();

				// Add component
				DesignState design = context.Foundation.DesignState;

				if( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID, true ) )
				{
					TraceValidity( state, itemID );
					design.SendDetailedInfoTo( state );
					return;
				}

				MultiComponentList mcl = design.Components;

				if( z < -3 || z > 12 || z % 3 != 0 )
					z = -3;
				z += GetLevelZ( context.Level, context.Foundation );

				MultiTileEntry[] list = mcl.List;
				for( int i = 0; i < list.Length; i++ )
				{
					MultiTileEntry mte = list[i];

					if( mte.m_OffsetX == x && mte.m_OffsetY == y && GetZLevel( mte.m_OffsetZ, context.Foundation ) == context.Level  && (TileData.ItemTable[mte.m_ItemID & TileData.MaxItemValue].Flags & TileFlag.Roof) != 0 )
						mcl.Remove( mte.m_ItemID, x, y, mte.m_OffsetZ );
				}

				mcl.Add( itemID, x, y, z );

				// Update revision
				design.OnRevised();
			}
		}
Exemplo n.º 10
0
 public static void SetAbility(this NetState state, IEntity e, EncodedReader reader)
 {
     EventSink.InvokeSetAbility(state.Mobile, reader.ReadInt32());
 }
Exemplo n.º 11
0
        public static void Designer_Build( GameClient state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to add a component
                 *  - Read data detailing component graphic and location
                 *  - Add component
                 *  - Update revision
                 */

                // Read data detailing component graphic and location
                int itemID = pvSrc.ReadInt32();
                int x = pvSrc.ReadInt32();
                int y = pvSrc.ReadInt32();

                // Add component
                DesignState design = context.Foundation.DesignState;

                if ( from.AccessLevel < AccessLevel.GameMaster && !ValidPiece( itemID ) )
                {
                    TraceValidity( state, itemID );
                    design.SendDetailedInfoTo( state );
                    return;
                }

                MultiComponentList mcl = design.Components;

                int z = GetLevelZ( context.Level, context.Foundation );

                if ( ( y + mcl.Center.Y ) == ( mcl.Height - 1 ) )
                    z = 0; // Tiles placed on the far-south of the house are at 0 Z

                mcl.Add( itemID, x, y, z );

                // Update revision
                design.OnRevised();
            }
        }
Exemplo n.º 12
0
 public void SetAbility( GameClient state, IEntity e, EncodedReader reader )
 {
     EventSink.Instance.InvokeSetAbility( new SetAbilityEventArgs( state.Mobile, reader.ReadInt32() ) );
 }