diff --git a/pad.pl b/pad.pl index fb6cfb8e..6019fe94 100755 --- a/pad.pl +++ b/pad.pl @@ -9,6 +9,7 @@ my $monsterjson; my $output; +print "importing box json\n"; { local $/=undef; open FILE, "pad.json" or die "Couldn't open file: $!"; @@ -16,6 +17,7 @@ close FILE; } +print "importing monster json\n"; { local $/=undef; open FILE, "paddata_processed_na_cards.json" or die "Couldn't open file: $!"; @@ -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 = ' @@ -119,6 +121,7 @@ "; +print "generating friend list\n"; my @friendarray; push @friendarray, "
@@ -148,9 +151,10 @@ $output .= join "\n", @friendarray; $output .= "\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, " "; - my $awakenings = keys $decodedmonster->[$cardnum]{'card'}{'awakenings'}; + my $awakenings = scalar(@{$decodedmonster->[$cardnum]{'card'}{'awakenings'}}); $monsterline .= ""; my $latents = sprintf("%049b", $decodedbox->{'card'}[$c][10]); my $latentcell; @@ -552,6 +556,7 @@ '; +print "writing to file\n"; open (my $fh, '>', "docs/index.html"); print $fh $output; close $fh;
  @@ -255,8 +259,8 @@ $output .= "
\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]); @@ -324,7 +328,7 @@ $skilllevel = $decodedbox->{'card'}[$c][3] }; $monsterline .= "
$skilllevel/$skillmax$decodedbox->{'card'}[$c][9]/$awakenings