-- 分辨率:2560×1440
-- 适配:罗技 LGS / G HUB Lua
EnablePrimaryMouseButtonEvents(true)
-- 二阶贝塞尔曲线计算 + 轻微随机偏移
local function BezierMove(startX, startY, endX, endY, step)
for i = 1, step do
local t = i / step
-- 缓动曲线:慢起慢落
t = t * t * (3 - 2 * t)
local mt = 1 - t
-- 二阶贝塞尔控制点(自动生成弧形)
local ctrlX = startX + (endX - startX) * 0.5 + math.random(-80, 80)
local ctrlY = startY + (endY - startY) * 0.5 + math.random(-60, 60)
-- 贝塞尔公式
local curX = mt^2 * startX + 2 * mt * t * ctrlX + t^2 * endX
local curY = mt^2 * startY + 2 * mt * t * ctrlY + t^2 * endY
-- 微小抖动,更像人手
curX = curX + math.random(-15, 15)
curY = curY + math.random(-15, 15)
MoveMouseTo(math.floor(curX), math.floor(curY))
Sleep(3)
end
end
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 7 then -- G4侧键触发
-- 打开背包
PressAndReleaseKey("Tab")
Sleep(80)
-- 起点:保险箱子弹坐标
local sX, sY = 31064, 47819
-- 终点:1号枪弹药位坐标
local eX, eY = 19745, 46999
-- 移动到子弹位置
MoveMouseTo(sX, sY)
Sleep(50)
-- 按住左键开始拖拽
PressMouseButton(1)
Sleep(10)
-- 【核心】贝塞尔弧线拖拽代替直线移动
BezierMove(sX, sY, eX, eY, 20)
-- 松开拖拽
ReleaseMouseButton(1)
Sleep(80)
-- 关闭背包
PressAndReleaseKey("Tab")
end
end