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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Aug 18 15:08:41 EDT 2009


Author: fruitiex
Date: 2009-08-18 15:08:40 -0400 (Tue, 18 Aug 2009)
New Revision: 7463

Added:
   trunk/server/rcon2irc/fastest_lap.pl
   trunk/server/rcon2irc/irc_nick_change.pl
Log:
two rcon2irc plugins by Mattias


Added: trunk/server/rcon2irc/fastest_lap.pl
===================================================================
--- trunk/server/rcon2irc/fastest_lap.pl	                        (rev 0)
+++ trunk/server/rcon2irc/fastest_lap.pl	2009-08-18 19:08:40 UTC (rev 7463)
@@ -0,0 +1,25 @@
+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;
+	} ],

Added: trunk/server/rcon2irc/irc_nick_change.pl
===================================================================
--- trunk/server/rcon2irc/irc_nick_change.pl	                        (rev 0)
+++ trunk/server/rcon2irc/irc_nick_change.pl	2009-08-18 19:08:40 UTC (rev 7463)
@@ -0,0 +1,11 @@
+sub out($$@);
+	# chat: IRC channel -> Nexuiz server, nick change
+ 	[ irc => q{:([^! ]*)![^ ]* (?i:NICK) :(.*)} => sub {
+ 		my ($nick, $newnick) = @_;
+ 		$nick = color_dpfix $nick;
+ 			# allow the nickname to contain colors in DP format! Therefore, NO color_irc2dp on the nickname!
+ 		$newnick = color_irc2dp $newnick;
+ 		$newnick =~ s/(["\\])/\\$1/g;
+ 		out dp => 0, "rcon2irc_say_as \"* $nick on IRC\" \"is now known as $newnick\"";
+ 		return 0;
+ 	} ],



More information about the nexuiz-commits mailing list