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

模块:基板

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

此模块的文档可以在模块:基板/doc创建

local p = {}

local data = mw.loadData("Module:基板/Data")

------基板页面
p["基板页面"] = function(frame)
  local idCardget = frame.args[1]
  local keys = {}
  
  for key in pairs(data) do
    table.insert(keys, key)
  end

  table.sort(keys, function(a, b)
    return tonumber(a) < tonumber(b)
  end)

  local resultList = {}
  for _, key in ipairs(keys) do
    local idCardData = data[key]
    local idCardhtml = idCardData.File .. "|'''<big>" .. idCardData.Name .. "</big>'''"
          .. frame:expandTemplate { title = '切换显示', args = { idCardget .. "基板介绍", "<br/><small>" .. idCardData.Desc_string .. "</small>" } }
    local idCardhtml2 = "<br/>'''获取方式:'''" .. idCardData.Get      
    if string.find(idCardData.Get, idCardget, 1, true) then
    	if idCardData.Get == "未实装" then
    		table.insert(resultList, tostring(idCardhtml))
    	else
    		table.insert(resultList, tostring(idCardhtml .. idCardhtml2))
    	end
    end
  end
  local result = table.concat(resultList, "\n")
  return frame:preprocess('<gallery mode="packed">\n' .. result .. '\n</gallery>')
end


p["基板页面大图"] = function(frame)
  local keys = {}

  for key in pairs(data) do
    table.insert(keys, key)
  end

  table.sort(keys, function(a, b)
    return tonumber(a) < tonumber(b)
  end)

  local resultList = {}
  for _, key in ipairs(keys) do
    local idCardData = data[key]
    local idCardhtml = idCardData.Img .. "|'''<big>" .. idCardData.Name .. "</big>'''"
    table.insert(resultList, tostring(idCardhtml))
  end

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


------意识重构页基板
p["意识重构基板"] = function(frame)
  local idCardget = frame.args[1]
  local resultList = {}

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

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

return p