|
You last visited: Today at 05:51
Advertisement
[Help] Messaging packet version 5630+
Discussion on [Help] Messaging packet version 5630+ within the CO2 Private Server forum part of the Conquer Online 2 category.
02/05/2013, 22:22
|
#1
|
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
|
[Help] Messaging packet version 5630+
Hello guys,
I need some little help here.
I've been making a server lately and I need the message packet structure for 5630+ versions.
I've tried allot of offsets without any result.
Here is a dump of the packet I send:
The structure I currently use:
Code:
WriteUInt((uint)Color.White.ToArgb(), 4);
WriteUInt(Type, 8);
WriteUInt(EntityID, 12);
WriteByte(4, 24);
WriteStringWithLength(From, 26);
WriteStringWithLength(To, 28 + From.Length);
WriteString("", 0, 29 + From.Length);
WriteStringWithLength(Message, 31 + (From.Length + To.Length));
I hope someone can help me!
Thanks in advance,
JobvdH!
|
|
|
02/05/2013, 22:59
|
#2
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
ushort Length = (ushort)(34 + Msg.Length + From.Length + To.Length + Date.Length);
| Offset | Value | | 0 | Length | | 2 | 1004 | | 4 | Color.ToArgb | | 8 | Message Type | | 12 | Message ID | | 16 | Unknown.. at least to me | | 20 | Mesh | | 24 | String count = 4 | | 25 | From.Length | | 26 | From as string | | 26 + From.Length | To.Length | | 27 + From.Length | To as string | | 27 + From.Length + To.Length | Date.Length | | 28 + From.Length + To.Length | Date as string | | 28 + From.Length + To.Length + Date.Length | Msg.Length | | 29 + From.Length + To.Length + Date.Length | Msg as string |
Good luck.
|
|
|
02/06/2013, 17:49
|
#3
|
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
|
Alright thanks for sharing.
I still can't login for some weird reason.
Here is my packet:
Code:
WriteUInt((uint)Color.White.ToArgb(), 4);
WriteUInt(Type, 8);
WriteUInt(EntityID, 12);
WriteUInt(client.Mesh, 20);
WriteByte(6, 24);
WriteStringWithLength(From, 26);
WriteStringWithLength(To, 27 + From.Length);
WriteStringWithLength(Date, 28 + From.Length + To.Length);
WriteStringWithLength(Message, 29 + From.Length + To.Length + Date.Length);
I send the following thing:
Code:
var MessageToSend = new SendChat(client, message, "ALL", "SYSTEM", 2101, response.Identity, DateTime.Now.ToString());
NOTE: I've also triend "ALLUSERS", that didn't work too.
And here is the dump of the packet which I send:
I hope you can help me.
PS: I've upgraded to the latest patch (5699), it didn't work on 5630 too)
Thanks in advance,
JobvdH!
|
|
|
02/06/2013, 19:50
|
#4
|
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
|
I'm not quite sure where you got this idea that there's 6 strings in the list, but I just logged these from the latest patch:
Code:
MsgTalk<1004>
{
UInt32 Color; // offset: 4, sample: 16777215
UInt16 Attribute; // offset: 8, sample: 2101
UInt16 Style; // offset: 10, sample: 0
Int32 Time; // offset: 12, sample: 1044
UInt32 Unknown; // offset: 16, sample: 0
UInt32 SpeakerLookface; // offset: 20, sample: 0
TQStringList StringList; // offset: 24, sample: "SYSTEM", "ALLUSERS", "", "ANSWER_OK"
}
Code:
MsgTalk<1004>
{
UInt32 Color; // offset: 4, sample: 16776960
UInt16 Attribute; // offset: 8, sample: 2000
UInt16 Style; // offset: 10, sample: 0
Int32 Time; // offset: 12, sample: 1044
UInt32 Unknown; // offset: 16, sample: 0
UInt32 SpeakerLookface; // offset: 20, sample: 0
TQStringList StringList; // offset: 24, sample: "SYSTEM", "Monkenstein", "", "Welcome to Conquer Online!"
}
|
|
|
02/06/2013, 20:00
|
#5
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
He didn't even write 6 strings to it.
|
|
|
02/06/2013, 20:06
|
#6
|
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
|
I just have no idea what's wrong, I've added a 4 to the coint of strings too.
It just doesn't work..
|
|
|
02/06/2013, 20:11
|
#7
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by nTL3fTy
I'm not quite sure where you got this idea that there's 6 strings in the list, but I just logged these from the latest patch:
|
Quote:
Originally Posted by Super Aids
He didn't even write 6 strings to it.
|
Isn't it Obvious enough i made a mistake and i wrote the "SYSTEM" length which is 6 instead of 4 in the string count offset?
PHP Code:
04 06 53 59 53 54 45 4D
And YES the string count can be 6 without writing 6 strings to the packet... try logging a talk packet coming from the client and take a look at the string count... TQ is that stupid...
PHP Code:
Len: 55, Type: 1004 37 00 EC 03 FF FF FF FF D0 07 00 00 5B 04 00 00 ;7 ìÿÿÿÿÐ [ 00 00 00 00 00 00 00 00 06 0F 21 3F 5F BD AC 2B ; !?_½¬+ A6 75 34 A1 35 5B 50 4D 5D 04 41 6C 6C 20 00 02 ;¦u4¡5[PM]All 48 69 00 00 00 00 00 ;Hi
|
|
|
02/06/2013, 20:22
|
#8
|
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
|
Quote:
Originally Posted by JobvdH
I just have no idea what's wrong, I've added a 4 to the coint of strings too.
It just doesn't work..
|
.
|
|
|
02/07/2013, 00:29
|
#9
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Code:
WriteUInt(0, 4);//in your case color = 0 will work just fine
WriteUInt(Type, 8);//2101
WriteUInt(EntityID, 12);//1311 for the test purpose
WriteUInt(0, 20);//in your case you don't need to add the mesh
WriteByte(4, 24);
WriteStringWithLength(From, 25);//"SYSTEM"
WriteStringWithLength(To, 26 + From.Length);//"ALLUSERS"
//WriteStringWithLength(Date, 27 + From.Length + To.Length);//in your case you don't need to add the Date its used only in offline messages
WriteStringWithLength(Message, 28 + From.Length + To.Length );// + Date.length only in an offline message
Here is the packet dumb...
Code:
36 00 EC 03 FF FF FF 00 35 08 00 00 6F 04 00 00 ;6 ìÿÿÿ 5 o
00 00 00 00 00 00 00 00 04 06 53 59 53 54 45 4D ; SYSTEM
08 41 4C 4C 55 53 45 52 53 00 08 4E 45 57 5F 52 ;ALLUSERS NEW_R
4F 4C 45 00 00 00 ;OLE
See if that works.. if not then i am sorry i can't help you anymore you need to learn how to sniff/structure packets on your own... And for that there is a lot of guides here on the forums.. you just need to search
|
|
|
02/07/2013, 02:08
|
#10
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
I know your mistakes. They are all off with 1 offset.
Look here:
WriteStringWithLength(From, 26);
You write the from length at 26 when it should be 25.
#Edit Angelius got it
And also Angelius @ the obvious, not really obvious
|
|
|
02/07/2013, 02:46
|
#11
|
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
|
Here's a protip: don't specify offsets when constructing packets -- or, you could make a method that will do it for you.
Then you won't run into problems like this.
As a side note, constructing packets like this always makes me think back to LOTF:
Code:
public byte[] SendMsg(uint MessageID, uint Color, string From, string To, string Message, ChatType Type)
{
byte[] Packet = new byte[29 + From.Length + To.Length + Message.Length];
fixed (byte* p = Packet)
{
*((ushort*)p) = (ushort)Packet.Length;
*((ushort*)(p + 2)) = 0x3EC;
*((uint*)(p + 4)) = Color;
*((uint*)(p + 8)) = (uint)Type;
*((uint*)(p + 12)) = MessageID;
//blanks?
*(p + 24) = 4;
*(p + 25) = (byte)From.Length;
for (byte i = 0; i < From.Length; i++) *(p + 26 + i) = (byte)From[i];
*(p + 26 + From.Length) = (byte)To.Length;
for (byte i = 0; i < To.Length; i++) *(p + 27 + From.Length + i) = (byte)To[i];
//blank
*(p + 28 + From.Length + To.Length) = (byte)Message.Length;
for (byte i = 0; i < Message.Length; i++) *(p + 29 + From.Length + To.Length + i) = (byte)Message[i];
}
return Packet;
}
I suppose we haven't come very far.
|
|
|
02/07/2013, 09:46
|
#12
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by nTL3fTy
Here's a protip: don't specify offsets when constructing packets-- or, you could make a method that will do it for you.
Then you won't run into problems like this.
As a side note, constructing packets like this always makes me think back to LOTF:
Code:
public byte[] SendMsg(uint MessageID, uint Color, string From, string To, string Message, ChatType Type)
{
byte[] Packet = new byte[29 + From.Length + To.Length + Message.Length];
fixed (byte* p = Packet)
{
*((ushort*)p) = (ushort)Packet.Length;
*((ushort*)(p + 2)) = 0x3EC;
*((uint*)(p + 4)) = Color;
*((uint*)(p + 8)) = (uint)Type;
*((uint*)(p + 12)) = MessageID;
//blanks?
*(p + 24) = 4;
*(p + 25) = (byte)From.Length;
for (byte i = 0; i < From.Length; i++) *(p + 26 + i) = (byte)From[i];
*(p + 26 + From.Length) = (byte)To.Length;
for (byte i = 0; i < To.Length; i++) *(p + 27 + From.Length + i) = (byte)To[i];
//blank
*(p + 28 + From.Length + To.Length) = (byte)Message.Length;
for (byte i = 0; i < Message.Length; i++) *(p + 29 + From.Length + To.Length + i) = (byte)Message[i];
}
return Packet;
}
I suppose we haven't come very far.
|
Generally.. C# beginners that never touched C++ don't have a clue on how to use Pointers\fixed Statements\Unsafe code and if they do they'll never bother...
I really don't think that a member who downloaded a public source and decided to start adding stuff to it will ever bother to Replace\Rebuild the packets builder class..
|
|
|
02/07/2013, 16:22
|
#13
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
Quote:
Originally Posted by nTL3fTy
Here's a protip: don't specify offsets when constructing packets -- or, you could make a method that will do it for you.
Then you won't run into problems like this.
As a side note, constructing packets like this always makes me think back to LOTF:
Code:
public byte[] SendMsg(uint MessageID, uint Color, string From, string To, string Message, ChatType Type)
{
byte[] Packet = new byte[29 + From.Length + To.Length + Message.Length];
fixed (byte* p = Packet)
{
*((ushort*)p) = (ushort)Packet.Length;
*((ushort*)(p + 2)) = 0x3EC;
*((uint*)(p + 4)) = Color;
*((uint*)(p + 8)) = (uint)Type;
*((uint*)(p + 12)) = MessageID;
//blanks?
*(p + 24) = 4;
*(p + 25) = (byte)From.Length;
for (byte i = 0; i < From.Length; i++) *(p + 26 + i) = (byte)From[i];
*(p + 26 + From.Length) = (byte)To.Length;
for (byte i = 0; i < To.Length; i++) *(p + 27 + From.Length + i) = (byte)To[i];
//blank
*(p + 28 + From.Length + To.Length) = (byte)Message.Length;
for (byte i = 0; i < Message.Length; i++) *(p + 29 + From.Length + To.Length + i) = (byte)Message[i];
}
return Packet;
}
I suppose we haven't come very far.
|
We all have our preferences. The reason I do static offsets is because IMO it gives a better look over the packet and where the hell data is written in it.
I do my messagepacket like this:
Code:
using System;
using ProjectX_V3_Lib.Network;
namespace ProjectX_V3_Game.Packets
{
/// <summary>
/// Client -> Server
/// Server -> Client
/// </summary>
public class MessagePacket : DataPacket
{
public MessagePacket(DataPacket inPacket)
: base(inPacket)
{
string[] strings = StringPacker.Analyze(inPacket, 24);
From = strings[0];
To = strings[1];
Unknown = strings[2];
Message = strings[3];
}
public MessagePacket(StringPacker Message)
: base((ushort)(24 + Message.Size), PacketType.MessagePacket)
{
Message.AppendAndFinish(this, 24);
Time = 0;
}
public readonly string From;
public readonly string To;
public readonly string Unknown;
public readonly string Message;
public System.Drawing.Color Color
{
get { return (System.Drawing.Color.FromArgb((int)ReadUInt32(4))); }
set { WriteUInt32((uint)value.ToArgb(), 4); }
}
public Enums.ChatType ChatType
{
get { return (Enums.ChatType)ReadUInt32(8); }
set { WriteUInt32((uint)value, 8); }
}
public uint Time
{
get { return ReadUInt32(12); }
set { WriteUInt32(value, 12); }
}
public uint ToFace
{
get { return ReadUInt32(16); }
set { WriteUInt32(value, 16); }
}
public uint FromFace
{
get { return ReadUInt32(20); }
set { WriteUInt32(value, 20); }
}
public static void Handle(Client.GameClient client, DataPacket packet)
{
using (var message = new MessagePacket(packet))
{
if (message.Message.StartsWith("/") || message.Message.StartsWith("@"))
{
Packets.Message.Commands.Handle(client, message.Message, message.Message.Split(' '));
}
else
{
Console.WriteLine("{0} speaks to {1}: {2}", message.From, message.To, message.Message);
}
}
}
}
}
|
|
|
02/07/2013, 17:08
|
#14
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Where did you get your Packet class?
|
|
|
02/07/2013, 17:31
|
#15
|
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
|
Quote:
Originally Posted by Lateralus
Where did you get your Packet class?
|
If you mean me?
I used Fang's packet writer.
Besides that everyone is sending me all kind of offsets and none of them really works.
|
|
|
Similar Threads
|
Which File in source 5630 Containt Ping !
11/21/2012 - CO2 Private Server - 3 Replies
I have 2 source its same !
one of them contain many prob but i want to get the file who contain ping cuz its bad in the another !!
i hope to understand me !!
and am sorry for my bad English lang !!
|
[B] e*pvp Messaging Tool ## Autopusher coming soon! ## [S] e*gold, PSC, uKash. Paypal
04/25/2012 - Trading - 7 Replies
.
|
Private Messaging options
07/03/2010 - Technical Support - 2 Replies
Hi guys:mofo:
I've been trying to send PMs to several members but I think my messages are not reaching because whenever i send it, it never shows up on the SEnt Messages link so im guessing i have to enable it or something?:confused:
Thank you if you can help me;):handsdown::D:bandit::):cool::rolleyes:
|
All times are GMT +1. The time now is 05:52.
|
|