Improve 200 rocks exploit fix
[slashemextended.git] / parsexlog.pl
blob1bb53a96f724059dc88ceb391e64eea6affabd9a
1 #!/usr/bin/perl
3 # Dungeon names
4 %dungeons = ( 0 => "the Dungeons of Doom",
5 1 => "Gehennom",
6 2 => "the Gnomish Mines",
7 3 => "the Quest",
8 4 => "Sokoban",
9 5 => "Fort Ludios",
10 6 => "Vlad's Tower",
11 7 => "the Elemental Planes" );
13 # Conducts, in the order that they are stored in the conduct bitfield
14 @conducts = ( "Foodless", "Vegan", "Vegetarian", "Atheist", "Weaponless",
15 "Pacifist", "Illiterate", "Polypileless", "Polyselfless",
16 "Wishless", "Artifact Wishless", "Genocideless" );
18 # Achievements, in the order that they are stored in the achievement
19 # bitfield
20 @achievements = ( "Obtained the Bell of Opening",
21 "Entered Gehennom",
22 "Obtained the Candelabrum of Invocation",
23 "Obtained the Book of the Dead",
24 "Performed the invocation ritual",
25 "Obtained the Amulet of Yendor",
26 "Reached the Elemental Planes",
27 "Reached the Astral Plane",
28 "Ascended",
29 "Completed the Mines",
30 "Completed Sokoban",
31 "Killed Medusa" );
33 while($entry = <>) {
34 # Parse the line and store in the hash %field
35 @fields = split /:/, $entry;
37 foreach $field (@fields) {
38 if($field =~ /^([^=]*)=(.*)$/) {
39 $fname = $1;
40 $fval = $2;
41 $field{$fname} = $fval;
45 # Display
46 printf "%s-%s-%s-%s-%s, %s\n", $field{name},
47 $field{role}, $field{race}, $field{gender}, $field{align},
48 $field{death};
49 printf " Died in %s on level %d (max %d). Final HP %d/%d.\n",
50 $dungeons{$field{deathdnum}}, $field{deathlev}, $field{maxlvl},
51 $field{hp}, $field{maxhp};
53 @c = ();
54 $field{conduct} = oct $field{conduct};
55 for($i = 0; $i <= $#conducts; $i++) {
56 if($field{conduct} & (1 << $i)) {
57 push @c, $conducts[$i];
60 print " Conducts: ", join(', ', @c), "\n";
62 @a = ();
63 $field{achieve} = oct $field{achieve};
64 for($i = 0; $i <= $#achievements; $i++) {
65 if($field{achieve} & (1 << $i)) {
66 push @a, $achievements[$i];
69 print " Notable achievements: ", join(', ', @a), "\n";
72 printf " The game lasted %d turns, and took %d seconds of playtime.\n",
73 $field{turns}, $field{realtime};