local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) return p._main(frame, args) end function p._main(frame, args) if not frame then frame = mw.getCurrentFrame() end local agent = args["agent"] local img = "" local credits = {"2000", "2500", "3000", "3500", "4000", "4500", "5500", "6500", "7500", "8000"} local titles = { ["t"] = "称号", ["c"] = "卡面", ["k"] = "王国币", ["s"] = "-{zh-cn:喷漆;zh-tw:塗鴉;}-", ["b"] = "-{zh-cn:挂饰;zh-tw:吊飾;}-", ["0"] = "皮肤" } local nopicflag = false local function createAlt(eles) return frame:callParserFunction("#invoke", {"SVG Data URL", "main", svg = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#8B978F" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">' .. eles .. '</svg>'}) end local alts = { ["c"] = createAlt('<path d="M3.604 7.197l7.138 -3.109a.96 .96 0 0 1 1.27 .527l4.924 11.902a1 1 0 0 1 -.514 1.304l-7.137 3.109a.96 .96 0 0 1 -1.271 -.527l-4.924 -11.903a1 1 0 0 1 .514 -1.304z" /><path d="M15 4h1a1 1 0 0 1 1 1v3.5" /><path d="M20 6c.264 .112 .52 .217 .768 .315a1 1 0 0 1 .53 1.311l-2.298 5.374" />'), ["s"] = createAlt('<path d="M4 10m0 2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-4a2 2 0 0 1 -2 -2z" /><path d="M6 10v-4a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4" /><path d="M15 7h.01" /><path d="M18 9h.01" /><path d="M18 5h.01" /><path d="M21 3h.01" /><path d="M21 7h.01" /><path d="M21 11h.01" /><path d="M10 7h1" />'), ["b"] = createAlt('<path d="M12 13m-8 0a8 8 0 1 0 16 0a8 8 0 1 0 -16 0" /><path d="M11 5l1 -2l1 2" /><path d="M4.512 10.161c2.496 -1.105 4.992 -.825 7.488 .839c2.627 1.752 5.255 1.97 7.882 .653" /><path d="M4.315 15.252c2.561 -1.21 5.123 -.96 7.685 .748c2.293 1.528 4.585 1.889 6.878 1.081" />'), ["0"] = createAlt('<path d="M14.5 14h4.5l2 -2v-6z" /><path d="M9 19h5l-11 -13v6z" />') } local container = mw.html.create():tag("div"):addClass("val-contracts") local function createContract(n, img, info) container :tag("div"):addClass("val-contract") :tag("div"):addClass("val-contract-level") :wikitext(n):done() :tag("div"):addClass("val-contract-img") :wikitext(img):done() :tag("div"):addClass("val-contract-title") :wikitext(args[n .. "-title"]):done() :tag("div"):addClass("val-contract-info") :wikitext(info):done() :allDone() end for i = 1, 10 do local t = args[i .. "-type"] or "0" local ext = args[i .. "-format"] or "png" local nopic = args[i .. "-nopic"] or "0" local imgContent = { ["t"] = "[[File:VALORANT_Contract_Title.png|link=]]", ["c"] = "[[File:VALORANT_Contract_" .. agent .. "_" .. i .. ".png|x180px|link=]]", ["k"] = "[[File:VALORANT_Contract_Kingdom_Credit.png|60px|link=]]" } if nopic == "1" then img = alts[t] nopicflag = true else img = imgContent[t] or ("[[File:VALORANT_Contract_" .. agent .. "_" .. i .. "." .. ext .. "|link=]]") end if t == "k" then createContract(i, img, "王国币") else createContract(i, img, titles[t] .. "<br/>" .. credits[i] .. "王国币") end end if nopicflag then container:wikitext("[[Category:无畏契约英雄契约图片存在缺失的条目]]") end return container end return p