本文整理汇总了C#中Server.Network.EncodedReader类的典型用法代码示例。如果您正苦于以下问题:C# EncodedReader类的具体用法?C# EncodedReader怎么用?C# EncodedReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodedReader类属于Server.Network命名空间,在下文中一共展示了EncodedReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuestButton
public static void QuestButton( GameClient state, IEntity e, EncodedReader reader )
{
if ( state.Mobile is PlayerMobile )
{
PlayerMobile from = (PlayerMobile) state.Mobile;
from.CloseGump( typeof( BaseQuestGump ) );
from.SendGump( new MLQuestMainLogGump( from ) );
}
}
示例2: QuestButton
public static void QuestButton(NetState state, IEntity e, EncodedReader reader)
{
if (state.Mobile is PlayerMobile)
{
PlayerMobile from = (PlayerMobile)state.Mobile;
from.CloseGump(typeof(MondainQuestGump));
from.SendGump(new MondainQuestGump(from));
}
}
示例3: Designer_Backup
public static void Designer_Backup( NetState state, IEntity e, EncodedReader pvSrc )
{
Mobile from = state.Mobile;
DesignContext context = DesignContext.Find( from );
if ( context != null )
{
/* Client chose to backup design state
* - Construct a copy of the current design state
* - Assign constructed state to backup state field
*/
// Construct a copy of the current design state
DesignState copyState = new DesignState( context.Foundation.DesignState );
// Assign constructed state to backup state field
context.Foundation.BackupState = copyState;
}
}
示例4: EquipLastWeaponMacro
public void EquipLastWeaponMacro( GameClient state, IEntity e, EncodedReader reader )
{
EventSink.Instance.InvokeEquipLastWeaponMacroUsed( new EquipLastWeaponMacroEventArgs( state.Mobile ) );
}
示例5: 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();
}
}
示例6: 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();
}
}
示例7: Designer_Restore
public static void Designer_Restore( NetState state, IEntity e, EncodedReader pvSrc )
{
Mobile from = state.Mobile;
DesignContext context = DesignContext.Find( from );
if ( context != null )
{
/* Client chose to restore design to the last backup state
* - Restore backup
* - Construct new design state from backup state
* - Assign constructed state to foundation
* - Update revision
* - Update client with new state
*/
// Restore backup : Construct new design state from backup state
DesignState backupDesign = new DesignState( context.Foundation.BackupState );
// Restore backup : Assign constructed state to foundation
context.Foundation.DesignState = backupDesign;
// Update revision;
backupDesign.OnRevised();
// Update client with new state
context.Foundation.SendInfoTo( state );
backupDesign.SendDetailedInfoTo( state );
}
}
示例8: 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();
}
}
示例9: Designer_Close
public static void Designer_Close( NetState state, IEntity e, EncodedReader pvSrc )
{
Mobile from = state.Mobile;
DesignContext context = DesignContext.Find( from );
if ( context != null )
{
/* Client closed his house design window
* - Remove design context
* - Notify the client that customization has ended
* - Refresh client with current visable design state
* - If a signpost is needed, add it
* - Eject all from house
* - Restore relocated entities
*/
// Remove design context
DesignContext.Remove( from );
// Notify the client that customization has ended
from.Send( new EndHouseCustomization( context.Foundation ) );
// Refresh client with current visible design state
context.Foundation.SendInfoTo( state );
context.Foundation.CurrentState.SendDetailedInfoTo( state );
// If a signpost is needed, add it
context.Foundation.CheckSignpost();
// Eject all from house
from.RevealingAction();
foreach ( Item item in context.Foundation.GetItems() )
item.Location = context.Foundation.BanLocation;
foreach ( Mobile mobile in context.Foundation.GetMobiles() )
mobile.Location = context.Foundation.BanLocation;
// Restore relocated entities
context.Foundation.RestoreRelocatedEntities();
}
}
示例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: QuestButton
public static void QuestButton(NetState state, IEntity e, EncodedReader reader)
{
if (state == null || state.Mobile == null) return;
Mobile from = state.Mobile;
from.CloseGump(typeof(QuestLogGump));
// bring up the quest status gump
from.SendGump(new QuestLogGump(from));
}
示例12: Designer_Commit
public static void Designer_Commit(NetState state, IEntity e, EncodedReader pvSrc)
{
Mobile from = state.Mobile;
DesignContext context = DesignContext.Find(from);
if (context != null)
{
int oldPrice = context.Foundation.Price;
int newPrice = oldPrice + context.Foundation.CustomizationCost +
((context.Foundation.DesignState.Components.List.Length -
(context.Foundation.CurrentState.Components.List.Length + context.Foundation.Fixtures.Count)) * 500);
Type cType = context.Foundation.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);
int bankBalance = Banker.GetBalance(from, cType);
from.SendGump(new ConfirmCommitGump(from, context.Foundation, bankBalance, oldPrice, newPrice));
}
}
示例13: SetAbility
public void SetAbility( GameClient state, IEntity e, EncodedReader reader )
{
EventSink.Instance.InvokeSetAbility( new SetAbilityEventArgs( state.Mobile, reader.ReadInt32() ) );
}
示例14: QuestGumpRequest
public void QuestGumpRequest( GameClient state, IEntity e, EncodedReader reader )
{
EventSink.Instance.InvokeQuestGumpRequest( new QuestGumpRequestArgs( state.Mobile ) );
}
示例15: 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();
}
}