mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-29 19:26:23 +01:00
introduce coloured loot message
This commit is contained in:
@@ -646,7 +646,12 @@ function addTabText(text, speaktype, tab, creatureName)
|
||||
label:setColoredText(highlightData)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if tab == serverTab then
|
||||
local highlightText = toHighlightedText(text, speaktype.color)
|
||||
label:setColoredText(highlightText)
|
||||
end
|
||||
|
||||
label.name = creatureName
|
||||
consoleBuffer.onMouseRelease = function(self, mousePos, mouseButton)
|
||||
processMessageMenu(mousePos, mouseButton, nil, nil, nil, tab)
|
||||
|
||||
@@ -92,12 +92,20 @@ function displayMessage(mode, text)
|
||||
end
|
||||
|
||||
if msgtype.screenTarget then
|
||||
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
|
||||
label:setText(text)
|
||||
label:setColor(msgtype.color)
|
||||
label:setVisible(true)
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
|
||||
if mode == 20 then
|
||||
local highlightData = toHighlightedText(text, msgtype.color)
|
||||
label:setColoredText(highlightData)
|
||||
label:setVisible(true)
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||
else
|
||||
label:setText(text)
|
||||
label:setColor(msgtype.color)
|
||||
label:setVisible(true)
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -8,4 +8,33 @@ function dirtostring(dir)
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function toHighlightedText(text, color)
|
||||
local tmpData = {}
|
||||
|
||||
for i, part in ipairs(text:split("[")) do
|
||||
if i == 1 then
|
||||
table.insert(tmpData, part)
|
||||
table.insert(tmpData, color)
|
||||
else
|
||||
for j, part2 in ipairs(part:split("]")) do
|
||||
if j == 1 then
|
||||
local text = part2:split(":")
|
||||
if #text == 2 then
|
||||
table.insert(tmpData, part2:split(":")[2])
|
||||
table.insert(tmpData, part2:split(":")[1])
|
||||
else
|
||||
table.insert(tmpData, '[' .. part2 .. ']')
|
||||
table.insert(tmpData, color)
|
||||
end
|
||||
else
|
||||
table.insert(tmpData, part2)
|
||||
table.insert(tmpData, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return tmpData
|
||||
end
|
||||
@@ -3259,3 +3259,15 @@ ProtocolGame parse message exception (21 bytes, 0 unread, last opcode is 0x0b (1
|
||||
6a 02 7e a4 79 06 01 3a
|
||||
0b 01
|
||||
|
||||
ProtocolGame parse message exception (25 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||
18 00 15 00
|
||||
d2 01 00 00 00 0d 00 4b 69 6e 67 20 54 69 62 69 61 6e 75 73 00
|
||||
|
||||
ProtocolGame parse message exception (16 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||
10 00 0c 00
|
||||
d2 08 00 00 00 04 00 56 65 72 64 00
|
||||
|
||||
ProtocolGame parse message exception (19 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||
18 00 0f 00
|
||||
d2 2a 05 00 00 07 00 44 72 75 69 64 6b 65 00
|
||||
|
||||
|
||||
Reference in New Issue
Block a user