mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Implement new cool features
* Implement walk booster (dash) as an option in settings menu * Dash is smarter (can pre-animate) * Implement smart walking (walk in diagonal when holding two arrow keys) * Implement ping meter for all protocols * Ping meter uses uses real ping packet for 9.6 and walk for others
This commit is contained in:
@@ -15,6 +15,14 @@ function translateKeyCombo(keyCombo)
|
||||
return keyComboDesc
|
||||
end
|
||||
|
||||
local function getKeyCode(key)
|
||||
for keyCode, keyDesc in pairs(KeyCodeDescs) do
|
||||
if keyDesc:lower() == key:trim():lower() then
|
||||
return keyCode
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function retranslateKeyComboDesc(keyComboDesc)
|
||||
if keyComboDesc == nil then
|
||||
error('Unable to translate key combo \'' .. keyComboDesc .. '\'')
|
||||
@@ -140,6 +148,13 @@ function g_keyboard.getModifiers()
|
||||
return g_window.getKeyboardModifiers()
|
||||
end
|
||||
|
||||
function g_keyboard.isKeyPressed(key)
|
||||
if type(key) == 'string' then
|
||||
key = getKeyCode(key)
|
||||
end
|
||||
return g_window.isKeyPressed(key)
|
||||
end
|
||||
|
||||
function g_keyboard.isCtrlPressed()
|
||||
return bit32.band(g_window.getKeyboardModifiers(), KeyboardCtrlModifier) ~= 0
|
||||
end
|
||||
|
Reference in New Issue
Block a user