MessageSettings = { none = {}, consoleYellow = { color = TextColors.yellow, consoleTab = 'Local Chat' }, consoleRed = { color = TextColors.red, consoleTab = 'Local Chat' }, consoleOrange = { color = TextColors.orange, consoleTab = 'Local Chat' }, consoleBlue = { color = TextColors.blue, consoleTab = 'Local Chat' }, centerRed = { color = TextColors.red, consoleTab = 'Server Log', screenTarget = 'lowCenterLabel' }, centerGreen = { color = TextColors.green, consoleTab = 'Server Log', screenTarget = 'highCenterLabel', consoleOption = 'showInfoMessagesInConsole' }, centerHKGreen = { color = TextColors.green, consoleTab = 'Server Log', screenTarget = 'highCenterLabel', consoleOption = 'showHotkeyMessagesInConsole' }, centerWhite = { color = TextColors.white, consoleTab = 'Server Log', screenTarget = 'middleCenterLabel', consoleOption = 'showEventMessagesInConsole' }, bottomWhite = { color = TextColors.white, consoleTab = 'Server Log', screenTarget = 'statusLabel', consoleOption = 'showEventMessagesInConsole' }, status = { color = TextColors.white, consoleTab = 'Server Log', screenTarget = 'statusLabel', consoleOption = 'showStatusMessagesInConsole' }, statusOwn = { color = TextColors.white, consoleTab = 'Server Log', consoleOption = 'showStatusMessagesInConsole' }, statusBoosted = { color = TextColors.white, consoleTab = 'Server Log', screenTarget = 'statusLabel', consoleOption = 'showBoostedMessagesInConsole' }, othersStatus = { color = TextColors.white, consoleTab = 'Server Log', consoleOption = 'showOthersStatusMessagesInConsole' }, statusSmall = { color = TextColors.white, screenTarget = 'statusLabel' }, private = { color = TextColors.lightblue, consoleTab = 'Local Chat', screenTarget = 'privateLabel' }, privateRed = { color = TextColors.red, consoleTab = 'Local Chat', private = true }, privatePlayerToPlayer = { color = TextColors.blue, consoleTab = 'Local Chat', private = true }, privatePlayerToNpc = { color = TextColors.blue, consoleTab = 'Local Chat', private = true, npcChat = true }, privateNpcToPlayer = { color = TextColors.lightblue, consoleTab = 'Local Chat', private = true, npcChat = true }, channelYellow = { color = TextColors.yellow }, channelWhite = { color = TextColors.white }, channelRed = { color = TextColors.red }, channelOrange = { color = TextColors.orange }, monsterSay = { color = TextColors.orange, hideInConsole = true }, monsterYell = { color = TextColors.orange, hideInConsole = true }, potion = { color = TextColors.orange, hideInConsole = true }, loot = { color = TextColors.white, consoleTab = 'Loot', screenTarget = 'highCenterLabel', consoleOption = 'showInfoMessagesInConsole', colored = true }, valuableLoot = { color = TextColors.white, consoleTab = 'Loot', screenTarget = 'statusLabel', consoleOption = 'showInfoMessagesInConsole', colored = true } } MessageTypes = { [MessageModes.Say] = MessageSettings.consoleYellow, [MessageModes.Whisper] = MessageSettings.consoleYellow, [MessageModes.Yell] = MessageSettings.consoleYellow, [MessageModes.MonsterSay] = MessageSettings.monsterSay, [MessageModes.MonsterYell] = MessageSettings.monsterYell, [MessageModes.BarkLow] = MessageSettings.consoleOrange, [MessageModes.BarkLoud] = MessageSettings.consoleOrange, [MessageModes.Failure] = MessageSettings.statusSmall, [MessageModes.Login] = MessageSettings.bottomWhite, [MessageModes.Game] = MessageSettings.centerWhite, [MessageModes.Status] = MessageSettings.status, [MessageModes.Warning] = MessageSettings.centerRed, [MessageModes.Look] = MessageSettings.centerGreen, [MessageModes.Loot] = MessageSettings.loot, [MessageModes.Red] = MessageSettings.consoleRed, [MessageModes.Blue] = MessageSettings.consoleBlue, [MessageModes.PrivateFrom] = MessageSettings.private, [MessageModes.PrivateTo] = MessageSettings.privatePlayerToPlayer, [MessageModes.GamemasterPrivateFrom] = MessageSettings.privateRed, [MessageModes.NpcTo] = MessageSettings.privatePlayerToNpc, [MessageModes.NpcFrom] = MessageSettings.privateNpcToPlayer, [MessageModes.NpcFromStartBlock] = MessageSettings.privateNpcToPlayer, [MessageModes.Channel] = MessageSettings.channelYellow, [MessageModes.ChannelManagement] = MessageSettings.channelWhite, [MessageModes.GamemasterChannel] = MessageSettings.channelRed, [MessageModes.ChannelHighlight] = MessageSettings.channelOrange, [MessageModes.Spell] = MessageSettings.consoleYellow, [MessageModes.RVRChannel] = MessageSettings.channelWhite, [MessageModes.RVRContinue] = MessageSettings.consoleYellow, [MessageModes.GamemasterBroadcast] = MessageSettings.consoleRed, [MessageModes.DamageDealed] = MessageSettings.statusOwn, [MessageModes.DamageReceived] = MessageSettings.statusOwn, [MessageModes.Heal] = MessageSettings.statusOwn, [MessageModes.Exp] = MessageSettings.statusOwn, [MessageModes.DamageOthers] = MessageSettings.othersStatus, [MessageModes.HealOthers] = MessageSettings.othersStatus, [MessageModes.ExpOthers] = MessageSettings.othersStatus, [MessageModes.Potion] = MessageSettings.potion, [MessageModes.TradeNpc] = MessageSettings.centerGreen, [MessageModes.Guild] = MessageSettings.statusOwn, [MessageModes.Party] = MessageSettings.statusOwn, [MessageModes.PartyManagement] = MessageSettings.centerGreen, [MessageModes.TutorialHint] = MessageSettings.statusSmall, [MessageModes.BeyondLast] = MessageSettings.centerWhite, [MessageModes.Report] = MessageSettings.centerWhite, [MessageModes.GameHighlight] = MessageSettings.centerRed, [MessageModes.HotkeyUse] = MessageSettings.centerGreen, [MessageModes.Attention] = MessageSettings.bottomWhite, [MessageModes.BoostedCreature] = MessageSettings.centerWhite, [MessageModes.OfflineTrainning] = MessageSettings.centerWhite, [MessageModes.Transaction] = MessageSettings.centerWhite, [MessageModes.ValuableLoot] = MessageSettings.valuableLoot, [254] = MessageSettings.private } messagesPanel = nil avisosPanel = nil function init() for messageMode, _ in pairs(MessageTypes) do registerMessageMode(messageMode, displayMessage) end connect(g_game, 'onGameEnd', clearMessages) g_ui.importStyle('textmessage') messagesPanel = g_ui.createWidget('UIWidget', modules.game_interface.getRootPanel()) messagesPanel:setId('avisosPanel') messagesPanel:fill('parent') messagesPanel:setPhantom(true) messagesPanel:setFocusable(false) avisosPanel = messagesPanel end function terminate() for messageMode, _ in pairs(MessageTypes) do unregisterMessageMode(messageMode, displayMessage) end disconnect(g_game, 'onGameEnd', clearMessages) clearMessages() messagesPanel:destroy() messagesPanel = nil avisosPanel = nil end function calculateVisibleTime(text) return math.max(#text * 50, 4000) end -- OT-MMO: Canary escribe sus mensajes en inglés. Se traducen aquí al recibirlos (patrón Lua -> texto), -- así no hay que tocar ni recompilar el servidor. El primero que coincide gana. -- ponytail: lista a mano de los mensajes que de verdad salen en el juego; se amplía cuando aparezca otro. local TRADUCCIONES = { { "^You have joined (.-)'s? party%. Open the party channel to communicate with your companions%.$", "Te uniste al grupo de %1. Abre el canal del grupo para hablar con tus compañeros." }, { "^(.-) has invited you to %a+ party %(Share range: (.-)%)%.$", "%1 te invitó a su grupo (experiencia compartida: %2)." }, { "^(.-) has invited you to %a+ party%.$", "%1 te invitó a su grupo." }, { "^(.-) has been invited to join the party.*$", "%1 fue invitado al grupo." }, { "^(.-) has been invited%..*$", "%1 fue invitado al grupo." }, { "^(.-) has joined the party%.$", "%1 se unió al grupo." }, { "^(.-) has left the party%.$", "%1 dejó el grupo." }, { "^You have left the party%.$", "Dejaste el grupo." }, { "^You are now the leader of the party%.$", "Ahora lideras el grupo." }, { "^(.-) is now the leader of the party%.$", "%1 ahora lidera el grupo." }, { "^Your party has been disbanded%.$", "El grupo se disolvió." }, { "^(.-) has revoked %a+ invitation%.$", "%1 retiró la invitación." }, { "^Target lost%.$", "Objetivo perdido." }, { "^You are exhausted%.$", "Estás agotado." }, { "^Sorry, not possible%.$", "No es posible." }, { "^Paid (%d+) gold from inventory%.$", "Pagas %1 de oro." }, { "^Paid (.-) from inventory and (.-) gold from bank account%..*$", "Pagas %1 de oro de la mochila y %2 del banco." }, { "^You do not have enough mana%.$", "No tienes suficiente maná." }, { "^There is not enough room%.$", "No hay espacio suficiente." }, { "^You are dead%.$", "Has muerto." }, { "^You may not logout during or immediately after a fight!$", "No puedes salir durante un combate o justo después." }, { "^You may not logout during a fight%.$", "No puedes salir durante un combate." }, { "^You advanced from Level (%d+) to Level (%d+)%.$", "Subiste del nivel %1 al nivel %2." }, { "^You were downgraded from Level (%d+) to Level (%d+)%.$", "Bajaste del nivel %1 al nivel %2." }, { "^You advanced to magic level (%d+)%.$", "Tu nivel mágico sube a %1." }, { "^You advanced to (.-) level (%d+)%.$", "Tu habilidad (%1) sube al nivel %2." }, { "^You lose (%d+) hitpoints? due to an attack by (.-)%.$", "Pierdes %1 de vida por un ataque de %2." }, { "^You lose (%d+) hitpoints?%.$", "Pierdes %1 de vida." }, { "^You lose (%d+) mana due to an attack by (.-)%.$", "Pierdes %1 de maná por un ataque de %2." }, { "^You lose (%d+) mana%.$", "Pierdes %1 de maná." }, { "^(.-) loses (%d+) hitpoints? due to your attack%.$", "%1 pierde %2 de vida por tu ataque." }, { "^(.-) loses (%d+) hitpoints? due to an attack by (.-)%.$", "%1 pierde %2 de vida por un ataque de %3." }, { "^You heal yourself for (%d+) hitpoints?%.$", "Te curas %1 de vida." }, { "^You heal (.-) for (%d+) hitpoints?%.$", "Curas a %1: %2 de vida." }, { "^You were healed by (.-) for (%d+) hitpoints?%.$", "%1 te cura %2 de vida." }, { "^You were healed for (%d+) hitpoints?%.$", "Recuperas %1 de vida." }, { "^You gained (%d+) experience points?%.$", "Ganas %1 de experiencia." }, { "^Loot of el (.-): nothing%.?$", "Botín del %1: nada." }, { "^Loot of el (.-): (.*)$", "Botín del %1: %2" }, { "^Loot of (.-): nothing%.?$", "Botín de %1: nada." }, { "^Loot of (.-): (.*)$", "Botín de %1: %2" }, { "^You see yourself%.(.*)$", "Te ves a ti mismo.%1" }, { "^This object is too heavy for you to carry%.$", "Pesa demasiado para que lo cargues." }, { "^You cannot carry more%..*$", "No puedes cargar más." }, { "^A player with this name is not online%.$", "Ese jugador no está conectado." }, { "^This action is not permitted in a protection zone%.$", "No se puede hacer en una zona protegida." }, { "^You may not attack this person%.$", "No puedes atacar a esa persona." }, { "^You cannot use this object%.$", "No puedes usar esto." }, { "^It is locked%.$", "Está cerrada con llave." }, { "^You can only use it on creatures%.$", "Elige un objetivo primero." }, { "^You need to equip a weapon to use this spell%.$", "Necesitas un arma equipada." }, { "^Please choose your outfit%.$", "Elige el aspecto de tu personaje." }, { "^You cannot use objects that are in a protection zone%.$", "No puedes usar objetos en una zona protegida." }, { "^Too far away%.$", "Está demasiado lejos." }, { "^First go upstairs%.$", "Primero sube." }, { "^First go downstairs%.$", "Primero baja." }, { "^You cannot throw there%.$", "No puedes lanzarlo ahí." }, { "^You can not use this object%.$", "No puedes usar esto." }, { "^This is impossible%.$", "Es imposible." }, { "^You are not the owner%.$", "No eres el dueño." }, { "^You see (.*)$", "Ves %1" }, } -- Trozos que aparecen dentro de otros mensajes (p. ej. el peso al mirar un objeto): se cambian todos. local TROZOS = { { "It weighs (.-) oz%.", "Pesa %1 oz." }, { "They weigh (.-) oz%.", "Pesan %1 oz." }, { "\nClassification: %d+ Tier: %d+[^\n]*", "" }, -- clases y niveles de la Forja de Tibia: no existen en OT-MMO { "\nImbuements: %b()%.", "" }, -- tampoco los imbuements { "^Today's boosted boss: .-$", "" }, { "^Today's boosted creature: .-$", "" }, -- Monedas y materiales (botín, mirar): items.xml conserva los nombres de Tibia porque los monstruos de Canary -- buscan su botín por nombre. Primero el plural con cantidad, luego el singular con artículo. { "(%d+) gold coins", "%1 monedas de oro" }, { "%f[%a]an? gold coin%f[%A]", "una moneda de oro" }, { "(%d+) minotaur leathers", "%1 cueros" }, { "%f[%a]an? minotaur leather%f[%A]", "un cuero" }, { "(%d+) iron ores", "%1 minerales de hierro" }, { "%f[%a]an? iron ore%f[%A]", "un mineral de hierro" }, { "(%d+) pieces of iron", "%1 lingotes de hierro" }, { "%f[%a]an? piece of iron%f[%A]", "un lingote de hierro" }, { "(%d+) star herbs", "%1 hierbas estrella" }, { "%f[%a]an? star herb%f[%A]", "una hierba estrella" }, { "(%d+) wooden stakes", "%1 mangos" }, { "%f[%a]an? wooden stake%f[%A]", "un mango" }, { "(%d+) bones%f[%A]", "%1 huesos" }, { "%f[%a]an? bone%f[%A]", "un hueso" }, { "(%d+) meat%f[%A]", "%1 trozos de carne" }, { "%f[%a]meat%f[%A]", "un trozo de carne" }, { "(%d+) wood%f[%A]", "%1 trozos de madera" }, { "%f[%a]wood%f[%A]", "un trozo de madera" }, { "(%d+) white pieces of cloth", "%1 telas" }, { "%f[%a]an? white piece of cloth%f[%A]", "una tela" }, } function traducirServidor(text) if type(text) ~= 'string' then return text end for _, par in ipairs(TROZOS) do text = text:gsub(par[1], par[2]) end for _, par in ipairs(TRADUCCIONES) do local nuevo, n = text:gsub(par[1], par[2]) if n > 0 then return nuevo end end return text end -- Avisos en pantalla (OT-MMO) ------------------------------------------------------------------------------------------- -- Lo que OTClient pintaba en el centro del mapa (texto plano con contorno, tres alturas) va ahora a una pila de -- tarjetas pequeñas encima de las barras de vida y maná (widget «vitals»): no tapan al personaje ni se pisan. La más -- nueva abajo; como mucho MAX_VISIBLES; un aviso repetido no se duplica (cuenta «×2» y vuelve a empezar su tiempo). local IMG = '/game_textmessage/images/' local ANCHO_MAX = 440 -- px de texto antes de partir en dos líneas local ANCHO_MIN = 240 -- ancho mínimo de la columna local MAX_VISIBLES = 3 local HUECO = 4 -- entre tarjetas local SOBRE_BARRAS = 12 -- de la tarjeta de abajo al borde de arriba de las barras local ENTRA, SALE = 140, 380 -- ms de la aparición y de la desaparición (solo opacidad) -- tipo -> icono, color del icono, borde local TIPOS = { sistema = { 'sistema', '#C7A86B', '#39444C' }, error = { 'error', '#DC6B6B', '#7A3436' }, botin = { 'botin', '#C7A86B', '#6E5B37' }, mision = { 'mision', '#E8D3A2', '#A88B55' }, mirar = { 'mirar', '#9AA7AE', '#39444C' }, privado = { 'privado', '#7FB2E5', '#2F4F70' }, } local avisos = {} -- { widget, clave, ev, veces } de abajo arriba (1 = la más nueva) local function fundir(w, desde, hasta, ms, alFinal) local t0 = g_clock.millis() local function paso() if w:isDestroyed() then return end local t = math.min(1, (g_clock.millis() - t0) / ms) local e = 1 - (1 - t) ^ 3 -- ease-out w:setOpacity(desde + (hasta - desde) * e) if t < 1 then w.fundido = scheduleEvent(paso, 16) else w.fundido = nil if alFinal then alFinal() end end end if w.fundido then removeEvent(w.fundido) end paso() end -- Dónde va la pila: encima de las barras si se ven; si no, a esa altura sobre el borde de abajo del mapa. local function base() local raiz = modules.game_interface.getRootPanel() local r = modules.game_interface.getMapPanel():getRect() local vit = raiz:recursiveGetChildById('vitals') if vit and vit:isVisible() and vit:getHeight() > 0 then local v = vit:getRect() -- 31-oct: por encima también de lo que va pegado encima del bloque (franja del Gunslinger, tira del Bardo): -- antes la tarjeta de abajo quedaba tapada por la recámara local tope = v.y for _, w in ipairs(raiz:getChildren()) do if w ~= vit and w:isVisible() and w ~= avisosPanel and w:getHeight() > 0 and w:getHeight() < 120 then local r = w:getRect() local bajo = r.y + r.height if bajo <= v.y + 1 and bajo >= v.y - 12 and r.x < v.x + v.width and v.x < r.x + r.width then tope = math.min(tope, r.y) end end end return v.x + math.floor(v.width / 2), tope - SOBRE_BARRAS end return r.x + math.floor(r.width / 2), r.y + r.height - 240 end -- Todas del mismo ancho (el de la más larga): una columna limpia, con los iconos y el texto alineados a la izquierda. local function apilar() if #avisos == 0 then return end local cx, y = base() local ancho = ANCHO_MIN for _, a in ipairs(avisos) do ancho = math.max(ancho, a.ancho) end for _, a in ipairs(avisos) do local w = a.widget w:setWidth(ancho) y = y - w:getHeight() w:setPosition({ x = cx - math.floor(ancho / 2), y = y }) y = y - HUECO end end local function quitar(a, rapido) if a.quitando then return end a.quitando = true if a.ev then removeEvent(a.ev) a.ev = nil end fundir(a.widget, a.widget:getOpacity(), 0, rapido and 120 or SALE, function() for i, x in ipairs(avisos) do if x == a then table.remove(avisos, i) break end end a.widget:destroy() apilar() end) end local function programar(a, ms) if a.ev then removeEvent(a.ev) end a.ev = scheduleEvent(function() a.ev = nil quitar(a) end, ms) end -- Ajusta el ancho al texto (una línea hasta ANCHO_MAX; más, en varias líneas de ese ancho). local function ponerTexto(w) if w.coloreado then w.texto:setColoredText(w.coloreado) else w.texto:setText(w.plano) end end local function medir(w) local l = w.texto l:setTextWrap(false) l:setTextAutoResize(true) if l:getWidth() > ANCHO_MAX then -- partir en líneas: primero el ancho y el ajuste, después el texto (así recalcula el alto) l:setTextAutoResize(false) l:setTextWrap(true) l:setTextVerticalAutoResize(true) l:setWidth(ANCHO_MAX) l:setText('') ponerTexto(w) end local extra = w.veces:getText() ~= '' and (w.veces:getWidth() + 8) or 0 w:setHeight(math.max(26, l:getHeight() + 10)) return 9 + 16 + 8 + l:getWidth() + 12 + extra end local function mostrarAviso(tipo, text, colorTexto, coloreado) if not avisosPanel then return end local t = TIPOS[tipo] or TIPOS.sistema local clave = tipo .. '|' .. text local ms = calculateVisibleTime(text) if tipo == 'error' then ms = math.min(ms, 3500) end for _, a in ipairs(avisos) do if a.clave == clave and not a.quitando then -- repetido: cuenta y vuelve a empezar a.veces = a.veces + 1 a.widget.veces:setText('\215' .. a.veces) a.ancho = medir(a.widget) apilar() programar(a, ms) return end end local w = g_ui.createWidget('AvisoTarjeta', avisosPanel) w.icono:setImageSource(IMG .. t[1]) w.icono:setImageColor(t[2]) w:setBorderColor(t[3]) w.texto:setColor(colorTexto or (tipo == 'mision' and '#E8D3A2' or '#E2E5E6')) w.plano, w.coloreado = text, coloreado ponerTexto(w) w.veces:setText('') local a = { widget = w, clave = clave, veces = 1, ancho = medir(w) } w:setOpacity(0) table.insert(avisos, 1, a) -- en el HUD compacto (ventana baja) como mucho dos: la tercera llegaba a la altura del personaje local maximo = (OtmmoHud and OtmmoHud.modo == 'compacto') and 2 or MAX_VISIBLES while #avisos > maximo do local viejo = table.remove(avisos) if viejo.ev then removeEvent(viejo.ev) end if viejo.widget.fundido then removeEvent(viejo.widget.fundido) end viejo.widget:destroy() end apilar() fundir(w, 0, 1, ENTRA) programar(a, ms) end -- Qué tarjeta lleva cada mensaje. Los textos del servidor llegan en cp1252 (como este archivo). local function tipoDe(mode, msgtype, text) if msgtype == MessageSettings.loot or msgtype == MessageSettings.valuableLoot then return 'botin' end if msgtype == MessageSettings.private then return 'privado' end if msgtype == MessageSettings.centerRed or msgtype == MessageSettings.statusSmall then return 'error' end if mode == MessageModes.Look then return 'mirar' end if text:find('^Misi\243n') or text:find('^%W*Contrato') or text:find('^Objetivo cumplido') or text:find('^Encargo') then return 'mision' end if text:find('^Tu bot\237n') or text:find('^Bot\237n de') or text:find('^Recoges') then return 'botin' end return 'sistema' end function displayMessage(mode, text) text = traducirServidor(text) if text == '' then -- OT-MMO: mensaje de un sistema de Tibia que no usamos (TROZOS lo vació) return end if not g_game.isOnline() then return end if g_game.getClientVersion() >= 1300 then MessageTypes[MessageModes.Loot] = MessageSettings.loot MessageTypes[MessageModes.ValuableLoot] = MessageSettings.valuableLoot MessageTypes[MessageModes.Guild] = MessageSettings.statusOwn MessageTypes[MessageModes.Party] = MessageSettings.statusOwn else MessageTypes[MessageModes.PrivateFrom] = MessageSettings.privateNpcToPlayer MessageTypes[MessageModes.Loot] = MessageSettings.centerGreen MessageTypes[MessageModes.ValuableLoot] = MessageSettings.centerGreen MessageTypes[MessageModes.Guild] = MessageSettings.centerGreen MessageTypes[MessageModes.Party] = MessageSettings.centerGreen MessageTypes[MessageModes.MonsterSay] = MessageSettings.consoleOrange MessageTypes[MessageModes.MonsterYell] = MessageSettings.consoleOrange end local msgtype = MessageTypes[mode] if not msgtype then return end if msgtype == MessageSettings.none then return end -- OT-MMO: nombres con calidad («{q3|...}», server/scripts/equipo/equipo.lua) en su color, en cualquier mensaje local conCalidad = text:find("{q%d|") ~= nil if conCalidad and msgtype ~= MessageSettings.loot and msgtype ~= MessageSettings.valuableLoot then local coloreado = ItemsDatabase.colorCalidad(text) if msgtype.consoleTab ~= nil and (msgtype.consoleOption == nil or modules.client_options.getOption(msgtype.consoleOption)) then local tipo = {} for k, v in pairs(msgtype) do tipo[k] = v end tipo.colored = true modules.game_console.addText(coloreado, tipo, tr(msgtype.consoleTab)) end if msgtype.screenTarget then local plano = text:gsub('{q%d|(.-)}', '%1') mostrarAviso(tipoDe(mode, msgtype, plano), plano, nil, coloreado) end return end if msgtype.consoleTab ~= nil and (msgtype.consoleOption == nil or modules.client_options.getOption(msgtype.consoleOption)) then if msgtype == MessageSettings.loot or msgtype == MessageSettings.valuableLoot then local lootColoredText = ItemsDatabase.setColorLootMessage(text) local lootTabName = tr(msgtype.consoleTab) local targetTab = modules.game_console.getTab(lootTabName) and lootTabName or tr("Server Log") modules.game_console.addText(lootColoredText, msgtype, targetTab) else modules.game_console.addText(text, msgtype, tr(msgtype.consoleTab)) end end if msgtype.screenTarget then if msgtype == MessageSettings.loot and not modules.client_options.getOption('showLootMessagesOnScreen') then return elseif msgtype == MessageSettings.loot or msgtype == MessageSettings.valuableLoot then mostrarAviso('botin', text, nil, ItemsDatabase.setColorLootMessage(text)) else mostrarAviso(tipoDe(mode, msgtype, text), text, msgtype == MessageSettings.private and '#BFD8F0' or nil) end end end function displayPrivateMessage(text) if not g_game.isOnline() then return end mostrarAviso('privado', text, '#BFD8F0') end function displayStatusMessage(text) displayMessage(MessageModes.Status, text) end function displayFailureMessage(text) displayMessage(MessageModes.Failure, text) end function displayGameMessage(text) displayMessage(MessageModes.Game, text) end function displayBroadcastMessage(text) displayMessage(MessageModes.Warning, text) end -- Para probar sin servidor: modules.game_textmessage.probarAviso('mision', 'Misión aceptada: ...') function probarAviso(tipo, text) mostrarAviso(tipo, text) end function clearMessages() for _, a in ipairs(avisos) do if a.ev then removeEvent(a.ev) end if a.widget.fundido then removeEvent(a.widget.fundido) end a.widget:destroy() end avisos = {} end function LocalPlayer:onAutoWalkFail(player) modules.game_textmessage.displayFailureMessage(tr('There is no way.')) end