Example #1
0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
require_once 'scripts/includes/global.php';
echo "Card Generator v{$version} - Prices\n\n";
$files = getInputFiles(array_slice($argv, 1), 'Drag and drop a decklist file or directory here and press enter...');
$setDB = new SetDB();
$artDB = new ArtDB();
$cardDB = new CardDB($setDB, $artDB);
$convertor = new Convertor();
echo 'Downloading MagicTraders pricing...';
$prices = array();
$file = @fopen('http://www.magictraders.com/pricelists/current-magic', 'r');
if (!$file) {
    error('Unable to open URL: http://www.magictraders.com/pricelists/current-magic');
}
$count = 0;
while (!feof($file)) {
    $line = fgets($file, 4096);
    if (substr($line, 0, 6) == 'total:') {
        continue;
Example #2
0
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
require_once 'includes/global.php';
$pagedOutput = $argv[1] == 'pagedOutput=true';
$decklistOnlyOutput = $argv[2] == 'decklistOnlyOutput=true';
$fileNames = array_slice($argv, 3);
$mode = 'Generate ';
if ($decklistOnlyOutput) {
    $mode .= 'Decklist ';
}
$mode .= $pagedOutput ? 'Pages' : 'Cards';
echo "Card Generator v{$version} - {$mode}\n\n";
$files = getInputFiles($fileNames, 'Drag and drop a decklist file or directory into this window and press enter...');
configPrompt($decklistOnlyOutput);
cleanOutputDir($pagedOutput);
$writer = new ImageWriter();
$writer->setOutputType($pagedOutput, $decklistOnlyOutput);
foreach ($files as $file) {
    $writer->parseDecklist($file);
}
echo "Generating images...\n";
if ($pagedOutput) {
    $count = $writer->writePages();
    echo "Image generation complete.\n";
    echo $count . " pages written.\n";
} else {
    $count = $writer->writeCards();
    echo "Image generation complete.\n";
Example #3
0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
require_once 'scripts/includes/global.php';
echo "Card Generator v{$version} - MWS to cards.csv\n\n";
$files = getInputFiles(array_slice($argv, 1), 'Drag and drop an MWS masterbase CSV file here and press enter...');
echo "Creating temporary file: data/cards.csv.temp\n";
$cardsFile = fopen_utf8('data/cards.csv.temp', 'w+b');
if (!$cardsFile) {
    error('Unable to write CSV file: data/cards.csv.temp');
}
// Copy orginal vanguard avatars.
echo "Copying extra Vanguard avatars...\n";
$origVanguardAvatarFile = fopen_utf8('misc/import/orginalVanguardAvatars.csv', 'rb');
if (!$origVanguardAvatarFile) {
    error('Unable to read orginal Vanguard CSV file.');
}
while (!feof($origVanguardAvatarFile)) {
    fwrite($cardsFile, fgets($origVanguardAvatarFile));
}
fclose($origVanguardAvatarFile);
Example #4
0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////
require_once 'scripts/includes/global.php';
echo "Card Generator v{$version} - Diff Decklists\n\n";
$files = getInputFiles(array_slice($argv, 1), 'Drag and drop the original decklist file into this window and press enter...', 'Drag and drop the new decklist file into this window and press enter...');
echo 'Ignore sets and picture numbers? (y/n) ';
$ignoreSets = strtolower(trim(fgets(STDIN))) == 'y';
echo "\n";
$setDB = new SetDB();
$artDB = new ArtDB();
$cardDB = new CardDB($setDB, $artDB);
$convertor = new Convertor();
$oldDecklist = new Decklist($setDB, $cardDB, $convertor, $files[0]);
$newDecklist = new Decklist($setDB, $cardDB, $convertor, $files[1]);
echo "Examining differences...";
$addCardsIndex = cardsMinusCards($newDecklist->cards, $oldDecklist->cards);
$removeCardsIndex = cardsMinusCards($oldDecklist->cards, $newDecklist->cards);
echo "\n";
if (count($addCardsIndex) == 0 && count($removeCardsIndex) == 0) {
    echo "Decklists are identical.";