Загрузка данных


-- ============================================================
--  РЕКОРДЕР ДЕЙСТВИЙ ДЛЯ ADOPT ME! (ANDROID + DELTA)
--  Версия: 3.1 (оптимизирован для Adopt Me!)
--  Записывает: касания, свайпы, задержки
-- ============================================================

local recorder = {
    recording = false,
    playing = false,
    events = {},
    startTime = 0,
    playIndex = 1,
    loopMode = false,
    speedFactor = 1.0,
    macroName = "adoptme_macro",
    savedMacros = {},
    touches = {},
}

-- Сервисы Roblox
local UserInputService = game:GetService("UserInputService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer

-- ============================================================
--  ЭМУЛЯЦИЯ КАСАНИЙ ДЛЯ ANDROID
-- ============================================================
local function simulateTouch(x, y, touchId)
    touchId = touchId or 1
    pcall(function()
        VirtualInputManager:SendTouchEvent(true, touchId, Vector2.new(x, y), nil)
    end)
end

local function releaseTouch(touchId)
    touchId = touchId or 1
    pcall(function()
        VirtualInputManager:SendTouchEvent(false, touchId, Vector2.new(0, 0), nil)
    end)
end

local function tapAt(x, y)
    simulateTouch(x, y, 1)
    task.wait(0.03)
    releaseTouch(1)
end

local function swipeFromTo(x1, y1, x2, y2, duration)
    duration = duration or 0.3
    local steps = math.max(1, math.floor(duration / 0.02))
    simulateTouch(x1, y1, 1)
    for i = 1, steps do
        local progress = i / steps
        local x = x1 + (x2 - x1) * progress
        local y = y1 + (y2 - y1) * progress
        pcall(function()
            VirtualInputManager:SendTouchEvent(true, 1, Vector2.new(x, y), nil)
        end)
        task.wait(duration / steps)
    end
    releaseTouch(1)
end

-- ============================================================
--  ЗАПИСЬ ДЕЙСТВИЙ
-- ============================================================
local function recordEvent(eventType, x, y, touchId)
    if not recorder.recording then return end
    local now = tick() - recorder.startTime
    table.insert(recorder.events, {
        type = eventType,
        time = now,
        x = x or 0,
        y = y or 0,
        touchId = touchId or 1,
    })
end

-- ЗАПИСЬ НАЧАЛА КАСАНИЯ
UserInputService.TouchStarted:Connect(function(input)
    if not recorder.recording then return end
    local pos = input.Position
    recordEvent("TouchBegin", pos.X, pos.Y, input.UserInputState)
    recorder.touches[input.UserInputState] = {x = pos.X, y = pos.Y}
end)

-- ЗАПИСЬ ДВИЖЕНИЯ
UserInputService.TouchMoved:Connect(function(input)
    if not recorder.recording then return end
    local pos = input.Position
    recordEvent("TouchMove", pos.X, pos.Y, input.UserInputState)
    recorder.touches[input.UserInputState] = {x = pos.X, y = pos.Y}
end)

-- ЗАПИСЬ ОКОНЧАНИЯ КАСАНИЯ
UserInputService.TouchEnded:Connect(function(input)
    if not recorder.recording then return end
    local pos = input.Position
    recordEvent("TouchEnd", pos.X, pos.Y, input.UserInputState)
    recorder.touches[input.UserInputState] = nil
end)

-- ============================================================
--  ВОСПРОИЗВЕДЕНИЕ
-- ============================================================
local function playEvents()
    local events = recorder.events
    if #events == 0 then
        print("[✗] Нет событий для воспроизведения")
        return
    end

    recorder.playing = true
    recorder.playIndex = 1
    local startTick = tick()
    local firstTime = events[1].time

    while recorder.playing and recorder.playIndex <= #events do