模块:装备获得:修订间差异

无编辑摘要
无编辑摘要
 
(未显示2个用户的19个中间版本)
第1行: 第1行:
-- 本模块为个人测试用
local data = mw.loadData("模块:特殊数据/舰娘")
local data = mw.loadData("模块:特殊数据/装备")
local ships = data.ships
local data2 = mw.loadData("模块:特殊数据/舰娘")
local byIndex = data.byIndex
local equipts = data.equipts
local ships = data2.ships
local byIndex = data2.byIndex
local p = {}


local function fixEquiptName(name)
local p = { }
name = string.gsub(name, '(', '(')
name = string.gsub(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 = data.equipts[name]
if ret == nil then ret = name end
return ret
end


p['自带'] = function(frame)
p['自带'] = function(frame)
local equiptName = frame.args[1]
local equiptName = frame.args[1]
equiptName = fixEquiptName(equiptName)
local ret = ''
local ret = ''
for i = 1,1300 do
for i = 1,1750 do
local shipName = byIndex[i]
local shipName = byIndex[i]
if shipName ~= nil then
if shipName ~= nil then
local eq = {ships[shipName].eq1, ships[shipName].eq2, ships[shipName].eq3, ships[shipName].eq4}
local eq = {ships[shipName].eq1, ships[shipName].eq2, ships[shipName].eq3, ships[shipName].eq4}
for k = 1,4 do
for k = 1, 4 do
if eq[k] == equiptName then
if eq[k] == equiptName then
if string.sub(shipName, -5, -1) == '·改' then
if eq[k] == eq[k-1] or eq[k] == eq[k-2] or eq[k] == eq[k-3] then
ret = ret .. '[[' .. string.sub(shipName, 1, -6) .. '|' .. shipName .. ']]、'
break
end
if 1000 < ships[shipName].index and ships[shipName].index < 2000 then
local shipBaseName = byIndex[i - 1000]
ret = ret .. '[[' .. shipBaseName .. '|' .. shipName .. ']]、'
else
else
ret = ret .. '[[' .. shipName .. ']]、'
ret = ret .. '[[' .. shipName .. ']]、'
第46行: 第28行:
end
end
ret = string.sub(ret, 1, -4)
ret = string.sub(ret, 1, -4)
return ret .. '自带'
if ret == '' then
ret = ''
else
ret = ret .. '自带'
end
return ret
end
end


return p
return p

2022年9月27日 (二) 22:45的最新版本

可在模块:装备获得/doc创建此模块的帮助文档

local data = mw.loadData("模块:特殊数据/舰娘")
local ships = data.ships
local byIndex = data.byIndex

local p = { }

p['自带'] = function(frame)
	local equiptName = frame.args[1]
	local ret = ''
	for i = 1,1750 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 eq[k] == eq[k-1] or eq[k] == eq[k-2] or eq[k] == eq[k-3] then
						break
					end
					if 1000 < ships[shipName].index and ships[shipName].index < 2000 then
						local shipBaseName = byIndex[i - 1000]
						ret = ret .. '[[' .. shipBaseName .. '|' .. shipName .. ']]、'
					else
						ret = ret .. '[[' .. shipName .. ']]、'
					end
				end
			end
		end
	end
	ret = string.sub(ret, 1, -4)
	if ret == '' then
		ret = ''
	else
		ret = ret .. '自带'
	end
	return ret
end

return p