9 our $VERSION = '0.001';
11 use Encode qw
/encode/;
14 use Term
::ANSIColor
':constants';
17 achieve_sokoban achieve_luckstone achieve_medusa achieve_bell achieve_gehennom achieve_candelabrum achieve_book achieve_invocation achieve_amulet achieve_endgame achieve_astral achieve_ascended
19 combo_arc_hum_law combo_arc_hum_neu combo_arc_dwa_law combo_arc_gno_neu
20 combo_bar_hum_neu combo_bar_hum_cha combo_bar_orc_cha
21 combo_cav_hum_law combo_cav_hum_neu combo_cav_dwa_law combo_cav_gno_neu
22 combo_hea_hum_neu combo_hea_gno_neu
24 combo_mon_hum_law combo_mon_hum_neu combo_mon_hum_cha
25 combo_pri_hum_law combo_pri_hum_neu combo_pri_hum_cha combo_pri_elf_cha
26 combo_ran_hum_neu combo_ran_hum_cha combo_ran_elf_cha combo_ran_gno_neu combo_ran_orc_cha
27 combo_rog_hum_cha combo_rog_orc_cha
30 combo_val_hum_law combo_val_hum_neu combo_val_dwa_law
31 combo_wiz_hum_neu combo_wiz_hum_cha combo_wiz_elf_cha combo_wiz_gno_neu combo_wiz_orc_cha
33 conduct_foodless conduct_vegan conduct_vegetarian conduct_atheist conduct_weaponless conduct_pacifist conduct_illiterate conduct_genocideless conduct_polypileless conduct_polyselfless conduct_wishless conduct_artiwishless
35 uconduct_survivor uconduct_boneless uconduct_minscore
/;
39 my @checks = @
{$dash->{checks
}};
40 my %numbers = %{$dash->{numbers
}};
45 #Sokoban #Luckstone #Medusa #Bell #Gehennom #Candelabrum
46 #Book #Invocation #Amulet #Endgame #Astral #Ascended
50 #Arc-Hum-Law #Arc-Hum-Neu #Arc-Dwa-Law #Arc-Gno-Neu
51 #Bar-Hum-Neu #Bar-Hum-Cha #Bar-Orc-Cha
52 #Cav-Hum-Law #Cav-Hum-Neu #Cav-Dwa-Law #Cav-Gno-Neu
53 #Hea-Hum-Neu #Hea-Gno-Neu
55 #Mon-Hum-Law #Mon-Hum-Neu #Mon-Hum-Cha
56 #Pri-Hum-Law #Pri-Hum-Neu #Pri-Hum-Cha #Pri-Elf-Cha
57 #Ran-Hum-Neu #Ran-Hum-Cha #Ran-Elf-Cha #Ran-Gno-Neu #Ran-Orc-Cha
58 #Rog-Hum-Cha #Rog-Orc-Cha
61 #Val-Hum-Law #Val-Hum-Neu #Val-Dwa-Law
62 #Wiz-Hum-Neu #Wiz-Hum-Cha #Wiz-Elf-Cha #Wiz-Gno-Neu #Wiz-Orc-Cha
66 #Foodless #Vegan #Vegetarian #Atheist
67 #Weaponless #Pacifist #Illiterate #Genocideless
68 #Polypileless #Polyselfless #Wishless #Artiwishless
72 #Survivor #Boneless #Minscore
76 Time played: $numbers{totalrealtime}
77 Games: $numbers{games}
78 Ascensions: $numbers{ascensions}
79 Most HP: $numbers{maxhp}
80 Most points: $numbers{maxpoints}
81 Most conducts: $numbers{maxconducts}
82 Least turns: $numbers{minturns}
83 Least time: $numbers{minrealtime}
87 for my $check (@order) {
88 my $color = (grep { $_ eq $check } @checks) ? GREEN UNDERLINE
: RED
;
89 $base =~ s/#([a-zA-Z-]+)/$color$1$rst/;
91 $base =~ s/([A-Z ]+)\n=*/BOLD($1).RESET/ge;
97 my ($user_or_path) = @_;
99 if ($user_or_path =~ /^\w+$/) { # Looks like a user
100 $stats = naodash_user
$user_or_path
102 $stats = naodash_xlog read_file
$user_or_path
104 print encode
'UTF-8', naodash_to_ansi
$stats ## no critic (RequireCheckedSyscalls)
114 App::NAOdash - Analyze NetHack xlogfiles and extract statistics (command-line interface)
119 App::NAOdash::run(@ARGV);
123 App::NAOdash is the backend of the L<naodash> script, a command-line
124 interface to L<NetHack::NAOdash>.
126 It defines two functions:
130 =item B<naodash_to_ansi>(I<$stats>)
132 Takes the result of B<naodash_user> or B<naodash_xlog> and presents it
133 in a text form, using ANSI escape sequences to indicate the
134 presence/absence of checks.
136 =item B<run>(I<$user_or_path>)
138 Analyzes the xlogfile for the given user / at the given path, passes
139 the result through B<naodash_to_ansi> and prints the result.
141 If the argument contains non-word characters, it is interpreted as a
142 path. Otherwise it is interpreted as a NAO username.
148 L<naodash>, L<NetHack::NAOdash>, L<App::Web::NAOdash>
152 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
154 =head1 COPYRIGHT AND LICENSE
156 Copyright (C) 2015 by Marius Gavrilescu
158 This library is free software; you can redistribute it and/or modify
159 it under the same terms as Perl itself, either Perl version 5.20.2 or,
160 at your option, any later version of Perl 5 you may have available.