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();
}
}