Credit

This is a mod that was originally created by Bloo and has since been heavily modified to work with the more updated versions of PHP. Since this only exists on Wayback Machine and doesn’t work properly, I thought I’d repost it here.

Problem

After you master a deck, the cards are seemingly gone forever and you don’t get to look at the decks properly.

Solution

Turn each master badge into a link that’ll take you to a page completely devoted to the mastered deck in question.

Instructions

In order to make this code work properly from game to game, there are a few things in here you’ll have to change.

<?php } elseif ( isset($_GET['mastered']) && $_GET['mastered'] !== '' ) { $deckid = intval($_GET['mastered']);
		$database = new Database;

		/* Change 'Literary' to the name of your TCG game */
    $tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='Literary' LIMIT 1");
		if ( $database->num_rows("SELECT * FROM `collecting` WHERE `id`='$deckid' AND `tcg`='".$tcginfo['id']."' LIMIT 1") > 0 ) {
				$deckinfo = $database->get_assoc("SELECT * FROM `collecting` WHERE `id`='$deckid' AND `tcg`='".$tcginfo['id']."' LIMIT 1");
				$cards = explode(',',$deckinfo['cards']); 
				array_walk($cards, 'trim_value');

				$count = count($cards);    

				echo '<center>';
				echo '<h1>'.$deckinfo['deck'].' - <em>'.date('F d, Y',strtotime($deckinfo['mastereddate'])).'</em></h1><br />';

				/* Change the format of the image to that of the master badges in your game */
				echo '<img src="'.$tcginfo['cardsurl'].''.$deckinfo['deck'].'-master.png" title="Mastered '.$deckinfo['deck'].'" /><br /><p>';
				for ( $i = 1; $i <= $deckinfo['count']; $i++ ) {
						$number = $i;
						if ( $number < 10 ) { $number = "0$number"; }
						$card = "".$deckinfo['deck']."$number";
            $pending = $database->num_rows("SELECT * FROM `trades` WHERE `tcg`='$id' AND `receiving` LIKE '%$card%'");
            if ( in_array($card, $cards) ) echo '<img src="'.$tcginfo['cardsurl'].''.$card.'.'.$tcginfo['format'].'" alt="" title="'.$card.'" />';
            else if ( $pending > 0 ) { echo '<img src="'.$tcginfo['cardsurl'].''.$deckinfo['pending'].'.'.$tcginfo['format'].'" alt="" />'; } 
else { echo '<img src="'.$tcginfo['cardsurl'].''.$deckinfo['filler'].'.'.$tcginfo['format'].'" alt="" />'; }
            if ( $deckinfo['puzzle'] == 0 ) { echo ' '; }
            if ( $deckinfo['break'] !== '0' && $i % $deckinfo['break'] == 0 ) { echo '<br />'; }
				}

				/* Change the link below to go back to your masteries page */
				echo '</p><br /><a href="literary.php?mastered">Go back?</a>';
				echo '<br /><br />';
				echo '</center>';				
		}
?>