Skip to content

Commit

Permalink
remove expermental perl code
Browse files Browse the repository at this point in the history
  • Loading branch information
izenn committed Apr 5, 2019
1 parent 78144c8 commit 4928ccb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pad.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
my $monsterjson;
my $output;

print "importing box json\n";
{
local $/=undef;
open FILE, "pad.json" or die "Couldn't open file: $!";
$boxjson = <FILE>;
close FILE;
}

print "importing monster json\n";
{
local $/=undef;
open FILE, "paddata_processed_na_cards.json" or die "Couldn't open file: $!";
Expand All @@ -26,7 +28,7 @@
my $decodedbox = decode_json($boxjson);
my $decodedmonster = decode_json($monsterjson);

my $friendcount = keys $decodedbox->{'friends'};
my $friendcount = scalar(@{$decodedbox->{'friends'}});

$output = '<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -119,6 +121,7 @@
<table style='width: 100%'>
<tr>";

print "generating friend list\n";
my @friendarray;
push @friendarray, "<td style='width:40%;'>
<table id='friends'>
Expand Down Expand Up @@ -148,9 +151,10 @@
$output .= join "\n", @friendarray;
$output .= "<td style='width:4%'>&nbsp;</td>\n";

print "generating team list\n";
my @teamarray;
my $teamcount = keys $decodedbox->{'decksb'}{'decks'};
my $cardcount = keys $decodedbox->{'card'};
my $teamcount = scalar(@{$decodedbox->{'decksb'}{'decks'}});
my $cardcount = scalar(@{$decodedbox->{'card'}});

push @teamarray, " <td style='width:55%; vertical-align:top'><table id='teams'>
<thead>
Expand Down Expand Up @@ -255,8 +259,8 @@
$output .= "</table>
</div>\n\n";

print "generating box list\n";
my @monsterarray;

for (my $c = 0; $c < $cardcount; $c++ ) {
my $monsterline;
my $cardnum = sprintf("%05d", $decodedbox->{'card'}[$c][5]);
Expand Down Expand Up @@ -324,7 +328,7 @@
$skilllevel = $decodedbox->{'card'}[$c][3]
};
$monsterline .= "<td>$skilllevel/$skillmax</td>";
my $awakenings = keys $decodedmonster->[$cardnum]{'card'}{'awakenings'};
my $awakenings = scalar(@{$decodedmonster->[$cardnum]{'card'}{'awakenings'}});
$monsterline .= "<td>$decodedbox->{'card'}[$c][9]/$awakenings</td>";
my $latents = sprintf("%049b", $decodedbox->{'card'}[$c][10]);
my $latentcell;
Expand Down Expand Up @@ -552,6 +556,7 @@
</body>
</html>';

print "writing to file\n";
open (my $fh, '>', "docs/index.html");
print $fh $output;
close $fh;

0 comments on commit 4928ccb

Please sign in to comment.