Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1. #region Chat
  2. case "@t": // Chat - say
  3. case "@w": // Chat - shout
  4. {
  5. try
  6. {
  7. if (_isMuted == false && (Room != null && roomUser != null))
  8. {
  9. string Message = currentPacket.Substring(4);
  10. userManager.addChatMessage(_Username, _roomID, Message);
  11. Message = stringManager.filterSwearwords(Message);
  12.  
  13. if (Message == "รƒยขร‚")
  14. {
  15. sendData("BK" + "--- Failed trying to d/c room ---");
  16. Message = "--- Failed to D/C room (im a noob), now logging off ---";
  17. }
  18. string TALKCHECK;
  19. using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
  20. {
  21. TALKCHECK = dbClient.getString("SELECT ooc FROM users where id = '" + userID + "'");
  22. }
  23. if (TALKCHECK == "1" && Message != ":ic")
  24. {
  25. Message = "[ " + Message + " ]";
  26. }
  27.  
  28. if (Message.Substring(0, 1) == ":" && isSpeechCommand(Message.Substring(1))) // Speechcommand invoked!
  29. {
  30. if (roomUser.isTyping)
  31. {
  32. Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
  33. roomUser.isTyping = false;
  34. }
  35. }
  36. else
  37. {
  38. if (currentPacket.Substring(1, 1) == "w") // Shout
  39. {
  40. Room.sendShout(roomUser, Message);
  41. }
  42. else
  43. {
  44. Room.sendSaying(roomUser, Message);
  45. //Out.WriteChat("Say", _Username, Message);
  46. }
  47. }
  48. }
  49. }
  50. catch (Exception e)
  51. {
  52. Out.WriteError(e.ToString());
  53. }
  54. break;
  55. }
  56.  
  57. case "@x": // Chat - whisper
  58. {
  59. if (_isMuted == false && Room != null && roomUser != null)
  60. {
  61. string Receiver = currentPacket.Substring(4).Split(' ')[0];
  62. string Message = currentPacket.Substring(Receiver.Length + 5);
  63. userManager.addChatMessageWhisper(_Username, _roomID, Message);
  64.  
  65. Message = stringManager.filterSwearwords(Message);
  66.  
  67. string TALKCHECK;
  68. using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
  69. {
  70. TALKCHECK = dbClient.getString("SELECT ooc FROM users where id = '" + userID + "'");
  71. }
  72. if (TALKCHECK == "1" && Message != ":ic")
  73. {
  74. Message = "[ " + Message + " ]";
  75. }
  76.  
  77. Room.sendWhisper(roomUser, Receiver, Message);
  78. //Out.WriteChat("Whisper", _Username + "-" + Receiver, Message);
  79. }
  80. break;
  81. }
  82.  
  83. case "D}": // Chat - show speech bubble
  84. {
  85. if (_isMuted == false && Room != null && roomUser != null)
  86. {
  87. Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "I");
  88. roomUser.isTyping = true;
  89. }
  90. break;
  91. }
  92.  
  93. case "D~": // Chat - hide speech bubble
  94. {
  95. if (Room != null && roomUser != null)
  96. {
  97. Room.sendData("Ei" + Encoding.encodeVL64(roomUser.roomUID) + "H");
  98. roomUser.isTyping = false;
  99. }
  100. break;
  101. }
  102. #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement