WIKI公告栏
欢迎各位引航者访问卡拉彼丘WIKI,由于游客访问页面会有一定的页面旧版缓存,建议你登陆B站账号进行浏览,如果您觉得本WIKI有帮助到你,欢迎推荐给身边的引航者。
全站通知:

模块:Items

来自卡拉彼丘WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

local p = {}

local QualityColor = {
    ["私服"] = "#F78653",
    ["传说"] = "#F85555",
    ["完美"] = "#FFC555",
    ["卓越"] = "#F285FF",
    ["精致"] = "#60A3F7",
    ["初始"] = "#ECECEC",
}


------道具图标模板
p["道具图标"] = function(frame)
    local itemName = frame.args[1]
    local data = mw.loadData("Module:Items/Data")
    local a = require("Module:ACandy")
    local size = frame.args["size"]
    local imgsize = frame.args["imgsize"]
    local itemIcon = ""

    local span1 = a.span[{ class = "items-icon" }]
    local span2 = a.span[{ class = "items-icon-img" }]
    local span3 = a.span[{ class = "items-icon-text", style = "font-size:" .. size }]

    local item = data[itemName] -- 获取礼物数据
    if not item then
        return ""               -- 如果找不到对应的礼物数据,则返回空字符串
    end

    local borderColor = QualityColor[item.Quality] -- 根据道具品质选择边框颜色

    itemIcon = span1 {
        span2 { style = "border-color:" .. borderColor, "[[file:" .. item.File .. "|" .. imgsize .. "|class=items-img|link=]]" },
        span3 { itemName }
    }
    return itemIcon
end


---道具图标/其它 模板
p["其它道具图标"] = function(frame)
    local a = require("Module:ACandy")
    local itemFile = frame.args[1]
    local itemName = frame.args[2]
    local itemQuality = frame.args[3]
    local size = frame.args["size"]
    local imgsize = frame.args["imgsize"]
    local otheritemIcon = ""

    local span1 = a.span[{ class = "items-icon" }]
    local span2 = a.span[{ class = "items-icon-img" }]
    local span3 = a.span[{ class = "items-icon-text", style = "font-size:" .. size }]

    local borderColor = QualityColor[itemQuality] -- 根据道具品质选择边框颜色

    otheritemIcon = span1 {
        span2 { style = "border-color:" .. borderColor, "[[file:" .. itemFile .. ".png|" .. imgsize .. "|class=items-img|link=]]" },
        span3 { itemName }
    }
    return otheritemIcon
end


p["道具筛选"] = function(frame)
    local data = mw.loadData("Module:Items/Data")
    local allrows = ""
    for i, item in pairs(data) do
        allrows = allrows .. "\n" .. frame:expandTemplate {
            title = '道具筛选',
            args = {
                name = item.name,
                File = item.File,
                Quality = item.Quality,
                LocalizedString = item.LocalizedString
            }
        }
    end
    return allrows
end


return p