]> ruin.nu Git - NDIRC.git/blobdiff - Def.pm
Converted .settype and .settypeall
[NDIRC.git] / Def.pm
diff --git a/Def.pm b/Def.pm
index d8115012c5c179f2975935e5ac46dc455ea62cc7..f2285d1572930b887585f9ec31bfbfe726ae8514 100644 (file)
--- a/Def.pm
+++ b/Def.pm
@@ -28,7 +28,7 @@ require Exporter;
 
 our @ISA = qw/Exporter/;
 
-our @EXPORT = qw/showCall setType takeCall covCall ignoreCall
+our @EXPORT = qw/showCall takeCall covCall ignoreCall
        setDefPrio setCalc getCalc/;
 
 sub showCall {
@@ -58,70 +58,6 @@ SQL
        }
 }
 
-sub setType {
-       my ($msg,$command) = @_;
-       my ($type,$id,$x,$y,$z) = @_;
-       if ($command eq 'settypeall'){
-               if (defined $msg && $msg =~ /^(\d+) (.*)$/){
-                       $type = $2;
-                       $id = $1
-               }else{
-                       $ND::server->command("notice $ND::nick Usage: $command callId type");
-                       return;
-               }
-       }else{
-               if (defined $msg && $msg =~ /^(\d+) (\d+):(\d+):(\d+) (.*)$/){
-                       $type = $5;
-                       $id = $1;
-                       $x = $2;
-                       $y = $3;
-                       $z = $4;
-               }elsif (defined $msg && $msg =~ /^(\d+) (.*)$/){
-                       $id = $1;
-                       $type = $2;
-               }else{
-                       $ND::server->command("notice $ND::nick Usage: $command incId type | or: $command callId X:Y:Z type");
-                       return;
-               }
-       }
-       if (my $user = dc()){
-               my $fleet;
-               my $query = qq{
-                       SELECT i.id,call,shiptype, coords(x,y,z),c.landing_tick - tick() FROM incomings i 
-                               JOIN current_planet_stats p ON i.sender = p.id
-                               JOIN calls c ON i.call = c.id
-                       };
-               if ($command eq 'settypeall'){
-                       $fleet = $ND::DBH->prepare(qq{
-                                       $query
-                                       WHERE i.call = ?
-                               });
-                       $fleet->execute($id);
-               }elsif (defined $x){
-                       $fleet = $ND::DBH->prepare(qq{
-                                       $query
-                                       WHERE i.call = ? AND p.id = planetid(?,?,?,tick()) 
-                               });
-                       $fleet->execute($id,$x,$y,$z);
-               }else{
-                       $fleet = $ND::DBH->prepare(qq{
-                                       $query
-                                       WHERE i.id = ?
-                               });
-                       $fleet->execute($id);
-               }       
-               $type = escapeHTML($type);
-               while (my ($id,$call,$oldtype,$coords,$tick) = $fleet->fetchrow()){
-                       if($ND::DBH->do(q{UPDATE incomings SET shiptype = ? WHERE id = ?},undef,$type,$id) == 1){
-                               def_log $user->{uid}, $call , "Set fleet: [B] $id [/B] to: [B] $type [/B]";
-                               $ND::server->command("msg $ND::target Set fleet from $coords on call $call to $type (previously $oldtype)");
-                               if ($tick < 0 && not (defined $x && $x eq 'call')){
-                                       $ND::server->command("msg $ND::target This call is old, did you use the call id, instead of inc id by accident? You can use .settypeall callid to set the type on all incs in a call.");
-                               }
-                       }
-               }
-       }
-}
 sub takeCall {
        my ($msg,$command) = @_;
        my ($id);