「于世界交点之处,逢似曾相识之人」

本wiki目前不支持自由编辑,如果有兴趣参与wiki内容编辑,请加入WIKI建设群904200987(游戏交流勿加会被踢)
使用wiki的数据、图片、音频资源,或者搬运页面内容时,请注明出处。具体参照CC BY-NC-SA 4.0协议
感谢Hyacinth对本wiki提供的数据支持
编辑帮助BWIKI反馈

bugfix1001.2
全站通知:

模块:Item/Link

来自白荆回廊Wiki
跳到导航 跳到搜索

此模块的文档可以在模块:Item/Link/doc创建

local p = {}

local icon_list = {
  ["「浮金回忆」"] = "人世行者_藏品_01",
  ["「故事新编」"] = "人世行者_藏品_02",
  ["「与日争辉」"] = "人世行者_藏品_03",
  ["「他乡之客」"] = "人世行者_藏品_04",
  ["「我是太阳」"] = "人世行者_藏品_05",
  ["「时光沙漏」"] = "人世行者_藏品_06",
  ["「异世入侵」"] = "人世行者_藏品_07",
  ["“蓐收”"] = "非龙_藏品_01",
  ["“玄冥”"] = "非龙_藏品_04",
  ["“句芒”"] = "非龙_藏品_03",
  ["“祝融”"] = "非龙_藏品_02",
}

function p.create_link_small(name, count, type, noname)
  local html = mw.html.create()
  if type == '家具' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|20px|link=家具图鉴]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:wikitext(' × ' .. count)
        :done()
  elseif type == '家具·复刻摹本' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|20px|link=家具图鉴]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name):tag('span'):cssText('color:#ed7000;'):wikitext('·复刻摹本'):done()
    end
    html = html:wikitext(' × ' .. count)
        :done()
  elseif type == '徽章' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:Icon_徽章_' .. name .. '.png|20px|link=徽章陈列室]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:done()
  elseif type == '头像' or type == '头像框' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:玩家' .. type .. '_' .. name .. '.png|20px|link=头像图鉴]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:done()
  elseif type == '音乐' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:官方音乐_专辑封面_' .. name .. '.png|20px|link=音乐专辑/' .. name .. ']]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:done()
  elseif type == '相纸' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:相纸_' .. name .. '.png|20px|link=相纸图鉴]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:done()
  elseif type == '名片' then
    html = html:tag('div'):addClass('item-link-sm')
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:icon_item_bgbg.png|20px|link=自定义名片图鉴]]'):done()
        :tag('div'):wikitext('[[文件:Icon_名片_' .. name .. '.png|20px|link=自定义名片图鉴]]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' ' .. name)
    end
    html = html:done()
  else
    html = html:tag('div'):addClass('item-link-sm bili-tt'):attr('data-type', '@悬浮预览'):attr('data-name', '物品/' .. name)
        :tag('div'):addClass('item-link-sm-icon')
        :tag('div'):wikitext('[[文件:icon_item_bgbg.png|20px|link=物品/' .. name .. ']]'):done()
        :tag('div'):wikitext('[[文件:icon_item_' .. name .. '.png|20px|link=物品/' .. name .. ']]'):done()
        :done()
    if noname ~= true then
      html = html:wikitext(' [[物品/' .. name .. '|' .. name .. ']]')
    end
    html = html:wikitext(' × ' .. count)
        :done()
  end
  return html
end

function p.create_link_medium(name, count, type, nopreview)
  local html = mw.html.create()

  if name == nil then
    return html
  end

  if type == '家具' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$家具图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|50px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '家具·复刻摹本' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$家具图鉴'):attr('data-name', name..'·复刻摹本'):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|50px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:UI_icon_复刻摹本.png|50px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):tag('span'):cssText('color:#ed7000;'):wikitext('·复刻摹本'):done():done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '徽章' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$徽章图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Icon_徽章_' .. name .. '.png|50px|link=徽章陈列室]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '头像' or type == '头像框' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$头像图鉴'):attr('data-name', type..'#'..name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:玩家'..type..'_' .. name .. '.png|50px|link=头像图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '音乐' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '@悬浮预览'):attr('data-name', '音乐专辑/' .. name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:官方音乐_专辑封面_' .. name .. '.png|50px|link=音乐专辑/' .. name .. ']]')
        :done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '藏品' then
    html = html:tag('div'):addClass('item-link-lg-50'):cssText('cursor:normal;')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:' .. icon_list[name] .. '.png|50px|link=]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
  elseif type == '相纸' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$相纸图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:相纸_' .. name .. '.png|50px|link=相纸图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '名片' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$名片图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_bgbg.png|50px|link=自定义名片图鉴]]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Icon_名片_' .. name .. '.png|50px|link=自定义名片图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  else
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '@悬浮预览'):attr('data-name', '物品/' .. name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-50')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_bgbg.png|50px|link=物品/' .. name .. ']]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_' .. name .. '.png|50px|link=物品/' .. name .. ']]')
        :done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  end
  return html
end

function p.create_link_big(name, count, type, nopreview)
  local html = mw.html.create()

  if name == nil then
    return html
  end

  if type == '家具' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$家具图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|70px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '家具·复刻摹本' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$家具图鉴'):attr('data-name', name..'·复刻摹本'):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Furniture_icon_' .. name .. '.png|70px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:UI_icon_复刻摹本.png|70px|link=家具图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):tag('span'):cssText('color:#ed7000;'):wikitext('·复刻摹本'):done():done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '徽章' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$徽章图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Icon_徽章_' .. name .. '.png|70px|link=徽章陈列室]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '头像' or type =='头像框' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$头像图鉴'):attr('data-name', type..'#'..name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:玩家'..type..'_' .. name .. '.png|70px|link=头像图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '音乐' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '@悬浮预览'):attr('data-name', '音乐专辑/' .. name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:官方音乐_专辑封面_' .. name .. '.png|70px|link=音乐专辑/' .. name .. ']]')
        :done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '相纸' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$相纸图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:相纸_' .. name .. '.png|70px|link=相纸图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  elseif type == '名片' then
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '$名片图鉴'):attr('data-name', name):cssText(
        'cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_bgbg.png|70px|link=自定义名片图鉴]]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:Icon_名片_' .. name .. '.png|70px|link=自定义名片图鉴]]'):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  else
    if nopreview ~= true then
      html = html:tag('span'):addClass('bili-tt'):attr('data-type', '@悬浮预览'):attr('data-name', '物品/' .. name):cssText(
        'display:inline-block;margin:10px;cursor:pointer;')
    end
    html = html:tag('div'):addClass('item-link-lg-70')
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_bgbg.png|70px|link=物品/' .. name .. ']]'):done()
        :tag('div'):addClass('item-link-el'):wikitext('[[文件:icon_item_' .. name .. '.png|70px|link=物品/' .. name .. ']]')
        :done()
        :tag('div'):addClass('item-link-el item-link-count'):wikitext(count):done()
        :tag('div'):addClass('item-link-el item-link-name'):wikitext(name):done()
        :done()
    if nopreview ~= true then
      html = html:done()
    end
  end
  return html
end

return p