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 . ", ";
}

View file

@ -1,30 +1,32 @@
Tenth Edition|tenth|
Magic 2010|magic2010|
Magic 2011|magic2011|
Magic 2012|magic2012|
Planechase|planechase|
Duel Decks: Elspeth vs. Tezzeret|elspethvstezzeret|
Tempest|tempest|
Invasion|invasion|
Planeshift|planeshift|
Apocalypse|apocalypse|
Mirrodin|mirrodin|
Darksteel|darksteel|
Fifth Dawn|fifthdawn|
Champions of Kamigawa|championsofkamigawa|
Ravnica: City of Guilds|ravnika|
Guildpact|guildpact|
Dissension|dissension|
Lorwyn|lorwyn|
Morningtide|morningtide|
Shadowmoor|shadowmoor|
Eventide|eventide|
Shards of Alara|shardsofalara|
Conflux|conflux|
Alara Reborn|alarareborn|
Zendikar|zendikar|
Worldwake|worldwake|
Rise of the Eldrazi|riseoftheeldrazi|
Scars of Mirrodin|scarsofmirrodin|
Mirrodin Besieged|mirrodinbesieged|
New Phyrexia|newphyrexia|
Tenth Edition|tenth|10E|
Magic 2010|magic2010|M10|
Magic 2011|magic2011|M11|
Magic 2012|magic2012|M12|
Planechase|planechase|HOP|
Duel Decks: Elspeth vs. Tezzeret|elspethvstezzeret|DDF|
Tempest|tempest|TMP|
Invasion|invasion|INV|
Planeshift|planeshift|PLS|
Apocalypse|apocalypse|APC|
Mirrodin|mirrodin|MRD|
Darksteel|darksteel|DST|
Fifth Dawn|fifthdawn|5DN|
Champions of Kamigawa|championsofkamigawa|CHK|
Ravnica: City of Guilds|ravnika|RAV|
Guildpact|guildpact|GPT|
Dissension|dissension|DIS|
Lorwyn|lorwyn|LRW|
Morningtide|morningtide|MOR|
Shadowmoor|shadowmoor|SHM|
Eventide|eventide|EVE|
Shards of Alara|shardsofalara|ALA|
Conflux|conflux|CON|
Alara Reborn|alarareborn|ARB|
Zendikar|zendikar|ZEN|
Worldwake|worldwake|WWK|
Rise of the Eldrazi|riseoftheeldrazi|ROE|
Scars of Mirrodin|scarsofmirrodin|SOM|
Mirrodin Besieged|mirrodinbesieged|MBS|
New Phyrexia|newphyrexia|NPH|
Innistrad|innistrad|ISD|
Dark Ascension|darkascension|DKA|