X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/bb07d710e95b75eb0089b07165616e825f406aae..1de61e5745ecf3dd1a41e1e932bae2f7568353a4:/sc.plp diff --git a/sc.plp b/sc.plp index 9a9a12a..55dbd09 100644 --- a/sc.plp +++ b/sc.plp @@ -1,5 +1,11 @@ <(common.inc.plp)><: +my $scver = 'bw'; +if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') { + my $scver = 'hots'; +} +my $datafile = "sc-units-$scver.inc.pl"; + Html({ title => 'starcraft unit cheat sheet', version => 'v1.0', @@ -13,6 +19,8 @@ Html({ reference software attributes properties '], stylesheet => [qw'light'], + raw => '', + data => [$datafile], }); :> @@ -23,123 +31,6 @@ Unit properties as seen or measured in Brood War versionâ¥1.08.
- - <: sub coltoggle { my ($name, $id) = @_; @@ -169,6 +60,12 @@ sub coltoggle { <: sub showrange { + my ($min, $max) = @_; + $_ = int($_ + .5) for $min, $max; # round halves up + return $min == $max ? $min : "$min-$max"; +} + +sub showval { my ($row, @elements) = @_; my ($min, $max); @@ -192,8 +89,10 @@ sub showrange { } } - if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'cmp') {{ - my $type = $row->{$elements[0]}->{$elements[1]}->{type} or next; + if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'dps') {{ + my $attack = $row->{ $elements[0] }->{ $elements[1] }; + ref $attack or $attack = $row->{ $elements[0] }->{$attack}; # follow + my $type = $attack->{type} or next; if ($type eq 'explosive') { $min /= 2; } @@ -201,31 +100,40 @@ sub showrange { $min /= 4; } }} - $_ = int($_ + .5) for $min, $max; # round halves up - - return $min == $max ? $min : "$min-$max"; + return showrange($min, $max); } sub showattack { my ($row, $area) = @_; - local $_ = $row->{attack}->{$area}; + my $attack = $row->{attack}->{$area}; + if (not ref $attack) { + # reference to another area + $area = $attack; + $attack = $row->{attack}->{$area}; + } - return '