Merge pull request #4 from BeniS/master
Pull request for NPC message fix and auto chase fix and new override option.
This commit is contained in:
commit
beb843a971
|
@ -25,3 +25,4 @@ CMakeLists.txt.user*
|
|||
/modules/myconfig.otml
|
||||
/modules/myotclientrc.lua
|
||||
!.gitignore
|
||||
otclient.map
|
||||
|
|
|
@ -3,6 +3,10 @@ Panel
|
|||
id: classicControl
|
||||
!text: tr('Classic control')
|
||||
|
||||
OptionCheckBox
|
||||
id: autoChaseOverride
|
||||
!text: tr('Allow auto chase override')
|
||||
|
||||
OptionCheckBox
|
||||
id: showInfoMessagesInConsole
|
||||
!text: tr('Show info messages in console')
|
||||
|
|
|
@ -5,6 +5,7 @@ local defaultOptions = {
|
|||
showfps = true,
|
||||
fullscreen = false,
|
||||
classicControl = false,
|
||||
autoChaseOverride = true,
|
||||
showStatusMessagesInConsole = true,
|
||||
showEventMessagesInConsole = true,
|
||||
showInfoMessagesInConsole = true,
|
||||
|
@ -144,7 +145,9 @@ function Options.setOption(key, value)
|
|||
value = 0
|
||||
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)
|
||||
elseif key == 'foregroundFrameRate' then
|
||||
local text = value
|
||||
|
@ -153,7 +156,9 @@ function Options.setOption(key, value)
|
|||
value = 0
|
||||
end
|
||||
|
||||
if graphicsPanel then graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text)) end
|
||||
if graphicsPanel then
|
||||
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
|
||||
end
|
||||
g_app.setForegroundPaneMaxFps(value)
|
||||
elseif key == 'painterEngine' then
|
||||
g_graphics.selectPainterEngine(value)
|
||||
|
|
|
@ -64,7 +64,8 @@ function CombatControls.init()
|
|||
onGameEnd = CombatControls.offline,
|
||||
onFightModeChange = CombatControls.update,
|
||||
onChaseModeChange = CombatControls.update,
|
||||
onSafeFightChange = CombatControls.update
|
||||
onSafeFightChange = CombatControls.update,
|
||||
onWalk = CombatControls.check
|
||||
})
|
||||
|
||||
if g_game.isOnline() then
|
||||
|
@ -97,7 +98,8 @@ function CombatControls.terminate()
|
|||
onGameEnd = CombatControls.offline,
|
||||
onFightModeChange = CombatControls.update,
|
||||
onChaseModeChange = CombatControls.update,
|
||||
onSafeFightChange = CombatControls.update
|
||||
onSafeFightChange = CombatControls.update,
|
||||
onWalk = CombatControls.check
|
||||
})
|
||||
|
||||
CombatControls = nil
|
||||
|
@ -120,6 +122,14 @@ function CombatControls.update()
|
|||
safeFightButton:setChecked(not safeFight)
|
||||
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()
|
||||
combatControlsWindow:setVisible(combatControlsButton:isOn())
|
||||
CombatControls.update()
|
||||
|
|
|
@ -94,8 +94,10 @@ local function onCreatureSpeak(name, level, speaktype, message, channelId, creat
|
|||
if speaktype.private then
|
||||
Console.addPrivateText(composedMessage, speaktype, name, false, name)
|
||||
if Options.getOption('showPrivateMessagesOnScreen') then
|
||||
if(speaktype.speakType ~= SpeakPrivateNpcToPlayer) then
|
||||
TextMessage.displayPrivate(name .. ':\n' .. message)
|
||||
end
|
||||
end
|
||||
else
|
||||
local channel = tr('Default')
|
||||
if not defaultMessage then
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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);
|
||||
staticText->addMessage(name, type, message);
|
||||
g_map.addThing(staticText, creaturePos);
|
||||
|
@ -456,6 +458,8 @@ void Game::walk(Otc::Direction direction)
|
|||
m_localPlayer->lockWalk();
|
||||
|
||||
forceWalk(direction);
|
||||
|
||||
g_lua.callGlobalField("g_game", "onWalk", direction);
|
||||
}
|
||||
|
||||
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());
|
||||
if(nextDirs.size() > 0)
|
||||
m_protocolGame->sendAutoWalk(nextDirs);
|
||||
|
||||
g_lua.callGlobalField("g_game", "onAutoWalk", direction);
|
||||
}
|
||||
|
||||
void Game::forceWalk(Otc::Direction direction)
|
||||
|
@ -494,9 +500,6 @@ void Game::forceWalk(Otc::Direction direction)
|
|||
if(!canPerformGameAction())
|
||||
return;
|
||||
|
||||
// always cancel chasing attacks
|
||||
setChaseMode(Otc::DontChase);
|
||||
|
||||
switch(direction) {
|
||||
case Otc::North:
|
||||
m_protocolGame->sendWalkNorth();
|
||||
|
|
Loading…
Reference in New Issue