Adjusted chase modes to work correctly, added new option for auto chase override. Fixed NPC speak messages to appear in the correct position.
This commit is contained in:
parent
6a85c31a77
commit
4453242bee
|
@ -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,7 +145,9 @@ 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
|
||||||
|
@ -153,7 +156,9 @@ function Options.setOption(key, value)
|
||||||
value = 0
|
value = 0
|
||||||
end
|
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)
|
g_app.setForegroundPaneMaxFps(value)
|
||||||
elseif key == 'painterEngine' then
|
elseif key == 'painterEngine' then
|
||||||
g_graphics.selectPainterEngine(value)
|
g_graphics.selectPainterEngine(value)
|
||||||
|
|
|
@ -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,8 +94,10 @@ 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
|
||||||
|
if(speakType.speakType ~= privateNpcToPlayer) then
|
||||||
TextMessage.displayPrivate(name .. ':\n' .. message)
|
TextMessage.displayPrivate(name .. ':\n' .. message)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local channel = tr('Default')
|
local channel = tr('Default')
|
||||||
if not defaultMessage then
|
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)
|
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…
Reference in New Issue