}
}
+sub setchannel
+ : Help(Usage: .setchannel X:Y:Z channel | Set channel or bot for a planet)
+ : ACL(irc_setchannel)
+{
+ my ($self,$c,$msg) = @_;
+ my ($x,$y,$z,$channel) = $msg =~ /^(\d+)\D(\d+)\D(\d+) (\S+)$/ or die 'ARGS';
+ my $dbh = $c->model;
+
+ my $findid = $dbh->prepare_cached(q{SELECT id,channel FROM current_planet_stats
+ WHERE x = ? AND y = ? and z = ?});
+ my ($id,$oc) = $dbh->selectrow_array($findid,undef,$x,$y,$z);
+ if ($channel ~~ $oc){
+ $c->reply("$x:$y:$z already got $oc as channel");
+ }elsif($id){
+ $dbh->begin_work;
+ $dbh->do(q{UPDATE planets SET channel = $1 WHERE id = $2}
+ ,undef,$channel,$id);
+ $c->intel_log($id,"Set channel to: $channel");
+ $dbh->commit;
+ if ($oc){
+ $c->reply("Changed $x:$y:$z from <b>$oc</b> to <b>$channel</b>");
+ }else{
+ $c->reply("Setting $x:$y:$z as <b>$channel</b>");
+ }
+ }else{
+ $c->reply("Couldn't find a planet at $x:$y:$z");
+ }
+}
+
1;
+++ /dev/null
-#**************************************************************************
-# Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu> *
-# *
-# 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::Intel;
-use strict;
-use warnings;
-use ND::DB;
-use NDIRC::Access;
-use NDIRC::Misc;
-use ND::Include;
-require Exporter;
-
-our @ISA = qw/Exporter/;
-
-our @EXPORT = qw/setChannel/;
-
-sub setChannel {
- my ($msg, $command) = @_;
- my ($x,$y,$z,$channel);
- if(defined $msg && $msg =~ /^(\d+)\D(\d+)\D(\d+) (\S+)$/){
- $x = $1;
- $y = $2;
- $z = $3;
- $channel = $4;
- }else{
- $ND::server->command("notice $ND::nick Usage: .$command X:Y:Z channel");
- return;
- }
- if (my $user = intel){
- my $findid = $ND::DBH->prepare_cached(q{SELECT id,channel FROM current_planet_stats
- WHERE x = ? AND y = ? and z = ?});
- my ($id,$c) = $ND::DBH->selectrow_array($findid,undef,$x,$y,$z);
- if ($ND::DBH->do('UPDATE planets SET channel = $1 WHERE id = $2'
- ,undef,$channel,$id)){
-
- if (defined $c){
- $ND::server->command("msg $ND::target Changed $x:$y:$z from $ND::B$c$ND::B to $ND::B$channel");
- }else{
- $ND::server->command("msg $ND::target Setting $x:$y:$z as $ND::B$channel");
- }
- intel_log $user->{uid},$id,"Set channel to: $channel";
- }else{
- $ND::server->command("msg $ND::target Couldn't find a planet at $x:$y:$z");
- }
- }
-}
-
-1;
INSERT INTO roles VALUES('irc_sethostile');
INSERT INTO roles VALUES('irc_setnick');
INSERT INTO roles VALUES('irc_setally');
+INSERT INTO roles VALUES('irc_setchannel');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_nick');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_p_intel');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_sethostile');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_setnick');
INSERT INTO group_roles (gid,role) VALUES(1,'irc_setally');
+INSERT INTO group_roles (gid,role) VALUES(1,'irc_setchannel');
INSERT INTO group_roles (gid,role) VALUES(2,'irc_gs');
INSERT INTO group_roles (gid,role) VALUES(2,'irc_scan');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_sethostile');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_setnick');
INSERT INTO group_roles (gid,role) VALUES(3,'irc_setally');
+INSERT INTO group_roles (gid,role) VALUES(3,'irc_setchannel');
INSERT INTO group_roles (gid,role) VALUES(4,'irc_points_others');
INSERT INTO group_roles (gid,role) VALUES(4,'irc_a');
INSERT INTO group_roles (gid,role) VALUES(5,'irc_sethostile');
INSERT INTO group_roles (gid,role) VALUES(5,'irc_setnick');
INSERT INTO group_roles (gid,role) VALUES(5,'irc_setally');
+INSERT INTO group_roles (gid,role) VALUES(5,'irc_setchannel');
INSERT INTO group_roles (gid,role) VALUES(6,'irc_p_intel');
INSERT INTO group_roles (gid,role) VALUES(6,'irc_points_others');