Mobius Final Fantasy Wiki
mNo edit summary
mNo edit summary
Line 24: Line 24:
 
local size = size or "20px"
 
local size = size or "20px"
 
local t = util.explode( "+", str )
 
local t = util.explode( "+", str )
local img = "[[File:" .. p.getColor( util.trim(t[1]) ) .. "|" .. size .. "]] "
+
local img = "[[File:" .. p.getColor( t[1] ) .. "|" .. size .. "]] "
 
if #t == 1 then
 
if #t == 1 then
 
return img .. t[1]
 
return img .. t[1]

Revision as of 11:48, 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( name )
	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]; break end
		end
	end
	return c
end

function p.formatString( str, size )
	local size = size or "20px"
	local t = util.explode( "+", str )
	local img = "[[File:" .. p.getColor( t[1] ) .. "|" .. size .. "]] "
	if #t == 1 then
		return img .. t[1]
	else
		return img .. t[1] .. " +" .. t[2]
	end
end

return p