murequire("Define") murequire("System.ScriptCore") ------------------------------------------------------- -- CONFIG PRINCIPAL ------------------------------------------------------- local ROUTE_PACKET_HEADER = 0xF3 local PANEL_IMAGE_ID = 5000 local BUTTON_IMAGE_ID = 5001 local PANEL = { x = 40, y = 120, w = 240, h = 360, visible = false, dragging = false, dragDX = 0, dragDY = 0, } ------------------------------------------------------- -- ROTAS (NOMES EXIBIDOS) ------------------------------------------------------- local ROUTES = { [1] = "Lorencia", [2] = "Devias", [3] = "Dungeon", [4] = "Noria", [5] = "Lost Tower", [6] = "Arena", [7] = "Atlans", [8] = "Tarkan", [9] = "Icarus", [10] = "Aida", [11] = "Raklion", [12] = "Vulcanus" } ------------------------------------------------------- -- CARREGAR IMAGENS ------------------------------------------------------- local function OnLoadInterface_RoutePanel() LoadBitmap("Custom\\LuaScript\\Interface\\Board.tga", PANEL_IMAGE_ID, GL_LINEAR, GL_REPEAT, false, false) LoadBitmap("Custom\\LuaScript\\Interface\\Button.tga", BUTTON_IMAGE_ID, GL_LINEAR, GL_REPEAT, false, false) end ------------------------------------------------------- -- ENVIO DA ROTA PARA O SERVER ------------------------------------------------------- local function SendRoute(routeId) -- Tenta suportar diferentes formatos de construtor de Packet (Compatibilidade) local function createPacket() if type(Packet) == "function" or (getmetatable(Packet) and getmetatable(Packet).__call) then return Packet() end if type(Packet) == "table" then if type(Packet.new) == "function" then return Packet.new() end if type(Packet.New) == "function" then return Packet.New() end if type(Packet.create) == "function" then return Packet.create() end if type(Packet.Create) == "function" then return Packet.Create() end end return nil end local p = createPacket() if not p then print("[RouteSystemClient] Nao foi possivel instanciar Packet") return end p:WriteByte(routeId) SendPacket(ROUTE_PACKET_HEADER, p) end ------------------------------------------------------- -- API INPUT NATIVO (C++) -- IsMouseClicked() -> Retorna true apenas no frame do clique (Rising Edge) -- IsMouseHeld() -> Retorna true enquanto o botão estiver pressionado -- SetBlockInput() -> Bloqueia o input do jogo (Camera/Walk) ------------------------------------------------------- ------------------------------------------------------- -- SISTEMA DE ARRASTAR JANELA ------------------------------------------------------- local function HandlePanelDrag(IsClickFrame) local headerH = 30 if CheckMouseIn(PANEL.x, PANEL.y, PANEL.w, headerH) and IsClickFrame then PANEL.dragging = true PANEL.dragDX = MouseX - PANEL.x PANEL.dragDY = MouseY - PANEL.y end if PANEL.dragging then -- Native API: IsMouseHeld() if IsMouseHeld() then PANEL.x = MouseX - PANEL.dragDX PANEL.y = MouseY - PANEL.dragDY else PANEL.dragging = false end end end ------------------------------------------------------- -- VERIFICAR SE O PAINEL ESTÁ ATIVO ------------------------------------------------------- local function IsRoutePanelActive() if not PANEL.visible then return false end -- Verifica se o mouse está sobre o painel principal if CheckMouseIn(PANEL.x, PANEL.y, PANEL.w, PANEL.h) then return true end return false end ------------------------------------------------------- -- RENDER DO PAINEL ------------------------------------------------------- local function OnInterfaceRender_RoutePanel() if not PANEL.visible then SetBlockInput(false) return end -- Native API: IsMouseClicked() -- Captura o estado do clique processado pelo C++ (garante 1 clique por frame) local IsClickFrame = IsMouseClicked() HandlePanelDrag(IsClickFrame) SetBlockInput(IsRoutePanelActive()) -- FUNDO RenderImage(PANEL_IMAGE_ID, PANEL.x, PANEL.y, PANEL.w, PANEL.h) -- TÍTULO UIRenderText_SetFont(g_hFontBold) UIRenderText_SetTextColor(255, 255, 0, 255) UIRenderText_SetBgColor(0, 0, 0, 0) UIRenderText_RenderText(PANEL.x + 108, PANEL.y + 10, "ROTAS", 0, 0, 0) -- BOTÃO FECHAR local closeSize = 14 local closeX = PANEL.x + PANEL.w - closeSize - 15 local closeY = PANEL.y + 10 if CheckMouseIn(closeX, closeY, closeSize, closeSize) then UIRenderText_SetTextColor(255, 80, 80, 255) if IsClickFrame then PANEL.visible = false end else UIRenderText_SetTextColor(255, 255, 255, 255) end UIRenderText_RenderText(closeX, closeY, "X", 0, 0, 0) --------------------------------------------------- -- GRADE 3x4 DE BOTÕES --------------------------------------------------- local startX = PANEL.x + 10 local startY = PANEL.y + 30 local btnW = 60 local btnH = 28 local colSpacing = 71 local rowSpacing = 30 for id = 1, 12 do local col = (id - 1) % 3 local row = math.floor((id - 1) / 3) local btnX = startX + (col * colSpacing) local btnY = startY + (row * rowSpacing) local hover = CheckMouseIn(btnX, btnY, btnW, btnH) -- DESENHA IMAGEM DO BOTÃO RenderImage(BUTTON_IMAGE_ID, btnX, btnY, btnW, btnH) -- COR DO TEXTO if hover then UIRenderText_SetTextColor(255, 180, 100, 255) if IsClickFrame then SendRoute(id) end else UIRenderText_SetTextColor(220, 220, 220, 255) end -- TEXTO CENTRALIZADO NO BOTÃO UIRenderText_SetFont(g_hFont) UIRenderText_RenderText( btnX + 10, btnY + 12, string.format("%d - %s", id, ROUTES[id]), 0, 0, 0 ) end end ------------------------------------------------------- -- TECLA F9 ABRIR / FECHAR ------------------------------------------------------- local function OnTimerThread_RoutePanel() if SEASON3B_IsPress(120) then PANEL.visible = not PANEL.visible end end ------------------------------------------------------- -- REGISTRO DOS EVENTOS ------------------------------------------------------- BridgeFunctionAttach("OnLoadInterface", OnLoadInterface_RoutePanel) BridgeFunctionAttach("OnInterfaceRender", OnInterfaceRender_RoutePanel) BridgeFunctionAttach("OnTimerThread", OnTimerThread_RoutePanel)