diff --git a/Utils/gen-list-unimplemented-cards-for-set.pl b/Utils/gen-list-unimplemented-cards-for-set.pl index 39255747d4..a01e5662e8 100755 --- a/Utils/gen-list-unimplemented-cards-for-set.pl +++ b/Utils/gen-list-unimplemented-cards-for-set.pl @@ -14,12 +14,43 @@ my %knownSets; my @setCards; +open (DATA, $knownSetsFile) || die "can't open $knownSetsFile"; +while(my $line = ) { + my @data = split('\\|', $line); + $knownSets{$data[0]} = $data[1]; + #print ("$data[0] ===> $data[1]\n"); +} +close(DATA); + + # gets the set name my $setName = $ARGV[0]; if(!$setName) { print 'Enter a set name: '; $setName = ; chomp $setName; + $setName = $setName; +} + +while (!defined ($knownSets{$setName})) +{ + print ("Invalid set - '$setName'\n"); + print (" Possible sets you meant:\n"); + my $origSetName = $setName; + $setName =~ s/^(.).*/$1/; + my $key; + foreach $key (sort keys (%knownSets)) + { + if ($key =~ m/^$setName/img) + { + print (" '$key'\n"); + } + } + + print 'Enter a set name: '; + $setName = ; + $setName = $setName; + chomp $setName; } @@ -32,13 +63,6 @@ while(my $line = ) { } close(DATA); -open (DATA, $knownSetsFile) || die "can't open $knownSetsFile"; -while(my $line = ) { - my @data = split('\\|', $line); - $knownSets{$data[0]}= $data[1]; -} -close(DATA); - open (DATA, $setsFile) || die "can't open $setsFile"; while(my $line = ) { my @data = split('\\|', $line); @@ -63,11 +87,16 @@ sub toCamelCase { } # TODO: check for basic lands with ending 1,2,3,4,5 ... +my %cardNames; my $toPrint = ''; foreach my $card (sort cardSort @setCards) { my $className = toCamelCase(@{$card}[0]); + + $cardNames {@{$card}[0]} = 1; + my $currentFileName = "../Mage.Sets/src/mage/sets/" . $knownSets{$setName} . "/" . $className . ".java"; if(! -e $currentFileName) { + $cardNames {@{$card}[0]} = 0; if ($toPrint) { $toPrint .= "\n"; } @@ -79,3 +108,24 @@ open CARD, "> " . lc($sets{$setName}) ."_unimplemented.txt"; print CARD $toPrint; close CARD; + +print ("Unimplemented cards are here: " . lc($sets{$setName}) ."_unimplemented.txt\n"); + +open ISSUE_TRACKER, "> " . lc($sets{$setName}) ."_issue_tracker.txt"; +print ISSUE_TRACKER "# Cards in set:\n- [x] [Example Card Name] (example URL here)\n"; + + +my $cn; +foreach $cn (sort keys (%cardNames)) +{ + my $x_or_not = "[ ]"; + if ($cardNames {$cn} == 1) + { + $x_or_not = "[x]"; + } + my $cn2 = $cn; + $cn2 =~ s/ /+/g; + print ISSUE_TRACKER "- $x_or_not [$cn] (https://www.google.com.au/search?q=$cn2+MTG&tbm=isch)\n"; +} +close ISSUE_TRACKER; +print ("Tracking Issue text for a new Github issue (similar to https://github.com/magefree/mage/issues/2215): " . lc($sets{$setName}) ."_issue_tracker.txt\n");