• Welcome to Valhalla Legends Archive.
 

MCP_CHARLIST2 Help

Started by Spilled, December 08, 2005, 12:58 AM

Previous topic - Next topic

Spilled

Hello all I'm having some trouble with the CHARLIST2 0x19 Packet. It returns a listing of the characters i suggest ( 8 ) always, But i can't figure out the statstring order. If im correct, which i hope, the order is expiration date, character name, statstring.
My problem is what is the order of the statstring? level,class, ect.... Heres i packet log.


16  Hide  Hide  170  Recv 
0000  AA 00 19 08 00 03 00 00 00 03 00 75 4D 09 44 49    ...........uM.DI
0010  63 45 79 5F 53 70 69 6C 6C 65 64 00 84 80 39 02    cEy_Spilled...9.
0020  03 03 03 35 FF 54 03 03 FF 02 42 13 13 13 13 FF    ...5.T....B.....
0030  FF 11 13 13 FF 53 A8 9E FF FF FF FF FF 00 A8 04    .....S..........
0040  12 44 53 70 69 6C 6C 65 64 2D 48 61 6D 6D 65 72    .DSpilled-Hammer
0050  73 00 84 80 39 02 02 03 01 0F FF 5D 03 03 FF 04    s...9......]....
0060  4D FF FF FF FF FF FF FF FF FF FF 5A A8 9E FF FF    M..........Z....
0070  FF FF FF 00 75 08 9E 43 53 70 69 6C 6C 65 64 5F    ....u..CSpilled_
0080  4A 61 56 61 5A 6F 4E 00 84 80 FF 02 01 01 01 1B    JaVaZoN.........
0090  FF 4F 02 02 FF 01 FF FF FF FF FF FF FF FF FF FF    .O..............
00A0  FF 0F A8 82 FF FF FF FF FF 00                      ..........


Now in the first line i know the DWORD before my character name (IcEy_Spilled) is the date

0000  AA 00 19 08 00 03 00 00 00 03 00 75 4D 09 44 49    ...........uM.DI


So that would make 75 4D 09 44  the expiration date correct? How would i convert that to a Date format?

Now my main question is the statstring... whats the order? how is it split? What's the Delimiter?

Thanks for the help guys! If i didnt make myself clear, post back and ill make sure to re-phrase it!

Ringo

Im not to sure about the time stamp and how to work out the expire date of the character, but i do have some stat string infomation if it helps:

Msg = Msg & Chr(&H84) 'unknown
Msg = Msg & Chr(&H80) 'unknown
       
Msg = Msg & Chr(&HFF) 'helm
Msg = Msg & Chr(&HFF) 'chest armor
Msg = Msg & Chr(&HFF) 'leg armor
Msg = Msg & Chr(&HFF) 'Chars right arm armor
Msg = Msg & Chr(&HFF) 'Chars left arm armor
Msg = Msg & Chr(5)    'Chars right hand wepon
Msg = Msg & Chr(&HFF) 'Chars left hand wepon
Msg = Msg & Chr(&H4F) 'Chars left hand shield
Msg = Msg & Chr(&HFF) 'Chars Right sholder pad
Msg = Msg & Chr(&HFF) 'Chars left sholder pad
Msg = Msg & Chr(&HFF) 'unknown
Msg = Msg & Chr(5)    'Char Type
Msg = Msg & Chr(&HFF) 'hair color
Msg = Msg & Chr(&HFF) 'chest color
Msg = Msg & Chr(&HFF) 'Leg Color
Msg = Msg & Chr(&HFF) 'Chars Right arm Color
Msg = Msg & Chr(&HFF) 'Chars Left arm color
Msg = Msg & Chr(&HFF) 'Chars right hand wepon color
Msg = Msg & Chr(&HFF) 'Chars left Hand Wepon color
Msg = Msg & Chr(&HFF) 'Chars left hand shield color
Msg = Msg & Chr(&HFF) 'Chars Right sholder pad color
Msg = Msg & Chr(&HFF) 'Chars left sholder pad Color
Msg = Msg & Chr(&HFF) 'unknown
Msg = Msg & Chr(1)    'Char level
Msg = Msg & Chr(&HE4) 'Char flags
Msg = Msg & Chr(&H80) 'Char flags
Msg = Msg & Chr(&HFF) 'unknown
Msg = Msg & Chr(&HFF) 'unknown
Msg = Msg & Chr(3)    'ladder
Msg = Msg & Chr(&HFF) 'unknown
Msg = Msg & Chr(&HFF) 'unknown



'SS = the d2 statstring
Dim CharType as integer
Dim CharLvL as Integer
Dim IsHC as Boolean
Dim IsDead as Boolean
Dim IsLOD as Boolean
Dim IsLadder as Boolean
CharType = Asc(Mid(SS, 14, 1))
CharLvL = Asc(Mid(SS, 26, 1))
IsHC = Asc(Mid(SS, 27, 1)) And 4
IsDead  = Asc(Mid(SS, 27, 1)) And 8
IsLOD = Asc(Mid(SS, 27, 1)) And 32
IsLadder = Asc(Mid(SS, 31, 1)) < &HFF

Spilled

Thanks to your help Ringo, I have extracted all the Information from the packet except the Expiration Data.

Heres some code of how I have achieved this:


    Case &H19
        AddChat vbYellow, "MCP PACKET 0x19 RECIEVED!"
        Dim i As Long, pos As Long, SS As String
        Dim count As Long
        count = Asc(Mid(strData, 6, 1))
        pos = 12
        For i = 0 To count - 1
            Character(i).Expiration = Mid(strData, pos, 4)
            pos = pos + 4
            Character(i).CharacterName = KillNull(Mid(strData, pos))
            pos = pos + Len(Character(i).CharacterName) + 1
            SS = KillNull(Mid(strData, pos))
            pos = pos + Len(SS) + 1
            Character(i).CharacterType = getCharType(Mid(SS, 14, 1))
            Character(i).Level = Asc(Mid(SS, 26, 1))
            Character(i).Hc = Asc(Mid(SS, 27, 1)) And 4
            Character(i).Lod = Asc(Mid(SS, 27, 1)) And 32
            Character(i).Ladder = Asc(Mid(SS, 31, 1)) < &HFF

           
           
           
            AddChat vbGreen, "Name: " & Character(i).CharacterName
            AddChat vbGreen, "Character Type: " & Character(i).CharacterType
            AddChat vbGreen, "Level: " & Character(i).Level
            AddChat vbGreen, "HardCore: " & Character(i).Hc
            AddChat vbGreen, "LOD: " & Character(i).Lod
            AddChat vbGreen, "Ladder: " & Character(i).Ladder
            AddChat vbYellow, "----------------------------------"
            'AddChat vbGreen, Character(i).Expiration
        Next i


Kinda sloppy But w/e. Heres my character type declaration....


Public Character(8) As chars
Private Type chars
    CharacterName As String
    Level As Long
    CharacterType As String
    Expiration As String
    Hc As Boolean
    Lod As Boolean
    Ladder As Boolean
End Type


Thanks for the help guys and I hope me posting this code will help many in the future!

Joe[x86]

I'm taking a wild stab in the dark, but perhaps that DWORD timestamp you see is a UNIX time stam?

PS: Those are three diffent links. Second is the best, if you ask me.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

MyndFyre

As I recall, UNIX timestamps are 32-bit integers representing the number of seconds since 0:00:00 January 1, 1970.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Kp

It looks reasonable to consider that to be a time_t.  The posted sequence [44094d75] maps to Sat Mar 04 08:19:01 2006, which seems about right for a 3 month expiration.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Spilled

O, I think i get it now, So its a unix time stamp recieved backwards? so i recieve 75 4D 09 44  so it would be 44 09 4D 75? I would reverse it like so then break it into seconds from Janurary 1st 1970?

Joe[x86]

A time_t is a typedef pointing to a long, nothing more. I haven't used it much, but I know that to create the current unix timestamp..

time_t currentTime;
time(&currentTime);


Include the time header, whatever its called.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Kp

Quote from: Spilled[DW] on December 09, 2005, 01:36 AMO, I think i get it now, So its a unix time stamp recieved backwards? so i recieve 75 4D 09 44  so it would be 44 09 4D 75? I would reverse it like so then break it into seconds from Janurary 1st 1970?

More precisely, it's a time_t received with little endian byte order.  You can just say "the epoch," and we'll know you mean 00:00:00 1/1/1970.

Quote from: Joe on December 09, 2005, 04:33 PMA time_t is a typedef pointing to a long, nothing more. I haven't used it much, but I know that to create the current unix timestamp..

time_t currentTime;
time(&currentTime);
Include the time header, whatever its called.

Strictly speaking, it's not pointing to a long.  If it were, you'd have typedef long *time_t;.  The time header is simply time.h.  Incidentally, it used to be common to prototype the time(2) function yourself, in which case you'd write long time();
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Spilled

How would i go about converting this is VB? Im working with this in vb for now, to get familiar with MCP Packets

dxoigmn

Quote from: Spilled[DW] on December 09, 2005, 06:57 PM
How would i go about converting this is VB? Im working with this in vb for now, to get familiar with MCP Packets

http://www.google.com/search?hl=en&q=VB+Unix+Timestamp&btnG=Google+Search