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; use strict;
open CARDS, "< added_cards.txt" or die; my $knownSetsFile = 'known-sets.txt';
my $cards_count = 0; my $cards_count = 0;
my %knownSets;
my %cards; 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>) { while (<CARDS>) {
my $line = $_; my $line = $_;
if ( $line =~/A Mage.Sets\\src\\mage\\sets\\(\w.*)\\(\w.*)\.java/ ) { 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"; 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)) { 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}}) { foreach my $card (@{$cards{$set}}) {
print REPORT $card . ", "; print REPORT $card . ", ";
} }

View file

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