Fix NPC static text and missing SpeakType.

This commit is contained in:
BenDol 2015-07-19 06:03:19 +12:00
parent b822e92c0e
commit 07a2995285
2 changed files with 17 additions and 15 deletions

View File

@ -38,6 +38,7 @@ SpeakTypes = {
[MessageModes.RVRChannel] = SpeakTypesSettings.channelWhite, [MessageModes.RVRChannel] = SpeakTypesSettings.channelWhite,
[MessageModes.RVRContinue] = SpeakTypesSettings.rvrContinue, [MessageModes.RVRContinue] = SpeakTypesSettings.rvrContinue,
[MessageModes.RVRAnswer] = SpeakTypesSettings.rvrAnswerFrom, [MessageModes.RVRAnswer] = SpeakTypesSettings.rvrAnswerFrom,
[MessageModes.NpcFromStartBlock] = SpeakTypesSettings.privateNpcToPlayer,
-- ignored types -- ignored types
[MessageModes.Spell] = SpeakTypesSettings.none, [MessageModes.Spell] = SpeakTypesSettings.none,
@ -1020,21 +1021,21 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
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
mode == MessageModes.Spell or mode == MessageModes.MonsterSay or mode == MessageModes.MonsterYell or mode == MessageModes.Spell or mode == MessageModes.MonsterSay or mode == MessageModes.MonsterYell or
mode == MessageModes.NpcFrom or mode == MessageModes.BarkLow or mode == MessageModes.BarkLoud) and mode == MessageModes.NpcFrom or mode == MessageModes.BarkLow or mode == MessageModes.BarkLoud or
creaturePos then mode == MessageModes.NpcFromStartBlock) and creaturePos then
-- Remove curly braces from screen message local staticText = StaticText.create()
local staticMessage = message -- Remove curly braces from screen message
if mode == MessageModes.NpcFrom then local staticMessage = message
local highlightData = getHighlightedText(staticMessage) if mode == MessageModes.NpcFrom or mode == MessageModes.NpcFromStartBlock then
if #highlightData > 0 then local highlightData = getHighlightedText(staticMessage)
for i = 1, #highlightData / 3 do if #highlightData > 0 then
local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] } for i = 1, #highlightData / 3 do
staticMessage = staticMessage:gsub("{"..dataBlock.words.."}", dataBlock.words) local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] }
end staticMessage = staticMessage:gsub("{"..dataBlock.words.."}", dataBlock.words)
end end
end end
staticText:setColor(speaktype.color)
local staticText = StaticText.create() end
staticText:addMessage(name, mode, staticMessage) staticText:addMessage(name, mode, staticMessage)
g_map.addThing(staticText, creaturePos, -1) g_map.addThing(staticText, creaturePos, -1)
end end

View File

@ -132,9 +132,10 @@ void StaticText::compose()
text += m_name; text += m_name;
text += " yells:\n"; text += " yells:\n";
m_color = Color(239, 239, 0); m_color = Color(239, 239, 0);
} else if(m_mode == Otc::MessageMonsterSay || m_mode == Otc::MessageMonsterYell || m_mode == Otc::MessageSpell || m_mode == Otc::MessageBarkLow || m_mode == Otc::MessageBarkLoud) { } else if(m_mode == Otc::MessageMonsterSay || m_mode == Otc::MessageMonsterYell || m_mode == Otc::MessageSpell
|| m_mode == Otc::MessageBarkLow || m_mode == Otc::MessageBarkLoud) {
m_color = Color(254, 101, 0); m_color = Color(254, 101, 0);
} else if(m_mode == Otc::MessageNpcFrom) { } else if(m_mode == Otc::MessageNpcFrom || m_mode == Otc::MessageNpcFromStartBlock) {
text += m_name; text += m_name;
text += " says:\n"; text += " says:\n";
m_color = Color(95, 247, 247); m_color = Color(95, 247, 247);