Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2.  
  3. using Plus.Core;
  4. using Plus.Communication.Packets.Incoming;
  5. using Plus.Utilities;
  6. using Plus.HabboHotel.Global;
  7. using Plus.HabboHotel.Quests;
  8. using Plus.HabboHotel.Rooms;
  9. using Plus.HabboHotel.GameClients;
  10. using Plus.HabboHotel.Rooms.Chat.Logs;
  11. using Plus.Communication.Packets.Outgoing.Messenger;
  12. using Plus.Communication.Packets.Outgoing.Rooms.Chat;
  13. using Plus.Communication.Packets.Outgoing.Moderation;
  14. using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
  15. using Plus.HabboHotel.Rooms.Chat.Styles;
  16.  
  17. namespace Plus.Communication.Packets.Incoming.Rooms.Chat
  18. {
  19. public class ChatEvent : IPacketEvent
  20. {
  21. public void Parse(GameClient Session, ClientPacket Packet)
  22. {
  23. if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
  24. return;
  25.  
  26. Room Room = Session.GetHabbo().CurrentRoom;
  27. if (Room == null)
  28. return;
  29.  
  30. RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
  31. if (User == null)
  32. return;
  33.  
  34. string Message = StringCharFilter.Escape(Packet.PopString());
  35. if (Message.Length > 100)
  36. Message = Message.Substring(0, 100);
  37.  
  38. int Colour = Packet.PopInt();
  39.  
  40. ChatStyle Style = null;
  41. if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
  42. Colour = 0;
  43.  
  44. User.UnIdle();
  45.  
  46. if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
  47. return;
  48.  
  49. if (Session.GetHabbo().TimeMuted > 0)
  50. {
  51. Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
  52. return;
  53. }
  54. if (PlusEnvironment.GetGame().GetChatManager().GetFilter().IsFiltered(Message))
  55. {
  56.  
  57. PlusEnvironment.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de Publicidad",
  58. "El Usuario: <b>" + Session.GetHabbo().Username + "<br>" +
  59.  
  60. "<br></b> Esta Publicando y/o usando una palabra contenida en el filtro" + "<br>" +
  61.  
  62. "<br><b>La Palabra Usada Fue:</b><br>" +
  63. "<br>" + "<b>" + "<font color =\"#FF0000\">" + Message + "</font>" + "</b><br>" +
  64. "<br>Para ir a la sala, da clic en \"Ir a la Sala \"</b>",
  65. "filter", "Ir a la Sala", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
  66. Session.GetHabbo().GetClient().SendMessage(new WhisperComposer(User.VirtualId, "La siguiente Palabra esta prohibida en el hotel:" + " " + Message, 0, 34));
  67. Message = null;
  68. }
  69.  
  70. if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
  71. {
  72. Session.SendWhisper("Oops, you're currently muted.");
  73. return;
  74. }
  75.  
  76. User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;
  77.  
  78. if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
  79. {
  80. int MuteTime;
  81. if (User.IncrementAndCheckFlood(out MuteTime))
  82. {
  83. Session.SendMessage(new FloodControlComposer(MuteTime));
  84. return;
  85. }
  86. }
  87.  
  88. if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
  89. return;
  90.  
  91. PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
  92.  
  93. if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
  94. {
  95. Session.GetHabbo().BannedPhraseCount++;
  96.  
  97. if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
  98. {
  99. PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
  100. Session.Disconnect();
  101. return;
  102. }
  103.  
  104. Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
  105. return;
  106. }
  107.  
  108. if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
  109. Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
  110.  
  111.  
  112. PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
  113.  
  114. User.OnChat(User.LastBubble, Message, false);
  115. }
  116. }
  117. }