X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=launchConfirmation.pl;h=ffe6b11b6c1bb39f524e56437006084d82529315;hb=e400bf854d1da7e70ea9e78838f82a9bbfe03249;hp=7e56eedbd3fd72608bea6fec712f88d91bff724d;hpb=354c2fb813a139fb08476b6d0e7f30308091038a;p=ndwebbie.git diff --git a/launchConfirmation.pl b/launchConfirmation.pl index 7e56eed..ffe6b11 100644 --- a/launchConfirmation.pl +++ b/launchConfirmation.pl @@ -19,20 +19,19 @@ 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 .= '

'.$DBH->errstr.'

';