12,726
edits
Falterfire (talk | contribs) (Moved getExpansionIcon here and directly keyed it off of ID) |
(Amend nolink handling) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 313: | Line 313: | ||
['Spider2'] = 'Brown Spider' | ['Spider2'] = 'Brown Spider' | ||
} | } | ||
--When calling for an icon for Key + Type, the link goes to Value | |||
local typeLinkOverrides = { | |||
['resource'] = { | |||
-- Township resources | |||
['Food'] = '', | |||
['Wood'] = '', | |||
['Planks'] = '', | |||
['Stone'] = '', | |||
['Bar'] = '', | |||
['Ore'] = '', | |||
['Coal'] = '', | |||
['Rune Essence'] = '', | |||
['Herbs'] = '', | |||
['Potions'] = '', | |||
['Leather'] = '', | |||
['Clothing'] = '' | |||
}, | |||
['township'] = { | |||
['Workers'] = '' | |||
} | |||
} | |||
--If no other text override was specified for the given link, use these | --If no other text override was specified for the given link, use these | ||
local txtOverrides = { | local txtOverrides = { | ||
Line 372: | Line 394: | ||
local ovrTxt = txtOverrides[link] | local ovrTxt = txtOverrides[link] | ||
local ovrLink = linkOverrides[link] | local ovrLink = linkOverrides[link] | ||
local ovrTypeLink = typeLinkOverrides[iconType] | |||
if ovrTypeLink ~= nil and ovrTypeLink[img] ~= nil then | |||
if ovrTypeLink[img] == '' then | |||
nolink = true | |||
else | |||
ovrLink = ovrTypeLink[img] | |||
end | |||
end | |||
local hasText = (text ~= nil and text ~= '') | local hasText = (text ~= nil and text ~= '') | ||
if ovrImg ~= nil and img == link then | if ovrImg ~= nil and img == link then | ||
Line 431: | Line 461: | ||
local txtImg = (iconType ~= nil and iconType ~= '' and img .. '_(' .. iconType .. ')' or img) .. '.' .. ext | local txtImg = (iconType ~= nil and iconType ~= '' and img .. '_(' .. iconType .. ')' or img) .. '.' .. ext | ||
-- Include a link unless no link -and- no text was requested | -- Include a link unless no link -and- no text was requested | ||
local txtLink = '|link=' .. (nolink | local txtLink = '|link=' .. (nolink and '' or link) | ||
resultText = '[[File:' .. txtImg .. '|' .. txtSize .. 'x' .. txtSize .. 'px' .. txtLink .. ']]' | resultText = '[[File:' .. txtImg .. '|' .. txtSize .. 'x' .. txtSize .. 'px' .. txtLink .. ']]' | ||
if class ~= nil and class ~= '' then | if class ~= nil and class ~= '' then |