X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FIntel.pm;fp=Commands%2FIntel.pm;h=5e79c96a6c859db3ab2df9a16470968a60a99b76;hb=f6172920f8ba7bfd9a15260edcf01322bf09472b;hp=0000000000000000000000000000000000000000;hpb=ca8f6135c9709112a5d6605ac34064f5946d9570;p=NDIRC.git diff --git a/Commands/Intel.pm b/Commands/Intel.pm new file mode 100644 index 0000000..5e79c96 --- /dev/null +++ b/Commands/Intel.pm @@ -0,0 +1,49 @@ +#************************************************************************** +# Copyright (C) 2009 by Michael Andreen * +# * +# This program is free software; you can redistribute it and/or modify * +# it under the terms of the GNU General Public License as published by * +# the Free Software Foundation; either version 2 of the License, or * +# (at your option) any later version. * +# * +# This program is distributed in the hope that it will be useful, * +# but WITHOUT ANY WARRANTY; without even the implied warranty of * +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# GNU General Public License for more details. * +# * +# You should have received a copy of the GNU General Public License * +# along with this program; if not, write to the * +# Free Software Foundation, Inc., * +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +#**************************************************************************/ + +package NDIRC::Commands::Intel; + +use strict; +use warnings; +use feature ':5.10'; + +use Moose; +use MooseX::MethodAttributes; + +sub sethostile + : Help(Usage: .sethostile X:Y:Z) + : ACL(irc_sethostile) +{ + my ($self,$c,$msg) = @_; + my ($x,$y,$z) = $msg =~ /^(\d+)\D(\d+)\D(\d+)$/ or die 'ARGS'; + my $dbh = $c->model; + + my $findid = $dbh->prepare(q{SELECT planetid(?,?,?,tick())}); + my ($id) = $dbh->selectrow_array($findid,undef,$x,$y,$z); + $dbh->begin_work; + my $rv = $dbh->do(q{UPDATE planets SET planet_status = 'Hostile' WHERE id = $1} + ,undef,$id); + if ($rv == 1){ + $c->reply("$x:$y:$z is now marked s hostile"); + $c->intel_log($id,"Set planet_status to: 'Hostile'"); + } + $dbh->commit; +} + +1;