]> ruin.nu Git - NDIRC.git/blobdiff - Intel.pm
Converted .setally
[NDIRC.git] / Intel.pm
index 4d98d80880dda96a3718dcf45c25f8ec9f1d6be9..83dd833c103c7a87e1ef110f3b1bc73586a5f12d 100644 (file)
--- a/Intel.pm
+++ b/Intel.pm
@@ -27,49 +27,7 @@ require Exporter;
 
 our @ISA = qw/Exporter/;
 
-our @EXPORT = qw/setAlly setChannel/;
-
-sub setAlly {
-       my ($msg, $command) = @_;
-       my ($x,$y,$z,$ally);
-       if(defined $msg && $msg =~ /^(\d+)\D(\d+)\D(\d+) (\S+)$/){
-               $x = $1;
-               $y = $2;
-               $z = $3;
-               $ally = $4;
-       }else{
-               $ND::server->command("notice $ND::nick Usage: .$command X:Y:Z ally | | % can be used for wildcards \%-crew\% will match [F-Crew]");
-               return;
-       }
-       if (my $user = intel){
-               my $aid;
-               if ($ally ne 'unknown'){
-                       ($aid,$ally) = $ND::DBH->selectrow_array("SELECT id,name FROM alliances WHERE name ILIKE ?",undef,$ally);
-               }
-               if ($ally){
-                       my $findid = $ND::DBH->prepare(q{SELECT id,alliance FROM current_planet_stats 
-                               WHERE x = ? AND y = ? and z = ?});
-                       my ($id,$alliance) = $ND::DBH->selectrow_array($findid,undef,$x,$y,$z);
-                       unless ($id){
-                               $ND::server->command("msg $ND::target Couldn't find a planet at $x:$y:$z");
-                               return;
-                       }
-                       if($ND::DBH->do('UPDATE planets SET alliance_id = $1 WHERE id = $2'
-                               ,undef,$aid,$id)){
-                               if (defined $alliance){
-                                       $ND::server->command("msg $ND::target Changed $x:$y:$z from $ND::B$alliance$ND::B to $ND::B$ally");
-                               }else{
-                                       $ND::server->command("msg $ND::target Setting $x:$y:$z as $ND::B$ally");
-                               }
-                               intel_log $user->{uid},$id,"Set alliance_id to: $aid ($ally)";
-                       }else{
-                               $ND::server->command("msg $ND::target Couldn't set alliance_id to: $aid");
-                       }
-               }else{
-                       $ND::server->command("msg $ND::target Couldn't find such an alliance");
-               }
-       }
-}
+our @EXPORT = qw/setChannel/;
 
 sub setChannel {
        my ($msg, $command) = @_;