]> ruin.nu Git - ndwebbie.git/blobdiff - launchConfirmation.pl
intel_log
[ndwebbie.git] / launchConfirmation.pl
index 7e56eedbd3fd72608bea6fec712f88d91bff724d..ffe6b11b6c1bb39f524e56437006084d82529315 100644 (file)
 
 use strict;
 use warnings FATAL => 'all';
-no warnings qw(uninitialized);
+use ND::Include;
 
 $ND::TEMPLATE->param(TITLE => 'Launch Confirmation');
 
 our $BODY;
 our $DBH;
-our $LOG;
 my $error;
 
 
 
 die "You don't have access" unless isMember();
 
-if (param('cmd') eq 'submit'){
+if (defined param('cmd') && param('cmd') eq 'submit'){
        my $missions = param('mission');
        my $findplanet = $DBH->prepare("SELECT planetid(?,?,?,?)");
        my $findattacktarget = $DBH->prepare(q{SELECT c.target,c.wave,c.launched FROM  raid_claims c
@@ -57,7 +56,8 @@ if (param('cmd') eq 'submit'){
        while ($missions =~ m/\S+\s+(\d+):(\d+):(\d+)\s+(\d+):(\d+):(\d+)\s+\((?:(\d+)\+)?(\d+)\).*?(?:\d+hrs\s+)?\d+mins\s+(Attack|Defend|Return|Fake Attack|Fake Defend)(.*?)(?:Launching in tick (\d+), arrival in tick (\d+)|ETA: \d+, Return ETA: (\d+))/sg){
                my %mission;
 
-               my $tick = $ND::TICK+$7+$8;
+               my $tick = $ND::TICK+$8;
+               $tick += $7 if defined $7;
                my $eta = $8;
                my $mission = $9;
                my $x = $4;
@@ -93,7 +93,7 @@ if (param('cmd') eq 'submit'){
                                $addattackpoint->execute($ND::UID);
                                $launchedtarget->execute($ND::UID,$claim->{target},$claim->{wave});
                                $mission{Warning} = "OK:$claim->{target},$claim->{wave},$claim->{launched}";
-                               $LOG->execute($ND::UID,"Gave attack point for confirmation on $mission mission to $x:$y:$z, landing tick $tick");
+                               log_message $ND::UID,"Gave attack point for confirmation on $mission mission to $x:$y:$z, landing tick $tick";
                        }
                }
 
@@ -108,7 +108,7 @@ if (param('cmd') eq 'submit'){
                        push @ships,{Ship => $1, Amount => $2};
                }
                $mission{Ships} = \@ships;
-               $LOG->execute($ND::UID,"Pasted confirmation for $mission mission to $x:$y:$z, landing tick $tick");
+               log_message $ND::UID,"Pasted confirmation for $mission mission to $x:$y:$z, landing tick $tick";
                push @missions,\%mission;
        }
        $DBH->commit or $error .= '<p>'.$DBH->errstr.'</p>';