LLWiki正在建设中,欢迎加入我们!
模块:Llllitem
跳转到导航
跳转到搜索
可在模块:Llllitem/doc创建此模块的帮助文档
-- @Author: [[User:Leranjun]] [[User:Zth]] local p = {} local getArgs = require("Module:Arguments").getArgs local DATA = mw.loadData("Module:Llllitem/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.force3 and arg3 == nil then return "<span class=\"error\">模板Llllitem缺失必要参数!</span>" end local file = data.file or mw.ustring.upper(item) local rank, displayrank = "" if data.force3 then rank = DATA.AKA[arg3] or arg3 if data.rare then displayrank = data.rare[rank] end rank = "("..rank..")" displayrank = displayrank and ("("..displayrank..")") end local r = tostring( mw.html.create('span'):addClass("game-item") :wikitext( "[[file:LLLL "..file..rank.. ".png|x40px|link=]]" ) ).." "..(data.before or file)..(displayrank or rank) 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