<(common.inc.plp)><:
-my $scver = 'bw';
+my %scver = (
+ id => 'bw',
+ name => 'Brood War',
+ title => 'starcraft',
+ game => 'StarCraft',
+ major => 1,
+);
+
if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
- my $scver = 'hots';
+ %scver = (
+ id => 'hots',
+ name => 'Heart of the Swarm',
+ title => 'starcraft2',
+ game => 'StarCraft II',
+ major => 2,
+ );
}
-my $datafile = "sc-units-$scver.inc.pl";
+my $datafile = "sc-units-$scver{id}.inc.pl";
Html({
- title => 'starcraft unit cheat sheet',
- version => 'v1.0',
+ title => "$scver{title} unit cheat sheet",
+ version => 'v1.1',
description => [
- 'Reference of StarCraft unit properties,'
- . ' comparing various statistics of all the units in Brood War'
+ "Reference of $scver{game} unit properties,"
+ . " comparing various statistics of all the units in $scver{name}"
. ' including costs, damage, defense, speed, ranges, and abilities.',
],
- keywords => [qw'
+ keywords => [
+ qw'
starcraft game unit statistics stats comparison table sheet cheat
reference software attributes properties
- '],
+ ',
+ $scver{major} < 2 ? qw' bw broodwar brood war ' : qw' starcraft2 hots ',
+ ],
stylesheet => [qw'light'],
raw => '<link rel="stylesheet" type="text/css" media="all" href="/sc.css?1.1" title="light">',
data => [$datafile],
});
-:>
-<h1>StarCraft units</h1>
+print "<h1>$scver{game} units</h1>\n\n";
-<p>
-Unit properties as seen or measured in Brood War
-<span title="no known changes as of v1.16.1">versionā„1.08</span>.
-</p>
+my $units = do $datafile;
+die "Cannot open unit data: $_\n" for $@ || $! || ();
+my $patch = shift @{$units}
+ or die "Cannot open unit data: metadata not found\n";
+
+print "<p>Unit properties as seen or measured in $scver{name}\n$patch.\n</p>\n\n";
-<:
sub coltoggle {
my ($name, $id) = @_;
return sprintf(
local $_ = $row;
$_->{hp} += $_->{shield} if $_->{shield};
my $suitchar = '';
- if ($_->{suit}) {
+ if ($_->{cargo} > 0) {
+ $suitchar = [qw/? s m l l h h h h/]->[abs $_->{cargo}];
+ }
+ elsif ($_->{size}) {
+ $suitchar = [qw/s m l h h h/]->[$_->{size}];
+ }
+ elsif ($_->{suit}) {
$suitchar = [qw/? s m l/]->[$_->{suit}];
}
);
}
- my $units = do $datafile;
- die "Cannot open unit data: $_\n" for $@ || $! || ();
my $grouped = 1; # race headers
if (exists $get{order}) {
$grouped = 0;
<dd>excludes construction of dependencies such as buildings
and <span class="unit-composed">+</span>parent units
<dt>size
- <dd>affected by <span class="unit unit-s">S</span>mall,
+ <dd><:
+if ($scver{major} > 1) {
+ :>transports can fit 8 <span class="unit unit-s">S</span>mall,
+ 4 <span class="unit unit-m">M</span>edium,
+ 2 <span class="unit unit-l">L</span>arge,
+ or a single <span class="unit unit-h">H</span>uge unit<:
+} else {
+ :>affected by <span class="unit unit-s">S</span>mall,
<span class="unit unit-m">M</span>edium,
- or <span class="unit unit-l">L</span>arge unit damage
+ or <span class="unit unit-l">L</span>arge unit damage<:
+} :>
<dd>number of command points taken per unit
<dd><span class="unit unit-o">o</span>rganic/<span class="unit unit-u">m</span>echanic unit
<dt>HP<dd>