1 #**************************************************************************
2 # Copyright (C) 2008 by Michael Andreen <harvATruinDOTnu> *
4 # This program is free software; you can redistribute it and/or modify *
5 # it under the terms of the GNU General Public License as published by *
6 # the Free Software Foundation; either version 2 of the License, or *
7 # (at your option) any later version. *
9 # This program is distributed in the hope that it will be useful, *
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 # GNU General Public License for more details. *
14 # You should have received a copy of the GNU General Public License *
15 # along with this program; if not, write to the *
16 # Free Software Foundation, Inc., *
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 #**************************************************************************/
20 package NDIRC::Commands::PA;
26 use MooseX::MethodAttributes;
31 : Help(usage: .p X:Y:Z | or .p nick with high enough access)
33 my ($self, $c, $msg) = @_;
36 if ($msg =~ /(\d+)\D+(\d+)\D+(\d+)/){
40 }elsif ($msg && $c->check_user_roles(qw/irc_p_nick/)){
46 my $f = $c->model->prepare(q{
47 SELECT coords(x,y,z),ruler,planet,race,score,size,value,scorerank,sizerank,
48 valuerank, xp, xprank, alliance, relationship, nick, planet_status, hit_us, channel
49 FROM current_planet_stats WHERE (x = $1 AND y = $2 and z = $3) OR nick ILIKE $4 LIMIT 1
51 $f->execute($x,$y,$z,$nick);
52 if (my $planet = $f->fetchrow_hashref()){
53 for (keys %{$planet}){
54 $planet->{$_} = valuecolor(1,$planet->{$_});
57 if ($c->check_user_roles(qw/irc_p_intel/)){
58 $ally = "Alliance=$planet->{alliance} ($planet->{relationship}), Nick=$planet->{nick} ($planet->{planet_status}), Channel: $planet->{channel}, Hostile Count: $planet->{hit_us},";
60 $c->reply("$planet->{coords} $planet->{ruler} OF $planet->{planet},$ally Race=$planet->{race}, Score=$planet->{score} ($planet->{scorerank}), Size=$planet->{size} ($planet->{sizerank}), Value=$planet->{value} ($planet->{valuerank}), XP=$planet->{xp} ($planet->{xprank})");
62 $c->reply("Couldn't find planet: $msg");