模块:舰娘:修订间差异
跳转到导航
跳转到搜索
(创建页面,内容为“local data = mw.loadData("模块:特殊数据") local ships = data.ships local byIndex = data.byIndex local p = { } local typeCode = { } typeCode['航空母舰'] =...”) |
无编辑摘要 |
||
(未显示2个用户的40个中间版本) | |||
第1行: | 第1行: | ||
local | local data1 = mw.loadData("模块:特殊数据/舰娘") | ||
local ships = | local data2 = mw.loadData("模块:特殊数据/技能") | ||
local byIndex = | local ships = data1.ships | ||
local stats = data1.stats | |||
local skills = data2.skills | |||
local byIndex = data1.byIndex | |||
local p = { } | local p = { } | ||
p['打印图鉴列表'] = function (frame) | |||
ret ='' | |||
for index, name in pairs(byIndex) do | |||
if type(index) == 'number' then | |||
if tonumber(index) < 1000 | |||
then ret = ret .. tostring(index) .. ',' .. name .. ',' .. ships[name].rarity .. '\n\n' | |||
end | |||
end | |||
end | |||
return ret | |||
end | |||
p['查找船名'] = function(frame) | |||
if tonumber(frame.args[1]) ~= nil | |||
then return byIndex[tonumber(frame.args[1])] | |||
else return byIndex[frame.args[1]] | |||
end | |||
end | |||
p['统计'] = function(frame) | |||
local normal = 0 | |||
local mod = 0 | |||
local skin = 0 | |||
for index, name in pairs(byIndex) do | |||
if type(index) == 'string' | |||
then skin = skin + 1 | |||
else | |||
if index < 1000 | |||
then normal = normal + 1 | |||
else if index < 2000 then mod = mod + 1 end | |||
end | |||
end | |||
end | |||
if frame.args[1] == '普通' then return normal end | |||
if frame.args[1] == '改造' then return mod end | |||
if frame.args[1] == '换装' then return skin end | |||
end | |||
p['属性'] = function(frame) | p['属性'] = function(frame) | ||
local ship = ships[frame.args[2]] | local ship = ships[frame.args[2]] | ||
if ship == nil then return | local default = frame.args[3] | ||
if default == nil then default = '' end | |||
if ship == nil then return default end | |||
local ret = ship[frame.args[1]] | local ret = ship[frame.args[1]] | ||
if ret == nil then return '' end | if ret == nil then return default end | ||
return ret | |||
end | |||
p['评分'] = function(frame) | |||
local stat = stats[frame.args[3]] | |||
local default = frame.args[5] | |||
if default == nil then default = '' end | |||
if stat == nil then return default end | |||
local val | |||
if frame.args[2] == '自定义' then | |||
val = tonumber(frame.args[4]) | |||
if val == nil then return default end | |||
else | |||
local ship = ships[frame.args[2]] | |||
if ship == nil then return default end | |||
val = ship[frame.args[1]] | |||
end | |||
if val == 0 then return '-' end | |||
if stat[frame.args[1]].stddev == 0 then return 100 end | |||
if stat[frame.args[1]].stddev == NaN then | |||
if val > 0 then return 200 | |||
else return '-' end | |||
end | |||
local stdval = (val - stat[frame.args[1]].mean) / stat[frame.args[1]].stddev | |||
local score = (stdval / 3 * 100) + 100 | |||
if score > 200 then score = 200 end | |||
if score < 0 then score = 0 end | |||
local ret = math.floor(score + 0.5) | |||
if ret == nil then return default end | |||
return ret | return ret | ||
end | end | ||
p[' | p['搭载'] = function(frame) | ||
local ship = ships[frame.args[1]] | local ship = ships[frame.args[1]] | ||
if ship == nil then return '' end | if ship == nil then return '' end | ||
return | return ship.cap1 + ship.cap2 + ship.cap3 + ship.cap4 | ||
end | |||
local typeName = { | |||
CV='航空母舰', CVL='轻型航空母舰', AV='装甲航母', BB='战列舰', BBV='航空战列舰', BC='战列巡洋舰', | |||
CA='重巡洋舰', CAV='航空巡洋舰', CLT='重雷装巡洋舰', CL='轻巡洋舰', BM='浅水重炮舰', DD='驱逐舰', SC='重炮潜艇', SS='潜艇', AP='补给舰', | |||
DDG='导弹驱逐舰', DDGAA='防空导弹驱逐舰', CBG='大型导弹巡洋舰', BBG='导弹战列舰', CF='飞行甲板巡洋舰', CG='导弹巡洋舰', CGAA='防空导弹巡洋舰', | |||
} | |||
p['舰种代码'] = function(frame) | |||
local ship = ships[frame.args[1]] | |||
if ship == nil then return '' end | |||
return ship.type:lower() | |||
end | |||
p['舰种名称'] = function(frame) | |||
local ship = ships[frame.args[1]] | |||
if ship == nil then return '' end | |||
return typeName[ship.type] | |||
end | end | ||
第37行: | 第115行: | ||
local ship = ships[frame.args[1]] | local ship = ships[frame.args[1]] | ||
if ship == nil then return '' end | if ship == nil then return '' end | ||
local ret = ship | |||
if ship.index < 1000 then | if ship.index < 1000 then | ||
ship = byIndex[ship.index] | ship = ships[byIndex[ship.index + 1000]] | ||
if ship ~= nil then ret = ship end | |||
end | end | ||
if ship == nil then return '' end | return ret.index | ||
return ship.index | end | ||
local function formatSkill(skill, green, red) | |||
if green == nil then green = '#00D500' end | |||
if red == nil then red = '#FF69B4' end | |||
skill = skill:gsub('_G%[_', '<span style="color:' .. green .. ';">') | |||
skill = skill:gsub('_R%[_', '<span style="color:' .. red .. ';">') | |||
skill = skill:gsub('_%]_', '</span>') | |||
return skill | |||
end | |||
p['技能描述'] = function(frame) | |||
local ship = ships[frame.args[1]] | |||
if ship == nil or ship.skill == nil then return '' end | |||
return formatSkill(skills[ship.skill], frame.args[2], frame.args[3]) | |||
end | |||
p['技能描述2'] = function(frame) | |||
local ship = ships[frame.args[1]] | |||
if ship == nil or ship.skill2 == nil then return '' end | |||
return formatSkill(skills[ship.skill2], frame.args[2], frame.args[3]) | |||
end | |||
p['页面'] = function(frame) | |||
local idx = ships[frame.args[1]].index | |||
return byIndex[idx % 1000] | |||
end | end | ||
return p | return p |
2024年8月30日 (五) 18:29的最新版本
{{#invoke:舰娘|统计|普通}}、{{#invoke:舰娘|统计|改造}}、{{#invoke:舰娘|统计|换装}}
577、218、421
{{#invoke:舰娘|查找船名|1001}}
胡德·改
{{#invoke:舰娘|属性|atk|胡德}}
68
{{#invoke:舰娘|评分|atkMax|密苏里|BB}}
150
{{#invoke:舰娘|评分|atkMax|自定义|BB|90}}
89
{{#invoke:舰娘|搭载|列克星敦}}
{{#invoke:舰娘|舰种代码|胡德}}
bc
{{#invoke:舰娘|舰种名称|胡德}}
战列巡洋舰
{{#invoke:舰娘|改造编号|胡德}}
1001
{{#invoke:舰娘|改造编号|格拉摩根}}
403
{{#invoke:舰娘|技能描述|胡德·改}}
自身作为旗舰时,为队伍中所有舰船附加5%/7.5%/10%的被暴击率,为队伍中的E国舰船附加10%/15%/20%的暴击率,为其他国家的舰船附加5%/7.5%/10%的暴击率。
{{#invoke:舰娘|技能描述2|胡德·改}}
自身作为旗舰时,提升全队航速2/3/4点。
local data1 = mw.loadData("模块:特殊数据/舰娘")
local data2 = mw.loadData("模块:特殊数据/技能")
local ships = data1.ships
local stats = data1.stats
local skills = data2.skills
local byIndex = data1.byIndex
local p = { }
p['打印图鉴列表'] = function (frame)
ret =''
for index, name in pairs(byIndex) do
if type(index) == 'number' then
if tonumber(index) < 1000
then ret = ret .. tostring(index) .. ',' .. name .. ',' .. ships[name].rarity .. '\n\n'
end
end
end
return ret
end
p['查找船名'] = function(frame)
if tonumber(frame.args[1]) ~= nil
then return byIndex[tonumber(frame.args[1])]
else return byIndex[frame.args[1]]
end
end
p['统计'] = function(frame)
local normal = 0
local mod = 0
local skin = 0
for index, name in pairs(byIndex) do
if type(index) == 'string'
then skin = skin + 1
else
if index < 1000
then normal = normal + 1
else if index < 2000 then mod = mod + 1 end
end
end
end
if frame.args[1] == '普通' then return normal end
if frame.args[1] == '改造' then return mod end
if frame.args[1] == '换装' then return skin end
end
p['属性'] = function(frame)
local ship = ships[frame.args[2]]
local default = frame.args[3]
if default == nil then default = '' end
if ship == nil then return default end
local ret = ship[frame.args[1]]
if ret == nil then return default end
return ret
end
p['评分'] = function(frame)
local stat = stats[frame.args[3]]
local default = frame.args[5]
if default == nil then default = '' end
if stat == nil then return default end
local val
if frame.args[2] == '自定义' then
val = tonumber(frame.args[4])
if val == nil then return default end
else
local ship = ships[frame.args[2]]
if ship == nil then return default end
val = ship[frame.args[1]]
end
if val == 0 then return '-' end
if stat[frame.args[1]].stddev == 0 then return 100 end
if stat[frame.args[1]].stddev == NaN then
if val > 0 then return 200
else return '-' end
end
local stdval = (val - stat[frame.args[1]].mean) / stat[frame.args[1]].stddev
local score = (stdval / 3 * 100) + 100
if score > 200 then score = 200 end
if score < 0 then score = 0 end
local ret = math.floor(score + 0.5)
if ret == nil then return default end
return ret
end
p['搭载'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil then return '' end
return ship.cap1 + ship.cap2 + ship.cap3 + ship.cap4
end
local typeName = {
CV='航空母舰', CVL='轻型航空母舰', AV='装甲航母', BB='战列舰', BBV='航空战列舰', BC='战列巡洋舰',
CA='重巡洋舰', CAV='航空巡洋舰', CLT='重雷装巡洋舰', CL='轻巡洋舰', BM='浅水重炮舰', DD='驱逐舰', SC='重炮潜艇', SS='潜艇', AP='补给舰',
DDG='导弹驱逐舰', DDGAA='防空导弹驱逐舰', CBG='大型导弹巡洋舰', BBG='导弹战列舰', CF='飞行甲板巡洋舰', CG='导弹巡洋舰', CGAA='防空导弹巡洋舰',
}
p['舰种代码'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil then return '' end
return ship.type:lower()
end
p['舰种名称'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil then return '' end
return typeName[ship.type]
end
p['改造编号'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil then return '' end
local ret = ship
if ship.index < 1000 then
ship = ships[byIndex[ship.index + 1000]]
if ship ~= nil then ret = ship end
end
return ret.index
end
local function formatSkill(skill, green, red)
if green == nil then green = '#00D500' end
if red == nil then red = '#FF69B4' end
skill = skill:gsub('_G%[_', '<span style="color:' .. green .. ';">')
skill = skill:gsub('_R%[_', '<span style="color:' .. red .. ';">')
skill = skill:gsub('_%]_', '</span>')
return skill
end
p['技能描述'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil or ship.skill == nil then return '' end
return formatSkill(skills[ship.skill], frame.args[2], frame.args[3])
end
p['技能描述2'] = function(frame)
local ship = ships[frame.args[1]]
if ship == nil or ship.skill2 == nil then return '' end
return formatSkill(skills[ship.skill2], frame.args[2], frame.args[3])
end
p['页面'] = function(frame)
local idx = ships[frame.args[1]].index
return byIndex[idx % 1000]
end
return p