Module:碧蓝航线Items
跳到导航
跳到搜索
本模块实现了{{碧蓝航线道具}}的功能。
本模块依赖Module:碧蓝航线Items/data提供数据。
- local p = {}
- local data = mw.loadData("Module:碧蓝航线Items/data")
- local color_itemback = {
- ['b3b3b3'] = 'linear-gradient(-45deg,#d0d0d0,#D3D3D3,#A9A9A9)',
- ['38c8ff'] = 'linear-gradient(-45deg,#4169E1,#aae6fd,#00BFFF)',
- ['9a6cf1'] = 'linear-gradient(-45deg,#9932CC,#B399FF,#9932CC)',
- ['ffce3b'] = 'linear-gradient(-45deg,#E6B800,#FFD700,#E6B800)',
- ['f7c1cf'] = 'linear-gradient(-45deg,#fd99dc,#c5a2f5,#a2bef5,#a2e0f5,#93f2ff,#a1ffe2,#a4ffb1)'
- }
- function p.main(frame)
- local item = frame.args[1]
- local num = frame.args[2]
- local css = frame.args["css"]
- local size = frame.args["size"]
- local unit = frame.args["unit"]
- local itemcolor1 = ''
- for color, itemList in pairs(data) do
- for _, value in pairs(itemList) do
- if value == item then
- itemcolor1 = color
- break
- end
- end
- end
- local itemcolor2 = color_itemback[itemcolor1]
- if not itemcolor2 then
- itemcolor2 ="#d0d0d0"
- end
- local result = mw.getCurrentFrame():expandTemplate{
- title = '碧蓝航线道具/core',
- args = {
- item = item,
- num = num,
- css = css,
- size = size,
- unit = unit,
- itemcolor1 = itemcolor1,
- itemcolor2 = itemcolor2
- }
- }
- return result
- end
- return p