X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=NDWeb%2FPages%2FResources.pm;fp=NDWeb%2FPages%2FResources.pm;h=0000000000000000000000000000000000000000;hb=00325acb2f3a1ae09e4a73d09a33f056dfb60fda;hp=f06620d41ea0501a0191bdd61e8809ee36834e15;hpb=f9f06136c85f9634c409b71e18452c358530556e;p=ndwebbie.git diff --git a/NDWeb/Pages/Resources.pm b/NDWeb/Pages/Resources.pm deleted file mode 100644 index f06620d..0000000 --- a/NDWeb/Pages/Resources.pm +++ /dev/null @@ -1,67 +0,0 @@ -#************************************************************************** -# Copyright (C) 2006 by Michael Andreen * -# * -# This program is free software; you can redistribute it and/or modify * -# it under the terms of the GNU General Public License as published by * -# the Free Software Foundation; either version 2 of the License, or * -# (at your option) any later version. * -# * -# This program is distributed in the hope that it will be useful, * -# but WITHOUT ANY WARRANTY; without even the implied warranty of * -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# GNU General Public License for more details. * -# * -# You should have received a copy of the GNU General Public License * -# along with this program; if not, write to the * -# Free Software Foundation, Inc., * -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * -#**************************************************************************/ - -package NDWeb::Pages::Resources; -use strict; -use warnings FATAL => 'all'; -use CGI qw/:standard/; -use NDWeb::Include; - -use base qw/NDWeb::XMLPage/; - -$NDWeb::Page::PAGES{resources} = __PACKAGE__; - -sub render_body { - my $self = shift; - my ($BODY) = @_; - $self->{TITLE} = 'Alliance Resources'; - my $DBH = $self->{DBH}; - my $error; - - return $self->noAccess unless $self->isHC; - - my $order = "respplanet DESC"; - if (defined param('order') && param('order') =~ /^(size|score|resources|respplanet|nscore|nscore2|nscore3)$/){ - $order = "$1 DESC"; - } - - - my $query = $DBH->prepare(qq{ - SELECT a.id,a.name,a.relationship,s.members,s.score,s.size,r.resources,r.planets, resources/planets AS respplanet, - resources / 300 AS scoregain, score + (resources / 300) AS nscore, - (resources/planets*LEAST(members,60))/300 AS scoregain2, score + (resources/planets*LEAST(members,60))/300 AS nscore2, - (s.size::int8*(1464-tick())*250)/100 + score + (resources/planets*LEAST(members,60))/300 AS nscore3, - (s.size::int8*(1464-tick())*250)/100 AS scoregain3 - FROM (SELECT alliance_id AS id,sum(metal+crystal+eonium) AS resources, count(*) AS planets - FROM planets p join planet_scans c ON p.id = c.planet GROUP by alliance_id) r - NATURAL JOIN alliances a - LEFT OUTER JOIN (SELECT * FROM alliance_stats WHERE tick = (SELECT max(tick) FROM alliance_stats)) s ON a.id = s.id - ORDER BY $order - }); - $query->execute; - my @alliances; - while (my $alliance = $query->fetchrow_hashref){ - push @alliances,$alliance; - } - $BODY->param(Alliances => \@alliances); - - $BODY->param(Error => $error); - return $BODY; -} -1;