]> ruin.nu Git - ndwebbie.git/blobdiff - lib/NDWeb/Controller/Raids.pm
Some raid tweaks
[ndwebbie.git] / lib / NDWeb / Controller / Raids.pm
index 61956b27226465cfacf6af7858523de40f264f0b..998f3293386b4235526708777bba59d6afb6b665 100644 (file)
@@ -114,7 +114,7 @@ sub view : Local {
        $c->stash(message => parseMarkup($raid->{message}));
        $c->stash(landingtick => $raid->{tick});
        my $targetquery = $dbh->prepare(q{SELECT r.id, pid AS planet, size, score, value
-               , p.x,p.y,p.z, race
+               , p.pid, p.x,p.y,p.z, race
                , p.value - p.size*200 -
                        COALESCE(ps.metal+ps.crystal+ps.eonium,0)/150 -
                        COALESCE(ds.total ,(SELECT
@@ -131,14 +131,14 @@ sub view : Local {
                        LEFT OUTER JOIN current_development_scans ds USING (pid)
                WHERE r.raid = $1
                        AND NOT COALESCE(p.x = $2 AND p.y = $3,False)
-               ORDER BY size});
+               ORDER BY size DESC, value DESC, score DESC});
        $targetquery->execute($raid->{id},$planet->{x},$planet->{y});
        my @targets;
        while (my $target = $targetquery->fetchrow_hashref){
                if ($planet && $planet->{x}){
-                       if ($planet->{x} == $target->{x}){
-                               $target->{style} = 'incluster';
-                       }
+                       #if ($planet->{x} == $target->{x}){
+                       #       $target->{style} = 'incluster';
+                       #}
                        $target->{cap} = min(0.25,0.25 * pow($target->{value}/$planet->{value} , 0.5));
                        $target->{scorebash} = 'bash' if ($target->{score}/$planet->{score} < 0.6);
                        $target->{valuebash} = 'bash' if ($target->{value}/$planet->{value} < 0.4);
@@ -206,7 +206,7 @@ ORDER BY name,tick DESC
 
                push @targets,$target;
        }
-       @targets = sort {$b->{roids}[0]{xp} <=> $a->{roids}[0]{xp} or $b->{size} <=> $a->{size}} @targets;
+       #@targets = sort {$b->{roids}[0]{xp} <=> $a->{roids}[0]{xp} or $b->{size} <=> $a->{size}} @targets;
 
        $c->stash(targets => \@targets);
 }