• Welcome to Valhalla Legends Archive.
 

Seems as if Bnet's up to it again

Started by IdIm, September 12, 2006, 02:34 PM

Previous topic - Next topic
|

Yegg

Quote from: Mephisto on September 13, 2006, 01:46 PM
Quote from: Spilled on September 13, 2006, 01:14 PM
There was no change in the checkRevision... The only change was the mpqFileName... Update your bot to recognize this change and your connection should be successful. I believe the change was (IX86ver0.mpq to IX86-0.mpq or some small change of that sort)

pRead->ExtractData(global->_bnetData._MPQVersionFile);
cout << Timestamp() << "MPQ Filename: " << global->_bnetData._MPQVersionFile << endl;

....
The MPQ file name is "ver-IX86-#.mpq" as I receive it from Battle.net, so I do ....
global->_bnetData._MPQVersionNumber = (unsigned long)atol((const char*)&global->_bnetData._MPQVersionFile[9]);
Yet, it seems to fail the version check 60% of the time and pass 40% of the time.

Grab the 9th character? That seems rather redundant. Why not loop through the string until you reach a digit and return that digit? If a bot was designed like that in the first place, not that the average person who have even considered it, this problem never would have occured.

Hdx

Quote from: Spilled on September 13, 2006, 04:43 PM
My vb applications that use bnetauth.dll are working fine but my c++ application needs up to data bncsutil binaries. Anyone have these?
http://jbls.org/Downloads/BNCSutil.dll

@Yegg: That wouldn't work....
ver-IX86-0.mpq
IX86ver0.mpq
Looping left to right the 1st diget you would hit would be 8, but thats > 7 so keep going, you get 6 ... Thats not the right answer.
Best I can tell is to strip out the IX86/ver/.mpq leaving you with the following:
--0
0
Then! you can loop and check for a diget.
Or you can just loop in reverse.
Or you do can IndexOf('.')-1
Theres plunty of ways to do it.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Yegg

#47
Quote from: HdxBmx27 on September 13, 2006, 06:16 PM
Quote from: Spilled on September 13, 2006, 04:43 PM
My vb applications that use bnetauth.dll are working fine but my c++ application needs up to data bncsutil binaries. Anyone have these?
http://jbls.org/Downloads/BNCSutil.dll

@Yegg: That wouldn't work....
ver-IX86-0.mpq
IX86ver0.mpq
Looping left to right the 1st diget you would hit would be 8, but thats > 7 so keep going, you get 6 ... Thats not the right answer.
Best I can tell is to strip out the IX86/ver/.mpq leaving you with the following:
--0
0
Then! you can loop and check for a diget.
Or you can just loop in reverse.
Or you do can IndexOf('.')-1
Theres plunty of ways to do it.
~-~(HDX)~-~

I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.

l)ragon

#48
For the lazy people.

Dim i As Integer
Dim MPQ_Id As Integer

    i = 1
    Do While IsNumeric(Mid(MPQName, i, 1)) = False
        i = i + 1
    Loop
    MPQ_Id = Mid(MPQName, i, 1)

Though this would probably be a better plan.
        MPQ_Id = RemoveNonNumerics(Replace(LCase(MPQName), "ix86", ""))

Public Function RemoveNonNumerics(ByVal inBuf As String) As Integer
Dim i As Integer
Dim BufLen As Integer
Dim outBuf As String

    BufLen = Len(inBuf)
    For i = 1 To BufLen
        If IsNumeric(Mid(inBuf, i, 1)) Then
            outBuf = outBuf & Mid(inBuf, i, 1)
        Else
            'Do nothing
        End If
    Next
    RemoveNonNumerics = Val(outBuf)
End Function



Edit: Somones sarcasim has its limits.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Yegg

Quote from: l)ragon on September 13, 2006, 06:42 PM
For the lazy people.

Dim i As Integer
Dim MPQ_Id As Integer

    i = 1
    Do While IsNumeric(Mid(MPQName, i, 1)) = False
        i = i + 1
    Loop
    MPQ_Id = Mid(MPQName, i, 1)

Though this would probably be a better plan.
    MPQ_Id = RemoveNonNumerics(MPQName)

Public Function RemoveNonNumerics(ByVal inBuf As String) As Integer
Dim i As Integer
Dim BufLen As Integer
Dim outBuf As String

    BufLen = Len(inBuf)
    For i = 1 To BufLen
        If IsNumeric(Mid(inBuf, i, 1)) Then
            outBuf = outBuf & Mid(inBuf, i, 1)
        Else
            'Do nothing
        End If
    Next
    RemoveNonNumerics = Val(outBuf)
End Function


There you go, problem solved in a more efficient manner than simply grabbing the 9th character which is currently a digit (there is only 1 digit in the string).

MyndFyre

Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.
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.

Ersan

#51
Who cares,

I'm having the same problem Mephisto is, I get the right MPQ filename and number, but version check fails 85% of the time.

I'm using BNLS.

Ringo

Hmm, wouldnt it be safe to say that the filenumber is always the last character of the filename?
I did it 2 ways this morning and decided on the top one  ::)

Public Function GetMPQFileNumber(ByVal mpqFileName As String) As Long
   Dim tmpInt As Integer
   GetMPQFileNumber = -1
   tmpInt = InStr(1, mpqFileName, ".mpq", vbTextCompare) - 1
   If tmpInt > 0 Then
       If IsNumeric(Mid(mpqFileName, tmpInt, 1)) Then
           GetMPQFileNumber = CLng(Mid(mpqFileName, tmpInt, 1))
       End If
   End If
End Function


Public Function GetMPQFileNumber(ByVal mpqFileName As String) As Long
   On Error GoTo MpqFileNumberError
   GetMPQFileNumber = CLng(Mid(Right(mpqFileName, 5), 1, 1))
   Exit Function
MpqFileNumberError:
   GetMPQFileNumber = -1
End Function

UserLoser

It would be rather interesting if Blizzard decided to generate random filenames that didn't even include the MPQ number in it... ;)

Yegg

Quote from: MyndFyre[vL] on September 13, 2006, 07:25 PM
Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.

Oops, you're right, he was right. Somehow... I didn't see the '86' in there. Heh, don't bother asking how that got by me. But, I think he said this also, just reverse the string and then return the first digit.

l)ragon

#55
Quote from: MyndFyre[vL] on September 13, 2006, 07:25 PM
Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.
Fine my bad here.
    MPQ_Id = RemoveNonNumerics(Replace(LCase(MPQName), "ix86", ""))

Edit: Fixed original post.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

MyndFyre

Quote from: l)ragon on September 13, 2006, 07:40 PM
Quote from: MyndFyre[vL] on September 13, 2006, 07:25 PM
Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.
Fine my bad here.
    MPQ_Id = RemoveNonNumerics(Replace(LCase(MPQName), "ix86", ""))

Wouldn't that leave the 86 in?
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.

Yegg

Quote from: MyndFyre[vL] on September 13, 2006, 07:41 PM
Quote from: l)ragon on September 13, 2006, 07:40 PM
Quote from: MyndFyre[vL] on September 13, 2006, 07:25 PM
Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.
Fine my bad here.
    MPQ_Id = RemoveNonNumerics(Replace(LCase(MPQName), "ix86", ""))

Wouldn't that leave the 86 in?

We could just remove the hyphens from the string. I believe hdx also suggested that earlier.

l)ragon

Quote from: MyndFyre[vL] on September 13, 2006, 07:41 PM
Quote from: l)ragon on September 13, 2006, 07:40 PM
Quote from: MyndFyre[vL] on September 13, 2006, 07:25 PM
Quote from: Yegg on September 13, 2006, 06:25 PM
I didn't say to return an index of where the character lies. I said to return the digit itself. So
where s = 'ver-IX86-0.mpq', loop until character is digit, return first digit found.
OK.  Using your pseudocode, the first digit found and returned would be 8.

Hdx was *right on the money* when he said that your plan was wrong.
Fine my bad here.
    MPQ_Id = RemoveNonNumerics(Replace(LCase(MPQName), "ix86", ""))

Wouldn't that leave the 86 in?
No that would replace the 'ix86' part of the string with ''.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

Hdx

18  192.168.7.78:2017  63.161.183.205:9367  82  Send 
0000  07 00 0D 02 00 00 00 4B 00 09 08 00 00 00 07 00    .......K........
0010  00 00 43 3D 31 36 37 35 35 37 39 36 31 35 20 41    ..C=1675579615 A
0020  3D 34 32 34 32 34 35 39 35 39 34 20 42 3D 37 37    =4242459594 B=77
0030  37 32 31 31 33 34 36 20 34 20 41 3D 41 5E 53 20    7211346 4 A=A^S
0040  42 3D 42 5E 43 20 43 3D 43 2D 41 20 41 3D 41 2B    B=B^C C=C-A A=A+
0050  42 00                                              B.

19  63.161.183.205:9367  192.168.7.78:2017  7  Recv 
0000  07 00 0D 01 00 00 00                               .......

20  63.161.183.205:9367  192.168.7.78:2017  50  Recv 
0000  32 00 09 01 00 00 00 BA 04 14 01 C3 46 D5 32 57    2...........F.2W
0010  61 72 33 2E 65 78 65 20 30 36 2F 31 33 2F 30 36    ar3.exe 06/13/06
0020  20 30 36 3A 31 33 3A 30 35 20 31 35 37 32 33 30     06:13:05 157230
0030  37 00                                              7.

The correct value should be 0x8a38ae2c NOT 0x32d546c3
So indeed BNLS needs to be updated.
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

|