-- 全局计数器
local gjCounter = 0
local isGJRunning = false
-- 配置参数
local config = {
startButton = 9,
stopKey = "scrolllock",
runKey = {"w", "lshift"},
skillKeys = {"c", "v"},
inventoryKey = "b",
sleepTimes = {
runDelay = 2000,
moveDelay = 200,
taskStartDelay = 600,
taskEndDelay = 1200,
inventoryClearDelay = 1200,
escapeDelay = 1000
},
coordinates = {
inventoryClick1 = {8000, 24000},
inventoryClick2 = {58739, 14400},
inventoryClick3 = {28140, 25692}
}
}
-- 主要挂机函数
function gj()
-- 执行一系列游戏内操作
executeGameActions()
--
-- -- 更新计数器
-- gjCounter = gjCounter + 1
-- if gjCounter >= 10 then
-- clearInventory()
-- gjCounter = 0
-- end
end
-- 游戏内操作
function executeGameActions()
-- 封装的跑步函数
run(config.sleepTimes.runDelay)
an("e", 600)
an("d", 1500)
PressAndReleaseKey("c")
run(4100)
Sleep(500)
MoveMouseRelative(700, 0)
run(2600)
an("e", 600)
Sleep(100)
MoveMouseRelative(-500, 0)
Sleep(500)
PressAndReleaseKey("v")
PressAndReleaseMouseButton(5)
run(2000)
Sleep(100)
MoveMouseRelative(450, -100)
Sleep(300)
run(2250)
Sleep(300)
MoveMouseRelative(520, 100)
Sleep(300)
run(3100)
Sleep(300)
MoveMouseRelative(-550, -50)
PressAndReleaseKey("c")
Sleep(1200)
run(3500)
Sleep(1500)
MoveMouseRelative(-1100, 0)
Sleep(300)
run(5000)
PressAndReleaseKey("escape")
Sleep(100)
MoveMouseTo(4680, 20000)
Sleep(100)
PressAndReleaseMouseButton(1)
Sleep(100)
PressAndReleaseKey("spacebar")
Sleep(1000)
end
-- -- 清理背包函数
-- function clearInventory()
-- PressAndReleaseKey(config.inventoryKey)
-- Sleep(config.sleepTimes.escapeDelay)
-- for _, coord in ipairs({config.coordinates.inventoryClick1, config.coordinates.inventoryClick2, config.coordinates.inventoryClick3}) do
-- MoveMouseTo(coord[1], coord[2])
-- Sleep(config.sleepTimes.moveDelay)
-- PressAndReleaseMouseButton(1)
-- Sleep(config.sleepTimes.inventoryClearDelay)
-- an("lshift", config.sleepTimes.inventoryClearDelay)
-- Sleep(config.sleepTimes.moveDelay)
-- an("lctrl", config.sleepTimes.inventoryClearDelay)
-- Sleep(config.sleepTimes.moveDelay)
-- PressAndReleaseKey("spacebar")
-- Sleep(config.sleepTimes.escapeDelay)
-- end
-- end
-- 封装的跑步函数
function run(t)
PressKey(config.runKey[1])
Sleep(10)
PressKey(config.runKey[2])
Sleep(t)
ReleaseKey(config.runKey[1])
ReleaseKey(config.runKey[2])
end
-- 封装的长按键位函数
function an(key, time)
PressKey(key)
Sleep(time)
ReleaseKey(key)
end
-- 事件处理函数
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_RELEASED" and config.startButton == arg and not isGJRunning then
isGJRunning = true
while isGJRunning do
gj()
end
end
if event == "MOUSE_BUTTON_RELEASED" and config.stopKey == arg and not isGJRunning then
isGJRunning = false
end
end
第一后裔脚本
最新推荐文章于 2024-07-26 14:50:22 发布