X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/8ccd2531f273e279b7732a50f9f46391f92cf8ec..3b6982ba552c02daa4de8489e90f90a274ea14fa:/sc.plp diff --git a/sc.plp b/sc.plp index 6b08c94..4706bbf 100644 --- a/sc.plp +++ b/sc.plp @@ -1,5 +1,10 @@ <(common.inc.plp)><: +my $datafile = 'sc-units.inc.pl'; +if ($ENV{PATH_INFO} and $ENV{PATH_INFO} eq '/2') { + $datafile = 'sc2-units.inc.pl'; +} + Html({ title => 'starcraft unit cheat sheet', version => 'v1.0', @@ -13,6 +18,8 @@ Html({ reference software attributes properties '], stylesheet => [qw'light'], + raw => '', + data => [$datafile], }); :> @@ -23,123 +30,6 @@ Unit properties as seen or measured in Brood War versionâ¥1.08.
- - <: sub coltoggle { my ($name, $id) = @_; @@ -169,6 +59,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); @@ -193,7 +89,9 @@ sub showrange { } if ($elements[0] eq 'attack' and $elements[1] ne 'range' and $elements[2] eq 'dps') {{ - my $type = $row->{$elements[0]}->{$elements[1]}->{type} or next; + 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 +99,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 '