]> ruin.nu Git - NDIRC.git/blobdiff - Commands/Usermgm.pm
Update to new database structure
[NDIRC.git] / Commands / Usermgm.pm
index deae5a2d93c0742f7b9dd7df19acbcb5b45ae79c..e85638562653df4206abff60a1ae6a90c578f42d 100644 (file)
@@ -259,10 +259,10 @@ sub getships
        my $f = $dbh->prepare(q{
 SELECT username,SUM(fs.amount) AS amount
 FROM users u
-       JOIN (SELECT DISTINCT ON (planet) planet,fid FROM fleets
+       JOIN (SELECT DISTINCT ON (pid) pid,fid FROM fleets
                WHERE mission = 'Full fleet' AND name <> 'Unit'
-               ORDER BY planet,tick DESC,fid DESC
-       ) f  USING (planet)
+               ORDER BY pid,tick DESC,fid DESC
+       ) f  USING (pid)
        JOIN fleet_ships fs USING (fid)
 WHERE ship ILIKE $1 AND uid IN (SELECT uid FROM groupmembers WHERE gid = 2)
 GROUP BY username ORDER BY amount DESC
@@ -304,10 +304,10 @@ SELECT fs.ship, fs.amount, username
 FROM fleet_ships fs
        JOIN (SELECT fid,username
                FROM fleets f
-                       JOIN users u USING (planet)
+                       JOIN users u USING (pid)
                WHERE mission = 'Full fleet' AND name <> 'Unit'
                        AND username ILIKE $1
-               ORDER BY planet,tick DESC,fid DESC
+               ORDER BY pid,tick DESC,fid DESC
                LIMIT 1
        ) f  USING (fid)
 ORDER BY num
@@ -404,11 +404,11 @@ SELECT username,hostmask,pnick FROM users WHERE hostmask ILIKE $1 OR pnick ILIKE
 }
 
 sub a
-       : Help(Usage: .a username [points] | % can be used for wildcards \%arro\% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
+       : Help(Usage: .a username [points] | % can be used for wildcards %arro% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
        : ACL(irc_a)
 {
        my ($self,$c,$msg) = @_;
-       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(\d+)?(\.\d+)?))?$/ or die 'ARGS';
+       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(:?\d+|\d*\.\d+)))?$/ or die 'ARGS';
        $points //= 1;
 
        my ($fleets) = $c->model->selectrow_array(q{
@@ -427,32 +427,32 @@ WHERE not launched  AND tick + 24 > tick()
 }
 
 sub d
-       : Help(Usage: .d username [points] | % can be used for wildcards \%arro\% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
+       : Help(Usage: .d username [points] | % can be used for wildcards %arro% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
        : ACL(irc_d)
        : Type(def)
 {
        my ($self,$c,$msg) = @_;
-       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(\d+)?(\.\d+)?))?$/ or die 'ARGS';
+       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(:?\d+|\d*\.\d+)))?$/ or die 'ARGS';
 
        addPoints($c, 'defense', $nick, $points);
 }
 
 sub s
-       : Help(Usage: .s username [points] | % can be used for wildcards \%arro\% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
+       : Help(Usage: .s username [points] | % can be used for wildcards %arro% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
        : ACL(irc_s)
 {
        my ($self,$c,$msg) = @_;
-       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(\d+)?(\.\d+)?))?$/ or die 'ARGS';
+       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(:?\d+|\d*\.\d+)))?$/ or die 'ARGS';
 
        addPoints($c, 'scan', $nick, $points);
 }
 
 sub h
-       : Help(Usage: .h username [points] | % can be used for wildcards \%arro\% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
+       : Help(Usage: .h username [points] | % can be used for wildcards %arro% will match barrow, if the number of points isn't specified, then 1 will be assumed.)
        : ACL(irc_h)
 {
        my ($self,$c,$msg) = @_;
-       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(\d+)?(\.\d+)?))?$/ or die 'ARGS';
+       my ($nick,$points) = $msg =~ /^(\S+)(?: (-?(:?\d+|\d*\.\d+)))?$/ or die 'ARGS';
 
        addPoints($c, 'humor', $nick, $points);
 }