update script to replace set names by set codes

This commit is contained in:
magenoxx 2011-08-30 17:21:08 +04:00
parent 12d3b974d0
commit 4a97e9c6fc
2 changed files with 49 additions and 33 deletions

View file

@ -2,12 +2,22 @@
use strict;
open CARDS, "< added_cards.txt" or die;
my $knownSetsFile = 'known-sets.txt';
my $cards_count = 0;
my %knownSets;
my %cards;
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
while(my $line = <DATA>) {
my @data = split('\\|', $line);
$knownSets{$data[1]}= $data[2];
}
close(DATA);
open CARDS, "< added_cards.txt" or die;
while (<CARDS>) {
my $line = $_;
if ( $line =~/A Mage.Sets\\src\\mage\\sets\\(\w.*)\\(\w.*)\.java/ ) {
@ -23,9 +33,13 @@ while (<CARDS>) {
}
open REPORT, "> added_cards_in_wiki_format.txt";
print REPORT "Added cards ($cards_count):\n";
print REPORT " * Added cards ($cards_count):\n";
foreach my $set (keys(%cards)) {
print REPORT " $set: ";
if (exists $knownSets{$set}) {
print REPORT " * $knownSets{$set}: ";
} else {
print REPORT " $set: ";
}
foreach my $card (@{$cards{$set}}) {
print REPORT $card . ", ";
}