模块:玩家装饰
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:玩家装饰/doc创建
local p = {}
local strinova = require("模块:卡拉彼丘")
local qualityColor = strinova.qualityColor
------样式
local function rarity_tag(frame, quality, name)
local color = qualityColor[quality] or "#ECECEC"
local rarityTag = '<span class="badge rounded-pill" style="background-color: '..color..';">'..name..'</span>'
return rarityTag
end
local function build_style(frame, name, quality, get, desc, file)
return "File:" .. file .. "::"
.. rarity_tag(frame, quality, name) .. "::"
.. desc .. "::"
.. get
end
local function quality_rarity_tag(frame, quality)
return frame:expandTemplate { title = '稀有度标签', args = { quality } }
end
local function common_style(frame, file, name, quality)
local html = file.."|'''<big>"..name.."</big>'''<br>"
..quality_rarity_tag(frame, quality)
return tostring(html)
end
p["封装"] = function (frame)
local data = mw.loadData("模块:玩家装饰/FrameData")
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '200px',
heights = '250px',
gap = '18px',
fit = 'cover',
}
for _, items in ipairs(data) do
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
------基板页面
p["基板页面"] = function (frame)
local data = mw.loadData("模块:玩家装饰/IDCardData")
local idCardget = frame.args[1]
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '150px',
heights = '150px',
gap = '18px',
fit = 'cover',
}
for _, items in ipairs(data) do
if string.find(items.get, idCardget, 1, true) then
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
p["基板大图"] = function (frame)
local idCardData = mw.loadData("模块:玩家装饰/IDCardData")
local idCardGet = frame.args[1]
local resultList = {}
for _, idCard in pairs(idCardData) do
if string.find(idCard.get, idCardGet, 1, true) then
local idCardhtml = idCard.img.."|'''<big>"..idCard.name.."</big>'''"
table.insert(resultList, tostring(idCardhtml))
end
end
local result = table.concat(resultList, "\n")
return frame:preprocess('<gallery mode="nolines" widths=140px heights=340px>\n'..result..'\n</gallery>')
end
------意识重构页基板
p["意识重构基板"] = function (frame)
local idCardData = mw.loadData("模块:玩家装饰/IDCardData")
local idCardget = frame.args[1]
local resultList = {}
for key, idCard in pairs(idCardData) do
if string.find(idCard.get, idCardget, 1, true) then
local idCardhtml = common_style(frame, idCard.file, idCard.name, idCard.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
------喷漆页面
p["喷漆页面"] = function (frame)
local data = mw.loadData("模块:玩家装饰/DecalData")
local decalGet = frame.args[1]
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '150px',
heights = '150px',
gap = '16px',
fit = 'contain',
}
for _, items in ipairs(data) do
if string.find(items.get, decalGet, 1, true) then
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
p["喷漆大图"] = function (frame)
local decalData = mw.loadData("模块:玩家装饰/DecalData")
local decalGet = frame.args[1]
local resultList = {}
for _, decal in pairs(decalData) do
if string.find(decal.get, decalGet, 1, true) then
local decalhtml = decal.img.."|'''<big>"..decal.name.."</big>'''"
table.insert(resultList, tostring(decalhtml))
end
end
local result = table.concat(resultList, "\n")
return frame:preprocess('<gallery mode="nolines" widths=200px heights=200px>\n'..result..'\n</gallery>')
end
------意识重构页喷漆
p["意识重构喷漆"] = function (frame)
local decalData = mw.loadData("模块:玩家装饰/DecalData")
local decalGet = frame.args[1]
local resultList = {}
for key, Decal in pairs(decalData) do
if string.find(Decal.get, decalGet, 1, true) then
local decalHTML = common_style(frame, Decal.file, Decal.name, 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
------勋章页面
p["勋章页面"] = function (frame)
local data = mw.loadData("模块:玩家装饰/BadgeData")
local badgeGet = frame.args[1]
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '150px',
heights = '150px',
gap = '16px',
fit = 'contain',
}
for _, items in ipairs(data) do
if string.find(items.get, badgeGet, 1, true) then
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
------弦海寻宝页喷漆
p["弦海寻宝勋章"] = function (frame)
local badgeData = mw.loadData("模块:玩家装饰/BadgeData")
local badgeGet = frame.args[1]
local resultList = {}
for key, badge in pairs(badgeData) do
if string.find(badge.get, badgeGet, 1, true) then
local badgeHTML = common_style(frame, badge.file, badge.name, badge.quality)
table.insert(resultList, tostring(badgeHTML))
end
end
local result = table.concat(resultList, "\n")
return frame:preprocess('<gallery mode="packed">\n'..result..'\n</gallery>')
end
p["聊天气泡"] = function (frame)
local data = mw.loadData("模块:玩家装饰/ChatBubblesData")
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '150px',
heights = '150px',
gap = '16px',
fit = 'cover',
}
for _, items in ipairs(data) do
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
p["头套"] = function (frame)
local data = mw.loadData("模块:玩家装饰/MascotHeadData")
local args = {
template = 'PlayerDecoration',
class = 'player-decoration',
widths = '200px',
heights = '200px',
gap = '18px',
fit = 'contain',
}
for _, items in ipairs(data) do
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, items.file)
table.insert(args, entry)
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
return p

沪公网安备 31011002002714 号