sc: suit fallback for sc2
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 3252cf3e3cb1f3965765417ad728e03df3dd0524..cf2155f3b9bbffe6fa1d9979ad9660dfead41c9b 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -3,7 +3,6 @@
 my %scver = (
        id => 'bw',
        name => 'Brood War',
 my %scver = (
        id => 'bw',
        name => 'Brood War',
-       patch => '<span title="no known changes as of v1.16.1">versionā‰„1.08</span>',
        title => 'starcraft',
        game => 'StarCraft',
        major => 1,
        title => 'starcraft',
        game => 'StarCraft',
        major => 1,
@@ -13,7 +12,6 @@ if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') {
        %scver = (
                id => 'hots',
                name => 'Heart of the Swarm',
        %scver = (
                id => 'hots',
                name => 'Heart of the Swarm',
-               patch => 'patch 2.1.3 BU',
                title => 'starcraft2',
                game => 'StarCraft II',
                major => 2,
                title => 'starcraft2',
                game => 'StarCraft II',
                major => 2,
@@ -42,7 +40,13 @@ Html({
 });
 
 print "<h1>$scver{game} units</h1>\n\n";
 });
 
 print "<h1>$scver{game} units</h1>\n\n";
-print "<p>Unit properties as seen or measured in $scver{name}\n$scver{patch}.\n</p>\n\n";
+
+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) = @_;
 
 sub coltoggle {
        my ($name, $id) = @_;
@@ -174,7 +178,13 @@ sub showval {
                local $_ = $row;
                $_->{hp} += $_->{shield} if $_->{shield};
                my $suitchar = '';
                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}];
                }
 
                        $suitchar = [qw/? s m l/]->[$_->{suit}];
                }
 
@@ -213,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;
        my $grouped = 1;  # race headers
        if (exists $get{order}) {
                $grouped = 0;
@@ -273,9 +281,17 @@ sub showval {
        <dd>excludes construction of dependencies such as buildings
                and <span class="unit-composed">+</span>parent units
 <dt>size
        <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,
                <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>
        <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>