+++ /dev/null
-#**************************************************************************
-# Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu> *
-# *
-# 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::Alliances;
-use strict;
-use warnings FATAL => 'all';
-use ND::Include;
-use CGI qw/:standard/;
-use NDWeb::Include;
-
-use base qw/NDWeb::XMLPage/;
-
-$NDWeb::Page::PAGES{alliances} = __PACKAGE__;
-
-sub render_body {
- my $self = shift;
- my ($BODY) = @_;
- $self->{TITLE} = 'Alliances';
- my $DBH = $self->{DBH};
-
- return $self->noAccess unless $self->isHC;
-
- my $alliance;
- if (defined param('alliance') && param('alliance') =~ /^(\d+)$/){
- my $query = $DBH->prepare(q{SELECT id,name, relationship FROM alliances WHERE id = ?});
- $alliance = $DBH->selectrow_hashref($query,undef,$1);
- }
- if ($alliance && defined param('cmd') && param ('cmd') eq 'change'){
- $DBH->begin_work;
- if (param('crelationship')){
- my $value = escapeHTML(param('relationship'));
- if ($DBH->do(q{UPDATE alliances SET relationship = ? WHERE id =?}
- ,undef,$value,$alliance->{id})){
- $alliance->{relationship} = $value;
- log_message $ND::UID,"HC set alliance: $alliance->{id} ($alliance->{name}) relationship: $value";
- }else{
- warn $DBH->errstr;
- }
- }
- my $coords = param('coords');
- my $findplanet = $DBH->prepare(q{SELECT id FROM current_planet_stats WHERE x = ? AND y = ? AND z = ?});
- my $addplanet = $DBH->prepare(q{
- UPDATE planets SET alliance_id = $2, nick = coalesce($3,nick)
- WHERE id = $1;
- });
- while ($coords =~ m/(\d+):(\d+):(\d+)(?:\s+nick=(\S+))?/g){
- my ($id) = $DBH->selectrow_array($findplanet,undef,$1,$2,$3) or $ND::ERROR .= p $DBH->errstr;
- if ($addplanet->execute($id,$alliance->{id},$4)){
- my $nick = '';
- $nick = "(nick $4)" if defined $4;
- warn "Added planet $1:$2:$3 $nick to this alliance\n";
- intel_log $ND::UID,$id,"HC Added planet $1:$2:$3 $nick to alliance: $alliance->{id} ($alliance->{name})";
- }else{
- warn $DBH->errstr;
- }
- }
- $DBH->commit or warn $DBH->errstr;
- }elsif ($alliance && defined param('cmd') && param ('cmd') eq 'remove_all'){
- $DBH->begin_work;
- my ($coords) = $DBH->selectrow_array(q{SELECT CONCAT(coords(x,y,z) || ' ')
- FROM current_planet_stats where alliance_id = $1
- },undef,$alliance->{id});
- my $removeplanets = $DBH->prepare(q{
- UPDATE planets SET alliance_id = NULL
- WHERE alliance_id = $1;
- }) or warn $DBH->errstr;
- if ($removeplanets->execute($alliance->{id})){
- log_message $ND::UID, "HC cleaned alliance: $alliance->{id} ($alliance->{name})\n\n$coords";
- $DBH->commit or warn $DBH->errstr;
- }else{
- warn $DBH->errstr;
- $DBH->rollback;
- }
- }
-
- if ($alliance){
- $BODY->param(Alliance => $alliance->{name});
- $BODY->param(Id => $alliance->{id});
- my @relationships;
- for my $relationship ("","Friendly", "NAP", "Hostile"){
- push @relationships,{Rel => $relationship, Selected => defined $alliance->{relationship} && $relationship eq $alliance->{relationship}}
- }
- $BODY->param(Relationships => \@relationships);
-
- my $order = "p.x,p.y,p.z";
- if (defined param('order') && param('order') =~ /^(score|size|value|xp|hit_us|race)$/){
- $order = "$1 DESC";
- }
- my $members = $DBH->prepare(qq{
- SELECT coords(x,y,z), nick, ruler, planet, race, size, score, value, xp,
- planet_status,hit_us, sizerank, scorerank, valuerank, xprank
- FROM current_planet_stats p
- WHERE p.alliance_id = ?
- ORDER BY $order});
- my @members;
- $members->execute($alliance->{id});
- while (my $member = $members->fetchrow_hashref){
- push @members,$member;
- }
- $BODY->param(Members => \@members);
-
- my $query = $DBH->prepare(intelquery('o.alliance AS oalliance,coords(o.x,o.y,o.z) AS origin, t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',q{not ingal AND (o.alliance_id = $1 OR t.alliance_id = $1)
- AND (i.mission = 'Defend' OR i.mission = 'AllyDef')
- AND ((( t.alliance_id != o.alliance_id OR t.alliance_id IS NULL OR o.alliance_id IS NULL)))
- AND i.sender NOT IN (SELECT planet FROM users u NATURAL JOIN groupmembers gm WHERE gid = 8 AND planet IS NOT NULL)
- AND NOT (i.back IS NOT NULL AND i.back = i.tick + 4)
- }));
- $query->execute($alliance->{id}) or warn $DBH->errstr;
-
- my @intel;
- while (my $intel = $query->fetchrow_hashref){
- if ($intel->{ingal}){
- $intel->{missionclass} = 'ingal';
- }else{
- $intel->{missionclass} = $intel->{mission};
- }
- push @intel,$intel;
- }
- $BODY->param(Intel => \@intel);
- }else{
-
- my $order = "score DESC";
- if (defined param('order') && param('order') =~ /^(score|kscore|size|ksize|members|kmem|kxp|kxp|scavg|kscavg|siavg|ksiavg|kxpavg|kvalue|kvalavg)$/){
- $order = "$1 DESC";
- }
- my $query = $DBH->prepare(qq{
- SELECT DISTINCT a.id,name,COALESCE(s.score,SUM(p.score)) AS score,COALESCE(s.size,SUM(p.size)) AS size,s.members,count(p.score) AS kmem,
- COALESCE(SUM(p.score),-1) AS kscore, COALESCE(SUM(p.size),-1) AS ksize, COALESCE(SUM(p.xp),-1) AS kxp,COALESCE(SUM(p.value),-1) AS kvalue,
- COALESCE(s.score/s.members,-1) AS scavg, COALESCE(AVG(p.score)::int,-1) AS kscavg, COALESCE(s.size/s.members,-1) AS siavg,
- COALESCE(AVG(p.size)::int,-1) AS ksiavg, COALESCE(AVG(p.xp)::int,-1) AS kxpavg, COALESCE(AVG(p.value)::int,-1) AS kvalavg
- FROM alliances a
- LEFT OUTER JOIN (SELECT * FROM alliance_stats WHERE tick = (SELECT max(tick) FROM alliance_stats)) s ON s.id = a.id
- LEFT OUTER JOIN current_planet_stats p ON p.alliance_id = a.id
- GROUP BY a.id,a.name,s.score,s.size,s.members
- ORDER BY $order
- })or warn $DBH->errstr;
- $query->execute or warn $DBH->errstr;
- my @alliances;
- while (my $alliance = $query->fetchrow_hashref){
- next unless (defined $alliance->{score} || $alliance->{kscore} > 0);
- push @alliances, $alliance;
- }
- $BODY->param(Alliances => \@alliances);
- }
- return $BODY;
-}
-1;
use warnings;
use parent 'Catalyst::Controller';
+use NDWeb::Include;
+
=head1 NAME
NDWeb::Controller::Alliances - Catalyst Controller
=cut
sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
+ my ( $self, $c ) = @_;
+ $c->stash(template => 'alliances/list.tt2');
+ $c->forward('list');
+}
+
+sub list : Local {
+ my ( $self, $c, $order ) = @_;
+ my $dbh = $c->model;
+
+ if (defined $order && $order =~ /^(score|kscore|size|ksize|members|kmem|kxp
+ |kxp|scavg|kscavg|siavg|ksiavg|kxpavg|kvalue|kvalavg)$/x){
+ $order = "$1 DESC";
+ } else {
+ $order = "score DESC";
+ }
+ my $query = $dbh->prepare(q{
+ SELECT DISTINCT a.id,name,COALESCE(s.score,SUM(p.score)) AS score
+ ,COALESCE(s.size,SUM(p.size)) AS size,s.members,count(p.score) AS kmem
+ ,COALESCE(SUM(p.score),-1) AS kscore
+ ,COALESCE(SUM(p.size),-1) AS ksize
+ ,COALESCE(SUM(p.xp),-1) AS kxp
+ ,COALESCE(SUM(p.value),-1) AS kvalue
+ ,COALESCE(s.score/LEAST(s.members,60),-1) AS scavg
+ ,COALESCE(AVG(p.score)::int,-1) AS kscavg
+ ,COALESCE(s.size/s.members,-1) AS siavg
+ ,COALESCE(AVG(p.size)::int,-1) AS ksiavg
+ ,COALESCE(AVG(p.xp)::int,-1) AS kxpavg
+ ,COALESCE(AVG(p.value)::int,-1) AS kvalavg
+ FROM alliances a
+ LEFT OUTER JOIN (SELECT * FROM alliance_stats
+ WHERE tick = (SELECT max(tick) FROM alliance_stats)) s ON s.id = a.id
+ LEFT OUTER JOIN current_planet_stats p ON p.alliance_id = a.id
+ GROUP BY a.id,a.name,s.score,s.size,s.members
+ HAVING s.score IS NOT NULL OR count(p.score) > 0
+ ORDER BY
+ } . $order);
+ $query->execute;
+ $c->stash(alliances => $query->fetchall_arrayref({}) );
+ $c->stash(comma => \&comma_value);
+}
+
+sub edit : Local {
+ my ( $self, $c, $id, $order ) = @_;
+ my $dbh = $c->model;
+
+ my $query = $dbh->prepare(q{SELECT id,name, relationship FROM alliances WHERE id = ?});
+ my $a = $dbh->selectrow_hashref($query,undef,$id);
+ $c->stash(a => $a);
+
+
+ if ($order && $order =~ /^((score|size|value|xp|hit_us|race)(rank)?)$/){
+ $order = $1;
+ }else {
+ $order = 'x,y,z';
+ }
+ $c->stash(order => $order);
+
+ $order .= ' DESC' if $order eq 'hit_us';
+
+ my $members = $dbh->prepare(q{
+ SELECT coords(x,y,z), nick, ruler, planet, race, size, score, value, xp
+ ,planet_status,hit_us, sizerank, scorerank, valuerank, xprank
+ FROM current_planet_stats p
+ WHERE p.alliance_id = ?
+ ORDER BY
+ } . $order);
+ $members->execute($a->{id});
+ $c->stash(members => $members->fetchall_arrayref({}) );
+
+ my $ticks = $c->req->param('ticks') || 48;
+ $c->stash(showticks => $ticks);
+
+ my $query = $dbh->prepare(intelquery q{
+ o.alliance AS oalliance ,coords(o.x,o.y,o.z) AS ocoords, i.sender
+ ,t.alliance AS talliance,coords(t.x,t.y,t.z) AS tcoords, i.target
+ },q{NOT ingal AND (o.alliance_id = $1 OR t.alliance_id = $1)
+ AND (i.mission = 'Defend' OR i.mission = 'AllyDef')
+ AND ((( t.alliance_id != o.alliance_id OR t.alliance_id IS NULL OR o.alliance_id IS NULL)))
+ AND i.sender NOT IN (SELECT planet FROM users u NATURAL JOIN groupmembers gm WHERE gid = 8 AND planet IS NOT NULL)
+ AND NOT (i.back IS NOT NULL AND i.back = i.tick + 4)
+ AND i.tick > (tick() - $2)
+ });
+ $query->execute($a->{id}, $ticks);
+ $c->stash(intel => $query->fetchall_arrayref({}) );
+}
+
+sub postallianceupdate : Local {
+ my ( $self, $c, $id, $order ) = @_;
+ my $dbh = $c->model;
+
+ $dbh->begin_work;
+ my $log = $dbh->prepare(q{INSERT INTO forum_posts (ftid,uid,message) VALUES(
+ (SELECT ftid FROM users WHERE uid = $1),$1,$2)
+ });
+ if ($c->req->param('crelationship')){
+ my $value = $c->req->param('relationship');
+ $dbh->do(q{UPDATE alliances SET relationship = ? WHERE id =?}
+ ,undef,$value,$id);
+ $log->execute($c->user->id
+ ,"HC set alliance: $id relationship: $value");
+ }
+ my $coords = $c->req->param('coords');
+ my $findplanet = $dbh->prepare(q{SELECT id FROM current_planet_stats
+ WHERE x = ? AND y = ? AND z = ?});
+ my $addplanet = $dbh->prepare(q{
+ UPDATE planets SET alliance_id = $2, nick = coalesce($3,nick)
+ WHERE id = $1;
+ });
+ my $text = '';
+ while ($coords =~ m/(\d+):(\d+):(\d+)(?:\s+nick=(\S+))?/g){
+ my ($planet) = $dbh->selectrow_array($findplanet,undef,$1,$2,$3);
+ $addplanet->execute($planet,$id,$4);
+ my $nick = '';
+ $nick = "(nick $4)" if defined $4;
+ $text .= "($planet) $1:$2:$3 $nick\n";
+ }
+ if ($text){
+ $log->execute($c->user->id
+ ,"HC added the following planets to alliance $id:\n $text");
+ }
+ $dbh->commit;
+
+ $c->res->redirect($c->uri_for('edit',$id));
+}
+
+sub postremoveallplanets : Local {
+ my ( $self, $c, $id, $order ) = @_;
+ my $dbh = $c->model;
- $c->response->body('Matched NDWeb::Controller::Alliances in Alliances.');
+ $dbh->begin_work;
+ my $log = $dbh->prepare(q{INSERT INTO forum_posts (ftid,uid,message) VALUES(
+ (SELECT ftid FROM users WHERE uid = $1),$1,$2)
+ });
+ my ($coords) = $dbh->selectrow_array(q{SELECT CONCAT(coords(x,y,z) || ' ')
+ FROM current_planet_stats where alliance_id = $1
+ },undef,$id);
+ my $removeplanets = $dbh->prepare(q{
+ UPDATE planets SET alliance_id = NULL
+ WHERE alliance_id = $1;
+ });
+ $removeplanets->execute($id);
+ $log->execute($c->user->id
+ ,"HC cleaned alliance $id :\n\n$coords");
+ $dbh->commit;
+
+ $c->res->redirect($c->uri_for('edit',$id));
}
sub hostile : Local {
--- /dev/null
+[% META title = 'Edit Alliance' %]
+
+<fieldset> <legend>Alliances: </legend>
+<form action="[% c.uri_for('postallianceupdate',a.id) %]" method="post">
+<div class="leftinfo">
+ <p>Alliance: [% a.name %]</p>
+ <p>Relationship: <select name="relationship">
+[% FOR rel IN ['','Friendly','NAP','Hostile'] %]
+ <option value="[% rel %]"[% IF rel == a.relationship %]selected[% END %]>[% rel %]</option>
+[% END %]
+ </select>
+ <input type="checkbox" name="crelationship"></p>
+ <p>Paste a list of coords that you want to add to this alliance</p>
+ <textarea rows="10" cols="40" name="coords"></textarea>
+ <p class="claimlinks"><input type="submit" value="Submit"></p>
+</div>
+</form>
+<div class="leftinfo">
+<fieldset> <legend></legend>
+<form action="[% c.uri_for('postremoveallplanets',a.id) %]" method="post">
+ <p>Yes, remove all planets <input type="checkbox" name="cremoveall"
+ onclick="$('#removeall').attr('disabled',null)"></p>
+ <p><input type="submit" id='removeall' disabled value="Remove All Planets"></p>
+</form>
+</fieldset>
+</div>
+</fieldset>
+<div class="leftinfo">
+<img class="graph" src="[% c.uri_for('/graphs/alliancevsintel',a.id,STICK) %]" alt="Alliance size and score vs members" height="300" width="500">
+<img class="graph" src="[% c.uri_for('/graphs/avgalliancevsintel',a.id,STICK) %]" alt="Avg alliance size and score vs members" height="300" width="500">
+</div>
+<div class="leftinfo">
+<table class="stats">
+ <tr>
+ <th><a href="[% c.uri_for('edit',a.id,'coords') %]">Coords</a></th>
+ <th>Nick</th>
+ <th><a href="[% c.uri_for('edit',a.id,'hit_us') %]">Hit us</a></th>
+ <th>Planet</th>
+ <th><a href="[% c.uri_for('edit',a.id,'race') %]">Race</a></th>
+ <th><a href="[% c.uri_for('edit',a.id,'sizerank') %]">Size (rank)</a></th>
+ <th><a href="[% c.uri_for('edit',a.id,'scorerank') %]">Score (rank)</a></th>
+ <th><a href="[% c.uri_for('edit',a.id,'valuerank') %]">Value (rank)</a></th>
+ <th><a href="[% c.uri_for('edit',a.id,'xprank') %]">XP (rank)</a></th>
+ </tr>
+[% FOR m IN members %]
+ <tr class="[% loop.count % 2 == 0 ? 'even' : 'odd' %]">
+ <td><a href="[% c.uri_for('/stats/planet',m.id) %]">[% m.coords %]</a></td>
+ <td class="[% m.planet_status %]"><a href="[% c.uri_for('/intel/planet',m.id) %]">[% m.nick %]([% m.planet_status %])</a></td>
+ <td>[% m.hit_us %]</td>
+ <td>[% m.ruler %] <b>OF</b> [% m.planet %]</td>
+ <td>[% m.race %]</td>
+ <td>[% m.size %] ([% m.sizerank %])</td>
+ <td>[% m.score %] ([% m.scorerank %])</td>
+ <td>[% m.value %] ([% m.valuerank %])</td>
+ <td>[% m.xp %] ([% m.xprank %])</td>
+ </tr>
+[% END %]
+</table>
+</div>
+<div class="leftinfo">
+<form action="[% c.uri_for('edit',a.id,order) %]" method="post">
+ <p>Show last <input type="text" name="ticks" value="[% showticks %]"> ticks <input type="submit" value="Show"></p>
+</form>
+<table class="stats">
+ <tr>
+ <th>Alliance</th><th>Sender</th>
+ <th>Mission</th><th>Landing tick</th><th>ETA</th><th>Amount</th>
+ <th>Target</th><th>Alliance</th>
+ <th>Reported by</th>
+ </tr>
+[% FOR i IN intel %]
+ <tr class="[% loop.count % 2 == 0 ? 'even' : 'odd' %]">
+ <td>[% i.oalliance %]</td>
+ <td><a href="[% c.uri_for('planet',i.sender) %]">[% i.ocoords %]</a></td>
+ <td class="[% i.mission %]">[% i.mission %]</td>
+ <td align="center">[% i.landingtick %]</td>
+ <td align="center">[% i.eta %]</td>
+ <td>[% i.amount %]</td>
+ <td><a href="[% c.uri_for('planet',i.target) %]">[% i.tcoords %]</a></td>
+ <td>[% i.talliance %]</td>
+ <td>[% i.username %]</td>
+ </tr>
+[% END %]
+</table>
+</div>
--- /dev/null
+[% META title = 'List Alliances' %]
+
+<table class="stats">
+ <tr>
+ <th>Alliance</th>
+ <th>Kmembers</th>
+ <th>Members</th>
+ <th><a href="[% c.uri_for('list','score') %]">Score</a></th>
+ <th><a href="[% c.uri_for('list','kscore') %]">KScore</a></th>
+ <th><a href="[% c.uri_for('list','scavg') %]">Avg Score</a></th>
+ <th><a href="[% c.uri_for('list','kscavg') %]">KAvg score</a></th>
+ <th><a href="[% c.uri_for('list','size') %]">Size</a></th>
+ <th><a href="[% c.uri_for('list','ksize') %]">KSize</a></th>
+ <th><a href="[% c.uri_for('list','siavg') %]">Avg Size</a></th>
+ <th><a href="[% c.uri_for('list','ksiavg') %]">KAvg size</a></th>
+ <th><a href="[% c.uri_for('list','kxp') %]">XP</a></th>
+ <th><a href="[% c.uri_for('list','kxpavg') %]">XP avg</a></th>
+ <th><a href="[% c.uri_for('list','kvalue') %]">Value</a></th>
+ <th><a href="[% c.uri_for('list','kvalueavg') %]">Val avg</a></th>
+ </tr>
+[% FOR a IN alliances %]
+ <tr align="right" class="[% loop.count % 2 ? 'even' : 'odd' %]">
+ <td align="left"><a href="[% c.uri_for('edit',a.id) %]">[% a.name %]</a></td>
+ <td>[% a.kmem %]</td>
+ <td>[% a.members %]</td>
+ <td>[% comma(a.score) %]</td>
+ <td>[% comma(a.kscore) %]</td>
+ <td>[% comma(a.scavg) %]</td>
+ <td>[% comma(a.kscavg) %]</td>
+ <td>[% comma(a.size) %]</td>
+ <td>[% comma(a.ksize) %]</td>
+ <td>[% comma(a.siavg) %]</td>
+ <td>[% comma(a.ksiavg) %]</td>
+ <td>[% comma(a.kxp) %]</td>
+ <td>[% comma(a.kxpavg) %]</td>
+ <td>[% comma(a.kvalue) %]</td>
+ <td>[% comma(a.kvalavg) %]</td>
+ </tr>
+[% END %]
+</table>
+++ /dev/null
-<TMPL_IF Alliance>
-<fieldset> <legend>Alliances: </legend><form action="<TMPL_VAR NAME=PAGE>" method="post">
-<div class="leftinfo">
- <input type="hidden" name="page" value="<TMPL_VAR NAME=PAGE>"/>
- <input type="hidden" name="cmd" value="change"/>
- <input type="hidden" name="alliance" value="<TMPL_VAR NAME=Id>"/>
- <p>Alliance: <TMPL_VAR NAME=Alliance></p>
- <p>Relationship: <select name="relationship">
- <TMPL_LOOP Relationships>
- <option value="<TMPL_VAR NAME=Rel>" <TMPL_IF NAME=Selected>selected="selected"</TMPL_IF>><TMPL_VAR NAME=Rel></option>
- </TMPL_LOOP>
- </select>
- <input type="checkbox" name="crelationship"/></p>
-
- <p>Paste a list of coords that you want to add to this alliance</p>
- <textarea rows="10" cols="40" name="coords"></textarea>
- <p class="claimlinks"><input type="submit" value="Submit"/></p>
-</div>
-</form>
-<div class="leftinfo">
-<form action="<TMPL_VAR NAME=PAGE>" method="post"><fieldset> <legend></legend>
- <input type="hidden" name="page" value="<TMPL_VAR NAME=PAGE>"/>
- <input type="hidden" name="cmd" value="remove_all"/>
- <input type="hidden" name="alliance" value="<TMPL_VAR NAME=Id>"/>
- <p>Yes, remove all planets <input type="checkbox" name="crelationship"/></p>
- <input type="submit" value="Remove All Planets"/>
-</fieldset></form>
-</div>
-</fieldset>
-<div class="leftinfo">
-<img class="graph" src="/graph/alliance/<TMPL_VAR NAME=Id>" alt="Alliance size and score vs members" height="300" width="500"/>
-<img class="graph" src="/graph/allianceavg/<TMPL_VAR NAME=Id>" alt="Avg alliance size and score vs members" height="300" width="500"/>
-</div>
-<div class="leftinfo">
-<table class="stats">
- <tr>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=coords">Coords</a></th>
- <th>Nick</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=hit_us">Hit us</a></th>
- <th>Planet</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=race">Race</a></th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=size">Size (rank)</a></th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=score">Score (rank)</a></th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=value">Value (rank)</a></th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>&order=xp">XP (rank)</a></th>
- </tr>
- <TMPL_LOOP Members>
- <tr class="<TMPL_IF __odd__>odd<TMPL_ELSE>even</TMPL_IF>">
- <td><a href="check?coords=<TMPL_VAR NAME=Coords>"><TMPL_VAR NAME=Coords></a></td>
- <td class="<TMPL_VAR NAME=Planet_status>"><a href="intel?coords=<TMPL_VAR NAME=Coords>"><TMPL_VAR NAME=Nick>(<TMPL_VAR NAME=Planet_status>)</a></td>
- <td><TMPL_VAR NAME=hit_us></td>
- <td><TMPL_VAR NAME=ruler> OF <TMPL_VAR NAME=planet></td>
- <td><TMPL_VAR NAME=race></td>
- <td><TMPL_VAR NAME=size> (<TMPL_VAR NAME=sizerank>)</td>
- <td><TMPL_VAR NAME=score> (<TMPL_VAR NAME=scorerank>)</td>
- <td><TMPL_VAR NAME=value> (<TMPL_VAR NAME=valuerank>)</td>
- <td><TMPL_VAR NAME=xp> (<TMPL_VAR NAME=xprank>)</td>
- </tr>
- </TMPL_LOOP>
-</table>
-</div>
-<div class="leftinfo">
-<table class="stats">
- <tr>
- <th>Alliance</th><th>Sender</th>
- <th>Mission</th><th>Landing tick</th><th>ETA</th><th>Amount</th>
- <th>Target</th><th>Alliance</th>
- <th>Ingal</th><th>Reported by</th>
- </tr>
- <TMPL_LOOP Intel>
- <tr class="<TMPL_IF __odd__>odd<TMPL_ELSE>even</TMPL_IF>">
- <td><TMPL_VAR NAME=OAlliance></td>
- <td><a href="intel?coords=<TMPL_VAR NAME=Origin>"><TMPL_VAR NAME=Origin></a></td>
- <td class="<TMPL_VAR NAME=MissionClass>"><TMPL_VAR NAME=Mission></td>
- <td align="center"><TMPL_VAR NAME=landingtick></td>
- <td align="center"><TMPL_VAR NAME=ETA></td>
- <td><TMPL_VAR NAME=Amount></td>
- <td><a href="intel?coords=<TMPL_VAR NAME=Target>"><TMPL_VAR NAME=Target></a></td>
- <td><TMPL_VAR NAME=TAlliance></td>
- <td><TMPL_VAR NAME=Ingal></td>
- <td><TMPL_VAR NAME=Username></td>
- </tr>
- </TMPL_LOOP>
-</table>
-</div>
-
-<TMPL_ELSE>
-<table class="stats">
- <tr>
- <th>User</th>
- <th>Known members</th>
- <th>Total members</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=score">Score</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=kscore">known planets</a>)</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=scavg">Avg Score</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=kscavg">known planets</a>)</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=size">Size</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=ksize">known planets</a>)</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=siavg">Avg Size</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=ksiavg">known planets</a>)</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=kxp">XP</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=kxpavg">avg</a>)</th>
- <th><a href="/<TMPL_VAR NAME=PAGE>?order=kvalue">Value</a> (<a href="/<TMPL_VAR NAME=PAGE>?order=kvalavg">avg</a>)</th>
- </tr>
-<TMPL_LOOP Alliances>
- <tr class="<TMPL_IF __odd__>odd<TMPL_ELSE>even</TMPL_IF>">
- <td><a href="/<TMPL_VAR NAME=PAGE>?alliance=<TMPL_VAR NAME=Id>"><TMPL_VAR NAME=Name></a></td>
- <td><TMPL_VAR NAME=kmem></td>
- <td><TMPL_VAR NAME=members></td>
- <td><TMPL_VAR NAME=score> (<TMPL_VAR NAME=kscore>)</td>
- <td><TMPL_VAR NAME=scavg> (<TMPL_VAR NAME=kscavg>)</td>
- <td><TMPL_VAR NAME=size> (<TMPL_VAR NAME=ksize>)</td>
- <td><TMPL_VAR NAME=siavg> (<TMPL_VAR NAME=ksiavg>)</td>
- <td><TMPL_VAR NAME=kxp> (<TMPL_VAR NAME=kxpavg>)</td>
- <td><TMPL_VAR NAME=kvalue> (<TMPL_VAR NAME=kvalavg>)</td>
- </tr>
-</TMPL_LOOP>
-</table>
-</TMPL_IF>