mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
spjspj - Generate a 'tracking issue' similar to Fenhl's for kaladesh. Prompt if you've not typed in a correct set name
This commit is contained in:
parent
7feb237c06
commit
3636b84b09
1 changed files with 57 additions and 7 deletions
|
@ -14,12 +14,43 @@ my %knownSets;
|
|||
|
||||
my @setCards;
|
||||
|
||||
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
|
||||
while(my $line = <DATA>) {
|
||||
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 = <STDIN>;
|
||||
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 = <STDIN>;
|
||||
$setName = $setName;
|
||||
chomp $setName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,13 +63,6 @@ while(my $line = <DATA>) {
|
|||
}
|
||||
close(DATA);
|
||||
|
||||
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
|
||||
while(my $line = <DATA>) {
|
||||
my @data = split('\\|', $line);
|
||||
$knownSets{$data[0]}= $data[1];
|
||||
}
|
||||
close(DATA);
|
||||
|
||||
open (DATA, $setsFile) || die "can't open $setsFile";
|
||||
while(my $line = <DATA>) {
|
||||
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");
|
||||
|
|
Loading…
Reference in a new issue