This commit is contained in:
Eduardo Bart 2012-10-23 17:15:59 -02:00
parent 5f72488eba
commit 7114946278
2 changed files with 15 additions and 6 deletions

View File

@ -350,21 +350,21 @@ function addTabText(text, speaktype, tab, creatureName)
for letter = lastBlockEnd, dataBlock._start-1 do for letter = lastBlockEnd, dataBlock._start-1 do
local tmpChar = string.byte(drawText:sub(letter, letter)) local tmpChar = string.byte(drawText:sub(letter, letter))
local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127) local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127)
tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar]) tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar])
end end
tmpText = tmpText .. dataBlock.words tmpText = tmpText .. dataBlock.words
end end
-- Fill the highlight label to the same size as default label -- Fill the highlight label to the same size as default label
local finalBlockEnd = (highlightData[(#highlightData/3-1)*3+2] or 1) local finalBlockEnd = (highlightData[(#highlightData/3-1)*3+2] or 1)
for letter = finalBlockEnd, drawText:len() do for letter = finalBlockEnd, drawText:len() do
local tmpChar = string.byte(drawText:sub(letter, letter)) local tmpChar = string.byte(drawText:sub(letter, letter))
local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127) local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127)
tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar]) tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar])
end end
labelHighlight:setText(tmpText) labelHighlight:setText(tmpText)
end end
else else
@ -544,6 +544,11 @@ function applyMessagePrefixies(name, level, message)
end end
function onTalk(name, level, mode, message, channelId, creaturePos) function onTalk(name, level, mode, message, channelId, creaturePos)
if mode == MessageModes.GamemasterBroadcast then
modules.game_textmessage.displayBroadcastMessage(name .. ': ' .. message)
return
end
if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end
if (mode == MessageModes.Say or mode == MessageModes.Whisper or mode == MessageModes.Yell or if (mode == MessageModes.Say or mode == MessageModes.Whisper or mode == MessageModes.Yell or
@ -561,7 +566,7 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
end end
end end
end end
local staticText = StaticText.create() local staticText = StaticText.create()
staticText:addMessage(name, mode, staticMessage) staticText:addMessage(name, mode, staticMessage)
g_map.addThing(staticText, creaturePos, -1) g_map.addThing(staticText, creaturePos, -1)
@ -583,7 +588,7 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
if speaktype.private then if speaktype.private then
addPrivateText(composedMessage, speaktype, name, false, name) addPrivateText(composedMessage, speaktype, name, false, name)
if Options.getOption('showPrivateMessagesOnScreen') and speaktype ~= SpeakTypesSettings.privateNpcToPlayer then if Options.getOption('showPrivateMessagesOnScreen') and speaktype ~= SpeakTypesSettings.privateNpcToPlayer then
modules.game_textmessage.displayPrivateMessage(name .. ':\n' .. message) modules.game_textmessage.displayPrivateMessage(name .. ':\n' .. message)
end end
else else

View File

@ -107,6 +107,10 @@ function displayGameMessage(text)
displayMessage(MessageModes.Game, text) displayMessage(MessageModes.Game, text)
end end
function displayBroadcastMessage(text)
displayMessage(MessageModes.Warning, text)
end
function clearMessages() function clearMessages()
for _i,child in pairs(messagesPanel:recursiveGetChildren()) do for _i,child in pairs(messagesPanel:recursiveGetChildren()) do
if child:getId():match('Label') then if child:getId():match('Label') then