From 5af89dd22a075c6652b779ef471bf21cb9965cb6 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Fri, 15 Dec 2006 12:24:07 +0000 Subject: [PATCH] member intel, shows all incoming and outgoing fleets for member planets --- include.pl | 2 +- index.pl | 2 +- memberIntel.pl | 75 ++++++++++++++++++++++++++++++++++++++ templates/memberIntel.tmpl | 35 ++++++++++++++++++ templates/skel.tmpl | 2 +- 5 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 memberIntel.pl create mode 100644 templates/memberIntel.tmpl diff --git a/include.pl b/include.pl index 07bb985..a78acc9 100644 --- a/include.pl +++ b/include.pl @@ -107,7 +107,7 @@ FROM (intel i NATURAL JOIN users u) JOIN current_planet_stats t ON i.target = t.id JOIN current_planet_stats o ON i.sender = o.id WHERE $where -GROUP BY i.tick,i.mission,t.x,t.y,t.z,o.x,o.y,o.z,i.amount,i.ingal,u.username,t.alliance,o.alliance +GROUP BY i.tick,i.mission,t.x,t.y,t.z,o.x,o.y,o.z,i.amount,i.ingal,u.username,t.alliance,o.alliance,t.nick,o.nick ORDER BY i.tick DESC, i.mission}; } diff --git a/index.pl b/index.pl index e557be1..fe1572b 100755 --- a/index.pl +++ b/index.pl @@ -64,7 +64,7 @@ while (my ($name,$attack,$gid) = $query->fetchrow()){ our $LOG = $DBH->prepare('INSERT INTO log (uid,text) VALUES(?,?)'); my $page = 'main'; -if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances)$/){ +if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances|memberIntel)$/){ $page = $1; } diff --git a/memberIntel.pl b/memberIntel.pl new file mode 100644 index 0000000..98d6738 --- /dev/null +++ b/memberIntel.pl @@ -0,0 +1,75 @@ +#************************************************************************** +# 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. * +#**************************************************************************/ + +use strict; +use POSIX; +our $BODY; +our $DBH; +our $LOG; +my $error; + +$ND::TEMPLATE->param(TITLE => 'Member Intel'); + +die "You don't have access" unless isHC(); + +my $showticks = 'AND i.tick > tick()'; +if (param('show') eq 'all'){ + $showticks = ''; +}elsif (param('show') =~ /^(\d+)$/){ + $showticks = "AND (i.tick - i.eta) > (tick() - $1)"; +} + + +my $query = $DBH->prepare(intelquery('o.alliance AS oalliance,coords(o.x,o.y,o.z) AS origin, coords(t.x,t.y,t.z) AS target, t.nick',"t.alliance_id = 1 $showticks")); +$query->execute() 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('o.nick,coords(o.x,o.y,o.z) AS origin,t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',"o.alliance_id = 1 $showticks")); +$query->execute() 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}; + +$BODY->param(IntelLIsts => \@intellists); + +$BODY->param(Error => $error); +1; diff --git a/templates/memberIntel.tmpl b/templates/memberIntel.tmpl new file mode 100644 index 0000000..b6a3c57 --- /dev/null +++ b/templates/memberIntel.tmpl @@ -0,0 +1,35 @@ + +

Show all ticks

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AllianceNickSenderMissionLanding tickETAAmountTargetAllianceNickIngalReported by
+
diff --git a/templates/skel.tmpl b/templates/skel.tmpl index 9c4685c..681038b 100644 --- a/templates/skel.tmpl +++ b/templates/skel.tmpl @@ -58,7 +58,7 @@
  • List users
  • Intel
  • Alliances
  • -
  • Alliance status
  • +
  • Member Intel
  • Alliance resources
  • -- 2.39.2