[nexuiz-commits] r8672 - trunk/server/rcon2irc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 25 13:27:51 EST 2010


Author: merlijn
Date: 2010-02-25 13:27:51 -0500 (Thu, 25 Feb 2010)
New Revision: 8672

Modified:
   trunk/server/rcon2irc/fastest_lap.pl
Log:
rewrite the record plugin to actually make a little sense

Modified: trunk/server/rcon2irc/fastest_lap.pl
===================================================================
--- trunk/server/rcon2irc/fastest_lap.pl	2010-02-25 00:44:18 UTC (rev 8671)
+++ trunk/server/rcon2irc/fastest_lap.pl	2010-02-25 18:27:51 UTC (rev 8672)
@@ -1,25 +1,24 @@
 sub out($$@);
-use POSIX qw(ceil floor);
-	# chat: Nexuiz server -> IRC channel, fastest record in nexrun and ctf
-	[ dp => q{:recordset:(\d+):(.*)} => sub {
-		my ($id, $record) = @_;
-		my $recordnick = $id ? $store{"playernick_byid_$id"} : "(console)";
-		my $minutes = $record/60;
-		my $seconds = $record%60;
-		my $ms = int(($record - floor($record))*1000000);
-		my $time;
-		if($seconds < 1) {
-			$time = "\003040:0.$ms";
-		} elsif($minutes < 1) {
-			$time = "\003040:$seconds.$ms";
-		} else {
-			$time = "\00304$minutes:$seconds.$ms";
-		}
-		my $mapname = $store{"map"};
-		if ($mapname =~ m/^ctf_/) {
-			out irc => 0, "PRIVMSG $config{irc_channel} :* \00304$recordnick\017 set the \00304all-time fastest flag capture \00304record\017 with $time ($mapname)";
-		} else {
-			out irc => 0, "PRIVMSG $config{irc_channel} :* \00304$recordnick\017 set the \00304all-time fastest lap \00304record\017 with $time ($mapname)";
-		}
-		return 0;
-	} ],
+
+# chat: Nexuiz server -> IRC channel, fastest record in race and ctf
+[ dp => q{:recordset:(\d+):(.*)} => sub {
+	my ($id, $record) = @_;
+	my $nick = $store{"playernick_byid_$id"} || '(console)';
+	
+	my $time;
+	if ($record < 60) {
+		$time = $record;
+	} else {
+		my $minutes = int($record/60);
+		my $seconds = $record - $minutes*60;
+		$time = "$minutes:$seconds";
+	}
+	
+	if ($store{map} =~ m/^ctf_/) {
+		out irc => 0, "PRIVMSG $config{irc_channel} :* \00306record\017 $nick\017 set the fastest flag capture record with \00304$time\017 on \00304$store{map}\017";
+	} else {
+		out irc => 0, "PRIVMSG $config{irc_channel} :* \00306record\017 $nick\017 set the fastest lap record with \00304$time\017 on \00304$store{map}\017";
+	}
+	
+	return 0;
+} ],



More information about the nexuiz-commits mailing list