模块:玩家装饰
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:玩家装饰/doc创建
local p = {}
local strinova = require("模块:卡拉彼丘")
local qualityName = strinova.qualityNumToName
local qualityColor = strinova.qualityNameToColor
local qualityToColor = strinova.qualityToColor
local format = string.format
------样式
local function rarity_tag(frame, quality, name)
local color = qualityColor[quality] or qualityToColor[quality]
local rarityTag = format('<span class="badge rounded-pill" style="background-color: %s;">%s</span>', color, name)
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 build_style_info(frame, name, quality, get, desc, file)
local info = frame:callParserFunction{ name = '#info', args = { '[[文件:'..name..'.gif]]', 'max-width=500' } }
return "File:" .. file .. "::"
.. rarity_tag(frame, quality, name)..info .. "::"
.. desc .. "::"
.. get
end
local function common_style(frame, file, name, quality)
local html = file.."|'''<big>"..name.."</big>'''<br>"
..strinova.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 _, items in pairs(idCardData) do
if string.find(items.get, idCardGet, 1, true) then
local idCardhtml = items.img.."|'''<big>"..items.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 _, items in pairs(idCardData) do
if string.find(items.get, idCardget, 1, true) then
local idCardhtml = common_style(frame, items.file, items.name, items.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 file = format('喷漆_%d.png', items.id)
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, 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 _, items in pairs(decalData) do
if string.find(items.get, decalGet, 1, true) then
local decalhtml = items.img.."|'''<big>"..items.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 _, items in pairs(decalData) do
if string.find(items.get, decalGet, 1, true) then
local file = format('喷漆_%d.png', items.id)
local decalHTML = common_style(frame, file, items.name, items.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 _, items in pairs(badgeData) do
if string.find(items.get, badgeGet, 1, true) then
local badgeHTML = common_style(frame, items.file, items.name, items.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 file = format('聊天气泡_%d.png', items.id)
local entry = build_style(frame, items.name, items.quality, items.get, items.desc, 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 quality = qualityName[items.quality]
local file = format('头套_%d.png', items.id)
local entry = build_style(frame, items.name, quality, items.get, items.desc, file)
table.insert(args, entry)
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
p["超弦体动作"] = function (frame)
local data = mw.loadData("模块:玩家装饰/RoleActionData")
local args = {
template = 'RoleAction',
class = 'player-decoration',
widths = '180px',
heights = '180px',
gap = '18px',
fit = 'contain',
}
for _, items in ipairs(data) do
local quality = qualityName[items.quality]
local file = format('超弦体动作图标_%d.png', items.id)
local entry = build_style_info(frame, items.name, quality, items.get, items.desc, file)
table.insert(args, entry)
end
local content = frame:expandTemplate{
title = 'gallerygrid',
args = args
}
return content
end
return p

沪公网安备 31011002002714 号