sub index :Path :Args(0) {
my ( $self, $c ) = @_;
- $c->stash( where => q{AND max_bank_hack > 60000
- ORDER BY max_bank_hack DESC, hack5 DESC, hack15 DESC, minalert,x,y,z});
+ $c->stash( where => q{hack5 > 60000
+ ORDER BY hack5 DESC, hack15 DESC, minalert
+ ,lastcovop NULLS FIRST,pstick DESC, dstick DESC,x,y,z
+ });
$c->forward('list');
}
sub easy : Local {
my ( $self, $c ) = @_;
- $c->stash( where => qq{AND minalert < 70
- ORDER BY minalert, max_bank_hack DESC, hack5 DESC, hack15 DESC,x,y,z});
+ $c->stash( where => q{minalert < 70
+ ORDER BY minalert, max_bank_hack DESC, hack5 DESC, hack15 DESC
+ ,lastcovop NULLS FIRST,pstick DESC, dstick DESC,x,y,z
+ });
$c->forward('list');
}
sub distwhores : Local {
my ( $self, $c ) = @_;
- $c->stash( where => qq{AND distorters > 0
- ORDER BY distorters DESC, minalert, x,y,z});
+ $c->stash( where => q{distorters > 0
+ ORDER BY distorters DESC, minalert
+ ,lastcovop NULLS FIRST,pstick DESC, dstick DESC,x,y,z
+ });
$c->forward('list');
}
my ( $self, $c ) = @_;
my $dbh = $c->model;
- my $query = $dbh->prepare(q{SELECT *
- FROM (SELECT p.id,coords(x,y,z),x,y,z,size, metal,crystal,eonium
+ my $query = $dbh->prepare(q{
+ SELECT * FROM (
+ SELECT *
+ ,max_bank_hack(500000,500000,500000,pvalue,cvalue,5)
+ ,max_bank_hack(metal,crystal,eonium,pvalue,cvalue,5) AS hack5
+ ,max_bank_hack(metal,crystal,eonium,pvalue,cvalue,13) AS hack15
+ FROM (SELECT p.id,coords(x,y,z),x,y,z,size
+ ,metal + metal_roids * (tick()-ps.tick) * 125 AS metal
+ ,crystal + crystal_roids * (tick()-ps.tick) * 125 AS crystal
+ ,eonium + eonium_roids * (tick()-ps.tick) * 125 AS eonium
,distorters,guards
,covop_alert(seccents,ds.total,size,guards,gov,0) AS minalert
,covop_alert(seccents,ds.total,size,guards,gov,50) AS maxalert
- ,max_bank_hack(500000,500000,500000,p.value,c.value,5)
- ,max_bank_hack(metal,crystal,eonium,p.value,c.value,5) AS hack5
- ,max_bank_hack(metal,crystal,eonium,p.value,c.value,15) AS hack15
, planet_status, relationship,gov,ps.tick AS pstick, ds.tick AS dstick
+ , p.value AS pvalue, c.value AS cvalue
FROM current_planet_stats p
LEFT OUTER JOIN current_planet_scans ps ON p.id = ps.planet
LEFT OUTER JOIN current_development_scans ds ON p.id = ds.planet
WHERE (metal IS NOT NULL OR distorters IS NOT NULL)
AND (NOT planet_status IN ('Friendly','NAP'))
AND (relationship IS NULL OR NOT relationship IN ('Friendly','NAP'))
- } . $c->stash->{where});
+ ) a
+ WHERE } . $c->stash->{where});
$query->execute($c->user->planet);
$c->stash(targets => $query->fetchall_arrayref({}));