X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FMembers.pm;h=6dcc1f67e5f3563fd440a23579f09ab9c63fd0f3;hb=eb3bda37d084c0e6b13c97f88f06d5563c40d2fb;hp=8c44e056590cb0e5832c4ab3281c1f79a79b3a71;hpb=5b6c3c7d0003d636c1c3da6d25734e4aad5736a5;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/Members.pm b/lib/NDWeb/Controller/Members.pm index 8c44e05..6dcc1f6 100644 --- a/lib/NDWeb/Controller/Members.pm +++ b/lib/NDWeb/Controller/Members.pm @@ -32,7 +32,7 @@ sub index : Path : Args(0) { $c->stash(comma => \&comma_value); $c->stash(u => $dbh->selectrow_hashref(q{SELECT planet,defense_points ,attack_points,scan_points,humor_points - , (attack_points+defense_points+scan_points/20) as total_points + , (attack_points+defense_points+scan_points/20)::NUMERIC(5,1) as total_points , sms,rank,hostmask FROM users WHERE uid = ? },undef,$c->user->id) ); @@ -145,6 +145,30 @@ sub postsmsupdate : Local { $c->res->redirect($c->uri_for('')); } +sub postowncoords : Local { + my ( $self, $c ) = @_; + my $dbh = $c->model; + + if ($c->user->planet){ + $c->flash(error => 'You already have a planet set.' + .' Contact a HC if they need to be changed'); + }elsif ($c->req->param('planet') =~ m/(\d+)\D+(\d+)\D+(\d+)/){ + my $planet = $dbh->selectrow_array(q{SELECT planetid($1,$2,$3,TICK()) + },undef,$1,$2,$3); + + if ($planet){ + $dbh->do(q{UPDATE users SET planet = ? WHERE uid = ? + },undef, $planet , $c->user->id); + }else{ + $c->flash(error => "No planet at coords: $1:$2:$3"); + } + }else{ + $c->flash(error => $c->req->param('planet') . " are not valid coords."); + } + + $c->res->redirect($c->uri_for('')); +} + sub postfleetupdate : Local { my ( $self, $c ) = @_; my $dbh = $c->model; @@ -241,6 +265,7 @@ sub postircrequest : Local { (uid,channel,message) VALUES($1,$2,$3) }); $query->execute($c->user->id,$c->req->param('channel'),$c->req->param('message')); + system 'killall','-USR1', 'irssi'; $c->flash(reply => "Msg sent to: ".$c->req->param('channel')); $c->res->redirect($c->uri_for('ircrequest')); @@ -261,7 +286,7 @@ sub points : Local { my $query = $dbh->prepare(qq{SELECT username,defense_points,attack_points ,scan_points,humor_points - ,(attack_points+defense_points+scan_points/20) as total_points + ,(attack_points+defense_points+scan_points/20)::NUMERIC(4,0) as total_points , count(NULLIF(rc.launched,FALSE)) AS raid_points FROM users u LEFT OUTER JOIN raid_claims rc USING (uid) WHERE uid IN (SELECT uid FROM groupmembers WHERE gid = 2)