Пример #1
0
 public static void OnChatReceived(byte playerID, Color color, string message)
 {
     if (ClientHooks.ChatReceived != null)
     {
         ClientHooks.ChatReceived(playerID, color, message);
     }
 }
Пример #2
0
 private static void NetHooks_SendData(SendDataEventArgs e)
 {
     if (Main.netMode != 2 && e.MsgID == PacketTypes.ChatText)
     {
         string text = e.text;
         e.Handled = ClientHooks.OnChat(ref text);
         e.text    = text;
     }
 }
Пример #3
0
 public static bool OnChat(ref string msg)
 {
     if (ClientHooks.Chat != null)
     {
         HandledEventArgs handledEventArgs = new HandledEventArgs();
         ClientHooks.Chat(ref msg, handledEventArgs);
         return(handledEventArgs.Handled);
     }
     return(false);
 }
Пример #4
0
 private static void NetHooks_GetData(GetDataEventArgs e)
 {
     if (Main.netMode != 2 && e.MsgID == PacketTypes.ChatText && e.Length > 3)
     {
         byte   playerID = e.Msg.readBuffer[e.Index];
         Color  color    = new Color((int)e.Msg.readBuffer[e.Index + 1] << 16, (int)e.Msg.readBuffer[e.Index + 2] << 8, (int)e.Msg.readBuffer[e.Index + 3]);
         string @string  = Encoding.ASCII.GetString(e.Msg.readBuffer, e.Index + 4, e.Length - 5);
         ClientHooks.OnChatReceived(playerID, color, @string);
     }
 }