diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 2fe8134..f76a218 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -640,59 +640,10 @@ function addTabText(text, speaktype, tab, creatureName) label:setColor(speaktype.color) consoleTabBar:blinkTab(tab) - -- Overlay for consoleBuffer which shows highlighted words only - local labelHighlight = label:getChildById("consoleLabelHighlight") - if labelHighlight then - labelHighlight:setText("") - end - if speaktype.npcChat and (g_game.getCharacterName() ~= creatureName or g_game.getCharacterName() == 'Account Manager') then - local highlightData = getHighlightedText(text) - if #highlightData > 0 then - if not labelHighlight then - labelHighlight = g_ui.createWidget('ConsolePhantomLabel', label) - labelHighlight:fill('parent') - labelHighlight:setId('consoleLabelHighlight') - labelHighlight:setColor("#1f9ffe") - end - - -- Remove the curly braces - for i = 1, #highlightData / 3 do - local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] } - text = text:gsub("%{(.-)%}", dataBlock.words, 1) - - -- Recalculate positions as braces are removed - highlightData[(i-1)*3+1] = dataBlock._start - ((i-1) * 2) - highlightData[(i-1)*3+2] = dataBlock._end - (1 + (i-1) * 2) - end - label:setText(text) - - -- Calculate the positions of the highlighted text and fill with string.char(127) [Width: 1] - local drawText = label:getDrawText() - local tmpText = "" - for i = 1, #highlightData / 3 do - local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] } - local lastBlockEnd = (highlightData[(i-2)*3+2] or 1) - - for letter = lastBlockEnd, dataBlock._start-1 do - local tmpChar = string.byte(drawText:sub(letter, letter)) - local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127) - - tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar]) - end - tmpText = tmpText .. dataBlock.words - end - - -- Fill the highlight label to the same size as default label - local finalBlockEnd = (highlightData[(#highlightData/3-1)*3+2] or 1) - for letter = finalBlockEnd, drawText:len() do - local tmpChar = string.byte(drawText:sub(letter, letter)) - local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127) - - tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar]) - end - - labelHighlight:setText(tmpText) + local highlightData = getNewHighlightedText(text, speaktype.color, "#1f9ffe") + if #highlightData > 2 then + label:setColoredText(highlightData) end end diff --git a/otclient_dx.exe b/otclient_dx.exe index b86eca4..d7a5b66 100644 Binary files a/otclient_dx.exe and b/otclient_dx.exe differ diff --git a/otclient_gl.exe b/otclient_gl.exe index 7a188e3..3d211bf 100644 Binary files a/otclient_gl.exe and b/otclient_gl.exe differ diff --git a/otclient_linux b/otclient_linux index 6c49e44..9e162e1 100644 Binary files a/otclient_linux and b/otclient_linux differ diff --git a/otclientv8.apk b/otclientv8.apk index 55adb9c..da886eb 100644 Binary files a/otclientv8.apk and b/otclientv8.apk differ