}
}
+sub getfleet
+ : Help(Usage: .getfleet username | % can be used as wildcard, e.g. barr%)
+ : ACL(irc_getfleet)
+{
+ my ($self,$c,$msg) = @_;
+ my ($nick) = $msg =~ /^(\S+)$/ or die 'ARGS';
+ my $dbh = $c->model;
+
+ my $f = $dbh->prepare(q{
+SELECT fs.ship, fs.amount, username
+FROM fleet_ships fs
+ JOIN (SELECT fid,username
+ FROM fleets f
+ JOIN users u USING (planet)
+ WHERE mission = 'Full fleet' AND name <> 'Unit'
+ AND username ILIKE $1
+ ORDER BY planet,tick DESC,fid DESC
+ LIMIT 1
+ ) f USING (fid)
+ORDER BY num
+ });
+ $f->execute($nick);
+ my $text;
+ my $username;
+ while (my $ship = $f->fetchrow_hashref){
+ unless (defined $username) {
+ $username = $ship->{username};
+ $text = "<b>$username</b> has: "
+ }
+ $text .= "$ship->{ship} $ship->{amount} ";
+ }
+ if ($text){
+ $c->reply($text);
+ }else{
+ $c->reply("Couldn't find any fleet for $nick");
+ }
+}
+
1;
our @ISA = qw/Exporter/;
-our @EXPORT = qw/addPoints setHost setPNick getFleet/;
-
-sub getFleet {
- my ($nick,$command) = @_;
-
- unless (defined $nick){
- $ND::server->command("notice $ND::nick Usage: $command nick | % can be used as wildcard, e.g. barr%");
- return;
- }
- if (officer() || dc()){
- my $f = $ND::DBH->prepare(q{SELECT fs.ship, fs.amount, username
- FROM fleet_ships fs
- JOIN (SELECT fid,username
- FROM fleets f
- JOIN users u USING (planet)
- WHERE mission = 'Full fleet' AND name <> 'Unit'
- AND username ILIKE $1
- ORDER BY planet,tick DESC,fid DESC
- LIMIT 1
- ) f USING (fid)
- ORDER BY num
- });
- $f->execute($nick);
- my $text;
- my $username;
- while (my $ship = $f->fetchrow_hashref){
- unless (defined $username) {
- $username = $ship->{username};
- $text = "$ND::B$username$ND::O has: "
- }
- $text .= "$ship->{ship} $ship->{amount} ";
- }
- if ($text){
- $ND::server->command("notice $ND::nick $text");
- }else{
- $ND::server->command("notice $ND::nick Couldn't find any fleet for $nick");
- }
- }
-}
+our @EXPORT = qw/addPoints setHost setPNick/;
sub addPoints {
my ($msg, $t) = @_;
INSERT INTO roles VALUES('irc_laston');
INSERT INTO roles VALUES('irc_lastseen');
INSERT INTO roles VALUES('irc_getships');
+INSERT INTO roles VALUES('irc_getfleet');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_nick');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_intel');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_laston');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_lastseen');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_getships');
+INSERT INTO group_roles (gid,role) VALUES(1,'irc_getfleet');
INSERT INTO group_roles (gid,role) VALUES(2,'irc_gs');
INSERT INTO group_roles (gid,role) VALUES(2,'irc_scan');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_laston');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_lastseen');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_getships');
+INSERT INTO group_roles (gid,role) VALUES(3,'irc_getfleet');
INSERT INTO group_roles (gid,role) VALUES(4,'irc_points_others');
INSERT INTO group_roles (gid,role) VALUES(6,'irc_points_others');
INSERT INTO group_roles (gid,role) VALUES(6,'irc_sms');
INSERT INTO group_roles (gid,role) VALUES(6,'irc_getships');
+INSERT INTO group_roles (gid,role) VALUES(6,'irc_getfleet');
INSERT INTO group_roles (gid,role) VALUES(8,'irc_scanreqs');
INSERT INTO group_roles (gid,role) VALUES(8,'irc_anonscan');