本文整理汇总了C#中Demo.Mmose.Core.Network.NetState.Send方法的典型用法代码示例。如果您正苦于以下问题:C# NetState.Send方法的具体用法?C# NetState.Send怎么用?C# NetState.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Demo.Mmose.Core.Network.NetState
的用法示例。
在下文中一共展示了NetState.Send方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Auth_HandleAuthProof
/// <summary>
/// 登陆验证
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Auth_HandleAuthProof( NetState netState, PacketReader packetReader )
{
AuthExtendData extendData = netState.GetComponent<AuthExtendData>( AuthExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "Auth_PacketHandlers.Auth_AuthProof(...) - extendData.IsLoggedIn == false error!" );
return;
}
extendData.AuthProof.AuthLogonProof = AuthLogonProof.ReadAuthLogonProof( packetReader );
extendData.SRP.PublicEphemeralValueA = extendData.AuthProof.AuthLogonProof.PublicEphemeralValueA;
if ( extendData.SRP.IsClientProofValid( extendData.AuthProof.AuthLogonProof.ClientProof ) == false )
{
// Authentication failed.
//netState.Send( new RealmList_AuthProofResultError( RealmListErrorsInfo.LOGIN_NO_ACCOUNT ) );
netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_NO_ACCOUNT ) );
return;
}
// 添加到全局的Key中
SrpHandler.AddSRP( extendData.WowAccount.AccountName, extendData.SRP );
// we're authenticated now :)
extendData.IsAuthenticated = true;
netState.Send( new Auth_AuthProofResult( extendData.SRP ) );
}
示例2: Realm_HandleRequestSession
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Realm_HandleRequestSession( NetState netState, PacketReader packetReader )
{
RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData.IsLoggedIn == false error!" );
return;
}
uint iSerial = packetReader.ReadUInt32();
string strAccountName = packetReader.ReadUTF8StringSafe();
WowAccount wowAccount = WowAccountHandler.GetAccount( strAccountName );
if ( wowAccount == null )
{
netState.Send( new Realm_RequestSessionResultError( iSerial ) );
return;
}
SecureRemotePassword srp = SrpHandler.GetSRP( strAccountName );
if ( srp == null )
{
netState.Send( new Realm_RequestSessionResultError( iSerial ) );
return;
}
netState.Send( new Realm_RequestSessionResult( iSerial, wowAccount, srp ) );
}
示例3: Auth_HandleAuthChallenge
/// <summary>
/// 登陆握手
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Auth_HandleAuthChallenge( NetState netState, PacketReader packetReader )
{
AuthExtendData extendData = netState.GetComponent<AuthExtendData>( AuthExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Auth_PacketHandlers.Auth_HandleAuthChallenge(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == true )
{
Debug.WriteLine( "Auth_PacketHandlers.Auth_HandleAuthChallenge(...) - extendData.IsLoggedIn == false error!" );
return;
}
extendData.AuthChallenge.AuthLogonChallenge = AuthLogonChallenge.ReadAuthLogonChallenge( packetReader );
// 版本验证
if ( extendData.AuthChallenge.AuthLogonChallenge.Build > (ushort)CLIENT_VERSIONS.CLIENT_MAX || extendData.AuthChallenge.AuthLogonChallenge.Build < (ushort)CLIENT_VERSIONS.CLIENT_MIN )
{
netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_WRONG_BUILD_NUMBER ) );
return;
}
// 帐号是否存在
WowAccount wowAccount = WowAccountHandler.GetAccount( extendData.AuthChallenge.AuthLogonChallenge.AccountName );
if ( wowAccount == null )
{
netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_NO_ACCOUNT ) );
return;
}
extendData.WowAccount = wowAccount;
// 帐号是否停用
if ( wowAccount.Banned )
{
netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_ACCOUNT_CLOSED ) );
return;
}
// 帐号是否在线
if ( wowAccount.Locked )
{
netState.Send( new Auth_AuthChallengeResultError( LogineErrorInfo.LOGIN_ACCOUNT_FREEZED ) );
return;
}
// 成功 更新IP
WowAccountHandler.UpdateAccountLastIP( wowAccount.AccountName, netState.NetAddress.Address.ToString() );
// 登陆成功
extendData.IsLoggedIn = true;
// 获取SRP的Key
extendData.SRP = new SecureRemotePassword( true, wowAccount.AccountName, wowAccount.Password );
netState.Send( new Auth_AuthChallengeResult( extendData.SRP ) );
}
示例4: ZoneCluster_HandlerLoginZoneCluster
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void ZoneCluster_HandlerLoginZoneCluster( NetState netState, PacketReader packetReader )
{
ZoneCluster_ListenerExtendData extendData = netState.GetComponent<ZoneCluster_ListenerExtendData>( ZoneCluster_ListenerExtendData.COMPONENT_ID );
if ( extendData == null )
throw new Exception( "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData == null error!" );
if ( extendData.IsLoggedIn == true )
{
LOGs.WriteLine( LogMessageType.MSG_ERROR, "ZoneCluster_PacketHandlers.ZoneCluster_HandlerLoginZoneCluster(...) - extendData.IsLoggedIn == true error!" );
return;
}
string strZoneClusterPassword = packetReader.ReadUTF8String();
string strZoneOrDomainPassword = packetReader.ReadUTF8String();
if ( extendData.ConfigZoneCluster.ZoneClusterPassword == strZoneClusterPassword )
{
extendData.IsLoggedIn = true;
// 检查是 Domain 服务端登陆 还是 Zone客户端登陆
if ( extendData.ConfigZoneCluster.DomainPassword == strZoneOrDomainPassword )
extendData.IsDomainServer = true;
else
extendData.IsZoneServer = true;
extendData.ServerPassword = strZoneOrDomainPassword;
}
netState.Send( new ZoneCluster_LoginZoneClusterResult( extendData.IsLoggedIn ) );
}
示例5: World_HandleRealmSplitStateRequest
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void World_HandleRealmSplitStateRequest( NetState netState, PacketReader packetReader )
{
LOGs.WriteLine( LogMessageType.MSG_HACK, "World_HandleRealmSplitStateRequest...... {0} ", packetReader.Size );
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData.IsLoggedIn == false error!" );
return;
}
if ( packetReader.Size < 10 /*ProcessNet.WORLD_HEAD_SIZE + 0*/)
{
Debug.WriteLine( "World_PacketHandlers.World_HandleRealmSplitStateRequest(...) - extendData.Size < 10 error!" );
return;
}
uint iUnknown = packetReader.ReadUInt32();
netState.Send( new Word_RealmSplitStateRequest( iUnknown ) );
//netState.Send( new Word_CharEnumResponse( new WowCharacterInfo[0] ) );
}
示例6: Enqueue
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
public static void Enqueue( NetState netState )
{
// 告诉玩家现在处在的位置
netState.Send( new Word_AuthResponsePending( (uint)( m_WaitQueue.Count + 1 ) ) );
Monitor.Enter( m_LockWaitQueue );
{
m_WaitQueue.Enqueue( netState );
}
Monitor.Exit( m_LockWaitQueue );
}
示例7: World_HandleCancelTrade
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void World_HandleCancelTrade( NetState netState, PacketReader packetReader )
{
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCancelTrade(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCancelTrade(...) - extendData.IsLoggedIn == false error!" );
return;
}
netState.Send( new Word_TradeStatus( TRADE_STATUS.TRADE_STATUS_CANCELLED ) );
}
示例8: Realm_HandlePing
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Realm_HandlePing( NetState netState, PacketReader packetReader )
{
RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandlePing(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandlePing(...) - extendData.IsLoggedIn == false error!" );
return;
}
netState.Send( new Realm_Pong() );
}
示例9: Realm_HandleRegisterRealm
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Realm_HandleRegisterRealm( NetState netState, PacketReader packetReader )
{
RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == true )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData.IsLoggedIn == true error!" );
return;
}
Realm realm = new Realm();
realm.Name = packetReader.ReadUTF8String();
realm.Address = packetReader.ReadUTF8String();
string strIcon = packetReader.ReadUTF8String();
if ( Insensitive.Equals( strIcon, "PVP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_PVP;
else if ( Insensitive.Equals( strIcon, "RP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_RP;
else if ( Insensitive.Equals( strIcon, "RPPVP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_RPPVP;
else
realm.Icon = (uint)RealmIconType.REALMTYPE_NORMAL;
realm.Colour = packetReader.ReadUInt32();
realm.TimeZone = packetReader.ReadUInt32();
realm.Population = packetReader.ReadFloat();
extendData.RequestSession.Serial = RealmHandler.RealmsExclusiveSerial.GetExclusiveSerial();
// Add to the main realm list
RealmHandler.AddRealm( extendData.RequestSession.Serial, realm );
extendData.IsLoggedIn = true;
// Send back response packet.
netState.Send( new Realm_RegisterRealmResult( extendData.RequestSession.Serial ) );
}
示例10: World_HandleChannelNumMembersQuery
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void World_HandleChannelNumMembersQuery( NetState netState, PacketReader packetReader )
{
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleChannelNumMembersQuery(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleChannelNumMembersQuery(...) - extendData.IsLoggedIn == false error!" );
return;
}
string strChannelName = packetReader.ReadUTF8String();
netState.Send( new Word_ChannelNumMembersQueryResponse( strChannelName, 0, 0 ) );
}
示例11: World_HandlePing
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void World_HandlePing( NetState netState, PacketReader packetReader )
{
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandlePing(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandlePing(...) - extendData.IsLoggedIn == false error!" );
return;
}
uint iPing = packetReader.ReadUInt32();
extendData.Ping.Latency = packetReader.ReadUInt32();
netState.Send( new Word_Pong( iPing ) );
}
示例12: InternalCallbackAuthenticate
/// <summary>
///
/// </summary>
internal static void InternalCallbackAuthenticate( NetState netState, PacketReader packetReader )
{
WorldExtendData worldExtendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( worldExtendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleAuthSession(...) - worldExtendData == null error!" );
netState.Send( new Word_AuthResponseError( ResponseCodes.AUTH_FAILED ) );
return;
}
if ( worldExtendData.IsLoggedIn == true )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleAuthSession(...) - worldExtendData.IsLoggedIn == true error!" );
netState.Send( new Word_AuthResponseError( ResponseCodes.AUTH_FAILED ) );
return;
}
bool isNoError = packetReader.ReadBoolean();
if ( isNoError == false )
{
netState.Send( new Word_AuthResponseError( ResponseCodes.AUTH_FAILED ) );
return;
}
// 读取数据
uint iAccountsGuid = packetReader.ReadUInt32();
AccessLevel iAccessLevel = (AccessLevel)packetReader.ReadInt32();
bool bIsTBC = packetReader.ReadBoolean();
byte[] byteSessionKey = new byte[40];
packetReader.ReadBuffer( ref byteSessionKey, 0, 40 );
// 开始鉴别
SHA1 sha1 = new SHA1CryptoServiceProvider();
byte[] byteAccountName = worldExtendData.AuthSession.AccountName.ToArrayInByte( Encoding.ASCII );
byte[] byteT = ( (uint)0 ).ToArrayInByte();
byte[] byteClientSeed = ( (uint)worldExtendData.AuthSession.ClientSeed ).ToArrayInByte();
byte[] byteSeed = ( (uint)worldExtendData.ServerSeed ).ToArrayInByte();
byte[] tempData0 = byteAccountName.Coalition( byteT );
byte[] tempData1 = tempData0.Coalition( byteClientSeed );
byte[] tempData2 = tempData1.Coalition( byteSeed );
byte[] tempData3 = tempData2.Coalition( byteSessionKey );
byte[] byteResult = sha1.ComputeHash( tempData3 );
// 是否成功
bool bIsOK = Algorithms.EqualCollections( byteResult, worldExtendData.AuthSession.Digest );
if ( bIsOK == false )
{
netState.Send( new Word_AuthResponseError( (uint)ResponseCodes.AUTH_UNKNOWN_ACCOUNT ) );
return;
}
// 初始化 加解密的Key
worldExtendData.WowCrypt.InitKey( byteSessionKey, 40 );
worldExtendData.CommonData.AccountsGuid = iAccountsGuid;
worldExtendData.CommonData.AccountName = worldExtendData.AuthSession.AccountName;
worldExtendData.CommonData.IsTBC = bIsTBC;
//WowPlayerInfo wowPlayerInfo = new WowPlayerInfo();
//wowPlayerInfo.AccessLevel = iAccessLevel;
//wowPlayerInfo.AccountName = worldExtendData.AuthSession.AccountName;
//wowPlayerInfo.Serial = iAccountsGuid;
//wowPlayerInfo.ClientBuild = worldExtendData.AuthSession.ClientBuild;
//wowPlayerInfo.LastPing = DateTime.Now;
//wowPlayerInfo.IsTBC = bIsTBC;
//wowPlayerInfo.NetState = netState;
//Program.BaseWorld.CharacterManager.AddCharacter( wowPlayerInfo.Serial, wowPlayerInfo );
if ( ProcessServer.WowZoneCluster.World.CharacterManager.Count < 600 || iAccessLevel == AccessLevel.GameMaster )
{
worldExtendData.IsLoggedIn = true;
netState.Send( new Word_AuthResponse( bIsTBC ) );
if ( worldExtendData.AuthSession.AddonInfo != null )
netState.Send( worldExtendData.AuthSession.AddonInfo );
}
else
{
// 等待玩家的减少
WaitQueueLogins.Enqueue( netState );
}
}
示例13: World_HandleCharCreate
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void World_HandleCharCreate( NetState netState, PacketReader packetReader )
{
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCharEnum(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCharEnum(...) - extendData.IsLoggedIn == false error!" );
return;
}
string strName = packetReader.ReadUTF8StringSafe();
byte iRace = packetReader.ReadByte();
byte iClass = packetReader.ReadByte();
byte iGender = packetReader.ReadByte();
byte iSkin = packetReader.ReadByte();
byte iFace = packetReader.ReadByte();
byte iHairStyle = packetReader.ReadByte();
byte iHairColor = packetReader.ReadByte();
byte iFacialHair = packetReader.ReadByte();
byte iOutFitId = packetReader.ReadByte();
if ( WorldPacketHandlers.VerifyName( strName ) == false )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( ProcessServer.WowZoneCluster.World.GlobalPlayerInfo.GetPlayerInfo( strName ) != null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacterCreateInfo wowCharacterCreateInfo = ProcessServer.WowZoneCluster.World.GlobalCreateInfo.GetCreateInfo( iRace, iClass );
if ( wowCharacterCreateInfo == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( ( iRace == WowRace.BloodElf || iRace == WowRace.Draenei ) &&
extendData.CommonData.IsTBC == false )
{
netState.Send ( new Word_CharCreateResponseError ( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacterLevelInfo[] wowCharacterLevelInfo = ProcessServer.WowZoneCluster.World.GlobalLevelInfo.GetLevelInfo( iRace, iClass );
if ( wowCharacterLevelInfo == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacter wowPlayerInfo = new WowCharacter();
wowPlayerInfo.Serial = 0;
wowPlayerInfo.IsTBC = extendData.CommonData.IsTBC;
wowPlayerInfo.AccountGuid = extendData.CommonData.AccountsGuid;
wowPlayerInfo.Name = strName;
wowPlayerInfo.Race = iRace;
wowPlayerInfo.Class = iClass;
wowPlayerInfo.Gender = iGender;
wowPlayerInfo.Skin = iSkin;
wowPlayerInfo.Face = iFace;
wowPlayerInfo.HairStyle = iHairStyle;
wowPlayerInfo.HairColor = iHairColor;
wowPlayerInfo.FacialHair = iFacialHair;
wowPlayerInfo.X = wowCharacterCreateInfo.PositionX;
wowPlayerInfo.Y = wowCharacterCreateInfo.PositionY;
wowPlayerInfo.Z = wowCharacterCreateInfo.PositionZ;
wowPlayerInfo.MapId = wowCharacterCreateInfo.Map;
wowPlayerInfo.ZoneId = wowCharacterCreateInfo.Zone;
wowPlayerInfo.BindX = 0;
wowPlayerInfo.BindY = 0;
wowPlayerInfo.BindZ = 0;
wowPlayerInfo.BindMapId = 0;
wowPlayerInfo.BindZoneId = 0;
ChrRacesEntry chrRacesEntry = DBCInstances.ChrRacesEntry.LookupIDEntry( iRace );
if ( chrRacesEntry == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( chrRacesEntry.m_TeamId == 7 )
//.........这里部分代码省略.........