Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 14:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Parsing Character Data Packet

Discussion on Parsing Character Data Packet within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
angalacon's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 42
Received Thanks: 11
Parsing Character Data Packet

Hello guys.
i have to say first thank you everyone here.
i learned a lot of thing from here. and sorry for my poor english. im working on it :P
So, my problem about character data.
i found Nep7Un2 post a while ago.
that is correct and i parsed all of data but im stuck on character coordinate.
i cant parsing it how can i calculate. i tried some way from walking structures like hex:7021 B021 but didnt work. that look like same structures but different.
calculate system is not same.
Now i want to learn how can i solve this. someone experienced guy can tell me correct parsing ways and structures for chardata. mainly coordinate system calculation.

Thanks everyone for interests.
Best regards.
angalacon is offline  
Old 10/21/2011, 15:18   #2
 
elite*gold: 0
Join Date: Jun 2009
Posts: 51
Received Thanks: 25
the values are FLOAT here, not SHORT or INT.
bheaven is offline  
Old 10/21/2011, 15:49   #3
 
angalacon's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 42
Received Thanks: 11
Quote:
Originally Posted by bheaven View Post
the values are FLOAT here, not SHORT or INT.
yes i know. i tried to convert decimal and some inverse bytes.
Code:
// in 3013 chardata packet
//------------------------------------
93 72 9B 04 // CharacterID
4C 69 // X-Y sector
00 00 EA 44 A0 C4 FE 40 00 40 B9 44 6A 45 // floating X-Y-Z coords
sectors same with walking packet but floating coords didnt.
im stuck on here. how can i calculate it which bytes and some formula like ingame coordinates.
angalacon is offline  
Old 10/22/2011, 00:51   #4
 
kevin_owner's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 1,484
Received Thanks: 809
Code:
		public float ToGameX(float X, byte Xsector)
		{
			return ((Xsector - 135) * 192 + (X / 10));
		}
		public float ToGameY(float Y, byte Ysector)
		{
			return ((Ysector - 92) * 192 + (Y / 10));
		}
These are 2 functions to calculate the ingame coords by the sectors and position in that sector.

So if I convert the values of your packet snippet to the real files you would get this:
X Sector: 75
Y Sector: 105
X Position: 1872
Z Position: 7.961502
Y Position: 1482

*Be careful with the y and z position. it actually is xyz in the packet if you view it from the graphical point of view since the height is the Y axis but most coders call the height the Z because they view it from the top. Just don't mess those 2 up

So those are the real values and if you use those 2 function you'll get this as a result:
Ingame x: -11332.8
Ingame y: 2644.2

All that's left of the xyz string are the last 2 bytes which is the angle of the character. it's a short and if it's 0 then the characters faces west if it's 32768 (the half of the max short value) then the character faces east. You can also calculate the angle in degrees but I can't find that formula atm.

Also bheaven you're not 100% right. They are float in the chardata packet BUT shorts/words in the 7021 and B021 and int/dword if the character in inside a cave.
kevin_owner is offline  
Thanks
2 Users
Old 10/22/2011, 01:24   #5
 
angalacon's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 42
Received Thanks: 11
Code:
		public float ToGameX(float X, byte Xsector)
		{
			return ((Xsector - 135) * 192 + (X / 10));
		}
		public float ToGameY(float Y, byte Ysector)
		{
			return ((Ysector - 92) * 192 + (Y / 10));
		}
Thanks a lot @Kevin
i already using this formula. im working on vb.net smilar with csharp
here is my first structures. i think there is wrong data types because i cant get correct ingame coordinates.
Code:
Dim Xsection As Byte = packet.readByte
Dim Ysection As Byte = packet.readByte
Dim Xcoord As Single = packet.readSingle
Dim Zcoord As Single = packet.readSingle // not using
Dim Ycoord As Single = packet.readSingle
Dim angle As UInt16 = packet.readuInt16 // not using
my result is x coord -9000 y coord 4000
where is wrong type :S my brain fuked...
Edit : my test char in constantinople outside. coordinates like Kevin's results.
angalacon is offline  
Old 10/22/2011, 02:34   #6
 
kevin_owner's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 1,484
Received Thanks: 809
Could you print or output the x and y section with hex as format so you know which byte it read. You probably forgot to read a byte somewhere so that's why i'm asking what the values are.
kevin_owner is offline  
Old 10/22/2011, 02:45   #7
 
angalacon's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 42
Received Thanks: 11
Quote:
Originally Posted by kevin_owner View Post
Could you print or output the x and y section with hex as format so you know which byte it read. You probably forgot to read a byte somewhere so that's why i'm asking what the values are.
Here is my latest Chardata packets from H& 3013
first i found my charid in packet and after select this codes.
im sure 4d69 constantinple sectors
Code:
d9331a00  // my char ID
4d // X sector
69 // Y sector
d8a5e043 // X Float ?
207dff40 // Z Float ?
2a37b544 // Y float ?
468d // Angle ?
Up for more info.
Guys comon... i must get correct ingame coordinates
d8a5e043 : here is X float. if i convert it to single or double, getting huge value
which way correct for converting.
4D : converted to 75
69 : converted to 105. up to here everything is fine.
im stuck on converting floats...

EDIT //

Finally i solved.
incorrect conversion on x,y,z floats
solution is simple :
0080a643 : here is x float my char. reverse and used a function for converting hex to single type.
Here is my function for convertin to single:
Code:
Private Function ConvertHexToSingle(ByVal hexValue As String) As Single
        Try
            Dim iInputIndex As Integer = 0
            Dim iOutputIndex As Integer = 0
            Dim bArray(3) As Byte

            For iInputIndex = 0 To hexValue.Length - 1 Step 2
                bArray(iOutputIndex) = Byte.Parse(hexValue.Chars(iInputIndex) & hexValue.Chars(iInputIndex + 1), Globalization.NumberStyles.HexNumber)
                iOutputIndex += 1
            Next

            Array.Reverse(bArray)
             Return BitConverter.ToSingle(bArray, 0)
        Catch ex As Exception

            Throw New FormatException("The supplied hex value is either empty or in an incorrect format. Use the following format: 00000000", ex)
        End Try
    End Function
i repeat this parts for all x y and z floats. and success
Thanks a lot who is answerd my post.

best regards
angalacon is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Need Help]Parsing solo spawn packet[3015]
10/20/2011 - SRO Coding Corner - 5 Replies
public static void ParseSoloSpawn(Packet p) { Packet copy1 = p; copy1.Skip(copy1.GetBytes().Length - 1); int type = copy1.Readbyte(); if (type == 1) { int charid = p.ReadInt32(); p.ReadInt32(); p.Readbyte();
5065 General Data Packet
07/08/2010 - CO2 Private Server - 8 Replies
Well I'm currently upgrading Hybrid's to 5065. I successfully got it logged into a 5065 client, updated the characterinfo packet, iteminfo packet, and now I'm working on GeneralData packet. I'm trying to turn this dump into a structure. 18 00 F2 03 8E A0 49 00 F2 D4 4C 00 00 00 00 00 00 00 00 00 00 00 4A 00 54 51 43 6C 69 65 6E 74 As much as Nullable taught me about dumps, all I got from that is 0x18 = 24, which is the length. 0x3F2 = 1010, which is the packet id. It's the rest...
[Question] Packet data , packet editing ??
10/13/2009 - 9Dragons - 2 Replies
I would like to know : What is packet data? How do i get the address for hacking a item in game? How to use it ??
[help] Max HP/VE packet data
09/03/2009 - 9Dragons - 11 Replies
I've been trying for 2 days trying to find the maximum HP/VE in the socket data to no avail. Getting the current HP/VE is no problem. Just trying to find the your current max hp/ve is being tricky. Anyone else figured this out? I'm beginning to think it is calculated within the client.
[Ask] editing packet data wìth wPe
03/05/2009 - Perfect World - 0 Replies
Is it possible to use wpe to edit captured data? I have tried to record two some actions then recorded them.unfortunately,there were no match data.i made me confuse.i tried to use filter but it was useless.When i sent back the captured data.the client was disconnect.please somebody there help me to edit with wpe.sory 4my bad english



All times are GMT +1. The time now is 14:04.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.