本文整理汇总了C#中Server.Network.EncodedReader.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# EncodedReader.ReadInt32方法的具体用法?C# EncodedReader.ReadInt32怎么用?C# EncodedReader.ReadInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Network.EncodedReader
的用法示例。
在下文中一共展示了EncodedReader.ReadInt32方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Designer_RoofDelete
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();
}
}
示例2: Designer_Stairs
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();
}
}
示例3: Designer_Level
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 );
}
}
示例4: Designer_Roof
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();
}
}
示例5: Designer_Build
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();
}
}
示例6: Designer_Delete
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();
}
}
示例7: SetAbility
public static void SetAbility( NetState state, IEntity e, EncodedReader reader )
{
EventSink.InvokeSetAbility( new SetAbilityEventArgs( state.Mobile, reader.ReadInt32() ) );
}
示例8: Designer_RoofDelete
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();
}
}
示例9: Designer_Roof
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();
}
}
示例10: Designer_Build
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();
}
}
示例11: SetAbility
public void SetAbility( GameClient state, IEntity e, EncodedReader reader )
{
EventSink.Instance.InvokeSetAbility( new SetAbilityEventArgs( state.Mobile, reader.ReadInt32() ) );
}