Module:Cards: Difference between revisions
No edit summary |
No edit summary |
||
Line 37: | Line 37: | ||
out = out .. ", " | out = out .. ", " | ||
end | end | ||
if i < # | if i < #card.Tribes then | ||
out = out .. " " | out = out .. " " | ||
end | end |
Revision as of 05:37, 15 December 2023
To edit card information, see Module:Cards/data
GetStat
Usage: {{#invoke:Cards|GetStat|<card>|<stat>}}
Returns the respective stat of the card.
Possible values for <stat>
: name health scrap attack counter other desc summoncon tribes price gold challenge unlock
Table
Usage: {{#invoke:Cards|Table|<entry>|<header_list>}}
OR
{{#invoke:Cards|Table|<entry_list>|*|<header_list>}}
Returns a table based on the given paramenters.
<entry>
is either a card name or type.
Types include: Boss Pet NonPetCompanion Companion Item Shade Clunker EnemyClunker Enemy Miniboss Boss ShopItem InventorsHut HotSpring Charm CursedCharm
Append a tribename before the type to filter cards exclusive to that tribe, eg SnowdwellersCompanion
<entry_list>
is a list of valid <entry>
values, input as multiple parameters, i.e. <entry1>|<entry2>|... etc.
.
<header_list>
is a list of valid stats, input as multiple parameters, i.e. <stat1>|<stat2>|... etc.
.
Stats include: name health scrap attack counter other desc summoncon tribes price challenge
The first usage option is used when only 1 entry is needed, e.g. the only entry is a type category. Otherwise, use the second option.
If challenge
is among the header stats, the table will be sorted based off the entry's ChallengeOrder
value, if it exists.
CardInfobox
Usage: {{#invoke:Cards|CardInfobox|<card>|<template_params>}}
Returns the infobox of the card.
<template_params>
is a list of template parameters input as multiple parameters, i.e. <p1>=<data1>|<p2>=<data2>|... etc.
.
These parameters are the same parameters used by Template:Infobox.
Parameters without inputs are autofilled with fitting module data, to the best of its ability.
CharmInfobox
Usage: {{#invoke:Cards|CharmInfobox|<charm>|<template_params>}}
Returns the infobox of the charm.
<template_params>
is a list of template parameters input as multiple parameters, i.e. <p1>=<data1>|<p2>=<data2>|... etc.
.
These parameters are the same parameters used by Template:Infobox.
Parameters without inputs are autofilled with fitting module data, to the best of its ability.
Itembox
Usage: {{#invoke:Cards|Itembox|<card>|<template_params>}}
Returns the itembox of the card.
<template_params>
is a list of template parameters input as multiple parameters, i.e. <p1>=<data1>|<p2>=<data2>|... etc.
.
These parameters are the same parameters used by Template:Itembox.
Parameters without inputs are autofilled with fitting module data, to the best of its ability.
Usage: {{#invoke:Cards|NavBoxSection|<type>}}
Returns a list of links for cards of a certain type, for use in Template:NavboxCards.
suggested values for <type>
: Boss Pet NonPetCompanion Item Shade Clunker EnemyClunker Enemy Miniboss Boss
local p = {} --local KeyData = mw.loadData( 'Module:Code/data') local all_cards = require("Module:Cards/data").cards function p.GetStat(frame) local card = all_cards[frame.args.name or frame.args[1]] if card == nil then return "" end local stat = frame.args.stat or frame.args[2] return frame:preprocess(_getStat(card, stat)) end function _getStat(card, stat) stat = string.lower(stat) if stat == "name" then return card.Name or "" elseif stat == "heath" then return card.Health or "" elseif stat == "scrap" then return card.Scrap or "" elseif stat == "attack" then return card.Attack or "" elseif stat == "counter" then return card.Counter or "" elseif stat == "other" then return card.Other or "" elseif stat == "description" or value == "desc" then return card.Desc or "" elseif stat == "tribes" then local out = "" --local conjunction = conj or "" for i, tribe in ipairs(card.Tribes) do out = out .. "[[Tribes#" .. tribe .. "|".. tribe.."]]" if i < #card.Tribes and #card.Tribes > 2 then out = out .. ", " end if i < #card.Tribes then out = out .. " " end end return out else error("Argument Invalid") end end function p.CardInfobox() return "{{Infobox|name=Azul Battle Axe|image=Azul Battle Axe.png|attack=3|description=Apply {{Stat|Overburn}} equal to damage dealt}}" end return p