use warnings;
use parent 'Catalyst::Controller';
-use POSIX;
+use POSIX qw/floor pow/;
use NDWeb::Include;
use ND::Include;
$targetquery->execute($raid->{id},$planet->{x},$planet->{y});
my @targets;
while (my $target = $targetquery->fetchrow_hashref){
- if ($planet){
+ if ($planet && $planet->{x}){
if ($planet->{x} == $target->{x}){
$target->{style} = 'incluster';
}
my $roids = floor(0.25*$size);
$size -= $roids;
my $xp = 0;
- if ($planet){
+ if ($planet && $planet->{score}){
$xp = pa_xp($roids,$planet->{score},$planet->{value},$target->{score},$target->{value});
}
push @roids,{wave => $i, roids => $roids, xp => $xp};
our @ISA = qw/Exporter/;
-our @EXPORT = qw/parseMarkup min max
+our @EXPORT = qw/parseMarkup
intelquery html_escape
comma_value array_expand/;
return $text;
}
-
-sub min {
- my ($x,$y) = @_;
- return ($x > $y ? $y : $x);
-}
-
-sub max {
- my ($x,$y) = @_;
- return ($x < $y ? $y : $x);
-}
-
sub intelquery {
my ($columns,$where) = @_;
return qq{
+[% IF g %]
<table class="stats">
<tr align="center"><th colspan="4">Rank</th>
</tr>
<td>[% g.ticks_roiding %]</td>
</tr>
</table>
+[% END %]
<table>
<tr align="center"><th colspan="4">Rank</th>
[% END %]
<div class="clear"></div>
-[% IF c.user.planet %]
+[% IF p %]
<table class="stats">
<tr align="center"><th colspan="4">Rank</th>
</tr>
[% META title = 'Galaxy stats' %]
+[% IF g %]
[% PROCESS inc/stats.tt2 %]
<div class="leftinfo">
<img class="graph" src="[% c.uri_for('/graphs/galaxystats',g.x,g.y,STICK) %]" alt="stats" height="300" width="500">
<img class="graph" src="[% c.uri_for('/graphs/galaxyranks',g.x,g.y,STICK) %]" alt="ranks" height="300" width="500">
</div>
+[% ELSE %]
+<p>No such galaxy</p>
+[% END %]
[% META title = 'Planet stats' %]
+[% IF p.id %]
[% PROCESS inc/stats.tt2 %]
+[% ELSE %]
+<p> No such planet</p>
+[% END %]
<div class="leftinfo">
[% IF planetscan.tick %]
</div>
[% END %]
+[% IF p.id %]
<div class="leftinfo">
<img class="graph" src="[% c.uri_for('/graphs/planetstats',p.id,STICK) %]" alt="stats" height="300" width="500">
<img class="graph" src="[% c.uri_for('/graphs/planetranks',p.id,STICK) %]" alt="ranks" height="300" width="500">
</div>
+[% END %]