diff --git a/modules/client_options/game.otui b/modules/client_options/game.otui index 558df41..f902bfd 100644 --- a/modules/client_options/game.otui +++ b/modules/client_options/game.otui @@ -26,11 +26,6 @@ Panel !text: tr('Enable smart walking') !tooltip: tr('Will detect when to use diagonal step based on the\nkeys you are pressing') - OptionCheckBox - id: ignoreServerDirection - !text: tr('Ignore server direction') - !tooltip: tr('Doesn\'t change direction when walk is canceled') - OptionCheckBox id: realDirection !text: tr('Show real direction') diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index f96c6c2..045cae7 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -295,8 +295,8 @@ function setOption(key, value, force) if modules.game_console and modules.game_console.consoleToggleChat:isChecked() ~= value then modules.game_console.consoleToggleChat:setChecked(value) end - elseif key == 'ignoreServerDirection' then - g_game.ignoreServerDirection(value) + --elseif key == 'ignoreServerDirection' then + -- g_game.ignoreServerDirection(value) elseif key == 'realDirection' then g_game.showRealDirection(value) elseif key == 'hotkeyDelay' then diff --git a/modules/corelib/http.lua b/modules/corelib/http.lua index 7f21646..04c3c71 100644 --- a/modules/corelib/http.lua +++ b/modules/corelib/http.lua @@ -55,10 +55,6 @@ function HTTP.downloadImage(url, callback) return operation end -function HTTP.progress(operationId) - return g_http.getProgress(operationId) -end - function HTTP.cancel(operationId) return g_http.cancel(operationId) end diff --git a/modules/corelib/ui/tooltip.lua b/modules/corelib/ui/tooltip.lua index d5c6115..c390707 100644 --- a/modules/corelib/ui/tooltip.lua +++ b/modules/corelib/ui/tooltip.lua @@ -62,7 +62,6 @@ function g_tooltip.init() toolTipLabel:setBackgroundColor('#111111cc') toolTipLabel:setTextAlign(AlignCenter) toolTipLabel:hide() - toolTipLabel.onMouseMove = function() moveToolTip() end end) end @@ -89,10 +88,18 @@ function g_tooltip.display(text) toolTipLabel:enable() g_effects.fadeIn(toolTipLabel, 100) moveToolTip(true) + + connect(rootWidget, { + onMouseMove = moveToolTip, + }) end function g_tooltip.hide() g_effects.fadeOut(toolTipLabel, 100) + + disconnect(rootWidget, { + onMouseMove = moveToolTip, + }) end diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 8c5c0bd..aad711a 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -1277,15 +1277,15 @@ function loadCommunicationSettings() local ignoreNode = g_settings.getNode('IgnorePlayers') if ignoreNode then - for i = 1, #ignoreNode do - table.insert(communicationSettings.ignoredPlayers, ignoreNode[i]) + for _, player in pairs(ignoreNode) do + table.insert(communicationSettings.ignoredPlayers, player) end end local whitelistNode = g_settings.getNode('WhitelistedPlayers') if whitelistNode then - for i = 1, #whitelistNode do - table.insert(communicationSettings.whitelistedPlayers, whitelistNode[i]) + for _, player in pairs(whitelistNode) do + table.insert(communicationSettings.whitelistedPlayers, player) end end diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 305749a..08ddac8 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -373,8 +373,23 @@ function addKeyCombo(keyCombo, keySettings, focus) updateHotkeyLabel(hotkeyLabel) - boundCombosCallback[keyCombo] = function() scheduleEvent(function() doKeyCombo(keyCombo) end, g_settings.getNumber('hotkeyDelay')) end + + if keyCombo:lower():find("ctrl") then + if boundCombosCallback[keyCombo] then + g_keyboard.unbindKeyPress(keyCombo, boundCombosCallback[keyCombo]) + end + end + + boundCombosCallback[keyCombo] = function() prepareKeyCombo(keyCombo) end g_keyboard.bindKeyPress(keyCombo, boundCombosCallback[keyCombo]) + + if not keyCombo:lower():find("ctrl") then + local keyComboCtrl = "Ctrl+" .. keyCombo + if not boundCombosCallback[keyComboCtrl] then + boundCombosCallback[keyComboCtrl] = function() prepareKeyCombo(keyComboCtrl) end + g_keyboard.bindKeyPress(keyComboCtrl, boundCombosCallback[keyComboCtrl]) + end + end end if focus then @@ -385,6 +400,24 @@ function addKeyCombo(keyCombo, keySettings, focus) configValueChanged = true end +function prepareKeyCombo(keyCombo) + local hotKey = hotkeyList[keyCombo] + if keyCombo:lower():find("ctrl") and not hotKey or (hotKey.itemId == nil and (not hotKey.value or #hotKey.value == 0)) then + keyCombo = keyCombo:gsub("Ctrl%+", "") + keyCombo = keyCombo:gsub("ctrl%+", "") + hotKey = hotkeyList[keyCombo] + end + if not hotKey then + return + end + + if hotKey.itemId == nil then -- say + scheduleEvent(function() doKeyCombo(keyCombo) end, g_settings.getNumber('hotkeyDelay')) + else + doKeyCombo(keyCombo) + end +end + function doKeyCombo(keyCombo) if not g_game.isOnline() then return end if modules.game_console and modules.game_console.isChatEnabled() then diff --git a/modules/game_walking/walking.lua b/modules/game_walking/walking.lua index 0c337ee..66dd64b 100644 --- a/modules/game_walking/walking.lua +++ b/modules/game_walking/walking.lua @@ -10,6 +10,7 @@ walkLock = 0 lastWalk = 0 lastTurn = 0 lastTurnDirection = 0 +lastStop = 0 turnKeys = {} function init() @@ -263,10 +264,14 @@ function walk(dir) end if player:isAutoWalking() or player:isServerWalking() then - if player:isAutoWalking() then - player:stopAutoWalk() + if lastStop + 100 < g_clock.millis() then + lastStop = g_clock.millis() + if player:isAutoWalking() then + player:stopAutoWalk() + end + g_game.stop() end - g_game.stop() + return end if player:isWalkLocked() then diff --git a/otclient_dx.exe b/otclient_dx.exe index 08ddb82..f210e72 100644 Binary files a/otclient_dx.exe and b/otclient_dx.exe differ diff --git a/otclient_gl.exe b/otclient_gl.exe index 84e67f9..2fb51d1 100644 Binary files a/otclient_gl.exe and b/otclient_gl.exe differ diff --git a/pdb/otclient_dx.pdb b/pdb/otclient_dx.pdb index 18436e5..acb7897 100644 Binary files a/pdb/otclient_dx.pdb and b/pdb/otclient_dx.pdb differ diff --git a/pdb/otclient_gl.pdb b/pdb/otclient_gl.pdb index 86fe1c6..5ba31f0 100644 Binary files a/pdb/otclient_gl.pdb and b/pdb/otclient_gl.pdb differ diff --git a/tutorials/HTTP.md b/tutorials/HTTP.md index 03c4f4b..1585fc6 100644 --- a/tutorials/HTTP.md +++ b/tutorials/HTTP.md @@ -10,11 +10,10 @@ HTTP.post(url, data, callback) HTTP.postJSON(url, data, callback) -- data should be a table {} and website should return json HTTP.download(url, file, downloadCallback, progressCallback) -- progressCallback can be null HTTP.downloadImage(url, downloadImageCallback) -HTTP.progress(operationId) -- return -1 on error or number from 0 to 100 HTTP.cancel(operationId) ``` -Each function, except `cancel` and `progress` return operationId, you can use it to cancel or get progress of http request. +Each function, except `cancel` return operationId, you can use it to cancel http request. Those functions came from `modules/corelib/http.lua` and they use more advanced g_http API. Files from download are available in virtual "/downloads" directory. Downloading of images is using cache based on url (so if you change image it won't refresh until restart or change url).