Module:ItemGrid: Difference between revisions
From ARC Raiders Wiki
More actions
Content deleted Content added
v0.1 -created a module for Traders' buyable items |
(No difference)
|
Revision as of 22:00, 21 October 2025
Documentation for this module may be created at Module:ItemGrid/doc
local p = {}
-- Rarity border colors
local rarityColors = {
Common = "#717471",
Uncommon = "#41eb6a",
Rare = "#1ecbfc",
Epic = "#d8299b",
Legendary = "#fbc700",
}
function p.render(frame)
local args = frame:getParent().args
local html = mw.html.create("div"):addClass("item-grid")
local i = 1
while args["image" .. i] and i < 100 do
local isLimited = args["isLimited" .. i] or false
local rarity = args["rarity" .. i] or ""
local border = rarityColors[rarity] or rarityColors["Common"]
local item = html:tag("div")
:addClass("item-cell")
:css("border", "1px solid " .. border)
if (isLimited == ("true" or "True")) then
item:tag("div")
:addClass("Icon_TimeReset")
:wikitext("[[File:Icon_TimeReset.png|16px]]")
:css("position", "absolute")
:css("left", "calc(100% - 20px)")
:css("top", "0%")
end
if rarity ~= "" then --reformat this repetitive block if you can
item:tag("div")
:addClass("item-image")
:wikitext(string.format("%s", args["image" .. i]))
:tag("div")
:addClass(string.format("curve-%s", rarity))
:done()
else
item:tag("div")
:addClass("item-image")
:wikitext(string.format("%s", args["image" .. i]))
end
item:tag("div")
:addClass("item-name")
:wikitext(args["name" .. i] or "")
item:tag("div")
:addClass("data-table")
:tag("div")
:addClass("category-icon")
:wikitext(args["category-icon" .. i] or "")
:done()
:tag("div")
:addClass("item-price")
:wikitext(args["price" .. i] or "")
:done()
i = i + 1
end
return tostring(html)
end
return p