public static byte[] SendChatMessage(Character ch, ChatMessageInfo cmi) { Packet p = new Packet(200); p.WriteInt(ch.CharacterId); p.WriteByte((byte)cmi.Type); // chat type probably p.WriteString(cmi.Message); p.WriteString(ch.Name); if (cmi.Type == ChatType.Whisper) { p.WriteInt(cmi.TargetID); p.WriteString(cmi.TargetName); } return p.GetWrittenBuffer(PacketIds.SendChatMessage); }
public static ChatMessageInfo RecvChatMessage(Packet p) { p.Skip(2); byte type = p.ReadByte(); int targetId = p.ReadInt(); string message = p.ReadString(); string targetName = p.ReadString(); // if you dont have id ChatMessageInfo cmi = new ChatMessageInfo { Type = (ChatType)type, TargetID = targetId, Message = message, TargetName = targetName }; return cmi; }
public void SendCommandHelp(string message, Client c) { Character fakeChar = new Character { CharacterId = -1, Name = "CONSOLE" }; ChatMessageInfo msg = new ChatMessageInfo { Message = message, Type = ChatType.Guild, TargetName = "" }; byte[] packet = PacketManager.SendChatMessage(fakeChar, msg); c.Send(packet); }
public ClientChatMessageEventArgs(ChatMessageInfo message) { this.chat = message; }
public void SendChatToAll(string message) { Character fakeChar = new Character { CharacterId = -1, Name = "CONSOLE" }; ChatMessageInfo msg = new ChatMessageInfo { Message = message, Type = ChatType.Pipe3, TargetName = "" }; byte[] packet = PacketManager.SendChatMessage(fakeChar, msg); SendToAll(packet); }