本文整理汇总了C#中IRealmClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# IRealmClient.Disconnect方法的具体用法?C# IRealmClient.Disconnect怎么用?C# IRealmClient.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRealmClient
的用法示例。
在下文中一共展示了IRealmClient.Disconnect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CharacterRenameRequest
public static void CharacterRenameRequest(IRealmClient client, RealmPacketIn packet)
{
if (client.Account == null || client.ActiveCharacter != null)
return;
var guid = packet.ReadEntityId();
var newName = packet.ReadCString();
var record = client.Account.GetCharacterRecord(guid.Low);
if (record == null)
{
log.Error(WCell_RealmServer.IllegalRenameAttempt, guid.ToString(), client);
}
else
{
if (record.CharacterFlags.HasFlag(CharEnumFlags.NeedsRename))
{
// their character isn't flagged to be renamed, what do they think they're doing? ;)
client.Disconnect();
}
else
{
LoginErrorCode errorCode = IsNameValid(ref newName);
if (errorCode != LoginErrorCode.RESPONSE_SUCCESS)
{
SendCharacterRenameError(client, errorCode);
}
else
{
log.Debug(WCell_RealmServer.RenamingCharacter, record.Name, newName);
record.Name = newName;
var charRenameTask =
new Message4<IRealmClient, CharacterRecord, string, EntityId>(CharacterRenameCallback)
{
Parameter1 = client,
Parameter2 = record,
Parameter3 = newName,
Parameter4 = guid
};
// only enqueue to IO Queue if we are in a map context?
RealmServer.IOQueue.AddMessage(charRenameTask);
}
}
}
}
示例2: HandleRequestAccountData
public static void HandleRequestAccountData(IRealmClient client, RealmPacketIn packet)
{
if (client.Account == null)
{
return;
}
var type = packet.ReadUInt32();
if (type > 8)
{
s_log.Error("{0} sent data type > 8", client);
client.Disconnect();
return;
}
//TODO
//SendAccountData(client, type);
}
示例3: HandleUpdateAccountData
public static void HandleUpdateAccountData(IRealmClient client, RealmPacketIn packet)
{
if (client.Account == null)
{
return;
}
var type = packet.ReadUInt32();
var time = packet.ReadUInt32();
var compressedSize = packet.ReadUInt32();
if (compressedSize > 65535)
{
s_log.Warn("{0} sent a too large data update: " + compressedSize, client.Account);
client.Disconnect();
return;
}
client.Account.AccountData.SetAccountData(type, time, packet.ReadBytes(packet.RemainingLength), compressedSize);
}
示例4: AuthSessionRequest
public static void AuthSessionRequest(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter != null || client.Account != null)
{
// Already logged in
SendAuthSessionErrorReply(client, LoginErrorCode.AUTH_ALREADY_ONLINE);
client.Disconnect();
}
else if (!client.IsEncrypted)
{
var builtNumberClient = packet.ReadUInt32();
var new302 = packet.ReadUInt32(); // NEW 0.0.2.8970
var accName = packet.ReadCString();
var unk322 = packet.ReadUInt32();
client.ClientSeed = packet.ReadUInt32();
var unk1 = packet.ReadUInt32(); // 3.3.5a
var unk2 = packet.ReadUInt32(); // 3.3.5a
var unk3 = packet.ReadUInt32(); // 3.3.5a
var unk4 = packet.ReadUInt64();
client.ClientDigest = packet.ReadBigInteger(20);
#if DEBUG
log.Debug("builtNumberClient:{0} new302:{1} accName:{2} unk322:{3} client.ClientSeed:{4} unk4:{5} ClientDigest:{6}",
builtNumberClient,
new302, accName, unk322, client.ClientSeed, unk4, client.ClientDigest);
#endif
var decompressedDataLength = packet.ReadInt32();
var compressedData = packet.ReadBytes(packet.RemainingLength);
client.Addons = new byte[decompressedDataLength];
Compression.DecompressZLib(compressedData, client.Addons);
var acctLoadTask = Message.Obtain(() => RealmAccount.InitializeAccount(client, accName));
client.Server.AddMessage(acctLoadTask);
}
}
示例5: LoginCharacter
/// <summary>
/// Checks whether the client is allowed to login and -if so- logs it in
/// </summary>
/// <remarks>Executed in IO-Context.</remarks>
/// <param name="client"></param>
/// <param name="charLowId"></param>
private static void LoginCharacter(IRealmClient client, uint charLowId)
{
var acc = client.Account;
if (acc == null)
{
return;
}
var record = client.Account.GetCharacterRecord(charLowId);
if (record == null)
{
log.Error(String.Format(WCell_RealmServer.CharacterNotFound, charLowId, acc.Name));
SendCharacterLoginFail(client, LoginErrorCode.CHAR_LOGIN_NO_CHARACTER);
}
else if (record.CharacterFlags.HasAnyFlag(CharEnumFlags.NeedsRename | CharEnumFlags.LockedForBilling))
{
// TODO: Check in Char Enum?
SendCharacterLoginFail(client, LoginErrorCode.AUTH_BILLING_EXPIRED);
}
else
{
Character chr = null;
try
{
var evt = BeforeLogin;
if (evt != null)
{
record = evt(client, record);
if (record == null)
{
throw new ArgumentNullException("OnBeforeLogin returned null");
}
}
chr = record.CreateCharacter();
chr.Create(acc, record, client);
chr.LoadAndLogin();
var message = String.Format("Welcome to " + RealmServer.FormattedTitle);
//chr.SendSystemMessage(message);
MiscHandler.SendMotd(client, message);
if (CharacterHandler.NotifyPlayerStatus)
{
World.Broadcast("{0} is now " + ChatUtility.Colorize("Online", Color.Green) + ".", chr.Name);
}
}
catch (Exception ex)
{
LogUtil.ErrorException(ex, "Failed to load Character from Record: " + record);
if (chr != null)
{
// Force client to relog
chr.Dispose();
client.Disconnect();
}
}
}
}