X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/1de61e5745ecf3dd1a41e1e932bae2f7568353a4..c09dbeb9c62930fc46ec793d4f18eda815cd8c34:/sc.plp
diff --git a/sc.plp b/sc.plp
index 55dbd09..0534c04 100644
--- a/sc.plp
+++ b/sc.plp
@@ -1,37 +1,53 @@
<(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 => '',
data => [$datafile],
});
-:>
-
StarCraft units
+print "
$scver{game} units
\n\n";
-
-Unit properties as seen or measured in Brood War
-versionâ¥1.08.
-
+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 "
Unit properties as seen or measured in $scver{name}\n$patch.\n
\n\n";
-<:
sub coltoggle {
my ($name, $id) = @_;
return sprintf(
@@ -47,7 +63,7 @@ sub coltoggle {
<:= coltoggle(qw'build cost') :>
-
<:= coltoggle(qw'size size') :>
+
<:= coltoggle(qw'size size') :>
HP
shield
armor
@@ -165,6 +181,18 @@ sub showval {
if ($_->{suit}) {
$suitchar = [qw/? s m l/]->[$_->{suit}];
}
+ elsif ($_->{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 ($_->{attr} and $_->{attr}->{light}) {
+ $suitchar = 's';
+ }
+ elsif ($_->{attr} and $_->{attr}->{armored}) {
+ $suitchar = 'l';
+ }
return (
'
excludes construction of dependencies such as buildings
and +parent units
size
-
affected by Small,
+
<:
+if ($scver{major} > 1) {
+ :>transports can fit 8 Small,
+ 4 Medium,
+ 2 Large,
+ or a single Huge unit<:
+} else {
+ :>affected by Small,
Medium,
- or Large unit damage
+ or Large unit damage<:
+} :>