FANDOM


local p ={}
 
local ship_data = mw.loadData('Module:ship.data')
local map_data = mw.loadData('Module:map.data')
 
local slotitem_data = mw.loadData('Module:slotitem.data')
local slotitem_type = mw.loadData('Module:slotitem.type')
 
local spd = {[5]='低', [10]='高', [0]='-', ['']='?'}
local leng = {'短', '中', '長', '超長', [0]='-'}
 
function sortDesc(a, b) return b[1] < a[1] end
function sortAsc(a, b) return b[1] > a[1] end
 
function p.info(frame)
    local list = require('module:list')
    local slotitem_id = tonumber(frame.args[1]) or 1
    local si_data = slotitem_data[slotitem_id]
    local res = {}
 
    res[#res+1] = '<table class="wikitable" style="width:100%"><tr>'
    res[#res+1] = '<td style="width:260px;">[[file:slotitem_card_' .. string.format('%03d',slotitem_id) .. '.png|link=]]</td>'
    res[#res+1] = '<td style="">No.' .. string.format('%03d',slotitem_id) .. '<br/>' .. si_data[2] .. '<br/>' .. si_data[30] .. '</td></tr></table>'
 
    res[#res+1] = '<table class="wikitable" style="width:100%"><tr><th>裝備素質</th></tr>'
    res[#res+1] = '<tr><td>'
    for i=7,17 do
        if si_data[i] ~= 0 then
            --res[#res+1] = '[[file:' .. '|link=]]' .. si_data[i]
        end
    end
    res[#res+1] = '</td></tr></table>'
 
    res[#res+1] = '<table class="wikitable" style="width:100%">'
    res[#res+1] = '<tr><th>可裝備艦種</th></tr>'
    res[#res+1] = '<tr><td>'
 
    local stype = mw.loadData('module:ship.type')
    local i = 1
    --for i=1,#stype do
    while stype[i] do
        res[#res+1] = '<div class="SIBTori">'
        res[#res+1] = '<div class="SIBTbg">[[File:ItemBoattype_'
        res[#res+1] = string.format('%02d', i)
        res[#res+1] = '.png|100px|link=]]</div>'
        if stype[i][si_data[5]+4] == 1 then
            res[#res+1] = '<div class="SIBTbg">'
        else
            res[#res+1] = '<div class="SIBTtxt">'
        end
        res[#res+1] = stype[i][2]
        res[#res+1] = '</div>'
        res[#res+1] = '</div>'
        i = i + 1
 
    end
 
    res[#res+1] = '</td></tr>'
    res[#res+1] = '</table>'
 
    res[#res+1] = '<h2>同型裝備</h2>'
    --{{#invoke:list|slotitem|type=1}}
    res[#res+1] = list.slotitem{args={type=si_data[5]}}
 
    res[#res+1] = '<h2>預載艦娘</h2>'
    local sh_data = mw.loadData('module:test.data')
    local tmp = {}
    for key,value in pairs(sh_data) do
        --res[#res+1] = #value['eq'][2] .. '<br/>'
        for i=1,4 do
            if value['eq'][2][i] == slotitem_id then tmp[#tmp+1] = {value[1],key} end
            --if value['eq'][2][i] == slotitem_id then
            --    res[#res+1] = '[[file:imgmini_1_'..value[1] .. '.png|80px|link=]]'
            --end
        end
    end
 
    table.sort(tmp, sortAsc)
    res[#res+1] = '<table class="wikitable" style="width:100%"><tr><th>img</th><th>name</th><th>eq</th></tr>'
    for _, value in ipairs(tmp) do
        res[#res+1] = '<tr><td>[[file:imgmini_1_'..string.format('%03d',value[1]) .. '.jpg|link=]]</td>'
        res[#res+1] = '<td></td>'
        res[#res+1] = '<td>'
        for i=1,4 do
            if sh_data[value[2]]['eq'][2][i] ~= -1 then
                res[#res+1] = '[[file:slotitem_card_'
                res[#res+1] = string.format('%03d',sh_data[value[2]]['eq'][2][i])
                res[#res+1] = '.png|80px|link=]]'
            end
        end
        res[#res+1] = '</td></tr>'
    end
    res[#res+1] = '</table>'
 
 
 
    res[#res+1] = '<h2>建造</h2>'
    res[#res+1] = '請參閱[http://kancolle-db.net/ 艦これ統計データベース(仮)]'
 
 
 
    return table.concat(res)
end
 
function p.album(frame)
    local imgtype = frame.args['img'] or 'imgcard'
    local res = {}
    local tmp = {}
 
    for key,value in pairs(ship_data) do
        if value[1] ~= '' then tmp[#tmp+1] = {value[1],key,value[2]} end
    end
    table.sort(tmp, sortAsc)
    for i=1,#tmp do
        res[#res+1] = '[[file:'
        res[#res+1] = imgtype
        res[#res+1] = '_1_'..string.format('%03d',tmp[i][1]) .. '.jpg|120px|link='
        res[#res+1] = tmp[i][3]
        res[#res+1] = ']]'
        --res[#res+1] = '_1_' .. tmp[i][1] .. '.jpg|60px|link=]]'
    end
 
    --imgcard_1_54568406.jpg
 
    return table.concat(res)
end
 
 
function p.test2(frame)
    --local res = {}
    --return frame:callParserFunction('#tag', 'tabber', '1=test1|-|2=test2')
    return frame:callParserFunction('#time', 'Y-m-d H:i:s')
 
    --return table.concat(res)
end
 
 
function p.test(frame)
    local map_no = frame.args[1]
    local map_pt = frame.args[2]
    local s_data = map_data[2][map_no][map_pt]
    local res = {}
 
    for key, value in ipairs(s_data) do
        res[#res+1] = ship_org(key, value)
    end
 
    return table.concat(res)
end
 
function ship_org(idx, pid)
    local res = {}
 
    res[#res+1] = '<table border="1" cellpadding="1" cellspacing="1" class="article-table" style="float:center; width:100%; font-size:16px; margin:2px;">'
    res[#res+1] = '<tr><th>編組' .. idx .. ':單縱 / 制空值 0</th></tr>'
    res[#res+1] = '<tr><td>'
 
    for key, value in ipairs(pid) do
        res[#res+1] = ship_mini(value)
    end
 
    res[#res+1] = '</td></tr></table>'
 
    return table.concat(res)
end
 
function ship_mini(pid)
    local res = {}
    local sno
 
    if ship_data[pid][1] == '' then
        sno = '000'
    else
        sno = string.format('%03d', ship_data[pid][1])
    end
 
    res[#res+1] = '<div style="float:left; width:160px; background-color:#'
    if ship_data[pid][3] == 'elite' then
        res[#res+1] = 'f08080'
    elseif ship_data[pid][3] == 'flagship' then
        res[#res+1] = 'ffe364'
    else
        res[#res+1] = '808080'
    end
 
    res[#res+1] = '; padding:2px; margin:1px;">[[File:imgmini_1_' .. sno .. '.png|160px|link=]]<br/>' .. ship_data[pid][2] .. '<br/>HP: ' .. ship_data[pid][7] .. '</div>'
 
    return table.concat(res)
end
 
function p.slotitem(frame)
    local cat1 = frame.args[1] or 1
    local cat2 = frame.args['type'] or 0 --type
    local rare = frame.args[2] or -1
    local res = {}
    local sitem_idx = {}
 
    if cat1 == '' then cat1 = 1 end
    if cat2 == '' then cat2 = 0 end
    if rare == '' then rare = -1 end
    if frame.args[3] == nil or frame.args[3] == '' then frame.args[3] = 0 end
 
    local str_split = function(s, p)
        local rt = {}
        string.gsub(s, '[^'..p..']+', function(w) table.insert(rt,w) end )
        return rt
    end
    local si_type = str_split(cat2,',')
 
    res[#res+1] = '<table border="0" cellpadding="1" cellspacing="1" class="wikitable sortable mw-datatable" style="width:100%; text-align:center; font-size:14px; line-height:22px;"><tr><th>編號</th><th style="width:120px;">名稱</th><th>類別</th><th>[[File:Icon_Range.png|18px|link=]]</th><th>[[File:Icon_Gun.png|18px|link=]]</th><th>[[File:Icon_AA.png|18px|link=]]</th><th>[[File:Icon_ASW.png|18px|link=]]</th><th>[[File:Icon_Torpedo.png|18px|link=]]</th><th>[[File:Icon_Dive.png|18px|link=]]</th><th>[[File:Icon_Hit.png|18px|link=]]</th><th>[[File:Icon_LOS.png|18px|link=]]</th><th>[[File:Icon_Evasion.png|18px|link=]]</th><th>[[File:Icon_Armor.png|18px|link=]]</th></tr>'
 
    for key, value in pairs(slotitem_data) do
        local res_tmp = {}
--        local i = 3
        --repeat
--        while frame.args[i] do
            if (math.ceil(slotitem_data[key][1]/(slotitem_data[key][1]+1)) == cat1*1 or cat1*1 == -1)
                --and (slotitem_data[key][5] == frame.args[i]*1 or frame.args[i]*1 == 0)
                and (slotitem_data[key][25] == rare*1 or rare*1 == -1) then
 
for j=1,#si_type do
    if cat2 == 0 or slotitem_data[key][5] == si_type[j]*1 then
 
                if slotitem_data[key][1] == 0 then
                    res_tmp[#res_tmp+1] = '<tr><td data-sort-value="' .. key .. '">-</td>'
                else
                    res_tmp[#res_tmp+1] = '<tr><td data-sort-value="' .. key .. '">' .. string.format('%03d', slotitem_data[key][1]) .. '</td>'
                end
                res_tmp[#res_tmp+1] = '<td>[[' .. slotitem_data[key][2] .. ']]</td>'
                --res_tmp[#res_tmp+1] = '<td>[[file:SlotItemType' .. string.format('%02d', slotitem_data[key][5]) .. '.png|20px|link=]]</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_type[slotitem_data[key][5]] .. '</td>'
                --res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][25] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. leng[slotitem_data[key][24]] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][9] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][13] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][14] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][10] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][12] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][16] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][21] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][18] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>' .. slotitem_data[key][8] .. '</td>'
                res_tmp[#res_tmp+1] = '<td>'
                --if slotitem_data[key]['note'] then res_tmp[#res_tmp+1] =  slotitem_data[key]['note'] end
                res_tmp[#res_tmp+1] = '</td></tr>'
                break
 
end
end
 
            end
            sitem_idx[#sitem_idx+1] = {key, table.concat(res_tmp)}
            --i = i + 1
        --until frame.args[i] == nil or frame.args[i] == ''
--        end
    end
 
    table.sort(sitem_idx, sortAsc)
    for _, value in ipairs(sitem_idx) do
        res[#res+1] = value[2]
    end
 
    res[#res+1] = '</table>'
    return table.concat(res)
end
 
return p

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。