Version 0.991 BETA

This commit is contained in:
OTCv8 2019-10-07 15:52:55 +02:00
parent bc977c268e
commit c5c600e83e
12 changed files with 57 additions and 22 deletions

View File

@ -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')

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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).