X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FPages%2FRaids.pm;h=afb91c1adb64501481b5f643837489755edc570d;hb=99ea1738beb3fd8eba6a016cbb4d5c95fa6834e2;hp=4af8631b612fb28fcb8facf49536baab39671a31;hpb=b9159022387023d73c9a6369a0dadcb20760988e;p=ndwebbie.git diff --git a/ND/Web/Pages/Raids.pm b/ND/Web/Pages/Raids.pm index 4af8631..afb91c1 100644 --- a/ND/Web/Pages/Raids.pm +++ b/ND/Web/Pages/Raids.pm @@ -19,7 +19,7 @@ package ND::Web::Pages::Raids; use strict; -use warnings FATAL => 'all'; +use warnings; use ND::Include; use POSIX; use CGI qw/:standard/; @@ -63,7 +63,6 @@ sub generateClaimXml : method { while (my $target = $targets->fetchrow_hashref){ my %target; $target{Id} = $target->{id}; - $target{Coords} = $target->{id}; my @waves; for (my $i = 1; $i <= $raid->{waves}; $i++){ my %wave; @@ -83,9 +82,6 @@ sub generateClaimXml : method { $claimers = join '/', @claimers; if ($owner){ $wave{Command} = 'Unclaim'; - if ($raid->{released_coords}){ - $target{Coords} = $DBH->selectrow_array('SELECT coords(x,y,z) FROM current_planet_stats WHERE id = ?',undef,$target->{planet}); - } }elsif ($joinable){ $wave{Command} = 'Join'; }else{ @@ -178,7 +174,7 @@ sub render_body { return $self->generateClaimXml($BODY,$raid,$from); } if ($self->{XML} && param('cmd') eq 'gettargets' ){ - $_ = listTargets(); + $_ = $self->listTargets(); $BODY->param(TargetList => $_); } @@ -195,7 +191,7 @@ sub render_body { $noingal = "AND NOT (x = $planet->{x} AND y = $planet->{y})"; } $BODY->param(Message => parseMarkup($raid->{message})); - $BODY->param(LandingTick => parseMarkup($raid->{tick})); + $BODY->param(LandingTick => $raid->{tick}); my $targetquery = $DBH->prepare(qq{SELECT r.id, r.planet, size, score, value, p.x,p.y,p.z, race, p.value - p.size*200 -coalesce(c.metal+c.crystal+c.eonium,0)/150 - coalesce(c.structures,(SELECT avg(structures) FROM covop_targets)::int)*1500 AS fleetvalue,(c.metal+c.crystal+c.eonium)/100 AS resvalue, comment FROM current_planet_stats p JOIN raid_targets r ON p.id = r.planet @@ -207,6 +203,14 @@ sub render_body { my @targets; while (my $target = $targetquery->fetchrow_hashref){ my %target; + if ($planet){ + if ($planet->{x} == $target->{x}){ + $target{style} = 'incluster'; + } + $target{ScoreBash} = 'bash' if ($target->{score}/$planet->{score} < 0.4); + $target{ValueBash} = 'bash' if ($target->{value}/$planet->{value} < 0.4); + #next if ($target->{score}/$planet->{score} < 0.4) && ($target->{value}/$planet->{value} < 0.4); + } $target{Id} = $target->{id}; $target{Race} = $target->{race}; my $num = pow(10,length($target->{score})-2); @@ -224,7 +228,7 @@ sub render_body { $target{comment} = parseMarkup($target->{comment}) if ($target->{comment}); my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) type, tick, scan FROM scans - WHERE planet = ? AND type ~ 'Unit|Planet|Military|.* Analysis' AND tick + 24 > tick() + WHERE planet = ? AND type ~ 'Unit|Planet|Advanced Unit|.* Analysis' AND tick + 24 > tick() AND scan is not null GROUP BY type, tick, scan ORDER BY type ,tick DESC}); $scans->execute($target->{planet}); my %scans; @@ -233,11 +237,11 @@ sub render_body { } my @scans; - for my $type ('Planet','Unit','Military','Surface Analysis','Technology Analysis'){ + for my $type ('Planet','Unit','Advanced Unit','Surface Analysis','Technology Analysis'){ next unless exists $scans{$type}; my $scan = $scans{$type}; if ($self->{TICK} - $scan->{tick} > 5){ - $scan->{scan} =~ s{}{}; + $scan->{scan} =~ s{}{}; } if ($type eq 'Planet'){ $target{PlanetScan} = $scan->{scan}; @@ -247,11 +251,6 @@ sub render_body { } $target{Scans} = \@scans; - if ($planet){ - if ($planet->{x} == $target->{x}){ - $target{style} = 'incluster'; - } - } my @roids; my @claims; @@ -259,9 +258,9 @@ sub render_body { for (my $i = 1; $i <= $raid->{waves}; $i++){ my $roids = floor(0.25*$size); $size -= $roids; - my $xp; + my $xp = 0; if ($planet){ - $xp = max(0,floor($roids * 10 * (min(2,$target{Score}/$planet->{score}) + min(2,$target{Value}/$planet->{value})-1))); + $xp = pa_xp($roids,$planet->{score},$planet->{value},$target{Score},$target{Value}); } push @roids,{Wave => $i, Roids => $roids, XP => $xp}; if ($self->{AJAX}){