-- ============================================================================= -- CLIENTE: REY DEL MU (V25.1 - TOP KILLS & TOP REYES BLINDADO UP43/UP44) -- Creado y Desarrollado por SPTEAM -- ============================================================================= pcall(function() require('Scripts\\ReyDelMu\\ReyClient_Crowns') end) -- Addon de Coronas Visuales local ReyConfig = { WindowID = 205, -- ID Unico para la ventana modal de resultados clanes WindowID_Kills = 206, -- ID Unico para ventana Top 10 Asesinos WindowID_Reyes = 207 -- ID Unico para ventana Top 10 Reyes } -- IDs DE TEXTURAS (REGISTRO OFICIAL - OFFSET +5) local ID_TopKills_Fondo = 60014 -- 512x512 Top Kills HUD local ID_TopRey_Fondo = 60015 -- 512x512 Top Reyes HUD local ID_Close_Hover = 60016 -- 128x128 Botón Cerrar Hover (Común) local ID_Close_Click = 60017 -- 128x128 Botón Cerrar Click (Común) local ID_BtnRey_Hover = 60018 -- 64x64 Botón Corona Hover (Main HUD) local ID_BtnRey_Click = 60019 -- 64x64 Botón Corona Click (Main HUD) local ID_BtnKill_Hover = 60020 -- 64x64 Botón Calavera Hover (Main HUD) local ID_BtnKill_Click = 60021 -- 64x64 Botón Calavera Click (Main HUD) -- SUB-COMANDOS DE PROTOCOLO RED local SUB_SYNC = 1 local SUB_TRONO_TOMADO = 2 local SUB_TRONO_LIBRE = 3 local SUB_RESULTADOS = 4 local SUB_CORONA_SYNC = 5 local SUB_RESULTADOS_KILLS = 6 local SUB_RESULTADOS_REYES = 7 -- [CONFIGURACIÓN CALIBRADA DE POSICIONES Y TAMAÑOS (SPTEAM)] local CalibRey = { -- 1. Botón Calavera en WinResultados (Esquina Inferior Izquierda) BtnKill = { OffX = 2, OffY = 178, W = 64, H = 64 }, -- 2. Botón Corona en WinResultados (Esquina Inferior Derecha) BtnRey = { OffX = 193, OffY = 178, W = 64, H = 64 }, -- 3. Ventana Top 10 Kills WinKills = { X = 280, Y = 85, W = 300, H = 300 }, -- 4. Ventana Top 10 Reyes WinReyes = { X = 280, Y = 85, W = 300, H = 300 }, -- 5. Botón Cerrar [X] en Top HUDs (Esquina Superior Derecha del marco 300x300) TopCloseBtn = { OffX = 265, OffY = 8, W = 34, H = 34 }, -- 6..9. Columnas de Texto en Top HUDs (Calibración Horizontal Individual) Cols = { ClaseX = 66, -- Siglas de clase (SM, BK, etc.) NombreX = 124, -- Nombre del personaje GuildX = 189, -- Nombre del clan ValorX = 246 -- Kills o Tiempo }, -- 10..11. Filas de la lista (Padding Vertical y Separación) Rows = { StartY = 86, -- Coordenada Y relativa a la ventana para puesto 1 GapY = 19 -- Separación vertical entre puestos } } -- [CONFIGURACIÓN CALIBRADA DE LA VENTANA PRINCIPAL DE CLANES] local CALIBRACION = { Winner_Guild_X = 77, Winner_Time_X = 170, Winner_Y = 65, List_Guild_X = 78, List_Time_X = 171, List_Start_Y = 106, List_Gap_Y = 27, Footer_X = 84, Footer_Y = 229, Bar_Offset_X = -5, Bar_Offset_Y = -4 } local Keys = { LButton = 1, Escape = 27, F5 = 116 } -- SIGLAS OFICIALES DE CLASES (EN TEXTO) local CLASS_ACRONYMS = { [0] = "SM", [1] = "BK", [2] = "ME", [3] = "MG", [4] = "DL", [5] = "BS", [6] = "RF" } local function GetClassSigla(clase) return CLASS_ACRONYMS[tonumber(clase)] or "SM" end local ReyData = { Ocupado = false, Clase = 0, Nombre = "", Guild = "", SegundosRestantes = 0, EventActive = false, TimerTick = 0 } local WinEvento = { ID_Fondo = 60000, ID_Close = 60002, Visible = false, Dragging = false, X = 0, Y = 100, W = 128, H = 128, OffX = 0, OffY = 0, Initialized = false, Btn = { W = 14, H = 14, OffX = 103, OffY = 2 } } local WinResultados = { ID_Fondo_Spn = 60001, ID_Fondo_Eng = 60003, ID_Fondo_Por = 60004, ID_Barra = 60008, Visible = false, Dragging = false, W = 256, H = 256, X = 0, Y = 0, OffX = 0, OffY = 0, Ranking = {}, ProximoEvento = "", Barra = { W = 140, H = 18 } } -- VENTANA TOP 10 ASESINOS local WinKills = { Visible = false, Dragging = false, OffX = 0, OffY = 0, Ranking = {} } -- VENTANA TOP 10 REYES local WinReyes = { Visible = false, Dragging = false, OffX = 0, OffY = 0, Ranking = {} } local CloseButton = { ID_Imagen = 60002, X = 230, Y = 0, W = 24, H = 24 } local IMG_CLASES = { [0]=50000, [1]=50001, [2]=50002, [3]=50003, [4]=50004, [5]=50005, [6]=50006 } local IMG_LIBRE = 50010 local Textos_Ventana = { Titulo = { ["Spn"]="REY DEL MU", ["Eng"]="KING OF MU", ["Por"]="REI DO MU" }, Rey = { ["Spn"]="Rey:", ["Eng"]="King:", ["Por"]="Rei:" }, Nombre = { ["Spn"]="Nombre:", ["Eng"]="Name:", ["Por"]="Nome:" }, Guild = { ["Spn"]="Guild:", ["Eng"]="Guild:", ["Por"]="Guild:" }, Tiempo = { ["Spn"]="Tiempo:", ["Eng"]="Time:", ["Por"]="Tempo:" }, Libre = { ["Spn"]="DISPONIBLE", ["Eng"]="AVAILABLE", ["Por"]="DISPONIVEL" }, MVP = { ["Spn"]="MEJOR JUGADOR", ["Eng"]="MOST VALUABLE", ["Por"]="MELHOR JOGADOR" } } local Textos_Multi = { ProximoEvento = { ["Spn"] = "Próximo Evento:", ["Eng"] = "Next Event:", ["Por"] = "Próximo Evento:" } } local function SafeDisableClick() if DisableClickClient then DisableClickClient() elseif DisableCLick then DisableCLick() end end local function SafeGetLang() local l = (GetLanguage and GetLanguage()) or "Spn" if l ~= "Spn" and l ~= "Eng" and l ~= "Por" then return "Spn" end return l end function RecuperarTexto(PacketName, Inicio, Largo) local Txt = "" for i = 0, Largo - 1 do local C = GetBytePacket(PacketName, Inicio + i) if C and C > 0 then Txt = Txt .. string.char(C) end end return Txt end function IsMouseIn(x, y, w, h) local mx = MousePosX() local my = MousePosY() return (mx >= x and mx <= x + w and my >= y and my <= y + h) end function FormatearSegundos(s) s = tonumber(s) or 0 if s < 0 then s = 0 end local h = math.floor(s / 3600) local m = math.floor((s % 3600) / 60) local sec = s % 60 return string.format("%02d:%02d:%02d", h, m, sec) end local function SafeRenderText(x, y, txt, w, sort) if _G.RenderText3 then _G.RenderText3(x, y, txt or "", w or 0, sort or 0) elseif _G.RenderText5 then _G.RenderText5(x, y, txt or "", w or 0, sort or 0) elseif _G.RenderText then _G.RenderText(x, y, txt or "", w or 0, sort or 0) end end function InitCoords() if not WinEvento.Initialized then local AnchoPantalla = GetWideX() local AltoPantalla = 480 WinEvento.X = AnchoPantalla - 150 WinResultados.X = (AnchoPantalla - WinResultados.W) / 2 WinResultados.Y = (AltoPantalla - WinResultados.H) / 2 - 20 if WinResultados.Y < 50 then WinResultados.Y = 100 end WinEvento.Initialized = true ReyData.TimerTick = os.clock() end end function ReyInterface_TimerUpdate() if not ReyData.EventActive then return end local now = os.clock() if (now - ReyData.TimerTick) >= 1.0 then ReyData.SegundosRestantes = ReyData.SegundosRestantes - 1 if ReyData.SegundosRestantes < 0 then ReyData.SegundosRestantes = 0 end ReyData.TimerTick = now end end -- ============================================================================= -- GESTION DE ESTADO MODAL Y FOCO DEL MOTOR -- ============================================================================= function SetWindowState(isOpen) WinResultados.Visible = isOpen WinResultados.Dragging = false WinKills.Visible = false WinKills.Dragging = false WinReyes.Visible = false WinReyes.Dragging = false if isOpen then UICustomInterface = ReyConfig.WindowID else if UICustomInterface == ReyConfig.WindowID or UICustomInterface == ReyConfig.WindowID_Kills or UICustomInterface == ReyConfig.WindowID_Reyes then UICustomInterface = 0 end end end function OpenWinKills() WinResultados.Visible = false WinResultados.Dragging = false WinReyes.Visible = false WinReyes.Dragging = false WinKills.Visible = true UICustomInterface = ReyConfig.WindowID_Kills end function OpenWinReyes() WinResultados.Visible = false WinResultados.Dragging = false WinKills.Visible = false WinKills.Dragging = false WinReyes.Visible = true UICustomInterface = ReyConfig.WindowID_Reyes end function CloseSubWindow() WinKills.Visible = false WinKills.Dragging = false WinReyes.Visible = false WinReyes.Dragging = false WinResultados.Visible = true UICustomInterface = ReyConfig.WindowID end -- ============================================================================= -- RENDERIZADO PRINCIPAL -- ============================================================================= local function ReyInterface_Draw_Internal() InitCoords() if GetMainScene() ~= 5 then _G.ReyDelMu_Active = false if WinResultados.Visible or WinKills.Visible or WinReyes.Visible then SetWindowState(false) end return end _G.ReyDelMu_Active = (ReyData.EventActive == true) ReyInterface_TimerUpdate() local lang = SafeGetLang() local AnchoPantalla = GetWideX() -- Limpieza inicial del pipeline gráfico DisableAlphaBlend() SetBlend(1) glColor4f(1.0, 1.0, 1.0, 1.0) -- 1. HUD PEQUEÑO DE ENTRADA if WinEvento.Visible then RenderImage(WinEvento.ID_Fondo, WinEvento.X, WinEvento.Y, WinEvento.W, WinEvento.H) local btn = WinEvento.Btn local cx, cy = WinEvento.X + btn.OffX, WinEvento.Y + btn.OffY local cv = 0.0; if IsMouseIn(cx, cy, btn.W, btn.H) then cv = 0.5 end RenderImage2(WinEvento.ID_Close, cx, cy, btn.W, btn.H, 0.0, cv, 1.0, 0.5, 1, 1, 1.0) SetFontType(1); SetTextBg(0,0,0,0); SetTextColor(255,200,100,255) local txtTitulo = Textos_Ventana.Titulo[lang] or Textos_Ventana.Titulo["Eng"] SafeRenderText(WinEvento.X+30, WinEvento.Y+6, txtTitulo, 70, 3) local IDFace = IMG_LIBRE if ReyData.Ocupado then IDFace = IMG_CLASES[ReyData.Clase] or IMG_LIBRE end RenderImage2(IDFace, WinEvento.X+45, WinEvento.Y+21, 40, 40, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) SetTextColor(200,200,200,255) SafeRenderText(WinEvento.X+18, WinEvento.Y+65, Textos_Ventana.Rey[lang], 40, 0) SafeRenderText(WinEvento.X+18, WinEvento.Y+84, Textos_Ventana.Guild[lang], 40, 0) SafeRenderText(WinEvento.X+18, WinEvento.Y+101, Textos_Ventana.Tiempo[lang], 40, 0) local ValX = WinEvento.X+62 if ReyData.Ocupado then SetTextColor(255,215,0,255); SafeRenderText(ValX, WinEvento.Y+65, ReyData.Nombre, 60, 0) SetTextColor(100,255,100,255); SafeRenderText(ValX, WinEvento.Y+84, ReyData.Guild, 60, 0) else SetTextColor(50,255,50,255); SafeRenderText(ValX, WinEvento.Y+65, Textos_Ventana.Libre[lang], 60, 0) SafeRenderText(ValX, WinEvento.Y+84, Textos_Ventana.Libre[lang], 60, 0) end SetTextColor(200,200,200,255) SafeRenderText(ValX, WinEvento.Y+101, FormatearSegundos(ReyData.SegundosRestantes), 60, 0) end -- 2. VENTANA PRINCIPAL DE RESULTADOS (CLANES) if WinResultados.Visible then if UICustomInterface ~= ReyConfig.WindowID then UICustomInterface = ReyConfig.WindowID end local fondo_id = WinResultados.ID_Fondo_Eng if lang == "Spn" then fondo_id = WinResultados.ID_Fondo_Spn elseif lang == "Por" then fondo_id = WinResultados.ID_Fondo_Por end RenderImage(fondo_id, WinResultados.X, WinResultados.Y, WinResultados.W, WinResultados.H) -- Botón Cerrar [X] de la ventana principal local bx, by = WinResultados.X + CloseButton.X, WinResultados.Y + CloseButton.Y local bv = 0.0; if IsMouseIn(bx, by, CloseButton.W, CloseButton.H) then bv = 0.5 end RenderImage2(CloseButton.ID_Imagen, bx, by, CloseButton.W, CloseButton.H, 0.0, bv, 1.0, 0.5, 1, 1, 1.0) -- BOTÓN CALAVERA (TOP KILLS) EN ESQUINA INFERIOR IZQUIERDA local bk = CalibRey.BtnKill local kX = WinResultados.X + bk.OffX local kY = WinResultados.Y + bk.OffY if IsMouseIn(kX, kY, bk.W, bk.H) then local isClick = (CheckPressedKey(Keys.LButton) == 1) local kImg = isClick and ID_BtnKill_Click or ID_BtnKill_Hover RenderImage2(kImg, kX, kY, bk.W, bk.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) end -- BOTÓN CORONA (TOP REYES) EN ESQUINA INFERIOR DERECHA local br = CalibRey.BtnRey local rX = WinResultados.X + br.OffX local rY = WinResultados.Y + br.OffY if IsMouseIn(rX, rY, br.W, br.H) then local isClick = (CheckPressedKey(Keys.LButton) == 1) local rImg = isClick and ID_BtnRey_Click or ID_BtnRey_Hover RenderImage2(rImg, rX, rY, br.W, br.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) end -- Ranking Top 5 de Clanes local TooltipData = nil for i = 1, #WinResultados.Ranking do if i > 5 then break end local data = WinResultados.Ranking[i] local CurrentY, CurrentGuildX, CurrentTimeX if i == 1 then CurrentY = WinResultados.Y + CALIBRACION.Winner_Y CurrentGuildX = WinResultados.X + CALIBRACION.Winner_Guild_X CurrentTimeX = WinResultados.X + CALIBRACION.Winner_Time_X else CurrentY = WinResultados.Y + CALIBRACION.List_Start_Y + ((i - 2) * CALIBRACION.List_Gap_Y) CurrentGuildX = WinResultados.X + CALIBRACION.List_Guild_X CurrentTimeX = WinResultados.X + CALIBRACION.List_Time_X end local BarX = CurrentGuildX + CALIBRACION.Bar_Offset_X local BarY = CurrentY + CALIBRACION.Bar_Offset_Y RenderImage2(WinResultados.ID_Barra, BarX, BarY, WinResultados.Barra.W, WinResultados.Barra.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) if IsMouseIn(BarX, BarY, WinResultados.Barra.W, WinResultados.Barra.H) then TooltipData = data end if i == 1 then SetFontType(2); SetTextColor(255,215,0,255) else SetFontType(1); SetTextColor(200,200,200,255) end SetTextBg(0,0,0,0) SafeRenderText(math.floor(CurrentGuildX), math.floor(CurrentY), i..". "..(data.guild or ""), 0, 0) if i == 1 then SetTextColor(255,215,0,255) else SetTextColor(200,200,200,255) end SafeRenderText(math.floor(CurrentTimeX), math.floor(CurrentY), FormatearSegundos(data.tiempo), 0, 0) end local txtP = (Textos_Multi.ProximoEvento[lang] or Textos_Multi.ProximoEvento["Eng"]) .. " " .. (WinResultados.ProximoEvento or "") .. " Hs." SetFontType(1); SetTextColor(150,200,255,255) SafeRenderText(math.floor(WinResultados.X + CALIBRACION.Footer_X), math.floor(WinResultados.Y + CALIBRACION.Footer_Y), txtP, 0, 0) -- Tooltip Flotante del MVP if TooltipData and TooltipData.mvp_nombre and TooltipData.mvp_nombre ~= "" then local TtipX = MousePosX() + 15 local TtipY = MousePosY() + 15 RenderImage(WinEvento.ID_Fondo, TtipX, TtipY, 128, 128) SetFontType(1); SetTextBg(0,0,0,0); SetTextColor(255,200,100,255) SafeRenderText(TtipX+20, TtipY+6, Textos_Ventana.MVP[lang], 90, 3) local IDFace = IMG_CLASES[TooltipData.mvp_clase] or IMG_LIBRE RenderImage2(IDFace, TtipX+45, TtipY+21, 40, 40, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) SetTextColor(200,200,200,255) SafeRenderText(TtipX+18, TtipY+65, Textos_Ventana.Nombre[lang], 40, 1) SafeRenderText(TtipX+18, TtipY+84, Textos_Ventana.Guild[lang], 40, 1) SafeRenderText(TtipX+18, TtipY+101, Textos_Ventana.Tiempo[lang], 40, 1) local ValX = TtipX+62 SetTextColor(255,215,0,255); SafeRenderText(ValX, TtipY+65, TooltipData.mvp_nombre, 60, 1) SetTextColor(100,255,100,255); SafeRenderText(ValX, TtipY+84, TooltipData.guild, 60, 1) SetTextColor(200,200,200,255); SafeRenderText(ValX, TtipY+101, FormatearSegundos(TooltipData.mvp_tiempo), 60, 1) end end -- 3. VENTANA MODAL TOP 10 DE ASESINOS if WinKills.Visible then if UICustomInterface ~= ReyConfig.WindowID_Kills then UICustomInterface = ReyConfig.WindowID_Kills end local cfg = CalibRey.WinKills local wX = (cfg.X and cfg.X >= 0) and cfg.X or math.floor((AnchoPantalla - cfg.W) / 2) local wY = cfg.Y RenderImage2(ID_TopKills_Fondo, wX, wY, cfg.W, cfg.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) -- Botón Cerrar [X] local cb = CalibRey.TopCloseBtn local cx = wX + cb.OffX local cy = wY + cb.OffY if IsMouseIn(cx, cy, cb.W, cb.H) then local isClick = (CheckPressedKey(Keys.LButton) == 1) local cImg = isClick and ID_Close_Click or ID_Close_Hover RenderImage2(cImg, cx, cy, cb.W, cb.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) end local lista = WinKills.Ranking SetFontType(1) SetTextBg(0, 0, 0, 0) for i = 1, 10 do local d = lista[i] if d then local rowY = wY + CalibRey.Rows.StartY + ((i - 1) * CalibRey.Rows.GapY) if i == 1 then SetTextColor(255, 215, 0, 255) elseif i == 2 then SetTextColor(220, 220, 240, 255) elseif i == 3 then SetTextColor(205, 140, 90, 255) else SetTextColor(200, 200, 200, 255) end SafeRenderText(wX + CalibRey.Cols.ClaseX, rowY, GetClassSigla(d.class), 35, 1) SafeRenderText(wX + CalibRey.Cols.NombreX, rowY, tostring(d.nombre or ""), 75, 1) SafeRenderText(wX + CalibRey.Cols.GuildX, rowY, tostring(d.guild or "NoGuild"), 75, 1) if i <= 3 then SetTextColor(255, 100, 100, 255) else SetTextColor(220, 180, 180, 255) end SafeRenderText(wX + CalibRey.Cols.ValorX, rowY, tostring(d.kills or 0), 45, 1) end end end -- 4. VENTANA MODAL TOP 10 DE REYES (TIEMPO EN TRONO) if WinReyes.Visible then if UICustomInterface ~= ReyConfig.WindowID_Reyes then UICustomInterface = ReyConfig.WindowID_Reyes end local cfg = CalibRey.WinReyes local wX = (cfg.X and cfg.X >= 0) and cfg.X or math.floor((AnchoPantalla - cfg.W) / 2) local wY = cfg.Y RenderImage2(ID_TopRey_Fondo, wX, wY, cfg.W, cfg.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) -- Botón Cerrar [X] local cb = CalibRey.TopCloseBtn local cx = wX + cb.OffX local cy = wY + cb.OffY if IsMouseIn(cx, cy, cb.W, cb.H) then local isClick = (CheckPressedKey(Keys.LButton) == 1) local cImg = isClick and ID_Close_Click or ID_Close_Hover RenderImage2(cImg, cx, cy, cb.W, cb.H, 0.0, 0.0, 1.0, 1.0, 1, 1, 1.0) end local lista = WinReyes.Ranking SetFontType(1) SetTextBg(0, 0, 0, 0) for i = 1, 10 do local d = lista[i] if d then local rowY = wY + CalibRey.Rows.StartY + ((i - 1) * CalibRey.Rows.GapY) if i == 1 then SetTextColor(255, 215, 0, 255) elseif i == 2 then SetTextColor(220, 220, 240, 255) elseif i == 3 then SetTextColor(205, 140, 90, 255) else SetTextColor(200, 200, 200, 255) end SafeRenderText(wX + CalibRey.Cols.ClaseX, rowY, GetClassSigla(d.class), 35, 1) SafeRenderText(wX + CalibRey.Cols.NombreX, rowY, tostring(d.nombre or ""), 75, 1) SafeRenderText(wX + CalibRey.Cols.GuildX, rowY, tostring(d.guild or "NoGuild"), 75, 1) if i <= 3 then SetTextColor(255, 215, 100, 255) else SetTextColor(200, 200, 200, 255) end SafeRenderText(wX + CalibRey.Cols.ValorX, rowY, FormatearSegundos(d.tiempo or 0), 65, 1) end end end -- Si ninguna de las 3 ventanas está abierta, liberamos nuestro UICustomInterface if not WinResultados.Visible and not WinKills.Visible and not WinReyes.Visible then if UICustomInterface == ReyConfig.WindowID or UICustomInterface == ReyConfig.WindowID_Kills or UICustomInterface == ReyConfig.WindowID_Reyes then UICustomInterface = 0 end end -- Limpieza final (Buffer Flush) SetBlend(0) DisableAlphaBlend() glColor4f(1.0, 1.0, 1.0, 1.0) SetTextColor(255, 255, 255, 255) end function ReyInterface_Draw() local ok = pcall(ReyInterface_Draw_Internal) if not ok then SetBlend(0) DisableAlphaBlend() glColor4f(1.0, 1.0, 1.0, 1.0) SetTextColor(255, 255, 255, 255) end end -- ============================================================================= -- GESTION DE INPUTS (MOUSE Y TECLADO) -- ============================================================================= function ReyInterface_UpdateMouse() InitCoords() if GetMainScene() ~= 5 then return end local AnchoPantalla = GetWideX() -- 1. CLICK EN VENTANA TOP 10 DE ASESINOS if WinKills.Visible then local cfg = CalibRey.WinKills local wX = (cfg.X and cfg.X >= 0) and cfg.X or math.floor((AnchoPantalla - cfg.W) / 2) local wY = cfg.Y if IsMouseIn(wX, wY, cfg.W, cfg.H) then SafeDisableClick() end if CheckPressedKey(Keys.LButton) == 1 then local cb = CalibRey.TopCloseBtn local cx = wX + cb.OffX local cy = wY + cb.OffY if IsMouseIn(cx, cy, cb.W, cb.H) then CloseSubWindow() SafeDisableClick() return end if IsMouseIn(wX, wY, cfg.W, 40) then WinKills.Dragging = true WinKills.OffX = MousePosX() - wX WinKills.OffY = MousePosY() - wY end end if CheckReleasedKey(Keys.LButton) == 1 then WinKills.Dragging = false end if WinKills.Dragging then cfg.X = MousePosX() - WinKills.OffX cfg.Y = MousePosY() - WinKills.OffY end return end -- 2. CLICK EN VENTANA TOP 10 DE REYES if WinReyes.Visible then local cfg = CalibRey.WinReyes local wX = (cfg.X and cfg.X >= 0) and cfg.X or math.floor((AnchoPantalla - cfg.W) / 2) local wY = cfg.Y if IsMouseIn(wX, wY, cfg.W, cfg.H) then SafeDisableClick() end if CheckPressedKey(Keys.LButton) == 1 then local cb = CalibRey.TopCloseBtn local cx = wX + cb.OffX local cy = wY + cb.OffY if IsMouseIn(cx, cy, cb.W, cb.H) then CloseSubWindow() SafeDisableClick() return end if IsMouseIn(wX, wY, cfg.W, 40) then WinReyes.Dragging = true WinReyes.OffX = MousePosX() - wX WinReyes.OffY = MousePosY() - wY end end if CheckReleasedKey(Keys.LButton) == 1 then WinReyes.Dragging = false end if WinReyes.Dragging then cfg.X = MousePosX() - WinReyes.OffX cfg.Y = MousePosY() - WinReyes.OffY end return end -- 3. CLICK EN VENTANA PRINCIPAL DE RESULTADOS (CLANES) if WinResultados.Visible then if IsMouseIn(WinResultados.X, WinResultados.Y, WinResultados.W, WinResultados.H) then SafeDisableClick() end if CheckPressedKey(Keys.LButton) == 1 then local btn_x = WinResultados.X + CloseButton.X local btn_y = WinResultados.Y + CloseButton.Y if IsMouseIn(btn_x, btn_y, CloseButton.W, CloseButton.H) then SetWindowState(false) SafeDisableClick() return end -- Click en Botón Calavera -> Abre Top 10 Asesinos local bk = CalibRey.BtnKill local kX = WinResultados.X + bk.OffX local kY = WinResultados.Y + bk.OffY if IsMouseIn(kX, kY, bk.W, bk.H) then OpenWinKills() SafeDisableClick() return end -- Click en Botón Corona -> Abre Top 10 Reyes local br = CalibRey.BtnRey local rX = WinResultados.X + br.OffX local rY = WinResultados.Y + br.OffY if IsMouseIn(rX, rY, br.W, br.H) then OpenWinReyes() SafeDisableClick() return end if IsMouseIn(WinResultados.X, WinResultados.Y, WinResultados.W, 40) then WinResultados.Dragging = true WinResultados.OffX = MousePosX() - WinResultados.X WinResultados.OffY = MousePosY() - WinResultados.Y end end if CheckReleasedKey(Keys.LButton) == 1 then WinResultados.Dragging = false end if WinResultados.Dragging then WinResultados.X = MousePosX() - WinResultados.OffX WinResultados.Y = MousePosY() - WinResultados.OffY end end -- 4. CLICK EN HUD PEQUEÑO DE ESTADO if not WinEvento.Visible then return end if IsMouseIn(WinEvento.X, WinEvento.Y, WinEvento.W, WinEvento.H) then SafeDisableClick() end if CheckPressedKey(Keys.LButton) == 1 then local btn = WinEvento.Btn local cx, cy = WinEvento.X + btn.OffX, WinEvento.Y + btn.OffY if IsMouseIn(cx, cy, btn.W, btn.H) then WinEvento.Visible = false; WinEvento.Dragging = false; return end if IsMouseIn(WinEvento.X, WinEvento.Y, WinEvento.W, 25) then WinEvento.Dragging = true; WinEvento.OffX = MousePosX() - WinEvento.X; WinEvento.OffY = MousePosY() - WinEvento.Y end end if CheckReleasedKey(Keys.LButton) == 1 then WinEvento.Dragging = false end if WinEvento.Dragging then WinEvento.X = MousePosX() - WinEvento.OffX; WinEvento.Y = MousePosY() - WinEvento.OffY end end function ReyInterface_UpdateKey() if GetMainScene() ~= 5 then return end if WinKills.Visible or WinReyes.Visible then if CheckPressedKey(Keys.Escape) == 1 then CloseSubWindow() SafeDisableClick() return end elseif WinResultados.Visible then if CheckPressedKey(Keys.Escape) == 1 then SetWindowState(false) SafeDisableClick() return end end end function ReyInterface_KeyListener(key) if GetMainScene() ~= 5 then return false end if UIChatWindow and CheckWindowOpen(UIChatWindow) == 1 then return false end if key == Keys.F5 and ReyData.EventActive then WinEvento.Visible = not WinEvento.Visible return true end return false end -- ============================================================================= -- PROTOCOLO DE RED ("ReyUpdate", PacketID = 254) - LEY #6 CERO CLEARPACKET -- ============================================================================= function ReyInterface_Protocol(Packet, PacketName) if PacketName == "ReyUpdate" then local shift = 0 local SubComando = GetBytePacket(PacketName, 0) if SubComando == Packet then SubComando = GetBytePacket(PacketName, 1) shift = 1 end -- Dejar pasar SubComando 5 para ReyClient_Crowns.lua if SubComando == SUB_CORONA_SYNC then return false end -- SUB_SYNC (1) if SubComando == SUB_SYNC then ReyData.EventActive = true _G.ReyDelMu_Active = true WinEvento.Visible = true SetWindowState(false) ReyData.SegundosRestantes = GetDwordPacket(PacketName, 1 + shift) ReyData.TimerTick = os.clock() if GetBytePacket(PacketName, 5 + shift) == 1 then ReyData.Ocupado = true ReyData.Clase = GetBytePacket(PacketName, 6 + shift) ReyData.Nombre = RecuperarTexto(PacketName, 7 + shift, 10) ReyData.Guild = RecuperarTexto(PacketName, 17 + shift, 8) else ReyData.Ocupado = false end -- SUB_TRONO_TOMADO (2) elseif SubComando == SUB_TRONO_TOMADO then if not ReyData.EventActive then return true end ReyData.Ocupado = true ReyData.Clase = GetBytePacket(PacketName, 1 + shift) ReyData.Nombre = RecuperarTexto(PacketName, 2 + shift, 10) ReyData.Guild = RecuperarTexto(PacketName, 12 + shift, 8) -- SUB_TRONO_LIBRE (3) elseif SubComando == SUB_TRONO_LIBRE then if not ReyData.EventActive then return true end ReyData.Ocupado = false -- SUB_RESULTADOS (4) - TOP 5 CLANES elseif SubComando == SUB_RESULTADOS then ReyData.EventActive = false _G.ReyDelMu_Active = false ReyData.Ocupado = false WinEvento.Visible = false WinResultados.ProximoEvento = RecuperarTexto(PacketName, 1 + shift, 16) local numResultados = GetBytePacket(PacketName, 17 + shift) or 0 if numResultados > 10 then numResultados = 10 end WinResultados.Ranking = {} local offset = 18 + shift for i = 1, numResultados do local g = RecuperarTexto(PacketName, offset, 8); offset = offset + 8 local t = GetDwordPacket(PacketName, offset); offset = offset + 4 local mn = RecuperarTexto(PacketName, offset, 10); offset = offset + 10 local mc = GetBytePacket(PacketName, offset); offset = offset + 1 local mt = GetDwordPacket(PacketName, offset); offset = offset + 4 WinResultados.Ranking[i] = { guild = g, tiempo = t, mvp_nombre = mn, mvp_clase = mc, mvp_tiempo = mt } end SetWindowState(true) -- SUB_RESULTADOS_KILLS (6) - TOP 10 ASESINOS elseif SubComando == SUB_RESULTADOS_KILLS then local numResultados = GetBytePacket(PacketName, 1 + shift) or 0 if numResultados > 10 then numResultados = 10 end WinKills.Ranking = {} local offset = 2 + shift for i = 1, numResultados do local n = RecuperarTexto(PacketName, offset, 10); offset = offset + 10 local g = RecuperarTexto(PacketName, offset, 8); offset = offset + 8 local c = GetBytePacket(PacketName, offset); offset = offset + 1 local kl = GetDwordPacket(PacketName, offset); offset = offset + 4 WinKills.Ranking[i] = { nombre = n, guild = g, class = c, kills = kl } end -- SUB_RESULTADOS_REYES (7) - TOP 10 REYES elseif SubComando == SUB_RESULTADOS_REYES then local numResultados = GetBytePacket(PacketName, 1 + shift) or 0 if numResultados > 10 then numResultados = 10 end WinReyes.Ranking = {} local offset = 2 + shift for i = 1, numResultados do local n = RecuperarTexto(PacketName, offset, 10); offset = offset + 10 local g = RecuperarTexto(PacketName, offset, 8); offset = offset + 8 local c = GetBytePacket(PacketName, offset); offset = offset + 1 local t = GetDwordPacket(PacketName, offset); offset = offset + 4 WinReyes.Ranking[i] = { nombre = n, guild = g, class = c, tiempo = t } end end return true end return false end -- ============================================================================= -- REGISTRO DE BRIDGES INDUSTRIAL -- ============================================================================= if _G.ReyInterface_Init == nil then BridgeFunctionAttach('MainProcThread', 'ReyInterface_Draw') BridgeFunctionAttach('UpdateMouseEvent', 'ReyInterface_UpdateMouse') BridgeFunctionAttach('UpdateKeyEvent', 'ReyInterface_UpdateKey') BridgeFunctionAttach('KeyboardEvent', 'ReyInterface_KeyListener') if ProtocolFunctions ~= nil and ProtocolFunctions.ClientProtocol ~= nil then ProtocolFunctions.ClientProtocol(ReyInterface_Protocol) else BridgeFunctionAttach('ClientProtocol', 'ReyInterface_Protocol') end _G.ReyInterface_Init = true end