FANDOM


local p = {}
 
local ship_data = mw.loadData('Module:ship.data')
local ship_type = mw.loadData('Module:ship.type')
local slotitem_data = mw.loadData('Module:slotitem.data')
 
local spd = {[5]='低', [10]='高', [0]='-'}
local leng = {'短', '中', '長', '超長', [0]='-'}
 
function p.rnd(frame)
    local t = frame.args['t'] or os.time()
    local pid
 
    math.randomseed(t)
    while ship_data[pid] == nil do
        pid = math.random(500)
    end
 
    return ship(pid)
end
 
function ship(pid)
    local col_name = {[28]='燃料', [29]='彈藥', [30]='鋼材', [31]='鋁土', [32]='火力', [33]='雷裝', [34]='對空', [35]='裝甲'}
    local res = {}
 
    res[#res+1] = '<div style="position:relative; width:690px; border:1px solid#aaaaaa; padding:6px; font-size:14px; line-height:22px;">'
    res[#res+1] = '<div style="position:absolute; float:right; top:60px; right:0px; padding:6px;">' .. img(pid) .. '</div>'
    res[#res+1] = 'No. ' .. ship_data[pid][1] .. '<br/>'
    res[#res+1] = '<span style="font-size:28px; line-height:28px;">' .. ship_type[ship_data[pid][4]][2] .. ' ' .. ship_data[pid][2] .. '</span><br/><br/>'
 
    res[#res+1] = '<div style="width:294px; border:1px solid#aaaaaa; padding:6px; border-radius:6px;">' .. ship_data[pid][37] .. '</div><br/>'
 
    res[#res+1] = '<span style="font-size:24px; line-height:28px;">性能諸元</span><br/>'
    res[#res+1] = '<table class="wikitable" style="text-align:center; width:308px;">'
    res[#res+1] = '<tr><th>耐久</th><td>' .. ship_data[pid][7] .. '</td><th>火力</th><td>' .. ship_data[pid][11] .. ' - ' .. ship_data[pid][12] .. '</td></tr>'
    res[#res+1] = '<tr><th>裝甲</th><td>' .. ship_data[pid][9] .. ' - ' .. ship_data[pid][10] .. '</td><th>雷裝</th><td>' .. ship_data[pid][13] .. ' - ' .. ship_data[pid][14] .. '</td></tr>'
    res[#res+1] = '<tr><th>迴避</th><td>?? - ??</td><th>對空</th><td>' .. ship_data[pid][15] .. ' - ' .. ship_data[pid][16] .. '</td></tr>'
    res[#res+1] = '<tr><th>搭載</th><td>' .. ship_data[pid][22]+ship_data[pid][23]+ship_data[pid][24]+ship_data[pid][25] .. '</td><th>對潛</th><td>?? - ??</td></tr>'
    res[#res+1] = '<tr><th>速度</th><td>' .. spd[ship_data[pid][19]] .. '</td><th>索敵</th><td>?? - ??</td></tr>'
    res[#res+1] = '<tr><th>射程</th><td>' .. leng[ship_data[pid][20]] .. '</td><th>運氣</th><td>' .. ship_data[pid][17] .. ' - ' .. ship_data[pid][18] .. '</td></tr>'
    res[#res+1] = '<tr><th>燃料</th><td>' .. ship_data[pid][40] .. '</td><th>彈藥</th><td>' .. ship_data[pid][41] .. '</td></tr>'
    res[#res+1] = '</table><br/>'
 
    res[#res+1] = '<span style="font-size:24px; line-height:28px;">預設裝備</span><br/>'
    res[#res+1] = '<table class="wikitable" style="text-align:center; width:308px;">'
    res[#res+1] = '<tr><th style="width:12px;"></th><th style="width:60px;">搭載量</th><th>預設裝備</th></tr>'
    for i = 1, 4 do
        if i <= ship_data[pid][21] then
            res[#res+1] = '<tr><th>' .. i .. '</th><td>' .. ship_data[pid][21+i] .. '</td><td>????</td></tr>'
        else
            res[#res+1] = '<tr><th>' .. i .. '</th><td>-</td><td>-</td></tr>'
        end
    end
    res[#res+1] = '</table><br/>'
 
    res[#res+1] = '<span style="font-size:24px; line-height:28px;">其他</span><br/>'
    res[#res+1] = '<table class="wikitable" style="width:308px;">'
    res[#res+1] = '<tr><th style="width:80px;">建造時間</th><td>' .. ship_data[pid][27] .. 'min</td></tr>'
    res[#res+1] = '<tr><th>解體</th><td>'
    for i = 28,31 do
        if ship_data[pid][i] > 0 then
            res[#res+1] = col_name[i] .. ' ' .. ship_data[pid][i]
            if ship_data[pid][i+1] > 0 and i+1 <=31 then res[#res+1] = '<br/>' end
        elseif ship_data[pid][i] == 0  and ship_data[pid][i+1] > 0 and i+1 <=31 then
            res[#res+1] = '<br/>'
        end
    end
    res[#res+1] = '</td></tr><tr><th>合成</th><td>'
    for i = 32,35 do
        if ship_data[pid][i] > 0 then
            res[#res+1] = col_name[i] .. '+' .. ship_data[pid][i]
            if ship_data[pid][i+1] > 0 and i+1 <=35 then res[#res+1] = '<br/>' end
        elseif ship_data[pid][i] == 0  and ship_data[pid][i+1] > 0 and i+1 <=35 and i~= 32 then
            res[#res+1] = '<br/>'
        end
    end
    res[#res+1] = '</td></tr><tr><th>改造</th><td>' .. kaizou(pid) .. '</td></tr></table><br/>'
 
    return table.concat(res)
end
 
function kaizou(pid)
    local res = {}
 
    if ship_data[pid][5] > 0 and ship_data[pid][6] > 0 then
        local i = 1
        res[#res+1] = ship_data[pid][2]
        while ship_data[pid][5] > 0 and i <= 5 do
            res[#res+1] = '<br/> (LV.' .. ship_data[pid][5] .. '/燃料' .. ship_data[pid][38] .. '/彈藥' .. ship_data[pid][39] .. ')<br/>→ ' .. ship_data[ship_data[pid][6]][2]
            pid = ship_data[pid][6]
            if pid == 461 or pid == 462 or pid == 466 or pid == 467 then i = 5 end
            i = i + 1
        end
    end
 
    if #res == 0 then res = {'×'} end
 
    return table.concat(res)
end
 
function img(pid)
    local w = 360
    local rnd
    local k
    local res = {}
 
    math.randomseed(os.time())
    rnd = math.random(100)
    if rnd <= 20 then k = 2 else k = 1 end
 
    if mw.title.new('file:imgbig_' .. k .. '_' .. ship_data[pid][1] .. '.png').exists then
        res[#res+1] = '[[file:imgbig_' .. k .. '_' .. ship_data[pid][1] .. '.png|' .. w .. 'px|link=]]'
    else
        res[#res+1] = '<span style="color:blue;"><strike>管理員很懶,沒有上傳圖片或圖片檔名錯誤。</strike></span>'
    end
 
    return table.concat(res)
end
 
return p

您使用了广告屏蔽软件!


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

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