X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/3b6982ba552c02daa4de8489e90f90a274ea14fa..e487749bf1899655bb0c7b7fe9c2d4cbff3b8021:/sc.plp diff --git a/sc.plp b/sc.plp index 4706bbf..cf2155f 100644 --- a/sc.plp +++ b/sc.plp @@ -1,36 +1,53 @@ <(common.inc.plp)><: -my $datafile = 'sc-units.inc.pl'; +my %scver = ( + id => 'bw', + name => 'Brood War', + title => 'starcraft', + game => 'StarCraft', + major => 1, +); + if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') { - $datafile = 'sc2-units.inc.pl'; + %scver = ( + id => 'hots', + name => 'Heart of the Swarm', + title => 'starcraft2', + game => 'StarCraft II', + major => 2, + ); } +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( @@ -161,7 +178,13 @@ sub showval { 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}]; } @@ -200,8 +223,6 @@ sub showval { ); } - my $units = do $datafile; - die "Cannot open unit data: $_\n" for $@ || $! || (); my $grouped = 1; # race headers if (exists $get{order}) { $grouped = 0; @@ -232,17 +253,15 @@ sub showval { print( '', - sprintf('%s', - $cat ne $_->{cat} ? ('h', $cat = $_->{cat}) : ('d', ' ') - ), - '' . $_->{name}, + '', $cat ne $_->{cat} && ($cat = $_->{cat}), + '', $_->{name}, showunitcols($_), ); for my $subrow (@{ $_->{special} }) { $subrow->{alt} or next; print( - '' . $subrow->{alt}, + '', $subrow->{alt}, showunitcols($subrow), ); } @@ -262,9 +281,17 @@ sub showval {
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<: +} :>
number of command points taken per unit
organic/mechanic unit
HP