From 9e7bc0a25ae14affe960a0606d0542677c51abd7 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Fri, 15 Dec 2006 11:29:49 +0000 Subject: [PATCH] nicer tables --- calls.pl | 2 +- covop.pl | 4 +++- intel.pl | 9 +++++++++ points.pl | 4 +++- templates/covop.tmpl | 4 ++-- templates/intel.tmpl | 2 +- templates/points.tmpl | 4 ++-- templates/top100.tmpl | 4 ++-- top100.pl | 3 +++ 9 files changed, 26 insertions(+), 10 deletions(-) diff --git a/calls.pl b/calls.pl index b56a639..9c3c3e0 100644 --- a/calls.pl +++ b/calls.pl @@ -26,7 +26,7 @@ my $error; $ND::TEMPLATE->param(TITLE => 'Defense Calls'); -die "You don't have access" unless isBC(); +die "You don't have access" unless isDC(); my $call; if (param('call') =~ /^(\d+)$/){ diff --git a/covop.pl b/covop.pl index 180a0a4..9c8284d 100644 --- a/covop.pl +++ b/covop.pl @@ -57,10 +57,12 @@ FROM covop_targets c JOIN current_planet_stats p ON p.id = c.planet $query->execute($ND::PLANET); my @targets; +my $i = 0; while (my ($id,$coords,$metal,$crystal,$eonium,$seccents,$dists,$lastcovop,$user,$max) = $query->fetchrow){ push @targets,{Username => $user, Target => $id, Coords => $coords , Metal => $metal, Crystal => $crystal, Eonium => $eonium, SecCents => $seccents - , Dists => $dists, MaxResHack => $max, LastCovOp => $lastcovop, List => $list}; + , Dists => $dists, MaxResHack => $max, LastCovOp => $lastcovop, List => $list, ODD => $i % 2}; + $i++; } $BODY->param(Targets => \@targets); diff --git a/intel.pl b/intel.pl index 65f847a..c1beff4 100644 --- a/intel.pl +++ b/intel.pl @@ -136,26 +136,32 @@ if ($planet){ $query->execute($planet->{id}) or $error .= $DBH->errstr; my @intellists; my @intel; + my $i = 0; while (my $intel = $query->fetchrow_hashref){ if ($intel->{ingal}){ $intel->{missionclass} = 'ingal'; }else{ $intel->{missionclass} = $intel->{mission}; } + $intel->{ODD} = $i % 2; push @intel,$intel; + $i++; } push @intellists,{Message => 'Incoming fleets', Intel => \@intel, Origin => 1}; my $query = $DBH->prepare(intelquery('t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',"o.id = ? $showticks")); $query->execute($planet->{id}) or $error .= $DBH->errstr; my @intel; + my $i = 0; while (my $intel = $query->fetchrow_hashref){ if ($intel->{ingal}){ $intel->{missionclass} = 'ingal'; }else{ $intel->{missionclass} = $intel->{mission}; } + $intel->{ODD} = $i % 2; push @intel,$intel; + $i++; } push @intellists,{Message => 'Outgoing Fleets', Intel => \@intel, Target => 1}; @@ -171,13 +177,16 @@ if ($planet){ my @intellists; my @intel; + my $i = 0; while (my $intel = $query->fetchrow_hashref){ if ($intel->{ingal}){ $intel->{missionclass} = 'ingal'; }else{ $intel->{missionclass} = $intel->{mission}; } + $intel->{ODD} = $i % 2; push @intel,$intel; + $i++; } push @intellists,{Message => q{Intel where alliances doesn't match}, Intel => \@intel, Origin => 1, Target => 1}; $BODY->param(IntelLIsts => \@intellists); diff --git a/points.pl b/points.pl index c75130c..464ad18 100644 --- a/points.pl +++ b/points.pl @@ -43,9 +43,11 @@ my $query = $DBH->prepare("SELECT username,defense_points,attack_points,scan_poi $query->execute; my @members; +my $i = 0; while (my ($username,$defense,$attack,$scan,$humor,$total,$rank) = $query->fetchrow){ push @members,{Username => $username, Defense => $defense, Attack => $attack - , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank}; + , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank, ODD => $i % 2}; + $i++; } $BODY->param(Members => \@members); diff --git a/templates/covop.tmpl b/templates/covop.tmpl index 29d36b1..aef3e6a 100644 --- a/templates/covop.tmpl +++ b/templates/covop.tmpl @@ -1,9 +1,9 @@ - +
- + diff --git a/templates/intel.tmpl b/templates/intel.tmpl index 5649740..7233ff2 100644 --- a/templates/intel.tmpl +++ b/templates/intel.tmpl @@ -85,7 +85,7 @@ - + diff --git a/templates/points.tmpl b/templates/points.tmpl index 3aa7f04..2441baf 100644 --- a/templates/points.tmpl +++ b/templates/points.tmpl @@ -1,4 +1,4 @@ -
CoordsMetalCrystalEonium% Sec CentresDistsMax (15 agents)Last covop (tick)
IngalReported by
+
@@ -9,7 +9,7 @@ - + diff --git a/templates/top100.tmpl b/templates/top100.tmpl index 6e6848b..20f7303 100644 --- a/templates/top100.tmpl +++ b/templates/top100.tmpl @@ -1,6 +1,6 @@

Previous 100 Next 100

-
User TotalND Rank
+
@@ -13,7 +13,7 @@ - + diff --git a/top100.pl b/top100.pl index 9611a17..20b0bd1 100644 --- a/top100.pl +++ b/top100.pl @@ -55,6 +55,7 @@ my $query = $DBH->prepare(qq{SELECT id,coords(x,y,z), ruler, planet,race, $extra_columns FROM current_planet_stats ORDER BY $order LIMIT 100 OFFSET ?}); $query->execute($offset); my @planets; +my $i = 0; while (my ($id,$coords,$ruler,$planet,$race,$size,$score,$value,$xp,$sizerank,$scorerank,$valuerank,$xprank ,$planet_status,$hit_us,$alliance,$relationship,$nick) = $query->fetchrow){ my %planet = (Coords => $coords, Planet => "$ruler OF $planet", Race => $race, Size => "$size ($sizerank)" @@ -67,7 +68,9 @@ while (my ($id,$coords,$ruler,$planet,$race,$size,$score,$value,$xp,$sizerank,$s $planet{Relationship} = $relationship; $planet{isHC} = 1; } + $planet{ODD} = $i % 2; push @planets,\%planet; + $i++; } $BODY->param(Planets => \@planets); -- 2.39.2
CoordsPlanetRace Size (rank) Score (rank)