Template:Custom card count

From Hearthstone Wiki
Jump to navigation Jump to search

This template returns a count of cards matching the same criteria as {{Custom card table}}. It also sets a variable for ease of retrieval of the count later in the same page without repeating the entire template call.

This may be useful directly in strategy descriptions or mechanics notes, but can also be used with {{DrawChance}} or {{DiscoverChance}} to generate dynamically updated probabilities.

Usage[edit source]

See {{Custom card table}} for most parameter/syntax documentation.

To use variables after an initial call to this template on a page:

  • {{#var:stdcount}} produces the same value as the previous call to this template that used |format=standard.
  • {{#var:wild-onlycount}} produces the same value as the previous call to this template that used |format=wild-only.
  • {{#var:wildcount}} produces the same value as the previous call to this template that used |format=wild or any other format, including no format at all.
  • Note that if multiple template calls are used in the same page with the same format, these count variables will always refer to the most recent template call of the corresponding format, which may have had a different count than earlier queries.

Note that unlike {{Custom card table}}, this does not have type-specific versions like {{Custom minion card table}} for minions, spells, or weapons. (Those alternates are used because they make good choices about table columns, whereas this template does not make a table at all.) Make sure to add |type=minion (or weapon or spell) to the parameter list if adding this template and copying parameters from one of the type-specific templates.

Examples[edit source]

  • {{Custom card count|type=Weapon|format=wild-only}} produces
    Error 3995: Character set 'utf8mb4_unicode_ci' cannot be used in conjunction with 'binary' in call to regexp_like.

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)" AND `cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Wild_format_cards(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("W","e","a","p","o","n")) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

, the number of weapon cards only available in Wild format play.

  • {{Custom card count|type=Spell|class=Mage|format=standard|rarity=!Legendary|collectible=true}} produces
    Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"M","a","g","e")) AND (`cargo__Cards`.`rarity`=CONCAT("!","L","e","g","e","n","d' at line 1

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)" AND `cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Standard_format_cards(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("S","p","e","l","l")) AND (`cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "M","a","g","e")) AND (`cargo__Cards`.`rarity`=CONCAT("!","L","e","g","e","n","d","a","r","y")) AND (`cargo__Cards`.`collectible`=1) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

.

  • {{Custom card count|type=Minion|collectible=true|class=Any{{!}}{{!}}Priest|mana=8~99|format=wild}}
    produces
    Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A","n","y") OR `cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__cl' at line 1

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("M","i","n","i","o","n")) AND (`cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "A","n","y") OR `cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "P","r","i","e","s","t")) AND (`cargo__Cards`.`cost`>="8" AND `cargo__Cards`.`cost`<="99") AND (`cargo__Cards`.`collectible`=1) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

.

    • This is the number of different neutral or priest minions with cost (8) or higher in Wild format, which is the card pool for  Free From Amber if cast by a priest.
  • {{#var:stdcount}} produces
    Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"M","a","g","e")) AND (`cargo__Cards`.`rarity`=CONCAT("!","L","e","g","e","n","d' at line 1

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)" AND `cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Standard_format_cards(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("S","p","e","l","l")) AND (`cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "M","a","g","e")) AND (`cargo__Cards`.`rarity`=CONCAT("!","L","e","g","e","n","d","a","r","y")) AND (`cargo__Cards`.`collectible`=1) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

again without re-querying, from the Standard format mage query above.

  • {{#var:wild-onlycount}} produces
    Error 3995: Character set 'utf8mb4_unicode_ci' cannot be used in conjunction with 'binary' in call to regexp_like.

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)" AND `cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Wild_format_cards(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("W","e","a","p","o","n")) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

again without re-querying, from the wild-exclusive weapon query above.

  • {{#var:wildcount}} produces
    Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"A","n","y") OR `cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__cl' at line 1

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("M","i","n","i","o","n")) AND (`cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "A","n","y") OR `cargo__Cards`.`_ID` IN (SELECT `_rowID` FROM `cargo__Cards__class` WHERE `_value`= CONCAT() "P","r","i","e","s","t")) AND (`cargo__Cards`.`cost`>="8" AND `cargo__Cards`.`cost`<="99") AND (`cargo__Cards`.`collectible`=1) ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

again without re-querying, from the Wild format Free From Amber query above.

  • {{Custom card count|type=Minion|mana=10|format=potato}} produces
    Error 3995: Character set 'utf8mb4_unicode_ci' cannot be used in conjunction with 'binary' in call to regexp_like.

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("M","i","n","i","o","n")) AND (`cargo__Cards`.`cost`="10") ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

, the number of 10-mana minions in Wild format (the most general format since "potato" is not valid).

  • {{#var:wildcount}} produces
    Error 3995: Character set 'utf8mb4_unicode_ci' cannot be used in conjunction with 'binary' in call to regexp_like.

Function: CargoSQLQuery::run Query: SELECT COUNT(DISTINCT `cargo__Cards`.`_pageName`) AS `count` FROM `cargo__Cards` LEFT OUTER JOIN `cargo___pageData` ON ((`cargo__Cards`.`_pageId`=`cargo___pageData`.`_pageId`)) WHERE (`cargo___pageData`.`_categories__full` RLIKE "(^|\\|)Card_data(\\||$)") AND `cargo__Cards`.`bg_type` IS NULL AND (`cargo__Cards`.`type`=CONCAT("M","i","n","i","o","n")) AND (`cargo__Cards`.`cost`="10") ORDER BY COUNT(DISTINCT `cargo__Cards`.`_pageName`) LIMIT 1000

again without re-querying. The result from the Free From Amber count has been replaced with the the more recent one from the 10-mana minion count.

See also[edit source]