LLWiki正在建设中,欢迎加入我们!
模块:Sifitem
跳转到导航
跳转到搜索
-- @Author: [[User:Leranjun]] local p = {} local getArgs = require("Module:Arguments").getArgs local DATA = mw.loadData("Module:Sifitem/data") function p.main(frame) local args = getArgs(frame, {parentOnly = true, removeBlanks = false}) local arg1, arg2, arg3 = mw.ustring.lower(args[1] or ""), args[2], args[3] local item = DATA.AKA[arg1] or arg1 local data = DATA.ITEMS[item] if data == nil then return "<span class=\"error\">错误的道具名!</span>" elseif data.force2 and arg2 == nil then return "<span class=\"error\">模板Sifitem缺失必要参数!</span>" end local file = data.file or mw.ustring.upper(item) local r = tostring( mw.html.create('span'):addClass("game-item") :wikitext( "[[file:SIF "..file.. (data.switch and data.switch[arg3 or ""] or (arg3 and " 有框" or "")).. ".png|40px|link=]]" ) ).." "..(data.before or file.." ") if arg2 == "" or arg2 == "0" or not (arg2 or data.default) then return r end return r..(arg2 or data.default)..(data.after or "") end return p