Module:Card: Difference between revisions
No edit summary |
right, trimmed out most of the garbage |
||
| Line 7: | Line 7: | ||
local allData = { | local allData = { | ||
--{'Neighbor', mw.loadData('Module:CentralData/Neighbors')}, | |||
{'Creature', mw.loadData('Module:CentralData/Creatures')}, | |||
--{'Furniture', mw.loadData('Module:CentralData/Furniture')}, | |||
{' | |||
{' | |||
} | } | ||
| Line 33: | Line 27: | ||
-- Reset agent-specific data to prevent carry-over from previous cards | -- Reset agent-specific data to prevent carry-over from previous cards | ||
local | local agQuality, nbGalaxy, crQuality, crGalaxy, outQuality, notice = nil, nil, nil, nil, nil, nil | ||
-- Caption Params: | -- Caption Params: | ||
| Line 50: | Line 44: | ||
-- Rank Param: | -- Rank Param: | ||
local | local quality = args.quality or args.rarity or nil | ||
-- Try to get Rank From Data | -- Try to get Rank From Data | ||
if lib.isEmpty( | if lib.isEmpty(quality) and data then | ||
if data. | if data.quality then | ||
quality = data.quality | |||
end | end | ||
end | end | ||
-- If | -- If quality is still empty, set it to "Gray" | ||
if lib.isEmpty( | if lib.isEmpty(quality) then | ||
quality = 'Gray' | |||
end | end | ||
-- If | -- If quality contains a semicolon, then split and get first | ||
if string.find( | if string.find(quality, ";") then | ||
quality = array._main({ | |||
quality, | |||
';', | ';', | ||
firstItemOnly = 1 | firstItemOnly = 1 | ||
| Line 73: | Line 67: | ||
end | end | ||
-- Make sure | -- Make sure quality is uppercase | ||
quality = quality:upper() | |||
-- Modifiers: | -- Modifiers: | ||
| Line 80: | Line 74: | ||
local isUp = args.UP or args.up or false | local isUp = args.UP or args.up or false | ||
-- Attribute/ | -- Attribute/galaxy | ||
local | local galaxy = args.galaxy or nil | ||
if lib.isEmpty(suffix) then | if lib.isEmpty(suffix) then | ||
local lcType = type:lower() | local lcType = type:lower() | ||
if (lcType == ' | if (lcType == 'neighbor') then | ||
suffix = ' Icon' | suffix = ' Icon' | ||
--Grabs Agent Rank, Attribute and Specialty from Data to display icons | --Grabs Agent Rank, Attribute and Specialty from Data to display icons | ||
agQuality = data['quality'] | |||
agAttribute = data['attribute'] | agAttribute = data['attribute'] | ||
nbGalaxy = data['galaxy'] | |||
--In Full-Size Card-Mode, if there is no specified text, Agents will default to using their full name displayed underneath. | --In Full-Size Card-Mode, if there is no specified text, Agents will default to using their full name displayed underneath. | ||
| Line 110: | Line 103: | ||
end | end | ||
elseif (lcType == ' | elseif (lcType == 'creature') then | ||
suffix = ' Icon' | suffix = ' Icon' | ||
--Grabs | --Grabs Creature Rank and Galaxy from Data to display icons | ||
crQuality = data['quality'] | |||
crGalaxy = data['galaxy'] | |||
elseif (lcType == 'npc') then | elseif (lcType == 'npc') then | ||
suffix = ' Icon' | suffix = ' Icon' | ||
elseif (lcType == ' | elseif (lcType == 'clothing') then | ||
suffix = ' Icon' | suffix = ' Icon' | ||
--Grabs Outfit Rank from Data to display icons | --Grabs Outfit Rank from Data to display icons | ||
outQuality = data['quality'] | |||
end | end | ||
end | end | ||
| Line 151: | Line 129: | ||
local card_container = result:tag('div') | local card_container = result:tag('div') | ||
:addClass('card-container') | :addClass('card-container') | ||
:addClass('card- | :addClass('card-quality-' .. quality) | ||
if args.mini == "1" then | if args.mini == "1" then | ||
| Line 211: | Line 189: | ||
-- Attribute icon, applied automatically for agents or manually specified for anything else | -- Attribute icon, applied automatically for agents or manually specified for anything else | ||
if args.mini ~= "1" then -- Only display the icons if mini is not set to "1" | if args.mini ~= "1" then -- Only display the icons if mini is not set to "1" | ||
if ne( | if ne(nbGalaxy) then | ||
card_body:addClass('card- | card_body:addClass('card-galaxy-' .. string.lower(nbGalaxy)) | ||
card_body:tag('span') | card_body:tag('span') | ||
:addClass('card-icon- | :addClass('card-icon-galaxy') | ||
:wikitext('[[File:Icon | :wikitext('[[File:Icon ', nbGalaxy, '.png|alt=', nbGalaxy, '|link=', nbGalaxy, '|20px]]') | ||
end | end | ||
if ne( | if ne(crGalaxy) then | ||
card_body:addClass('card- | card_body:addClass('card-galaxy-' .. string.lower(crGalaxy)) | ||
card_body:tag('span') | card_body:tag('span') | ||
:addClass('card-icon- | :addClass('card-icon-galaxy') | ||
:wikitext('[[File:Icon | :wikitext('[[File:Icon ', crGalaxy, '.png|alt=', crGalaxy, '|link=', crGalaxy, '|20px]]') | ||
end | end | ||
local notice = args.notice or nil | local notice = args.notice or nil | ||
| Line 275: | Line 207: | ||
:wikitext(notice) | :wikitext(notice) | ||
end | end | ||
end | end | ||