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

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

function p.getGameID(name)
	local userList = {}
	local page_name = {
		"Stapx Steve",
		"123154567",
		"159357890",
		"DoctorX",
		"ClownPiece",
		"Lemon tea",
		"Mars Cloud",
		"Doodle",
		"New Stars",
		"Craft Kevin",
		"Himokes",
		"Sakuraa",
		"Silver Lights",
		"InitAuther97",
		"Sjfhsjfh",
		"A90ml",
		"Czz",
		"Jack Nero233",
		"小龙",
		"Xiaotao Jwhite",
		"Kuai123",
		"Ynnad",
		"Dinnerbone",
		"Kubor Kelp",
		"NSTeno",
		"L Ac",
	}
	local game_name = {
		"Stapx_Steve",
		"123154567",
		"159357890",
		"DoctorX",
		"Wakamiya_Eve",
		"Lemon_tea",
		"Mars_Cloud",
		"DoodleHuang",
		"new_stars",
		"Craft_Kevin",
		"himokes",
		"sakuraa",
		"Silver_Lights",
		"InitAuther97",
		"sjfhsjfh",
		"a90ml",
		"Czz",
		"Jack_Nero233",
		"xiaolong2011",
		"xiaotao_jwhite",
		"Kuai123",
		"Ynnad",
		"",
		"Kubor_Kelp",
		"NSTeno_",
		"L_Ac",
	}
	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
end

-- 根据页面 farme 直接获取皮肤
function p.getGameIDPage(farme)
	local page_name = mw.title.getCurrentTitle()
	return p.getGameID(page_name)
end

function p.getCatInfo(frame)
	local name = frame.args[1]
	local title = mw.title.new(name)
	local url = title.prefixedText
	local main = "https://" .. mw.uri.fullUrl( "主页").host
	local api = main.."/api.php?action=query&list=categorymembers&cmlimit=100&format=json&cmtitle="..url
	
	local pages = mw.ext.externaldata.getWebData {
    	url = api
		, data = "name = $.query.categorymembers[*].title, all = $..*, err = $.error.code"
		, format = "json"
		, 'use jsonpath'
	}
	return pages.info
end

return p