X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=include.pl;h=fe3646d0a1cfe215db5b828eafea2fd9e38a753f;hb=c7d0fba418165b74a21f5d5dcb4cd404ba3a64c4;hp=408361a369ecab58a8fceeec08ff5f41613efde8;hpb=e63c14e793686ca3d8a47df6866134c21a77e4b7;p=ndwebbie.git diff --git a/include.pl b/include.pl index 408361a..fe3646d 100644 --- a/include.pl +++ b/include.pl @@ -63,7 +63,7 @@ sub max { } sub listTargets { - my $query = $ND::DBH->prepare(qq{SELECT t.id, r.id AS raid, r.tick+c.wave-1 AS landingtick, released_coords, coords(x,y,z),c.launched + my $query = $ND::DBH->prepare(qq{SELECT t.id, r.id AS raid, r.tick+c.wave-1 AS landingtick, released_coords, coords(x,y,z),c.launched,c.wave FROM raid_claims c JOIN raid_targets t ON c.target = t.id JOIN raids r ON t.raid = r.id @@ -76,11 +76,23 @@ ORDER BY r.tick+c.wave,x,y,z}); my $coords = "Target $target->{id}"; $coords = $target->{coords} if $target->{released_coords}; push @targets,{Coords => $coords, Launched => $target->{launched}, Raid => $target->{raid} - , Target => $target->{id}, Tick => $target->{landingtick}}; + , Target => $target->{id}, Tick => $target->{landingtick}, Wave => $target->{wave}}; } my $template = HTML::Template->new(filename => "templates/targetlist.tmpl"); $template->param(Targets => \@targets); return $template->output; } +sub alliances { + my ($alliance) = @_; + my @alliances; + push @alliances,{Id => -1, Name => ' ', Selected => not $alliance}; + my $query = $ND::DBH->prepare(q{SELECT id,name FROM alliances ORDER BY name}); + $query->execute; + while (my $ally = $query->fetchrow_hashref){ + push @alliances,{Id => $ally->{id}, Name => $ally->{name}, Selected => $alliance eq $ally->{name}}; + } + return @alliances; +} + 1;