… | |
… | |
119 | or return $who->reply ($npc, "I don't know any person named '$args'."); |
119 | or return $who->reply ($npc, "I don't know any person named '$args'."); |
120 | |
120 | |
121 | my $s = $pl->ob->{stats_death} |
121 | my $s = $pl->ob->{stats_death} |
122 | or return $who->reply ($npc, "$args didn't die even once."); |
122 | or return $who->reply ($npc, "$args didn't die even once."); |
123 | |
123 | |
124 | my $rep = "$args died a total of " . $pl->ob->kv_get ("schmorplog_death_count") . " times, among them:\n\n\n\n"; |
124 | my $rep = "$args died a total of " . $pl->ob->kv_get ("schmorplog_death_count") . " times, among them:\n\n"; |
125 | |
125 | |
126 | for (sort { $s->{$b} <=> $s->{$a} } keys %$s) { |
126 | for (sort { $s->{$b} <=> $s->{$a} } keys %$s) { |
127 | $rep .= "$s->{$_} time(s) due to $_.\n\n"; |
127 | $rep .= sprintf " C<%4d> time(s) due to %s.\n", $s->{$_}, $_; |
128 | } |
128 | } |
129 | |
129 | |
130 | $who->reply ($npc, $rep); |
130 | $who->reply ($npc, $rep); |
131 | }; |
131 | }; |
132 | } elsif ($cmd eq "kills") { |
132 | } elsif ($cmd eq "kills") { |
… | |
… | |
135 | or return $who->reply ($npc, "I don't know any person named '$args'."); |
135 | or return $who->reply ($npc, "I don't know any person named '$args'."); |
136 | |
136 | |
137 | my $s = $pl->ob->{stats_kill} |
137 | my $s = $pl->ob->{stats_kill} |
138 | or return $who->reply ($npc, "I don't know of I<anything> that $args has killed so far."); |
138 | or return $who->reply ($npc, "I don't know of I<anything> that $args has killed so far."); |
139 | |
139 | |
140 | my $rep = sprintf "\n\nC<%6s> %s\n\n", "Kills", "Name"; |
140 | my $rep = sprintf "Here is a list of all the kills I know about:\n\n"; |
141 | for (sort { $s->{$a} <=> $s->{$b} } keys %$s) { |
141 | for (sort { $s->{$b} <=> $s->{$a} } keys %$s) { |
142 | $rep .= sprintf "C<%6s> %s\n\n", $s->{$_}, $_; |
142 | $rep .= sprintf " C<%6s> %s\n", $s->{$_}, $_; |
143 | } |
143 | } |
144 | |
144 | |
145 | $who->reply ($npc, $rep); |
145 | $who->reply ($npc, $rep); |
146 | }; |
146 | }; |
147 | } elsif ($cmd eq "hi") { |
147 | } elsif ($cmd eq "hi") { |
148 | $who->reply ($npc, "Hello!\n\n" |
148 | $who->reply ($npc, "Hello!\n\n" |
149 | . "I am a statistician, I keep statistics about all people here.\n\n" |
149 | . "I am a statistician, I keep statistics about all people here.\n\n" |
150 | . "To know how often somebody died, ask C<deaths> I<playername>\n\n" |
150 | . " - To know how often somebody died, ask C<deaths> I<playername>\n" |
151 | . "To know how many kills somebody scored, ask C<kills> I<playername>"); |
151 | . " - To know how many kills somebody scored, ask C<kills> I<playername>"); |
152 | } else { |
152 | } else { |
153 | $who->reply ($npc, "No idea what you want of me, how about saying 'hi' first?"); |
153 | $who->reply ($npc, "No idea what you want of me, how about saying 'hi' first?"); |
154 | } |
154 | } |
155 | |
155 | |
156 | $cmd = lc $cmd; |
156 | $cmd = lc $cmd; |