Module:Sandbox/Hcmzn
跳到导航
跳到搜索
-- 本模块为个人测试用 local data = mw.loadData("模块:战舰少女:特殊数据") local enemies = mw.loadData("模块:战舰少女:敌舰属性列表") local alias = mw.loadData("模块:战舰少女:别名") local ships = data.ships local equipts = data.equipts local equiptDisplay = data.equiptDisplay local byIndex = data.byIndex local p = {} local function fixEquiptName(name) name = string.gsub(name, 'Ⅲ', 'III') name = string.gsub(name, 'Ⅵ', 'VI') name = string.gsub(name, '日本', 'J国') name = string.gsub(name, '德国', 'G国') name = string.gsub(name, '英国', 'E国') name = string.gsub(name, '美国', 'U国') name = string.gsub(name, '意大利', 'I国') name = string.gsub(name, '法国', 'F国') name = string.gsub(name, '德国', 'G国') name = string.gsub(name, '苏联', 'S国') name = string.gsub(name, '中国', 'C国') local ret = alias.equiptName[name] if ret == nil then ret = name end return ret end p['自带'] = function(frame) local equiptName = frame.args[1] equiptName = fixEquiptName(equiptName) local ret = '' for i = 1,1300 do local shipName = byIndex[i] if shipName ~= nil then local eq = {ships[shipName].eq1, ships[shipName].eq2, ships[shipName].eq3, ships[shipName].eq4} for k = 1,4 do if eq[k] == equiptName then if i > 1000 and i < 2000 then local shipBaseName = byIndex[i - 1000] ret = ret .. '[[战舰少女:' .. shipBaseName .. '|' .. shipName .. ']]、' else ret = ret .. '[[战舰少女:' .. shipName .. '|' .. shipName .. ']]、' end end end end end ret = string.sub(ret, 1, -4) if ret == '' then return ret else return ret .. '自带' end end p['简介debug'] = function() local ret = '{| class="wikitable mw-collapsible mw-collapsed" style="text-align:left"\n|-\n! colspan=3 | 简介对比表\n|-\n!船名!! colspan=2 | 简介' for i = 1,400 do local shipName = byIndex[i] local mod = byIndex[i + 1000] if ships[shipName] ~= nil and ships[mod] ~= nil and ships[shipName]['简介'] ~= ships[mod]['简介'] then ret = ret .. '\n|-\n! rowspan=2 |[[战舰少女:' .. shipName .. '|' .. shipName .. ']]\n|改前||' .. ships[shipName]['简介'] .. '\n|-\n|改后||' .. ships[mod]['简介'] end end return ret .. '\n|}' end return p