tools for generating supported card list

This commit is contained in:
techdragon.nguyen@gmail.com
2010-12-27 09:22:52 +00:00
parent 6cf5212bab
commit 814993ac1c
5 changed files with 6840 additions and 0 deletions

View File

@@ -0,0 +1 @@
run the createHTMLList_SupportedCards.bash to create a text file contianing the HTML to use for the Miki on the supported cards in wagic

View File

@@ -0,0 +1,37 @@
There are a total of 6715 cards supported in this release.
__NOTOC__
<ul id="Top">
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#A]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#B]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#C]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#D]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#E]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#F]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#G]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#H]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#I]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#J]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#K]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#L]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#M]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#N]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#O]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#P]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#Q]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#R]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#S]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#T]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#U]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#V]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#W]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#X]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#Y]]</li>
<li style="display:inline; list-style-type: none; right-padding: 5px" >[[#Z]]</li>
</ul>
<h2 style="width: 100%"><span id="0-9">0-9</span> <span style="font-size:small; float: right;">Back to [[#Top]]</span></h2>
<ul id="index_0-9">
<li>3rd Creature Buried Alive</li>
</ul>

View File

@@ -0,0 +1,72 @@
#!/bin/perl
my $currentIndex = 0;
my %data;
while ( <> )
{
s/
//;
s/\n//;
my $line = $_;
my $currentIndex = uc substr($line,0,1);
if ($line =~ /^\d/ )
{
push @{$data->{"0-9"}}, $line;
}
else
{
push @{$data->{$currentIndex}}, $line;
}
}
my @keys = sort keys %$data;
foreach (@keys)
{
my $cardCount = scalar @{$data->{$_}};
print $_ . " => $cardCount \n";
$totalCardCount += $cardCount;
}
my $headerRow = &getHeader( \@keys );
open OUTFILE, ">cardList.txt";
#print index keys of cards
# print the miki card count information
print OUTFILE<<MIKI;
There are a total of $totalCardCount cards supported in this release.
MIKI
print OUTFILE $headerRow . "\n";;
foreach my $key ( @keys )
{
my $cardCount = $#{$data->{$key}} + 1;
print OUTFILE "<h2 style=\"width: 100%\"><span id=\"$key\">";
print OUTFILE "$key" ;
print OUTFILE " ($cardCount)" if ($cardCount > 10 );
print OUTFILE "</span> <span style=\"font-size:small; float: right;\">Back to [[#Top]]</span></h2>\n";
print OUTFILE "<ul id=\"index_$key\">\n";
print OUTFILE map "\t<li>$_</li>\n", @{$data->{$key}};
print OUTFILE "</ul>\n\n";
close OUTFILE;
}
sub getHeader
{
my $listRef = shift;
my @list = map "<li style=\"display:inline; list-style-type: none; right-padding: 5px\" >[[#$_]]</li>", @{$listRef};
shift( @list ); # remove the link to the first set of cards
my $listItems = join "\n", @list;
return "__NOTOC__ \n<ul id=\"Top\">\n$listItems\n</ul>\n";

View File

@@ -0,0 +1,15 @@
#!/bin/bash
####################################################
# adjust the values for mtg.txt and borderline.txt
# if your "Res" directory isn't in the default place
####################################################
####################################################
# Purpose: build an HTML list of all the supported
# cards in Wagic for use in the Miki.
# http://wololo.net/.
####################################################
grep '^name=' ../../bin/Res/sets/primitives/mtg.txt ../../bin/Res/sets/primitives/borderline.txt|sed s/name=// | sed s/.*txt:// |sort -iu > supportedCards.txt
perl createHTMLList_SupportedCards.pl < supportedCards.txt

File diff suppressed because it is too large Load Diff