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

模块:喷漆

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

此模块的文档可以在模块:喷漆/doc创建

local p = {}

local data = mw.loadData("Module:喷漆/Data")

------喷漆页面
p["喷漆页面"] = function(frame)
  local Decalget = frame.args[1]
  local resultList = {}

  for key, Decal in pairs(data) do
    if string.find(Decal.Get, Decalget, 1, true) then
      local Decalhtml = {
        key = key,
        html = Decal.File .. "|'''<big>" .. Decal.Name .. "</big>'''"
            .. frame:expandTemplate { title = '切换显示', args = { Decalget .. "喷漆介绍", "<br/>" .. Decal.Desc_string } }
            .. "<br/>'''获取方式:'''" .. Decal.Get
      }
      table.insert(resultList, Decalhtml)
    end
  end

  table.sort(resultList, function(a, b)
    return a.key < b.key
  end)

  local sortedResult = {}
  for _, Decalhtml in ipairs(resultList) do
    table.insert(sortedResult, Decalhtml.html)
  end

  local result = table.concat(sortedResult, "\n")
  return frame:preprocess('<gallery mode="packed">\n' .. result .. '\n</gallery>')
end


------意识重构页喷漆
p["意识重构喷漆"] = function(frame)
  local Decalget = frame.args[1]
  local resultList = {}

  for key, Decal in pairs(data) do
    if string.find(Decal.Get, Decalget, 1, true) then
      local Decalhtml = Decal.File .. "|'''<big>" .. Decal.Name .. "</big>'''<br>"
          .. frame:expandTemplate { title = '稀有度标签', args = { Decal.Quality } }
      table.insert(resultList, tostring(Decalhtml))
    end
  end

  local result = table.concat(resultList, "\n")
  return frame:preprocess('<gallery mode="packed">\n' .. result .. '\n</gallery>')
end


return p