script for generating new cards list

This commit is contained in:
Loki 2011-08-30 12:56:23 +03:00
parent 6740cef9aa
commit 1d506d29dc

View file

@ -0,0 +1,33 @@
#!/usr/bin/perl -w
use strict;
open CARDS, "< added_cards.txt" or die;
my $cards_count = 0;
my %cards;
while (<CARDS>) {
my $line = $_;
if ( $line =~/A Mage.Sets\\src\\mage\\sets\\(\w.*)\\(\w.*)\.java/ ) {
$cards_count++;
my $set = $1;
my $card = $2;
if (!exists($cards{$set})) {
$cards{$set} = [];
}
push $cards{$set}, $card;
}
}
open REPORT, "> added_cards_in_wiki_format.txt";
print REPORT "Added cards ($cards_count):\n";
foreach my $set (keys(%cards)) {
print REPORT " $set: ";
foreach my $card (@{$cards{$set}}) {
print REPORT $card . ", ";
}
print REPORT "\n";
}