mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Updated extract_in_wiki_format.pl. Now the name of the cars are used for output.
This commit is contained in:
parent
9929470807
commit
e02b6980c7
3 changed files with 73 additions and 41 deletions
|
@ -2,22 +2,47 @@
|
|||
|
||||
use strict;
|
||||
|
||||
my $dataFile = 'mtg-cards-data.txt';
|
||||
my $setsFile = 'mtg-sets-data.txt';
|
||||
my $knownSetsFile = 'known-sets.txt';
|
||||
|
||||
my $cards_count = 0;
|
||||
|
||||
my %knownSets;
|
||||
my %sets;
|
||||
my %cardsBySet;
|
||||
my %cards;
|
||||
|
||||
sub toCamelCase {
|
||||
my $string = $_[0];
|
||||
$string =~ s/\b([\w']+)\b/ucfirst($1)/ge;
|
||||
$string =~ s/[-,\s\']//g;
|
||||
$string;
|
||||
}
|
||||
|
||||
open (DATA, $dataFile) || die "can't open $dataFile";
|
||||
while(my $line = <DATA>) {
|
||||
my @data = split('\\|', $line);
|
||||
$cardsBySet{$data[1]}{toCamelCase($data[0])} = \@data;
|
||||
}
|
||||
close(DATA);
|
||||
|
||||
open (DATA, $setsFile) || die "can't open $setsFile";
|
||||
while(my $line = <DATA>) {
|
||||
my @data = split('\\|', $line);
|
||||
$sets{$data[0]}= $data[1];
|
||||
}
|
||||
close(DATA);
|
||||
|
||||
open (DATA, $knownSetsFile) || die "can't open $knownSetsFile";
|
||||
while(my $line = <DATA>) {
|
||||
my @data = split('\\|', $line);
|
||||
$knownSets{$data[1]}= $data[2];
|
||||
$knownSets{$data[1]}= $data[0];
|
||||
}
|
||||
close(DATA);
|
||||
|
||||
open CARDS, "< added_cards.txt" or die;
|
||||
|
||||
open CARDS, "< added_cards.txt" or die;
|
||||
while (<CARDS>) {
|
||||
my $line = $_;
|
||||
if ( $line =~/A Mage.Sets\\src\\mage\\sets\\(\w.*)\\(\w.*)\.java/ ) {
|
||||
|
@ -28,7 +53,7 @@ while (<CARDS>) {
|
|||
$cards{$set} = [];
|
||||
}
|
||||
|
||||
push $cards{$set}, $card;
|
||||
push @{$cards{$set}}, $card;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,17 +62,24 @@ print REPORT " * Added cards ($cards_count):\n";
|
|||
foreach my $set (keys(%cards)) {
|
||||
if ($set ne "tokens") {
|
||||
if (exists $knownSets{$set}) {
|
||||
print REPORT " * $knownSets{$set}: ";
|
||||
print REPORT " * $sets{$knownSets{$set}}: ";
|
||||
} else {
|
||||
print REPORT " $set: ";
|
||||
}
|
||||
my $first = 1;
|
||||
foreach my $card (@{$cards{$set}}) {
|
||||
if ($first == 0) { print REPORT ","; }
|
||||
$card =~ s/([A-Z]{1}[a-z]+)/ $1/g;
|
||||
$card =~ s/A Ether/ AEther/g;
|
||||
print REPORT $card;
|
||||
$first = 0;
|
||||
if ($first == 0) {
|
||||
print REPORT "; ";
|
||||
} else {
|
||||
$first = 0;
|
||||
}
|
||||
if ($cardsBySet{$knownSets{$set}}{$card}) {
|
||||
print REPORT $cardsBySet{$knownSets{$set}}{$card}[0];
|
||||
} else {
|
||||
#$card =~ s/([A-Z]{1}[a-z]+)/ $1/g;
|
||||
#$card =~ s/A Ether/ AEther/g;
|
||||
print "not processed: $sets{$knownSets{$set}} $card\n";
|
||||
}
|
||||
}
|
||||
print REPORT "\n";
|
||||
}
|
||||
|
|
|
@ -1,32 +1,31 @@
|
|||
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|
|
||||
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|
|
||||
Innistrad|innistrad|
|
|
@ -39,6 +39,7 @@ Guildpact|GPT|
|
|||
Homelands|HML|
|
||||
Planechase|HOP|
|
||||
Ice Age|ICE|
|
||||
Innistrad|ISD|
|
||||
Invasion|INV|
|
||||
Judgment|JUD|
|
||||
Limited Edition Alpha|LEA|
|
||||
|
|
Loading…
Reference in a new issue