Advertisement
Guest User

Untitled

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