Cleanup and more help for gen-existing-cards-by-set.pl

This commit is contained in:
spjspj 2016-11-02 09:07:43 +11:00
parent 3f882b73c4
commit d062ff11f0

View file

@ -46,6 +46,8 @@ if (-e $authorFile) {
}
my $cardsFound = 0;
my %all_sets;
print ("Opening $dataFile\n");
open (DATA, $dataFile) || die "can't open $dataFile";
while(my $line = <DATA>) {
@ -56,11 +58,25 @@ while(my $line = <DATA>) {
my $cardInfo = "$data[0],,,$data[2]";
push(@setCards, $cardInfo);
$cardsFound = $cardsFound + 1;
} else {
$all_sets {$data[1]} = 1;
}
}
close(DATA);
print "Number of cards found for set " . $setName . ": " . $cardsFound . "\n";
if ($cardsFound == 0) {
$setName =~ s/^(...).*/$1/;
my $poss;
foreach $poss (sort keys (%all_sets)) {
if ($poss =~ m/^$setName/i) {
print ("Did you possibly mean: $poss ?\n");
}
}
exit;
}
open (DATA, $setsFile) || die "can't open $setsFile";
while(my $line = <DATA>) {
@ -90,9 +106,9 @@ sub getRarity
{
return $raritiesConversion {$val};
}
print ("JSKLDFJSLKDFJLSKJDF --- $val,,,$_[1]\n");
print ("ERROR DETECTED! - Incorrect rarity.. --- $val,,,$_[1]\n");
sleep (10);
return "WHOKNOWS";
exit;
}
# Generate the cards