Valhalla Legends Forums Archive | Battle.net Bot Development | MCP_CHARLIST2 Help

AuthorMessageTime
Spilled[DW]
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.

[code]
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                      ..........
[/code]

Now in the first line i know the DWORD before my character name (IcEy_Spilled) is the date
[code]
0000  AA 00 19 08 00 03 00 00 00 03 00 75 4D 09 44 49    ...........uM.DI
[/code]

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!
December 8, 2005, 6:58 AM
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:
[code]
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
[/code]

[code]
'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
[/code]
December 8, 2005, 3:52 PM
Spilled[DW]
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:

[code]
    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
[/code]

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

[code]
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
[/code]

Thanks for the help guys and I hope me posting this code will help many in the future!
December 8, 2005, 9:56 PM
JoeTheOdd
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.
December 9, 2005, 12:07 AM
Myndfyr
As I recall, UNIX timestamps are 32-bit integers representing the number of seconds since 0:00:00 January 1, 1970.
December 9, 2005, 12:31 AM
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.
December 9, 2005, 2:56 AM
Spilled[DW]
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?
December 9, 2005, 7:36 AM
JoeTheOdd
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..

[code]time_t currentTime;
time(&currentTime);[/code]

Include the time header, whatever its called.
December 9, 2005, 10:33 PM
Kp
[quote author=Spilled[DW] link=topic=13454.msg136925#msg136925 date=1134113815]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?[/quote]

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 author=Joe link=topic=13454.msg137032#msg137032 date=1134167617]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..

[code]time_t currentTime;
time(&currentTime);[/code]Include the time header, whatever its called.[/quote]

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 [code]long time();[/code]
December 10, 2005, 12:48 AM
Spilled[DW]
How would i go about converting this is VB? Im working with this in vb for now, to get familiar with MCP Packets
December 10, 2005, 12:57 AM
kamakazie
[quote author=Spilled[DW] link=topic=13454.msg137047#msg137047 date=1134176278]
How would i go about converting this is VB? Im working with this in vb for now, to get familiar with MCP Packets
[/quote]

http://www.google.com/search?hl=en&q=VB+Unix+Timestamp&btnG=Google+Search
December 10, 2005, 6:03 AM

Search