Editing Module:Card
Appearance
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 6: | Line 6: | ||
local TemplateData = require('Module:TemplateData') | local TemplateData = require('Module:TemplateData') | ||
local array = require('Module:Array') | local array = require('Module:Array') | ||
local allData = CentralData. | local allData = { | ||
-- Neighbor | |||
{'Neighbor', mw.loadData('Module:CentralData/Neighbors')}, | |||
-- Creatures | |||
{'Fish', mw.loadData('Module:CentralData/Aquatic Creatures')}, | |||
{'Insect', mw.loadData('Module:CentralData/Land Creatures')}, | |||
{'Shore-Dweller', mw.loadData('Module:CentralData/Shore-Dwellers')}, | |||
-- Furniture | |||
{'Furniture', mw.loadData('Module:CentralData/Furniture')}, | |||
-- Items | |||
{'Item', mw.loadData('Module:CentralData/Items')}, | |||
{'Dish', mw.loadData('Module:CentralData/Dishes')}, | |||
{'Crop', mw.loadData('Module:CentralData/Crops')}, | |||
{'Tool', mw.loadData('Module:CentralData/Tools')}, | |||
-- Clothing | |||
{'Clothing', mw.loadData('Module:CentralData/Clothing')}, | |||
{'Styling', mw.loadData('Module:CentralData/Styling')}, | |||
-- Other | |||
{'Title', mw.loadData('Module:CentralData/Titles')}, | |||
{'Reaction', mw.loadData('Module:CentralData/Reactions')}, | |||
{'Set', mw.loadData('Module:CentralData/Sets')}, | |||
-- Redirects | |||
{'Redirect', mw.loadData('Module:CentralData/Redirects')}, | |||
} | |||
local CARD_ARGS = { | local CARD_ARGS = { | ||
| Line 28: | Line 56: | ||
name = 'quality', | name = 'quality', | ||
alias = 'rarity', | alias = 'rarity', | ||
default = ' | default = 'Gray', | ||
}, | }, | ||
{ | { | ||
| Line 86: | Line 114: | ||
alias = 'UP', | alias = 'UP', | ||
type = '1', | type = '1', | ||
}, | |||
{ | |||
name = 'galaxy', | |||
}, | }, | ||
{ | { | ||
| Line 99: | Line 130: | ||
return p._main(args) | return p._main(args) | ||
end | end | ||
| Line 137: | Line 141: | ||
if lib.isEmpty(requestedType) or dataType == requestedType then | if lib.isEmpty(requestedType) or dataType == requestedType then | ||
local data = | local data = dataTable[name] | ||
if data then | if data then | ||
| Line 172: | Line 176: | ||
if lib.isEmpty(quality) then | if lib.isEmpty(quality) then | ||
quality = ' | quality = 'Gray' | ||
end | end | ||
| Line 197: | Line 201: | ||
name = tostring(name or '') | name = tostring(name or '') | ||
local size = mini and 74 | local size = mini and 56 or 74 | ||
return '[[File:' .. | return '[[File:' .. | ||
| Line 227: | Line 231: | ||
-- Base name for assets. | -- Base name for assets. | ||
-- Removes a trailing disambiguation such as "(Currency)". | -- Removes a trailing disambiguation such as "(Currency)". | ||
out.image_name = out.name | out.image_name = out.name:gsub('%s*%([^()]*%)$', '') | ||
-- Boolean parameters | -- Boolean parameters | ||
| Line 265: | Line 269: | ||
if not (out.nonDefaults and out.nonDefaults.quality) then | if not (out.nonDefaults and out.nonDefaults.quality) then | ||
out.quality = out.data.quality | out.quality = out.data.quality | ||
end | |||
end | |||
if out.data.galaxy then | |||
out.defaults.galaxy = out.data.galaxy | |||
if not (out.nonDefaults and out.nonDefaults.galaxy) then | |||
out.galaxy = out.data.galaxy | |||
end | end | ||
end | end | ||
| Line 375: | Line 387: | ||
if isSplit then | if isSplit then | ||
node_container:addClass(' | node_container:addClass('recipe-type-split-card') | ||
end | end | ||
| Line 402: | Line 414: | ||
-- Split or regular image | -- Split or regular image | ||
if isSplit then | if isSplit then | ||
imageContainer:addClass(' | imageContainer:addClass('recipe-type-split-image') | ||
-- First item: top-left half | -- First item: top-left half | ||
imageContainer:tag('span') | imageContainer:tag('span') | ||
:addClass(' | :addClass('recipe-type-split-half') | ||
:addClass(' | :addClass('recipe-type-split-half-a') | ||
:wikitext(a.image_wikitext) | :wikitext(a.image_wikitext) | ||
-- Second item: bottom-right half | -- Second item: bottom-right half | ||
imageContainer:tag('span') | imageContainer:tag('span') | ||
:addClass(' | :addClass('recipe-type-split-half') | ||
:addClass(' | :addClass('recipe-type-split-half-b') | ||
:wikitext(makeSplitIcon(a.split, a.mini)) | :wikitext(makeSplitIcon(a.split, a.mini)) | ||
else | else | ||
imageContainer:wikitext(a.image_wikitext) | imageContainer:wikitext(a.image_wikitext) | ||
end | |||
-- Galaxy icon | |||
if not a.mini and ne(a.galaxy) then | |||
node_card:tag('span') | |||
:addClass('card-icon-galaxy') | |||
:wikitext( | |||
'[[File:' .. | |||
a.galaxy .. | |||
' Icon.png|alt=' .. | |||
a.galaxy .. | |||
'|link=' .. | |||
a.galaxy .. | |||
'|20px]]' | |||
) | |||
end | end | ||