comparison skillbot.pl @ 35:b0436bc63f9e

Merging df's branch
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 07 Dec 2008 11:18:23 +0000
parents b36c677365aa 8b631d17dfd0
children 6baa10b255ae
comparison
equal deleted inserted replaced
30:b36c677365aa 35:b0436bc63f9e
223 sub on_public 223 sub on_public
224 { 224 {
225 my ($self, $event) = @_; 225 my ($self, $event) = @_;
226 my ($their_nick, $msg) = ($event->nick, $event->args); 226 my ($their_nick, $msg) = ($event->nick, $event->args);
227 227
228 # lists the current chars in training of the caller
228 if ($msg =~ /^\!eta(\s+(.+))?/i) { 229 if ($msg =~ /^\!eta(\s+(.+))?/i) {
229 my $found = 0; 230 my $found = 0;
230 for my $f (@friends) { 231 for my $f (@friends) {
231 if ((defined $2 && lc($f->{char}->name) eq lc($2)) 232 if ((defined $2 && lc($f->{char}->name) eq lc($2))
232 || (!defined $2 && $f->{nick} eq $their_nick)) { 233 || (!defined $2 && $f->{nick} eq $their_nick)) {
245 } 246 }
246 247
247 if ($found == 0) { 248 if ($found == 0) {
248 $self->privmsg('#' . $config{channel}, "No characters found"); 249 $self->privmsg('#' . $config{channel}, "No characters found");
249 } 250 }
251 }
252
253 # force update/reload of the friends/training data
254 if ($msg =~ /^\!update/i) {
255 update_friends($self);
256 check_training($self);
257 $self->privmsg('#' . $config{channel}, "Done");
258 }
259
260 # lists the chars in order of shortest training time
261 if ($msg =~ /^\!next/i) {
262 my $nreply = "Training: ";
263
264 for my $f (sort { $a->{skill}->finish_time <=> $b->{skill}->finish_time } grep(defined $_->{skill}, @friends)) {
265 $nreply .= $f->{char}->name . " (" . $f->{skill}->time_remaining . ") | ";
266 }
267
268 $self->privmsg('#' . $config{channel}, $nreply);
250 } 269 }
251 } 270 }
252 271
253 sub on_notice 272 sub on_notice
254 { 273 {