local player = require("player") local world = require("world") local silentRotations = require("silent_rotations_v2") local foundLicence = true --- @param entity entity --- @return entity? local function getEntityAbove(entity) if entity then local box = entity.box.expand(1, 2, 1) for index, entity2 in ipairs(world.getEntitiesInBox(box)) do if entity2.display_name:find("MERCHANT") then return entity2 end end end return nil end local function getEntityMerchant() for index, entity in ipairs(world.getEntities()) do if entity.display_name:find("MERCHANT") and entity.distance_to_player <= 10 then return { x = entity.x, y = entity.y - 1, z = entity.z } end end return nil end local function isHasFish() for i = 9, 43, 1 do local stack = player.inventory.getStack(i) if stack then -- 1057 --print("" .. stack.display_name .. " | " .. stack.id) if stack.id == 1057 then return true end end end if player.inventory.isAnyScreenOpened() and player.inventory.getContainerSlots() >= 47 then for i = 54, 88, 1 do local stack = player.inventory.getStack(i) if stack then -- 1057 if stack.id == 1057 then return true end end end end return false end local closeClicked = false local actionDelay = 0 registerClientTick(function() if foundLicence then local ray = player.raycast(4.5) if ray.type == "entity" then local entity = getEntityAbove(ray.data) if entity and isHasFish() then player.input.interactEntity() end end -- Разрешаем вход, если есть рыба ИЛИ мы ждём завершения продажи (чтобы не сбрасывалось между тиками) if player.inventory.isAnyScreenOpened() and (isHasFish() or closeClicked) and player.inventory.getContainerSlots() >= 47 then local stack = player.inventory.getStackFromContainer(50) if stack and stack.display_name == "§f[§cSell Settings§f]" and player.inventory.getStackFromContainer(13) == nil then if actionDelay > 0 then actionDelay = actionDelay - 1 else if not closeClicked then -- Фаза 1: Поиск и shift-click local clicked = false for i = 54, 88, 1 do local stack = player.inventory.getStack(i) or player.inventory.getStackFromContainer(i) if stack then -- 1057 if stack.id == 1057 then player.inventory.shiftLeftClick(i) closeClicked = true -- Блокируем повторный поиск в этом цикле clicked = true break end end end if clicked then -- Ставим рандомную задержку 2-5 тиков перед подтверждением actionDelay = math.random(2, 5) end else -- Фаза 2: Клик по 49 слоту (после задержки) player.inventory.leftClick(49) closeClicked = false -- Разрешаем искать следующую рыбу actionDelay = 0 end end else closeClicked = false actionDelay = 0 end else closeClicked = false actionDelay = 0 end end end)