Valhalla Legends Forums Archive | Battle.net Bot Development | [VB6] D2GS Waypoint Flags

AuthorMessageTime
Ringo
Iv not been awake long, so try to bear with me :P
Over the last few days iv been tinkering with Open bnet, and iv been slowly working my way through my list of things to add/finished, one of which was the avalible waypoint flags.
Cos blizzard did them on a basic * 2 flagging system, and the number of possible avalible waypoints, they are sent in a TWORD (6 bytes) or maybe a QWORD?.
So far iv worked out all the flags and have been testing them, and they hold true all the way.
Heres what i have at the moment:
[code]
    ~~~ Act 1 Waypoints ~~~
Rogue Encampment           = &H1
Cold Plains                = &H2
Stony Fields               = &H4
Dark Wood                  = &H8
Black Marsh                = &H10
Outer Cloister             = &H20
Jail Level 1               = &H40
Inner Cloister             = &H80
CataCombs Level 2          = &H100
    ~~~ Act 2 Waypoints ~~~
Lut Gholein                = &H200
Sewers Level 2             = &H400
Dry Hills                  = &H800
Halls Of The Dead Level 2  = &H1000
Far Oasis                  = &H2000
Lost City                  = &H4000
Palace Cellar Level 1      = &H8000
Arcain Sanctuary           = &H10000
Canyon Of The Magi         = &H20000
    ~~~ Act 3 Waypoints ~~~
Kurast Docks               = &H40000
Spider Forest              = &H80000
Great Marsh                = &H100000
Flayer Jungle              = &H200000
Lower Kurast               = &H400000
Kurast Bazaar              = &H800000
Upper Kurast               = &H1000000
Travincal                  = &H2000000
Durance Of Hate Level 2    = &H4000000
    ~~~ Act 4 Waypoints ~~~
The Pandeminoum Fortress   = &H8000000
City Of The Damned         = &H10000000
River Of Flame             = &H20000000
    ~~~ Act 5 Waypoints ~~~
Harrogath                  = &H40000000
Frigid Highlands           = &H80000000
Arreat Plateau             = &H100000000
Crystalline Passage        = &H200000000
Glacial Trail              = &H400000000
Halls Of Pain              = &H800000000
Frozen Tundra              = &H1000000000
The Ancient's Way          = &H2000000000
Worldstone Keep Level 2    = &H4000000000
[/code]

It looks somthing like this:
(All towns incuded)
[code]
Harrogath:           0x48040201   (&H40000000)    01 02 04 48 00 00
Frigid Highlands:    0xC8040201   (&H80000000)    01 02 04 C8 00 00
Arreat Plateau:      0x148040201  (&H100000000)    01 02 04 48 01 00
Crystalline Passage: 0x248040201  (&H200000000)    01 02 04 48 02 00
Glacial Trail:       0x448040201  (&H400000000)    01 02 04 48 04 00
Halls Of Pain:       0x848040201  (&H800000000)    01 02 04 48 08 00
Frozen Tundra:       0x1048040201 (&H1000000000)    01 02 04 48 10 00
The Ancient's Way:   0x2048040201 (&H2000000000)    01 02 04 48 20 00
WS Keep Level 2:     0x4048040201 (&H4000000000)    01 02 04 48 40 00
[/code]
And for a player with all the waypoints avalible, the flag is: 0x007FFFFFFFFF
Can anyone think of a good data type to handle this?
Im corrently thinking CCur("&H" & StrToHex(Strreverse(Data))) cos copy memory doesnt seem to be liking it.

Ideas?

[EDIT]: OK, im stupid, iv woke up now, CDbl("&H" & "7FFFFFFFFF") works like a charm.

[REEDIT]: The moto this this topic is, dont start programing untill you have had your weetabix :P
December 23, 2005, 1:37 PM
JoeTheOdd
According to LoRd[nK], the closest data type to a QWORD, in Visual Basic, is Currency.

If I know how CopyMemory works, which I daresay not, you can do something like this.

[code]Public Type udtQWORD
  dwLO as Long
  dwHI as Long
End Type

Public Function MakeQWORD(QWORD as udtQWORD) As String
    Dim Ret as String * 8
    CopyMemory udtQWORD, Ret, 8 '// udtQWORD should be displayed in memory as DWORD|DWORD
End Function[/code]
December 27, 2005, 12:30 AM
Ringo
Hm i didnt think to try that.
I knocked these up for a quick solution and they worked great :)
Cos i dont hardly ever need to use them, it kinda makes up for the ewwyness :)
Merry xmas btw
[code]
Public Function GetTWORD(ByVal Data6 As String) As Double
    If Data6 = "" Then Exit Function
    GetTWORD = CDbl("&H" & StrToHex(StrReverse(Left(Data6, 6)), ""))
End Function

Public Function GetQWORD(ByVal Data8 As String) As Currency
    If Data8 = "" Then Exit Function
    GetQWORD = CCur("&H" & StrToHex(StrReverse(Left(Data8, 8)), ""))
End Function
[/code]
December 27, 2005, 12:52 AM
JoeTheOdd
[code]Public Type udtTWORD
  w1 as Integer
  w2 as Integer
  w3 as Integer
End Type

Public Type udtQWORD
  dw1 as Long
  dw2 as Long
End Type

Public Function QWORD_TOSTRING(QWORD as udtQWORD) As String
  QWORD_TOSTRING = MakeDWORD(QWORD.dw1) & MakeDWORD(QWORD.dw2)
End Sub

Public Function QWORD_FROMSTRING(sData as String) As udtQWORD
  Dim Ret as udtQWORD
  Ret.dw1 = GetDWORD(Mid(sData, 1, 4))
  Ret.dw2 = GetDWORD(Mid(sData, 5, 4))
  QWORD_FROMSTRING = Ret
End Function[/code]

I'd write the TWORD functions too, but I'm passing out at the keyboard. Good night, morning, heck, afternoon. I'm going to bed!
December 27, 2005, 11:43 AM
Trejo
The GetMem8 function of MSVBVM60.dll is a much more cleaner version of what Ringo's GetQWORD and Joe's QWORD_FROMSTRING do.  Just for your convenience, I have included the prototype for the function call below.

[code]
Declare Sub GetQWord Lib "MSVBVM60.dll" Alias "GetMem8" (ByRef inSrc As Any, ByRef inDst As Currency)
[/code]

The second parameter can be changed to Any incase you would like to copy the data into a user-defined type.  This can be changed without any issues assuming you call the function correctly, hope this helps.
December 27, 2005, 5:56 PM
Ringo
Awsome, thanks!

[EDIT]: I dont think that function is ment for this kinda thing :(
[code]
    Dim D As Currency
    Dim E As String
    E = Chr(&HFF) & Chr(&HFF) & _
        Chr(&HFF) & Chr(&HFF) & _
        Chr(&H7F) & Chr(0) & _
        Chr(0) & Chr(0)
    Call GetQWORD(E, D)
[/code]
D returns a differnt number every time.
Any ideas?
December 27, 2005, 6:14 PM
Trejo
No, this function is perfectally fine for this.  Remember that the first value needs to be passed by value.  With a Currency data type, it'll return 54975581.3887 into the variable.  Although, 0x7fffffffff is 549755813887, that's the only way you can copy it unless you're using a user-defined type with two long members.
December 27, 2005, 11:09 PM
Myndfyr
I don't think Currency is the right type for this.  You'd be better off just reading two 32-bit integers.  Currency is floating-point, which is not appropriate for bitfields.
December 28, 2005, 1:29 AM

Search