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

View File

@ -132,9 +132,10 @@ void StaticText::compose()
text += m_name;
text += " yells:\n";
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);
} else if(m_mode == Otc::MessageNpcFrom) {
} else if(m_mode == Otc::MessageNpcFrom || m_mode == Otc::MessageNpcFromStartBlock) {
text += m_name;
text += " says:\n";
m_color = Color(95, 247, 247);