Mobius Final Fantasy Wiki
Advertisement

local p = {}
local getArgs = require("Module:Arguments").getArgs
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",
	yellow = "Icon Auto-Abilities Yellow.png",
	locked = "Icon Auto-Abilities Locked.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 "18px"
	local t = mw.text.split( str, "+" )
	local img = "[[File:" .. p.getColor(  mw.text.trim(t[1]) ) .. "|" .. size .. "]] "
	if #t == 1 and img == "[[File:Icon question.png|18px]] "  then
		t = mw.text.split( str, "%(" )
		img =  "[[File:" .. p.getColor(  mw.text.trim(t[1]) ) .. "|" .. size .. "]] "
		if #t == 1 then
			return img .. '[['..t[1]..']]'
		else
			return img .. '[['..t[1]..']]' .. "(" .. t[2]
		end
	end
	if #t == 1 then
		return img .. '[['..t[1]..']]'
	else
		return img .. '[['..t[1]..']]' .. " +" .. t[2]
	end
end

function p.formatString(frame)
	local args = getArgs(frame)
	return p._formatString(args[1], args.size)
end

return p
Advertisement