Merge pull request #4 from BeniS/master

Pull request for NPC message fix and auto chase fix and new override option.
master
Eduardo Bart 12 years ago
commit beb843a971

1
.gitignore vendored

@ -25,3 +25,4 @@ CMakeLists.txt.user*
/modules/myconfig.otml /modules/myconfig.otml
/modules/myotclientrc.lua /modules/myotclientrc.lua
!.gitignore !.gitignore
otclient.map

@ -3,6 +3,10 @@ Panel
id: classicControl id: classicControl
!text: tr('Classic control') !text: tr('Classic control')
OptionCheckBox
id: autoChaseOverride
!text: tr('Allow auto chase override')
OptionCheckBox OptionCheckBox
id: showInfoMessagesInConsole id: showInfoMessagesInConsole
!text: tr('Show info messages in console') !text: tr('Show info messages in console')

@ -5,6 +5,7 @@ local defaultOptions = {
showfps = true, showfps = true,
fullscreen = false, fullscreen = false,
classicControl = false, classicControl = false,
autoChaseOverride = true,
showStatusMessagesInConsole = true, showStatusMessagesInConsole = true,
showEventMessagesInConsole = true, showEventMessagesInConsole = true,
showInfoMessagesInConsole = true, showInfoMessagesInConsole = true,
@ -144,17 +145,21 @@ function Options.setOption(key, value)
value = 0 value = 0
end end
if graphicsPanel then graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text)) end if graphicsPanel then
graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
end
g_app.setBackgroundPaneMaxFps(value) g_app.setBackgroundPaneMaxFps(value)
elseif key == 'foregroundFrameRate' then elseif key == 'foregroundFrameRate' then
local text = value local text = value
if value <= 0 or value >= 61 then if value <= 0 or value >= 61 then
text = 'max' text = 'max'
value = 0 value = 0
end end
if graphicsPanel then graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text)) end if graphicsPanel then
g_app.setForegroundPaneMaxFps(value) graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
end
g_app.setForegroundPaneMaxFps(value)
elseif key == 'painterEngine' then elseif key == 'painterEngine' then
g_graphics.selectPainterEngine(value) g_graphics.selectPainterEngine(value)
end end

@ -64,7 +64,8 @@ function CombatControls.init()
onGameEnd = CombatControls.offline, onGameEnd = CombatControls.offline,
onFightModeChange = CombatControls.update, onFightModeChange = CombatControls.update,
onChaseModeChange = CombatControls.update, onChaseModeChange = CombatControls.update,
onSafeFightChange = CombatControls.update onSafeFightChange = CombatControls.update,
onWalk = CombatControls.check
}) })
if g_game.isOnline() then if g_game.isOnline() then
@ -97,7 +98,8 @@ function CombatControls.terminate()
onGameEnd = CombatControls.offline, onGameEnd = CombatControls.offline,
onFightModeChange = CombatControls.update, onFightModeChange = CombatControls.update,
onChaseModeChange = CombatControls.update, onChaseModeChange = CombatControls.update,
onSafeFightChange = CombatControls.update onSafeFightChange = CombatControls.update,
onWalk = CombatControls.check
}) })
CombatControls = nil CombatControls = nil
@ -120,6 +122,14 @@ function CombatControls.update()
safeFightButton:setChecked(not safeFight) safeFightButton:setChecked(not safeFight)
end end
function CombatControls.check()
if(Options.getOption('autoChaseOverride')) then
if(g_game.isAttacking() and g_game.getChaseMode() == ChaseOpponent) then
g_game.setChaseMode(DontChase)
end
end
end
function CombatControls.online() function CombatControls.online()
combatControlsWindow:setVisible(combatControlsButton:isOn()) combatControlsWindow:setVisible(combatControlsButton:isOn())
CombatControls.update() CombatControls.update()

@ -94,7 +94,9 @@ local function onCreatureSpeak(name, level, speaktype, message, channelId, creat
if speaktype.private then if speaktype.private then
Console.addPrivateText(composedMessage, speaktype, name, false, name) Console.addPrivateText(composedMessage, speaktype, name, false, name)
if Options.getOption('showPrivateMessagesOnScreen') then if Options.getOption('showPrivateMessagesOnScreen') then
TextMessage.displayPrivate(name .. ':\n' .. message) if(speaktype.speakType ~= SpeakPrivateNpcToPlayer) then
TextMessage.displayPrivate(name .. ':\n' .. message)
end
end end
else else
local channel = tr('Default') local channel = tr('Default')

@ -161,7 +161,9 @@ void Game::processTextMessage(const std::string& type, const std::string& messag
void Game::processCreatureSpeak(const std::string& name, int level, Otc::SpeakType type, const std::string& message, int channelId, const Position& creaturePos) void Game::processCreatureSpeak(const std::string& name, int level, Otc::SpeakType type, const std::string& message, int channelId, const Position& creaturePos)
{ {
if(creaturePos.isValid() && (type == Otc::SpeakSay || type == Otc::SpeakWhisper || type == Otc::SpeakYell || type == Otc::SpeakMonsterSay || type == Otc::SpeakMonsterYell)) { if(creaturePos.isValid() && (type == Otc::SpeakSay || type == Otc::SpeakWhisper || type == Otc::SpeakYell
|| type == Otc::SpeakMonsterSay || type == Otc::SpeakMonsterYell || type == Otc::SpeakPrivateNpcToPlayer))
{
StaticTextPtr staticText = StaticTextPtr(new StaticText); StaticTextPtr staticText = StaticTextPtr(new StaticText);
staticText->addMessage(name, type, message); staticText->addMessage(name, type, message);
g_map.addThing(staticText, creaturePos); g_map.addThing(staticText, creaturePos);
@ -456,6 +458,8 @@ void Game::walk(Otc::Direction direction)
m_localPlayer->lockWalk(); m_localPlayer->lockWalk();
forceWalk(direction); forceWalk(direction);
g_lua.callGlobalField("g_game", "onWalk", direction);
} }
void Game::autoWalk(const std::vector<Otc::Direction>& dirs) void Game::autoWalk(const std::vector<Otc::Direction>& dirs)
@ -487,6 +491,8 @@ void Game::autoWalk(const std::vector<Otc::Direction>& dirs)
nextDirs.erase(nextDirs.begin()); nextDirs.erase(nextDirs.begin());
if(nextDirs.size() > 0) if(nextDirs.size() > 0)
m_protocolGame->sendAutoWalk(nextDirs); m_protocolGame->sendAutoWalk(nextDirs);
g_lua.callGlobalField("g_game", "onAutoWalk", direction);
} }
void Game::forceWalk(Otc::Direction direction) void Game::forceWalk(Otc::Direction direction)
@ -494,9 +500,6 @@ void Game::forceWalk(Otc::Direction direction)
if(!canPerformGameAction()) if(!canPerformGameAction())
return; return;
// always cancel chasing attacks
setChaseMode(Otc::DontChase);
switch(direction) { switch(direction) {
case Otc::North: case Otc::North:
m_protocolGame->sendWalkNorth(); m_protocolGame->sendWalkNorth();

Loading…
Cancel
Save