无编辑摘要
无编辑摘要
第31行: 第31行:
end
end
end
end
return name:gsub(" ", "_")
    local back = name:gsub(" ", "_")
return back
end
end


第37行: 第38行:
function p.getGameIDPage(frame)
function p.getGameIDPage(frame)
local page_name = tostring(mw.title.getCurrentTitle())
local page_name = tostring(mw.title.getCurrentTitle())
return page_name
return p.getGameID(page_name)
end
end


return p
return p

2022年12月30日 (五) 08:57的版本


--Info By Stapx Steve
--本模块包含一些用于获取底层数据的功能

local p = {} --p代表一个包(package)

-- 此方法用于获取 wiki 用户名对应的游戏内用户名
-- PS:只有页面名和游戏名不一样的需要增加到列表里
function p.getGameID(name)
	local userList = {}
	local page_name = {
		"ClownPiece",
		"Doodle",
		"小龙",
		"NSTeno",
		"Mo xia"
	}
	local game_name = {
		"Wakamiya_Eve",
		"DoodleHuang",
		"xiaolong2011",
		"NSTeno_",
		"mo__xia"
	}
	userList[1] = page_name
	userList[2] = game_name
	-- 检索数组
	for i = 1, #userList[1] do
		if(userList[1][i] == name)
		then
			return userList[2][i]
		end
	end
    local back = name:gsub(" ", "_")
	return back
end

-- 根据页面 frame 直接获取游戏 ID
function p.getGameIDPage(frame)
	local page_name = tostring(mw.title.getCurrentTitle())
	return p.getGameID(page_name)
end

return p