]> ruin.nu Git - NDIRC.git/blobdiff - Usermgm.pm
Converted .getships and .shipshome
[NDIRC.git] / Usermgm.pm
index b24e3e11ab92e659c9e4cfdc156014bf77425fd1..21fbce815aabdc876d2fe79cfe8095035c617e5e 100644 (file)
@@ -25,50 +25,7 @@ require Exporter;
 
 our @ISA = qw/Exporter/;
 
-our @EXPORT = qw/addPoints setHost setPNick getShips getFleet/;
-
-sub getShips {
-       my ($ship,$command) = @_;
-
-       unless (defined $ship){
-               $ND::server->command("notice $ND::nick Usage: .$command ship | % can be used as wildcard, e.g. beet%");
-               return;
-       }
-       if (officer() || dc()){
-               my $f = $ND::DBH->prepare(qq{SELECT username,SUM(fs.amount) AS amount
-                       FROM users u 
-                               JOIN (SELECT DISTINCT ON (planet) planet,fid FROM fleets
-                                       WHERE mission = 'Full fleet' AND name <> 'Unit'
-                                       ORDER BY planet,tick DESC,fid DESC) f  USING (planet) 
-                               JOIN fleet_ships fs USING (fid)
-                       WHERE ship ILIKE ? AND uid IN (SELECT uid FROM groupmembers WHERE gid = 2)
-                       GROUP BY username ORDER BY amount DESC
-                       });
-               if ($command eq 'shipshome'){
-                       $f = $ND::DBH->prepare(q{
-SELECT username,SUM(amount) AS amount
-FROM available_ships
-WHERE ship ILIKE ? AND uid IN (SELECT uid FROM groupmembers WHERE gid = 2)
-GROUP BY username ORDER BY amount DESC
-                       });
-               }
-               $f->execute($ship);
-               my $text;
-               my $i = 0;
-               my $total = 0;
-               while (my $user = $f->fetchrow_hashref){
-                       $user->{last} = '?' unless defined $user->{last};
-                       $text .= "$user->{username}: $user->{amount} ";
-                       $i++;
-                       $total += $user->{amount};
-               }
-               if ($text){
-                       $ND::server->command("notice $ND::nick $ND::B$i$ND::B Users with $ND::B$total $ship$ND::B: $text");
-               }else{
-                       $ND::server->command("msg $ND::target $ND::B$i$ND::B Couldn't find any user with $ND::B$ship$ND::B:");
-               }
-       }
-}
+our @EXPORT = qw/addPoints setHost setPNick getFleet/;
 
 sub getFleet {
        my ($nick,$command) = @_;