本文整理汇总了C#中Plus.HabboHotel.GameClients.GameClient.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.Disconnect方法的具体用法?C# GameClient.Disconnect怎么用?C# GameClient.Disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plus.HabboHotel.GameClients.GameClient
的用法示例。
在下文中一共展示了GameClient.Disconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public void Parse(GameClient Session, ClientPacket Packet)
{
if (!Session.GetHabbo().InRoom)
return;
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;
if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Room.CheckMute(Session))
{
Session.SendWhisper("Oops, you're currently muted.");
return;
}
if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
return;
string Params = Packet.PopString();
string ToUser = Params.Split(' ')[0];
string Message = Params.Substring(ToUser.Length + 1);
int Colour = Packet.PopInt();
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);
if (User2 == null)
return;
if (Session.GetHabbo().TimeMuted > 0)
{
Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
return;
}
if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
ChatStyle Style = null;
if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
Colour = 0;
User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;
if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
{
int MuteTime;
if (User.IncrementAndCheckFlood(out MuteTime))
{
Session.SendMessage(new FloodControlComposer(MuteTime));
return;
}
}
if (!User2.GetClient().GetHabbo().ReceiveWhispers && !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
{
Session.SendWhisper("Oops, this user has their whispers disabled!");
return;
}
PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Plus.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, "<Whisper to " + ToUser + ">: " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
Room.AddChatlog(Session.GetHabbo().Id, "<Whisper to " + ToUser + ">: " + Message);
if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
{
Session.GetHabbo().BannedPhraseCount++;
if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
{
PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
Session.Disconnect();
return;
}
Session.SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
return;
}
PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
User.UnIdle();
User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
{
if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
{
User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
}
}
List<RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(2);
if (ToNotify.Count > 0)
{
foreach (RoomUser user in ToNotify)
{
if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
{
//.........这里部分代码省略.........
示例2: ExecutePacketAsync
private void ExecutePacketAsync(GameClient Session, ClientPacket Packet, IPacketEvent Pak)
{
DateTime Start = DateTime.Now;
var CancelSource = new CancellationTokenSource();
CancellationToken Token = CancelSource.Token;
Task t = _eventDispatcher.StartNew(() =>
{
Pak.Parse(Session, Packet);
Token.ThrowIfCancellationRequested();
}, Token);
_runningTasks.TryAdd(t.Id, t);
try
{
if (!t.Wait(MaximumRunTimeInSec * 1000, Token))
{
CancelSource.Cancel();
}
}
catch (AggregateException ex)
{
foreach (Exception e in ex.Flatten().InnerExceptions)
{
if (ThrowUserErrors)
{
throw e;
}
else
{
//log.Fatal("Unhandled Error: " + e.Message + " - " + e.StackTrace);
Session.Disconnect();
}
}
}
catch (OperationCanceledException)
{
Session.Disconnect();
}
finally
{
Task RemovedTask = null;
_runningTasks.TryRemove(t.Id, out RemovedTask);
CancelSource.Dispose();
//log.Debug("Event took " + (DateTime.Now - Start).Milliseconds + "ms to complete.");
}
}
示例3: Parse
public void Parse(GameClient Session, ClientPacket Packet)
{
if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
return;
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;
RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
string Message = StringCharFilter.Escape(Packet.PopString());
if (Message.Length > 100)
Message = Message.Substring(0, 100);
int Colour = Packet.PopInt();
ChatStyle Style = null;
if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
Colour = 0;
User.UnIdle();
if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
return;
if (Session.GetHabbo().TimeMuted > 0)
{
Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
return;
}
if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
{
Session.SendWhisper("Oops, you're currently muted.");
return;
}
User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;
if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
{
int MuteTime;
if (User.IncrementAndCheckFlood(out MuteTime))
{
Session.SendMessage(new FloodControlComposer(MuteTime));
return;
}
}
if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
return;
PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
{
Session.GetHabbo().BannedPhraseCount++;
if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
{
PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
Session.Disconnect();
return;
}
Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
return;
}
if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
User.OnChat(User.LastBubble, Message, false);
}