RT 本问题来自于面对面会议
将下面的Lua函数复制到关卡文件夹/scripts/main.lua中
-- 获取游戏版本平台版本号
---@param mapId integer
function GetGameVersion(mapId)
local url = 'https://www.kkdzpt.com/rpgarea'
y3.game:request_url(url, nil, function(body)
local buildId = string.match(body, '"buildId"%s*:%s*"([^"]+)"')
if buildId then
local url = "https://www.kkdzpt.com/_next/data/"..buildId.."/fab/" ..
tostring(mapId) .. ".json?mapid=" .. tostring(mapId)
y3.game:request_url(url, nil, function(body)
local data = y3.json.decode(body)
if data then
local gameVersion = data['pageProps']['initialState']['fab']['gameDetail']['mapVersion']
log.info('游戏版本:' .. gameVersion)
end
end)
else
print("未找到 buildId, 拉取版本失败")
end
end)
end
ECA调用参照下图