From 4b5116d8223eca33ed573cd36157ce979abd4a07 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Thu, 14 Dec 2006 14:22:35 +0000 Subject: [PATCH] display all information --- calls.pl | 56 +++++++++++++++++++++++++++++++++++- templates/calls.tmpl | 67 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/calls.pl b/calls.pl index 11c4ed7..063c40f 100644 --- a/calls.pl +++ b/calls.pl @@ -30,11 +30,65 @@ die "You don't have access" unless isBC(); my $call; if (param('call') =~ /^(\d+)$/){ - my $query = $DBH->prepare(q{}); + my $query = $DBH->prepare(q{ +SELECT c.id, coords(p.x,p.y,p.z), c.landing_tick, c.info, covered, open, dc.username AS dc, u.defense_points,c.member +FROM calls c + JOIN users u ON c.member = u.uid + LEFT OUTER JOIN users dc ON c.dc = dc.uid + JOIN current_planet_stats p ON u.planet = p.id +WHERE c.id = ?}); $call = $DBH->selectrow_hashref($query,undef,$1); } if ($call){ + $BODY->param(Call => $call->{id}); + $BODY->param(Coords => $call->{coords}); + $BODY->param(DefensePoints => $call->{defense_points}); + $BODY->param(LandingTick => $call->{landing_tick}); + $BODY->param(ETA => $call->{landing_tick}-$ND::TICK); + $BODY->param(Info => $call->{info}); + if ($call->{covered}){ + $BODY->param(Cover => 'Uncover'); + }else{ + $BODY->param(Cover => 'Cover'); + } + if ($call->{open} && !$call->{covered}){ + $BODY->param(Cover => 'Ignore'); + }else{ + $BODY->param(Cover => 'Open'); + } + my $fleets = $DBH->prepare(q{ +SELECT id,mission,landing_tick,eta, (landing_tick+eta-1) AS back FROM fleets WHERE uid = ? AND (fleet = 0 OR (landing_tick + eta > ? AND landing_tick - eta - 11 < ? )) +ORDER BY fleet ASC}); + my $ships = $DBH->prepare('SELECT ship,amount FROM fleet_ships WHERE fleet = ?'); + $fleets->execute($call->{member},$call->{landing_tick},$call->{landing_tick}); + my @fleets; + while (my $fleet = $fleets->fetchrow_hashref){ + if ($fleet->{back} == $call->{landing_tick}){ + $fleet->{Fleetcatch} = 1; + } + $ships->execute($fleet->{id}); + my @ships; + while (my $ship = $ships->fetchrow_hashref){ + push @ships,$ship; + } + $fleet->{Ships} = \@ships; + push @fleets, $fleet; + } + $BODY->param(Fleets => \@fleets); + + my $attackers = $DBH->prepare(q{ +SELECT coords(p.x,p.y,p.z), p.planet_status, p.race,i.eta,i.amount,i.fleet,i.shiptype,p.relationship,p.alliance,i.id +FROM incomings i + JOIN current_planet_stats p ON i.sender = p.id +WHERE i.call = ? +ORDER BY p.x,p.y,p.z}); + $attackers->execute($call->{id}); + my @attackers; + while(my $attacker = $attackers->fetchrow_hashref){ + push @attackers,$attacker; + } + $BODY->param(Attackers => \@attackers); }else{ my $where = 'open AND c.landing_tick-6 > tick()'; if (param('show') eq 'covered'){ diff --git a/templates/calls.tmpl b/templates/calls.tmpl index b08723d..5e721a1 100644 --- a/templates/calls.tmpl +++ b/templates/calls.tmpl @@ -1,4 +1,71 @@ +
Call details, call# + + +

Current DC:

+

Member:

+

Defense points:

+

Landing at tick: +

+

ETA:

+
Member fleet + +
+

FLEETCATCH

+

Fleet mission: , Landing tick: , Initial eta: , Back:

+ + + + + +
ShipAmount
+
+
+
+

Userful information:

+ +

+ + + + +

+
+

Attackers:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CoordsPlanet statusAllianceRaceInitial ETAAmountShiptypesFleetChange/remove?
()
+

+ + +

+
-- 2.39.2
CallMember (def points)Landing tickRacesAmountShiptypesCurrent etaInital etaAllianceAttackers