February 09, 2012, 10:55:56 PM

Author Topic: Leaderboards  (Read 1142 times)

Scott

  • ForumNazi
  • BNU Leader
  • THE TURKISH EMPEROR
  • *****
  • Posts: 1146
  • Karma: +6/-6
  • BNU-Camel since December 2002
    • View Profile
    • Clan BNU
Leaderboards
« Reply #30 on: August 12, 2007, 10:22:27 PM »
Okay, the problem is solved.

When you join a channel, part of the packet is your stat string - it has your stats. For starcraft/warcraft2/warcraft3, it's pretty simple because it's human-readable, usually looks like a set of numbers separated by spaces, where each number has a meaning like "number of wins" or "ladder rating." Diablo 2's stat string is harder to parse because it's binary - instead of being human readable, each byte of the statstring can have a value between 0 and 255, and that's what has meaning.

The reason the bot didn't know what level you were is because it was not properly converting the java String object in to a byte array because it was intepreting the high byte values to mean unicode characters, which you can't simply dump in to an array the way I was doing so.

Unfortunately, I never saw the bug until I started messing around with the bot in Linux, because this is a quirk of the Linux JVM I'm using, and it doesn't occur in OSX with Apple's JVM, or Windows with Sun's JVM.

In any event, the bug is fixed - I wont be able to get the new code up on to the server until tomorrow.
It's like saying, "Hello, my name is Camel and I don't know what I'm talking about."