• Welcome to Valhalla Legends Archive.
 

Statstring question

Started by UserLoser, July 02, 2003, 12:52 AM

Previous topic - Next topic

UserLoser

How would I get a character's current difficulty and act out of the user's statstring?  I've been packetlogging for about the last 20 minutes or so and I'm still not sure...

Here is one of my logs I dissected a bit...
70 6C 2D 6B 69 6C 6C 65 72 00 = pl-killer

50 58 32 44  = PX2D

55 53 45 61 73 74 2C = USEast,

50 4C 2D 50 76 70 4B 69 4C 4C 65 72 2C = PL-PvpKiLLer,

84 80 = Don't think this really means anything, seems all the statstrings have this. [non open character]

39 03 02 02 02 19 FF 51 02 02 FF

02 = charclass (sorceress)

4D 48 48 48 48 22 FF FF 48 48 FF

5A = level 90

A8

9E = character title

FF FF FF FF FF 00 = Once again, all I've seen have these same bytes in same place.

That is a character that has completed act 5, in hell.  But where the hell in that statstring are the byte(s) that tell you which act/difficulty?

Camel

#1
I dont know if you can tell what act they are in, but the difficulty can be figgured out based on what you have titled 'character title.' For example, a title of Slayer indicates that the charactor has completed Normal difficulty, Champion for Nightmare, and Matriarch/Patriarch for Hell.

   If Expansion Then
       Select Case RShift((Asc(p(27)) And &H18), 3)
           Case 1: ParseD2StatsEnd = ParseD2StatsEnd & IIf(Hardcore, "Destroyer", "Slayer") & " "
           Case 2: ParseD2StatsEnd = ParseD2StatsEnd & IIf(Hardcore, "Conquer", "Champion") & " "
           Case 3: ParseD2StatsEnd = ParseD2StatsEnd & IIf(Hardcore, "Guardian", IIf(female, "Matriarch", "Patriarch")) & " "
       End Select
   Else
       Select Case RShift((Asc(p(27)) And &H18), 3)
           Case 1: ParseD2StatsEnd = ParseD2StatsEnd & IIf(female, IIf(Hardcore, "Countess", "Dame"), IIf(Hardcore, "Count", "Sir")) & " "
           Case 2: ParseD2StatsEnd = ParseD2StatsEnd & IIf(female, IIf(Hardcore, "Duchess", "Lady"), IIf(Hardcore, "Duke", "Lord")) & " "
           Case 3: ParseD2StatsEnd = ParseD2StatsEnd & IIf(female, IIf(Hardcore, "Queen", "Baroness"), IIf(Hardcore, "King", "Baron")) & " "
       End Select
   End If

Skywing

Note that Camel's method will work for Diablo II classic only, and not Lord of Destruction.

UserLoser

Yes I guess you could get the difficulty that way.  But what about the act?

c0ol

#4

my %charSirNames = ('expansion',
        {'sc' => ['Slayer', 'Champion', 'Patriarch Matriarch'],
         'hc' => ['Destroyer', 'Conquerer', 'Guardian']},
         'classic',
            {'sc' => ['Sir Dame', 'Lord Lady', 'Baron Baroness'],
         'hc' => ['Count Countess', 'Duke Duchess', 'King Queen']
        });  

sub parseRealmStat {
   my ($statString) = @_;
   my @classes = qw/amazon sorceress necromancer paladin barbarian druid assassin/;
   #                  0f      1f          2m        3m       4m      5m     6f
   my @icons = ('ico/amzn.png', 'ico/sorc.png', 'ico/necro.png', 'ico/pali.png', 'ico/barb.png', 'ico/druid.png', 'ico/asn.png');
   my @diffs = qw/normal nightmare hell/;

   my ($sex) = 0;
   my ($charString,$version,$icon);
   my ($completedActs) = 0;
   my @stats = unpack("C*",$statString);
   my ($charClass, $charLevel, $hcMask, $sirName) =
  ($stats[13], $stats[25], $stats[26], $stats[27]);
 
   $completedActs = ($sirName & 0x3e) >> 1;
   if ($hcMask & 0x20) {
      $version = "expansion";
      $charString = "an ";
      $sirName = int($completedActs/5);
      $completedActs -= $sirName * 5;
   }else{
      $version = "classic";
      $charString = "a ";
      $sirName = int($completedActs/4);
      $completedActs -= $sirName * 4;
   }
   $completedActs++;
   $charString .= "$version ";
   $charClass--;
   if ($hcMask & 0x04) {
      $charString .= "dead " if ($hcMask & 0x08);
      $charString .= "hardcore";
      $hcMask = 'hc';
   }else{
      $charString .= "softcore";
      $hcMask = 'sc';
   }
   
   $sex = 1 if ($charClass == 0 or $charClass == 1 or $charClass == 6);
   if ($classes[$charClass]) {
      $icon = $icons[$charClass];
      $charClass = $classes[$charClass];
   }else{
      $charClass = "Unknown Char Class";
      $icon = $icons[7];
   }
   my $sirNameWord;
   if ($sirName) {
      $sirNameWord =  $charSirNames{$version}{$hcMask}[$sirName-1];
      $sirNameWord = (split(/ /,$sirNameWord))[$sex] if ($sirNameWord =~ / /);
      $sirNameWord .= " ";
   }
   
   my $completed;
   if ($sirName < 3) {
      $completed = "currently in ".$diffs[$sirName]." act $completedActs";
   }else{
      $completed = "who has beaten the game";
   }

   return ($sirNameWord, $charClass, $icon, $charLevel, $charString, $completed);
}

excuse my sloppy code, its old, but will do.