LLWiki正在建设中,欢迎加入我们

模块:Llllreward

来自LLWiki
跳转到导航 跳转到搜索

可在模块:Llllreward/doc创建此模块的帮助文档

local p = {}

local getArgs = require("Module:Arguments").getArgs
local colors = mw.loadData("module:llllreward/data")

function p.main(frame)
	local args = getArgs(frame, {parentOnly = true, removeBlanks = false})
	local arg1, arg2, arg3 = mw.ustring.upper(args[1]), mw.ustring.lower(args[2] or ""), mw.ustring.lower(args[3] or "")

	local r = tostring( mw.html.create('span'):addClass("game-item")
            :wikitext("[[file:LLLL "..arg1..".png|x40px|link=]]")
        )

	if arg2 == "" then
		return r
	end
	
	if arg3 == "" then
		return r.." '''"..arg2.."'''"
	end

        local color, name
	if colors[arg2] then
		color = colors[arg2]
		name = args[3]
	elseif  colors[arg3] then
		color = colors[arg3]
		name = args[2]
	else
		return '<span class="error">Llllreward模板的属性参数错误!</span>'
	end

        return r.." '''"..frame:expandTemplate{title = "color", args = {color, name}}.."'''"
end

return p