Themed Decks | v1.1 | etcgfm v1.0.1 | up 10.22.13

  1. 4 years ago

    Required Mods
    Get Category

    Purpose
    Show theme sets as a deck using an additional field and a category! Cards go in the order you list them, but a list shows up in alphabetical order, as well as a "Pending" list under it. The images given are also based on if you have it. The cards you have show up; the cards you don't are fillers, and the cards that are pending have a pending filler. I use it for 801's Patchwork, themed decks in most TCGs, and even to list variants at 5x7.5.

    Preview (Collecting Variants)

    Function

    function themed( $tcg, $b, $word, $fill = 'pending'){
    	$database = new Database;
    	$sanitize = new Sanitize;
    	$tcg = $sanitize->for_db($tcg);
    	
    	$tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
    	$tcgid = $tcginfo['id'];
    	$cardsurl = $tcginfo['cardsurl'];
    	$format = $tcginfo['format'];
    
    $patches = get_additional($tcg, $word);
    $patches = explode(', ',$patches);
    $list = get_category($tcg, $word);
    $list = explode(', ',$list);
    
    $need = $patches;
    sort($need);
    
    $pend = array( );
    $listed = '';
    $listp = '';
    foreach($need as $item){
    $pending = $database->num_rows("SELECT * FROM `trades` WHERE `tcg`='$tcgid' AND `receiving` LIKE '%$item%'");
    if(in_array($item, $list)) {}
    else if ( $pending > 0 ) {$pend[ ] = $item;}
    else{$listed = $listed.$item.', ';}
    }
    $listed = substr($listed,0,-2);
    echo $listed.'<br/>';
    
    echo 'Pending: ';
    foreach($pend as $p){$listp = $listp.$p.', ';}
    $listp = substr($listp,0,-2);
    echo $listp.'<br/>';
    $i = 1;
    foreach($patches as $patch){
    $pending = $database->num_rows("SELECT * FROM `trades` WHERE `tcg`='$tcgid' AND `receiving` LIKE '%$patch%'");
    if(in_array($patch, $list)) {echo '<img src="'.$tcginfo['cardsurl'].$patch.'.'.$tcginfo['format'].'" title="'.$patch.'"> ';}
    else if ( $pending > 0 ) { echo '<img src="'.$tcginfo['cardsurl'].$fill.'.'.$tcginfo['format'].'" title="'.$patch.'" /> '; }
    else{ echo '<img src="'.$tcginfo['cardsurl'].'filler.'.$tcginfo['format'].'" title="'.$patch.'" /> '; }
    if($i % $b === 0){echo '<br/>';}
    $i++;}
    }

    Execution
    To show your themed decks, use:

    themed( $tcg, $b, $word, $fill);

    The reqired variables to change are $tcg, to whatever TCG you're using it on; $b to the number of cards per line you'd like, and $word to whatever category/field you're using it on.
    $word is a word that has to be SHARED between a category and an additional field. ($word is patchwork in this example).

    Your additional field named "patchwork" needs to be the full list of the cards you need. Your category named "patchwork" should only have the cards you're using for the set in it.

    The only optional variable is $fill, which is your pending filler filename. It is automatically set to 'pending', but in case you don't have a pending card, or would like to use a specific pending card, you can change $fill to whatever you'd like.

    Update Notes
    This was originally the "Patchwork" function. I just thought it needed a more generalized name. Feel free to replace the old function with this one. You should be able to use the following code to replace your old one (if you changed the 'word' already, you should only have to change "patchwork(" to "themed("

    themed('801', '4', 'patchwork');

    There are some tweaks to it (mainly just that neither list--needed or pending--have a ", " at the end of it).

    Upcoming Versions
    - Allowing the use of a second category for themed cards with mixed worth (such as some Overdrive mini-masteries).

  2. 3 years ago

    sujini

    5 Jul 2015 http://hello-love.org/

    I'm wondering if there is a way to hack (or if there is already a mod out there) in such a way that I can master a theme deck and add on to the masteries?

or Sign Up to reply!