bugfix20250107.1
全站通知:

模块:玩家装饰

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

此模块的文档可以在模块:玩家装饰/doc创建

local p = {}

p["封装"] = function (frame)
	local frameData = mw.loadData("模块:玩家装饰/FrameData")
	local resultList = {}

	for key, frameName in pairs(frameData) do
		local frameHTML = {
			key = key,
			html = p.commonStyle(frame, "", "", frameName.file, frameName.name, frameName.get, frameName.desc),
		}
		table.insert(resultList, frameHTML)
	end

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

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

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



------基板页面
p["基板页面"] = function (frame)
	local idCardData = mw.loadData("模块:玩家装饰/IDCardData")
	local idCardget = frame.args[1]
	local keys = {}

	for key in pairs(idCardData) 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 idCard = idCardData[key]
		local idCardhtml = idCard.file.."|'''<big>"..idCard.name.."</big>'''"
			..
			frame:expandTemplate { title = '切换显示', args = { idCardget.."基板介绍", "<br/><small>"..idCard.desc.."</small>" } }
		local idCardhtml2 = "<br/>'''获取方式:'''"..idCard.get
		if string.find(idCard.get, idCardget, 1, true) then
			if idCard.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 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 = p.commonStyle2(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 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 = {
				key = key,
				html = p.commonStyle(frame, "喷漆", decalGet, Decal.file, Decal.name, Decal.get, Decal.desc),
			}
			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 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 = p.commonStyle2(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 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 = {
				key = key,
				html = p.commonStyle(frame, "勋章", badgeGet, Badge.file, Badge.name, Badge.get, Badge.desc),
			}
			table.insert(resultList, Badgehtml)
		end
	end

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

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

	local result = table.concat(sortedResult, "\n")
	return frame:preprocess('<gallery mode="packed">\n'..result..'\n</gallery>')
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 = p.commonStyle2(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 chatBubblesData = mw.loadData("模块:玩家装饰/ChatBubblesData")
	local resultList = {}

	for key, chatBubbleName in pairs(chatBubblesData) do
		local chatBubbleHTML = {
			key = key,
			html = p.commonStyle(frame, "", "", chatBubbleName.file, chatBubbleName.name, chatBubbleName.get,
				chatBubbleName.desc),
		}
		table.insert(resultList, chatBubbleHTML)
	end

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

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

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


p["头套"] = function (frame)
	local mascotHeadData = mw.loadData("模块:玩家装饰/MascotHeadData")
	local resultList = {}

	for key, mascotHeadName in pairs(mascotHeadData) do
		local mascotHeadHTML = {
			key = key,
			html = p.commonStyle(frame, "", "", mascotHeadName.file, mascotHeadName.name, mascotHeadName.get,
				mascotHeadName.desc),
		}
		table.insert(resultList, mascotHeadHTML)
	end

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

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

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


------样式
function p.commonStyle(frame, decorationType, getArgs, file, name, get, desc)
	local html = file.."|'''<big>"..name.."</big>'''"
		..frame:expandTemplate { title = '切换显示', args = { getArgs..decorationType.."介绍", "<br/>"..desc } }
		.."<br/>'''获取方式:'''"..get
	return tostring(html)
end

function p.commonStyle2(frame, file, name, quality)
	local html = file.."|'''<big>"..name.."</big>'''<br>"
		..frame:expandTemplate { title = '稀有度标签', args = { quality } }
	return tostring(html)
end

return p