@DeletedUser1714 (talk | contribs) mNo edit summary |
@DeletedUser1714 (talk | contribs) mNo edit summary |
||
Line 25: | Line 25: | ||
local size = size or "20px" |
local size = size or "20px" |
||
local t = util.explode( '+', str ) |
local t = util.explode( '+', str ) |
||
− | return mw.text.trim( t[1] ) |
+ | return p.getColor(mw.text.trim( t[1] )) |
--local img = "[[File:" .. p.getColor( name ) .. "|" .. size .. "]] " |
--local img = "[[File:" .. p.getColor( name ) .. "|" .. size .. "]] " |
||
--if #t == 1 then |
--if #t == 1 then |
Revision as of 11:28, 8 September 2016
local p = {}
local util = require( 'Module:Utils' )
local aa = mw.loadData( 'Module:AutoAbilities/data' )
local icons = {
red = "Icon Auto-Abilities Red.png",
green = "Icon Auto-Abilities Green.png",
blue = "Icon Auto-Abilities Blue.png",
yellox = "Icon Auto-Abilities Yellow.png",
unknown = "Icon question.png"
}
function p.getColor( str )
local name = str or ""
local c = icons.unknown
for color, v in pairs( aa ) do
for k, desc in pairs( v ) do
if k == name then c = icons[color] end
end
end
return c
end
function p.formatString( str, size )
local size = size or "20px"
local t = util.explode( '+', str )
return p.getColor(mw.text.trim( t[1] ))
--local img = "[[File:" .. p.getColor( name ) .. "|" .. size .. "]] "
--if #t == 1 then
-- return img .. t[1]
--else
-- return img .. t[1] .. " +" .. t[2]
--end
end
return p