It can be a pain to manually keep count of all the crayons that you have, right? I know it was definitely annoying for me. That's why I created this mod for all of you...well, mostly me.

All it does is allow you to use a card category to keep track of your crayons and display it neatly, like on my own trade post.

One thing to note, though, is that this mod requires you to be hosting the crayons on your own website to minimize what needs to be edited in the mod itself.

This goes in your mods.php file - or wherever you keep your custom functions.

function show_crayon( $tcg, $category ) {

    $database = new Database;
    $sanitize = new Sanitize;
    $tcg = $sanitize->for_db($tcg);
    $category = $sanitize->for_db($category);
    $altname = strtolower(str_replace(' ','',$tcg));

    $tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
    $tcgid = $tcginfo['id'];
    $cardsurl = $tcginfo['cardsurl'];
    $format = $tcginfo['format'];

    $cards = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$category' LIMIT 1");

// initiate
$red_count = 0;
    $orange_count = 0;
	$yellow_count = 0;
	$green_count = 0;
	$blue_count = 0;
	$purple_count = 0;
	$brown_count = 0;
	$gray_count = 0;

$crayon_dir = "images/tcg/".$altname."/currency/"; // where you keep your crayon images.

    if ( $cards['cards'] === '' ) {
$cards['cards'] = [];

// keep at zero if empty
$red_count = 0;
    $orange_count = 0;
	$yellow_count = 0;
	$green_count = 0;
	$blue_count = 0;
	$purple_count = 0;
	$brown_count = 0;
	$gray_count = 0;
}
else {
    $cards = explode(',',$cards['cards']);
    $cards = array_map('trim', $cards);

    foreach($cards as $currency){
        if($currency == 'red crayon' || $currency == 'red'){
            $red_count++;
        }
        elseif($currency == 'orange crayon' || $currency == 'orange'){
            $orange_count++;
        }
		elseif($currency == 'yellow crayon' || $currency == 'yellow'){
            $yellow_count++;
        }
		elseif($currency == 'green crayon' || $currency == 'green'){
            $green_count++;
        }
		elseif($currency == 'blue crayon' || $currency == 'blue'){
            $blue_count++;
        }
		elseif($currency == 'purple crayon' || $currency == 'purple'){
            $purple_count++;
        }
		elseif($currency == 'brown crayon' || $currency == 'brown'){
            $brown_count++;
        }
		elseif($currency == 'gray crayon' || $currency == 'gray'){
            $gray_count++;
        }
    }
}
	
	if ($red_count < 10) {
		$red = "0$red_count";
	}
	else {
		$red = $red_count;
	}
	if ($orange_count < 10) {
		$orange = "0$orange_count";
	}
	else {
		$orange = $orange_count;
	}
	if ($yellow_count < 10) {
		$yellow = "0$yellow_count";
	}
	else {
		$yellow = $yellow_count;
	}
	if ($green_count < 10) {
		$green = "0$green_count";
	}
	else {
		$green = $green_count;
	}
	if ($blue_count < 10) {
		$blue = "0$blue_count";
	}
	else {
		$blue = $blue_count;
	}
	if ($purple_count < 10) {
		$purple = "0$purple_count";
	}
	else {
		$purple = $purple_count;
	}
	if ($brown_count < 10) {
		$brown = "0$brown_count";
	}
	else {
		$brown = $brown_count;
	}
	if ($gray_count < 10) {
		$gray = "0$gray_count";
	}
	else {
		$gray = $gray_count;
	}

    echo '<img src="'.$crayon_dir.'crayon1.gif"> x '.$red.' &nbsp;&nbsp; ';
    echo '<img src="'.$crayon_dir.'crayon2.gif"> x '.$orange.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon3.gif"> x '.$yellow.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon4.gif"> x '.$green.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon5.gif"> x '.$blue.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon6.gif"> x '.$purple.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon7.gif"> x '.$brown.' &nbsp;&nbsp; ';
	echo '<img src="'.$crayon_dir.'crayon8.gif"> x '.$gray;

}

Replace the value of $crayon_dir with the relative path of where your crayon images are stored.

IF YOU ARE NOT HOSTING YOUR OWN CRAYON IMAGES: Comment out the line containing $crayon_dir and replace each individual crayon image at the bottom of this portion of code.

echo '<img src="'.$crayon_dir.'crayon1.gif"> x '.$red.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon2.gif"> x '.$orange.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon3.gif"> x '.$yellow.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon4.gif"> x '.$green.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon5.gif"> x '.$blue.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon6.gif"> x '.$purple.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon7.gif"> x '.$brown.' &nbsp;&nbsp; ';
echo '<img src="'.$crayon_dir.'crayon8.gif"> x '.$gray;

Managing in eTCG

Create a category called "crayons" - or whatever you feel like calling it, and add all your crayons. You can use either the color by itself - or the full text as shown below.

https://files.catbox.moe/3if023.png

The priority of the category doesn't matter.