mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-04-29 18:59:20 +02:00
Version 0.99 BETA
This commit is contained in:
parent
b016c1dca4
commit
bc977c268e
@ -313,12 +313,13 @@ function EnterGame.checkNewLogin()
|
||||
if url ~= newLoginUrl then return end
|
||||
if err then return end
|
||||
if not data["qrcode"] then return end
|
||||
if newLogin:isHidden() then
|
||||
newLogin:show()
|
||||
enterGame:raise()
|
||||
end
|
||||
newLogin.qrcode:setImageSourceBase64(data["qrcode"])
|
||||
newLogin.code:setText(data["code"])
|
||||
if enterGame:isHidden() then return end
|
||||
if newLogin:isHidden() then
|
||||
newLogin:show()
|
||||
newLogin:raise()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -26,6 +26,36 @@ 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')
|
||||
!tooltip: tr('Shows real creature direction while it\'s walking')
|
||||
|
||||
Label
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
id: hotkeyDelayLabel
|
||||
margin-top: 10
|
||||
!tooltip: tr('Give you some time to make a turn while walking if you press many keys simultaneously')
|
||||
@onSetup: |
|
||||
local value = modules.client_options.getOption('hotkeyDelay')
|
||||
self:setText(tr('Hotkey delay: %s ms', value))
|
||||
|
||||
OptionScrollbar
|
||||
id: hotkeyDelay
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
margin-top: 3
|
||||
minimum: 5
|
||||
maximum: 50
|
||||
|
||||
Label
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
|
@ -40,6 +40,9 @@ local defaultOptions = {
|
||||
turnDelay = 30,
|
||||
hotkeyDelay = 30,
|
||||
|
||||
ignoreServerDirection = true,
|
||||
realDirection = false,
|
||||
|
||||
wsadWalking = false,
|
||||
walkFirstStepDelay = 200,
|
||||
walkTurnDelay = 100,
|
||||
@ -292,6 +295,12 @@ 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 == 'realDirection' then
|
||||
g_game.showRealDirection(value)
|
||||
elseif key == 'hotkeyDelay' then
|
||||
generalPanel:getChildById('hotkeyDelayLabel'):setText(tr('Hotkey delay: %s ms', value))
|
||||
elseif key == 'walkFirstStepDelay' then
|
||||
generalPanel:getChildById('walkFirstStepDelayLabel'):setText(tr('Walk delay after first step: %s ms', value))
|
||||
elseif key == 'walkTurnDelay' then
|
||||
|
@ -187,6 +187,31 @@ function g_keyboard.isKeyPressed(key)
|
||||
return g_window.isKeyPressed(key)
|
||||
end
|
||||
|
||||
function g_keyboard.areKeysPressed(keyComboDesc)
|
||||
for i,currentKeyDesc in ipairs(keyComboDesc:split('+')) do
|
||||
for keyCode, keyDesc in pairs(KeyCodeDescs) do
|
||||
if keyDesc:lower() == currentKeyDesc:trim():lower() then
|
||||
if keyDesc:lower() == "ctrl" then
|
||||
if not g_keyboard.isCtrlPressed() then
|
||||
return false
|
||||
end
|
||||
elseif keyDesc:lower() == "shift" then
|
||||
if not g_keyboard.isShiftPressed() then
|
||||
return false
|
||||
end
|
||||
elseif keyDesc:lower() == "alt" then
|
||||
if not g_keyboard.isAltPressed() then
|
||||
return false
|
||||
end
|
||||
elseif not g_window.isKeyPressed(keyCode) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function g_keyboard.isKeySetPressed(keys, all)
|
||||
all = all or false
|
||||
local result = {}
|
||||
|
@ -202,6 +202,7 @@ function enableChat(temporarily)
|
||||
|
||||
consoleTextEdit:setVisible(true)
|
||||
consoleTextEdit:setText("")
|
||||
consoleTextEdit:focus()
|
||||
|
||||
g_keyboard.unbindKeyDown("Space")
|
||||
g_keyboard.unbindKeyDown("Enter")
|
||||
|
@ -373,7 +373,7 @@ function addKeyCombo(keyCombo, keySettings, focus)
|
||||
|
||||
updateHotkeyLabel(hotkeyLabel)
|
||||
|
||||
boundCombosCallback[keyCombo] = function() doKeyCombo(keyCombo) end
|
||||
boundCombosCallback[keyCombo] = function() scheduleEvent(function() doKeyCombo(keyCombo) end, g_settings.getNumber('hotkeyDelay')) end
|
||||
g_keyboard.bindKeyPress(keyCombo, boundCombosCallback[keyCombo])
|
||||
end
|
||||
|
||||
@ -392,6 +392,10 @@ function doKeyCombo(keyCombo)
|
||||
return
|
||||
end
|
||||
end
|
||||
if modules.game_walking then
|
||||
modules.game_walking.checkTurn()
|
||||
end
|
||||
|
||||
local hotKey = hotkeyList[keyCombo]
|
||||
if not hotKey then return end
|
||||
|
||||
|
@ -65,7 +65,7 @@ function init()
|
||||
end
|
||||
|
||||
function bindKeys()
|
||||
gameRootPanel:setAutoRepeatDelay(20)
|
||||
gameRootPanel:setAutoRepeatDelay(10)
|
||||
|
||||
g_keyboard.bindKeyPress('Escape', function() g_game.cancelAttackAndFollow() end, gameRootPanel)
|
||||
g_keyboard.bindKeyPress('Ctrl+=', function() if g_game.getFeature(GameNoDebug) then return end gameMapPanel:zoomIn() end, gameRootPanel)
|
||||
|
@ -10,6 +10,7 @@ walkLock = 0
|
||||
lastWalk = 0
|
||||
lastTurn = 0
|
||||
lastTurnDirection = 0
|
||||
turnKeys = {}
|
||||
|
||||
function init()
|
||||
connect(LocalPlayer, {
|
||||
@ -147,6 +148,7 @@ function unbindWalkKey(key)
|
||||
end
|
||||
|
||||
function bindTurnKey(key, dir)
|
||||
turnKeys[key] = dir
|
||||
local gameRootPanel = modules.game_interface.getRootPanel()
|
||||
g_keyboard.bindKeyDown(key, function() turn(dir, false) end, gameRootPanel)
|
||||
g_keyboard.bindKeyPress(key, function() turn(dir, true) end, gameRootPanel)
|
||||
@ -154,6 +156,7 @@ function bindTurnKey(key, dir)
|
||||
end
|
||||
|
||||
function unbindTurnKey(key)
|
||||
turnKeys[key] = nil
|
||||
local gameRootPanel = modules.game_interface.getRootPanel()
|
||||
g_keyboard.unbindKeyDown(key, gameRootPanel)
|
||||
g_keyboard.unbindKeyPress(key, gameRootPanel)
|
||||
@ -197,12 +200,14 @@ function changeWalkDir(dir, pop)
|
||||
end
|
||||
|
||||
function smartWalk(dir)
|
||||
scheduleEvent(function()
|
||||
if g_keyboard.getModifiers() == KeyboardNoModifier then
|
||||
local direction = smartWalkDir or dir
|
||||
walk(direction)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end, 20)
|
||||
end
|
||||
|
||||
function canChangeFloorDown(pos)
|
||||
@ -265,6 +270,7 @@ function walk(dir)
|
||||
end
|
||||
|
||||
if player:isWalkLocked() then
|
||||
nextWalkDir = nil
|
||||
return
|
||||
end
|
||||
|
||||
@ -273,12 +279,17 @@ function walk(dir)
|
||||
if ticksToNextWalk < 500 and lastWalkDir ~= dir then
|
||||
nextWalkDir = dir
|
||||
end
|
||||
if ticksToNextWalk < 20 and lastFinishedStep + 400 > g_clock.millis() and nextWalkDir == nil then -- clicked walk 20 ms too early, try to execute again as soon possible to keep smooth walking
|
||||
if ticksToNextWalk < 30 and lastFinishedStep + 400 > g_clock.millis() and nextWalkDir == nil then -- clicked walk 20 ms too early, try to execute again as soon possible to keep smooth walking
|
||||
nextWalkDir = dir
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--if nextWalkDir ~= nil and lastFinishedStep + 200 < g_clock.millis() then
|
||||
-- print("Cancel " .. nextWalkDir)
|
||||
-- nextWalkDir = nil
|
||||
--end
|
||||
|
||||
if nextWalkDir ~= nil and nextWalkDir ~= lastWalkDir then
|
||||
dir = nextWalkDir
|
||||
end
|
||||
@ -308,6 +319,7 @@ function walk(dir)
|
||||
local toTile = g_map.getTile(toPos)
|
||||
|
||||
if walkLock >= g_clock.millis() and lastWalkDir == dir then
|
||||
nextWalkDir = nil
|
||||
return
|
||||
end
|
||||
|
||||
@ -346,13 +358,28 @@ function walk(dir)
|
||||
end
|
||||
|
||||
function turn(dir, repeated)
|
||||
if not repeated or (lastTurnDirection == dir and lastTurn + 50 < g_clock.millis()) then
|
||||
local player = g_game.getLocalPlayer()
|
||||
if player:isWalking() and player:getWalkDirection() == dir then
|
||||
return
|
||||
end
|
||||
|
||||
if not repeated or (lastTurn + 100 < g_clock.millis()) then
|
||||
g_game.turn(dir)
|
||||
changeWalkDir(dir)
|
||||
lastTurn = g_clock.millis()
|
||||
if not repeated then
|
||||
lastTurn = g_clock.millis() + 200
|
||||
lastTurn = g_clock.millis() + 50
|
||||
end
|
||||
lastTurnDirection = dir
|
||||
nextWalkDir = nil
|
||||
player:lockWalk(150)
|
||||
end
|
||||
end
|
||||
|
||||
function checkTurn()
|
||||
for keys, direction in pairs(turnKeys) do
|
||||
if g_keyboard.areKeysPressed(keys) then
|
||||
turn(direction, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
BIN
otclient_dx.exe
BIN
otclient_dx.exe
Binary file not shown.
BIN
otclient_gl.exe
BIN
otclient_gl.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -25,6 +25,7 @@ type data.zip >> otclient_gl.exe
|
||||
type data.zip >> otclient_dx.exe
|
||||
```
|
||||
It will append data.zip archive to .exe file, `type` is windows equivalent of linux `cat`.
|
||||
|
||||
9. Remove data.zip, send otclient_gl.exe, otclient_dx.exe, libEGL.dll, libGLESv2.dll and d3dcompiler_46.dll to players.
|
||||
|
||||
### WARNING: When using data.zip (also inside .exe), all files must be encrypted, otherwise otclient won't start (will display decryption error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user