置顶公告:【置顶】关于临时开启评论区所有功能的公告(2022.10.22) | 【置顶】关于本站Widget恢复使用的公告
  • 你好~!欢迎来到萌娘百科镜像站!如需查看或编辑,请联系本站管理员注册账号。
  • 本镜像站和其他萌娘百科的镜像站无关,请注意分别。

Module:碧蓝航线Items

猛汉♂百科,万男皆可猛的百科全书!转载请标注来源页面的网页链接,并声明引自猛汉百科。内容不可商用。
跳到导航 跳到搜索
Template-info.svg 模块文档  [查看] [编辑] [历史] [刷新]

本模块实现了{{碧蓝航线道具}}的功能。

本模块依赖Module:碧蓝航线Items/data提供数据。

  1. local p = {}
  2. local data = mw.loadData("Module:碧蓝航线Items/data")
  3. local color_itemback = {
  4. ['b3b3b3'] = 'linear-gradient(-45deg,#d0d0d0,#D3D3D3,#A9A9A9)',
  5. ['38c8ff'] = 'linear-gradient(-45deg,#4169E1,#aae6fd,#00BFFF)',
  6. ['9a6cf1'] = 'linear-gradient(-45deg,#9932CC,#B399FF,#9932CC)',
  7. ['ffce3b'] = 'linear-gradient(-45deg,#E6B800,#FFD700,#E6B800)',
  8. ['f7c1cf'] = 'linear-gradient(-45deg,#fd99dc,#c5a2f5,#a2bef5,#a2e0f5,#93f2ff,#a1ffe2,#a4ffb1)'
  9. }
  10. function p.main(frame)
  11. local item = frame.args[1]
  12. local num = frame.args[2]
  13. local css = frame.args["css"]
  14. local size = frame.args["size"]
  15. local unit = frame.args["unit"]
  16. local itemcolor1 = ''
  17. for color, itemList in pairs(data) do
  18. for _, value in pairs(itemList) do
  19. if value == item then
  20. itemcolor1 = color
  21. break
  22. end
  23. end
  24. end
  25. local itemcolor2 = color_itemback[itemcolor1]
  26. if not itemcolor2 then
  27. itemcolor2 ="#d0d0d0"
  28. end
  29. local result = mw.getCurrentFrame():expandTemplate{
  30. title = '碧蓝航线道具/core',
  31. args = {
  32. item = item,
  33. num = num,
  34. css = css,
  35. size = size,
  36. unit = unit,
  37. itemcolor1 = itemcolor1,
  38. itemcolor2 = itemcolor2
  39. }
  40. }
  41. return result
  42. end
  43. return p