-- ========================================== -- 速度之星 - 严格锁定+无感换进程版 (纯文本版) -- ========================================== local TargetPackage = "com.lukedoukakis.speedstars" local DefaultSearchValue = "2.88750004768" local IsHooked = false local isWaitingForProcess = false -- 核心标志:是否正在等待换进程 -- 核心检测 local function GetProcessStatus() local info = gg.getTargetInfo() if not info then return "未选中", false end if info.packageName == TargetPackage then return "速度之星", true else return "错误进程", false end end -- 核心功能:极速修改 local function ExecuteModify() local _, isRight = GetProcessStatus() if not isRight then gg.alert("警告:当前不是《速度之星》进程!\n请先点【更换进程】去原版界面选对游戏。") return end local listItems = gg.getListItems() local hasCache = false if listItems and #listItems > 0 then local testVal = gg.getValues({{address = listItems[1].address, flags = gg.TYPE_FLOAT}})[1].value if testVal and testVal ~= 0 then hasCache = true else gg.clearList() end end if hasCache then local input = gg.prompt({"[极速覆盖] 新数值:"}, {"100"}, {"number"}) if not input or not input[1] then return end for i, v in ipairs(listItems) do v.value = input[1] v.freeze = true end gg.setValues(listItems) gg.toast("极速覆盖成功!") else local input = gg.prompt( {"[首次搜索] 原数值:", "修改为:"}, {DefaultSearchValue, "100"}, {"number", "number"} ) if not input or not input[1] or not input[2] then return end gg.toast("正在搜索,请稍候...") gg.clearResults() gg.searchNumber(input[1], gg.TYPE_AUTO) local count = gg.getResultsCount() if count > 0 then gg.addListItems(gg.getResults(count)) local saved = gg.getListItems() for i, v in ipairs(saved) do v.value = input[2] v.freeze = true end gg.setValues(saved) DefaultSearchValue = input[1] gg.toast("抓取成功!锁定了 " .. count .. " 个数据。") else gg.alert("未搜到数值。\n请确保游戏已经在跑动中。") end end end -- 触发更换进程模式 local function TriggerChangeProcess() local _, isRight = GetProcessStatus() if isRight then gg.alert("无需更换") return end isWaitingForProcess = true gg.toast("已开启换进程模式!\n请点击悬浮窗,在弹出的原版界面选中速度之星") end -- ========================================== -- 高颜值 UI 渲染 (纯文本) -- ========================================== local function ShowUI() local procText, isRight = GetProcessStatus() local listItems = gg.getListItems() local cacheCount = (listItems and #listItems > 0) and #listItems or 0 local cacheIcon = cacheCount > 0 and ("已抓取 ("..cacheCount..")") or "未抓取" local procDisplay = isRight and (" 进程: [" .. procText .. "]") or (" 进程: [" .. procText .. "]") local titleUI = "--------------------------\n" .. " 速度之星 - 助手 \n" .. "--------------------------\n" .. procDisplay .. "\n" .. " 数据: [" .. cacheIcon .. "]\n" .. "--------------------------" local menu = gg.choice({ "1. 极速修改数值", "2. 更换进程 (去原版界面选)", "3. 清空缓存数据", "4. 彻底退出脚本" }, nil, titleUI) if menu == 1 then ExecuteModify() elseif menu == 2 then TriggerChangeProcess() elseif menu == 3 then gg.clearList(); gg.clearResults(); gg.toast("已清空缓存数据") elseif menu == 4 then os.exit() end end -- ========================================== -- 启动入口:状态机无限循环 -- ========================================== gg.setVisible(false) gg.toast("助手已加载!点击悬浮窗唤醒。") while true do -- 状态1:用户正在选进程 (放行原版界面) if isWaitingForProcess then local info = gg.getTargetInfo() -- 如果检测到已经选对了游戏 if info and info.packageName == TargetPackage then isWaitingForProcess = false -- 退出待命模式 gg.setVisible(false) -- 如果原版界面还开着,关掉它 gg.toast("进程切换成功!已自动恢复助手。") ShowUI() -- 自动无缝弹回专属UI end -- 状态2:正常拦截模式 else -- 如果检测到修改器面板弹出 if gg.isVisible() then gg.setVisible(false) if not IsHooked then IsHooked = true ShowUI() IsHooked = false end end end gg.sleep(100) end