Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. using System;
  2. using GoldTree.HabboHotel.Misc;
  3. using GoldTree.HabboHotel.GameClients;
  4. using GoldTree.Util;
  5. using GoldTree.Messages;
  6. using GoldTree.HabboHotel.Rooms;
  7. using GoldTree.Storage;
  8. using GoldTree.HabboHotel.Users;
  9.  
  10. namespace GoldTree.Communication.Messages.Rooms.Chat
  11. {
  12. internal sealed class WhisperMessageEvent : Interface
  13. {
  14. public void Handle(GameClient Session, ClientMessage Event)
  15. {
  16. Room room = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
  17. if ((room != null) && (Session != null))
  18. {
  19. if (Session.GetHabbo().IsMuted)
  20. {
  21. Session.SendNotification(GoldTreeEnvironment.GetExternalText("error_muted"));
  22. }
  23. else if (Session.GetHabbo().HasFuse("ignore_roommute") || !room.bool_4)
  24. {
  25. string str = GoldTree.FilterString(Event.PopFixedString());
  26. char[] separator = new char[] { ' ' };
  27. string str2 = str.Split(separator)[0];
  28. string s = ChatCommandHandler.smethod_4(str.Substring(str2.Length + 1));
  29. RoomUser roomUserByHabbo = room.GetRoomUserByHabbo(Session.GetHabbo().Id);
  30. RoomUser user2 = room.method_56(str2);
  31. if (Session.GetHabbo().method_4() > 0)
  32. {
  33. TimeSpan span = (TimeSpan)(DateTime.Now - Session.GetHabbo().dateTime_0);
  34. if (span.Seconds > 4)
  35. {
  36. Session.GetHabbo().int_23 = 0;
  37. }
  38. if (((span.Seconds < 4) && (Session.GetHabbo().int_23 > 5)) && !roomUserByHabbo.IsBot)
  39. {
  40. ServerMessage message2 = new ServerMessage(0x1b);
  41. message2.AppendInt32(Session.GetHabbo().method_4());
  42. Session.SendMessage(message2);
  43. Session.GetHabbo().IsMuted = true;
  44. Session.GetHabbo().int_4 = Session.GetHabbo().method_4();
  45. return;
  46. }
  47. Session.GetHabbo().dateTime_0 = DateTime.Now;
  48. Habbo habbo = Session.GetHabbo();
  49. habbo.int_23++;
  50. }
  51. ServerMessage message = new ServerMessage(0x19);
  52. message.AppendInt32(roomUserByHabbo.VirtualId);
  53. message.AppendStringWithBreak(s);
  54. message.AppendBoolean(false);
  55. if ((roomUserByHabbo != null) && !roomUserByHabbo.IsBot)
  56. {
  57. roomUserByHabbo.GetClient().SendMessage(message);
  58. }
  59. roomUserByHabbo.Unidle();
  60. if (((user2 != null) && !user2.IsBot) && ((user2.GetClient().GetHabbo().list_2.Count <= 0) || !user2.GetClient().GetHabbo().list_2.Contains(Session.GetHabbo().Id)))
  61. {
  62. user2.GetClient().SendMessage(message);
  63. if (ServerConfiguration.EnableChatlog)
  64. {
  65. using (DatabaseClient client = GoldTree.GetDatabase().GetClient())
  66. {
  67. client.AddParamWithValue("message", "<Whisper to " + user2.GetClient().GetHabbo().Username + ">: " + s);
  68. client.ExecuteQuery(string.Concat(new object[] { "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('", Session.GetHabbo().Id, "','", room.Id, "','", DateTime.Now.Hour, "','", DateTime.Now.Minute, "',UNIX_TIMESTAMP(),@message,'", Session.GetHabbo().Username, "','", DateTime.Now.ToLongDateString(), "')" }), 30);
  69. }
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement