打开/关闭菜单
1683
2.2万
6537
11.8万
舰R百科
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

舰R百科是靠无数志愿编辑者持续地建设更新完善的。编辑非常简单,无需代码知识,请勇于更新页面!
编辑入门 | 资助百科 | 留言讨论页 | 微博@舰R百科 | 百科编辑讨论Q群:366818861

模块:数据:修订间差异

舰R百科,玩家自由编辑的战舰少女R百科
无编辑摘要
Donnyjie留言 | 贡献
无编辑摘要
 
(未显示1个用户的16个中间版本)
第1行: 第1行:
local tr = mw.loadData("模块:对照表")
local tr = mw.loadData("模块:对照表")
local data = mw.loadData("模块:特殊数据")
local equipts = mw.loadData("模块:特殊数据/装备").equipts
local equipts = data.equipts
local ships = mw.loadData("模块:特殊数据/舰娘").ships
local ships = data.ships
local byIndex = mw.loadData("模块:特殊数据/舰娘").byIndex
local enemy = mw.loadData("模块:敌舰数据")
local enemy = mw.loadData("模块:敌舰数据")
local enemyShips = enemy.ships
local enemyShips = enemy.ships
第74行: 第74行:
     local shipName = frame.args[1]
     local shipName = frame.args[1]
     return replaceCountryName(ships[shipName]['简介'])
     return replaceCountryName(ships[shipName]['简介'])
end
p['改造'] = function(frame)
    local shipName = frame.args[1]
    local mod = ships[shipName].mod
    if mod == nil then mod = '' end
    return mod
end
end


第79行: 第86行:
     local shipName = frame.args[1]
     local shipName = frame.args[1]
     local dialogue = frame.args[2]
     local dialogue = frame.args[2]
    local force = frame.args[3]
    if force ~= nil and force ~= '' then return force end
     if shipName == '' then return '' end
     if shipName == '' then return '' end
     local ret = ships[shipName][dialogue]
     local ret = ships[shipName][dialogue]
     if ret == nil then ret = '' end
     if ret == nil then ret = '' end
    return ret
end
p['查找编号'] = function(frame)
    return byIndex[tonumber(frame.args[1])]
end
p['页面'] = function(frame)
    local idx = ships[frame.args[1]].index
    return byIndex[idx % 1000]
end
local typeCode = { }
typeCode['航空母舰'] = 'cv'
typeCode['轻型航空母舰'] = 'cvl'
typeCode['装甲航母'] = 'av'
typeCode['战列舰'] = 'bb'
typeCode['航空战列舰'] = 'bbv'
typeCode['战列巡洋舰'] = 'bc'
typeCode['重巡洋舰'] = 'ca'
typeCode['轻巡洋舰'] = 'cl'
typeCode['浅水重炮舰'] = 'bm'
typeCode['驱逐舰'] = 'dd'
typeCode['重炮潜艇'] = 'sc'
typeCode['潜艇'] = 'ss'
typeCode['补给舰'] = 'ap'
local curFrame = nil
local function expand(idx)
    local name = byIndex[idx]
    local link = byIndex[idx % 1000]
    local ship = ships[name]
    local moe = ship['萌王']
    if moe == nil then moe = '' end
    local args = { idx, name:gsub('·改', ''), link, ship.rarity, typeCode[ship.type], moe }
    return curFrame:expandTemplate{ title = '图鉴立绘2', args = args }
end
local function genShipList(idx)
    local part1 = ''
    local part2 = ''
    local empty1 = true
    local empty2 = true
    local prefix = '\n|width="200px"|'
    for i = idx + 1, idx + 5 do
        part1 = part1 .. prefix
        if byIndex[i] ~= nil then
            part1 = part1 .. expand(i)
            empty1 = false
        end
    end
    if not empty1 then prefix = '\n|' end
    for i = idx + 6, idx + 10 do
        part2 = part2 .. prefix
        if byIndex[i] ~= nil then
            part2 = part2 .. expand(i)
            empty2 = false
        end
    end
    if empty1 and empty2 then
        return nil
    elseif empty1 then
        return '{|\n|- valign="bottom"' .. part2 .. '\n|}\n'
    elseif empty2 then
        return '{|\n|- valign="bottom"' .. part1 .. '\n|}\n'
    else
        return '{|\n|- valign="bottom"' .. part1 .. '\n|-' .. part2 .. '\n|}\n'
    end
end
p['图鉴'] = function(frame)
    curFrame = frame
    local l = math.floor((tonumber(frame.args[1]) - 1) / 10) * 10
    local r = math.floor((tonumber(frame.args[2]) - 1) / 10) * 10
    local ret = ''
    local buf = ''
    for i = l, r, 10 do
        local title = '===No.' .. (i + 1) .. '~' .. (i + 10) .. '===\n'
        local list = genShipList(i)
        if list ~= nil then
            ret = ret .. buf .. title .. list
            buf = ''
        else
            buf = buf .. title
        end
    end
     return ret
     return ret
end
end
第125行: 第220行:
local colorName = { 'black', 'green', 'blue', 'purple', 'orange', 'red' }
local colorName = { 'black', 'green', 'blue', 'purple', 'orange', 'red' }
local function formatEnemyShip(ship)
local function formatEnemyShip(ship)
     local ret = '['
     local ret = '[['
     local len = mw.ustring.len(ship.title)
     local len = mw.ustring.len(ship.title)
     if mw.ustring.sub(ship.title, len, len) == '型' and mw.ustring.sub(ship.title, len - 2, len - 2) == '级' then
     if mw.ustring.sub(ship.title, len, len) == '型' and mw.ustring.sub(ship.title, len - 2, len - 2) == '级' then
第132行: 第227行:
         ret = ret .. ship.title
         ret = ret .. ship.title
     end
     end
     return ret .. "|<span style='color:" .. colorName[ship.rarity] .. ";'>" .. ship.title .. "</span>]"
     return ret .. "|<span style='color:" .. colorName[ship.rarity] .. ";'>" .. ship.title .. "</span>]]"
end
end


第157行: 第252行:
     local node = frame.args[1]
     local node = frame.args[1]
     local label = frame.args[2]
     local label = frame.args[2]
     if label == nil then label = node:sub(5,5) end
     if label == nil or label == '' then label = node:sub(5,5) end
    local shipNum = frame.args[3]
    if shipNum == nil then shipNum = 6 end


     local ret = ''
     local ret = ''
     local n = 0
     local n = 0
     for i, fleet in pairs(enemyFleets[node]) do
     for i, fleet in pairs(enemyFleets[node]) do
        if i ~= 1 then ret = ret .. '|-\n' end
         ret = ret .. '|' .. fleet.title .. '||' .. fleet.formation
         ret = ret .. '|' .. fleet.title .. '||' .. fleet.formation
         n = n + 1
         n = n + 1
第179行: 第277行:
             speedCnt[st] = speedCnt[st] + 1
             speedCnt[st] = speedCnt[st] + 1
         end
         end
         for j = m + 1, 6 do
         for j = m + 1, shipNum do
             ret = ret .. '||'
             ret = ret .. '||'
         end
         end
第191行: 第289行:
             s = speed[3] / speedCnt[3]
             s = speed[3] / speedCnt[3]
         end
         end
         ret = ret .. '||' .. rec .. '||' .. math.floor(s) .. '||' .. formatFloat(aa) .. '\n|-\n'
         ret = ret .. '||' .. rec .. '||' .. formatFloat(aa) .. '||' .. math.floor(s) .. '\n'
     end
     end
     return '|rowspan=' .. n .. '|' .. label .. '|' .. ret
     return '|rowspan=' .. n .. '|' .. label .. '|' .. ret
第198行: 第296行:
p.debug = function()
p.debug = function()
     f = { }
     f = { }
     f.args = { '2-5/B' }
     f.args = {'1', '400' }
     return p['敌舰队'](f)
     return p['图鉴'](f)
end
end


return p
return p