changeset 35:b0436bc63f9e

Merging df's branch
author Dominic Cleal <dominic@computerkb.co.uk>
date Sun, 07 Dec 2008 11:18:23 +0000
parents b36c677365aa (current diff) 8b631d17dfd0 (diff)
children 6baa10b255ae
files skillbot.pl
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/skillbot.pl	Sun Dec 07 10:35:39 2008 +0000
+++ b/skillbot.pl	Sun Dec 07 11:18:23 2008 +0000
@@ -225,6 +225,7 @@
 	my ($self, $event) = @_;
 	my ($their_nick, $msg) = ($event->nick, $event->args);
 
+	# lists the current chars in training of the caller
 	if ($msg =~ /^\!eta(\s+(.+))?/i) {
 		my $found = 0;
 		for my $f (@friends) {
@@ -248,6 +249,24 @@
 			$self->privmsg('#' . $config{channel}, "No characters found");
 		}
 	}
+	
+	# force update/reload of the friends/training data
+	if ($msg =~ /^\!update/i) {
+		update_friends($self);
+		check_training($self);
+		$self->privmsg('#' . $config{channel}, "Done");
+	}
+
+	# lists the chars in order of shortest training time
+	if ($msg =~ /^\!next/i) {
+		my $nreply = "Training: ";
+		
+		for my $f (sort { $a->{skill}->finish_time <=> $b->{skill}->finish_time } grep(defined $_->{skill}, @friends)) {
+			$nreply .= $f->{char}->name . " (" . $f->{skill}->time_remaining . ") | ";
+		}
+		
+		$self->privmsg('#' . $config{channel}, $nreply);
+	}
 }
 
 sub on_notice