[5165] Chat Packets

11/28/2010 12:48 †he Knight#1
Hello everybody!
I'm using 5165 Tanel's Source but I noticed that the chat packet Isn't correct... Somethings are missing,, such as the avatar in whisper chat window and scanning gears of the target..
Any1 has the correct packet? Thanks

Here Goes My Packet
Code:
public static COPacket ChatMessage(uint MessageID, string From, string To, string Message, ushort Type, uint Mesh)
        {
            byte[] Packet = new byte[8 + 34 + Message.Length + From.Length + To.Length];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16((ushort)0x3ec);
            P.WriteBytes(new byte[] { 0xff, 0xff, 0xff, 0x00 });
            P.WriteInt32(Type);
            P.WriteInt32(MessageID);
            P.WriteInt32(Mesh);
            P.WriteInt32(Mesh);
            P.WriteByte(4);
            P.WriteByte((byte)From.Length);
            P.WriteString(From);
            P.WriteByte((byte)To.Length);
            P.WriteString(To);
            P.Move(1);
            if (Message.Length < 255)
                P.WriteByte((byte)(Message.Length));
            else
                P.WriteByte(255);

            P.WriteString(Message, 255);
            P.Move(6);

            return P;
        }
11/28/2010 14:11 |NeoX#2
packet wiki.
11/28/2010 14:12 Basser#3
Code:
            P.WriteInt32(Mesh);
            P.WriteInt32(Mesh);
Could that be it?
11/28/2010 18:06 †he Knight#4
Quote:
Originally Posted by Basser View Post
Code:
            P.WriteInt32(Mesh);
            P.WriteInt32(Mesh);
Could that be it?
That's Color of the text..
11/28/2010 18:50 FuriousFang#5
Nope.
"P.WriteBytes(new byte[] { 0xff, 0xff, 0xff, 0x00 });"
is the color of the text.

Look into Impulse's source. I'm sure it's fixed in there.
11/28/2010 18:55 Basser#6
Fang is right, oh and I would make the color an int32 with value 0xFFFFFF instead.
Or using the 'Color' class in the .NET framework...
11/28/2010 18:55 teroareboss1#7
Code:
public static COPacket ChatMessage(uint MessageID, string From, string To, string Message, ushort Type, uint Mesh [COLOR="Red"], System.Drawing.Color color[/COLOR])
        {
            byte[] Packet = new byte[8 + 34 + Message.Length + From.Length + To.Length];
            COPacket P = new COPacket(Packet);
            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16((ushort)0x3ec);
            [COLOR="Red"] P.WriteInt32((uint)color.ToArgb());[/COLOR]
            P.WriteInt32(Type);
            P.WriteInt32(MessageID);
            P.WriteInt32(Mesh);
            P.WriteInt32(Mesh);
            P.WriteByte(4);
            P.WriteByte((byte)From.Length);
            P.WriteString(From);
            P.WriteByte((byte)To.Length);
            P.WriteString(To);
            P.Move(1);
            if (Message.Length < 255)
                P.WriteByte((byte)(Message.Length));
            else
                P.WriteByte(255);

            P.WriteString(Message, 255);
            P.Move(6);

            return P;
        }
Code:
        public void LocalMessage(ushort Type, System.Drawing.Color _color, string Message)
        {
            SendPacket(Packets.ChatMessage(MessageID, "SYSTEM", MyChar.Name, Message, Type, MyChar.Mesh, _color));
        }
Code:
LocalMessage(2005, System.Drawing.Color.Red , " message ");