mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
Added enable/disable chat mode (allows for alphabetical key controls), battle window anchoring fixed (thank you River) & more:
* Added better walk key binding (for other uses, like the sample given WASD). * Made string.ends part of the string meta table rather than parameter based.
This commit is contained in:
@@ -143,10 +143,59 @@ function init()
|
||||
g_keyboard.bindKeyDown('Ctrl+O', g_game.requestChannels)
|
||||
g_keyboard.bindKeyDown('Ctrl+E', removeCurrentTab)
|
||||
g_keyboard.bindKeyDown('Ctrl+H', openHelp)
|
||||
|
||||
|
||||
consoleToggleChat = consolePanel:getChildById('toggleChat')
|
||||
load()
|
||||
end
|
||||
|
||||
function toggleChat()
|
||||
if consoleToggleChat:isChecked() then
|
||||
disableChat()
|
||||
else
|
||||
enableChat()
|
||||
end
|
||||
end
|
||||
|
||||
function enableChat()
|
||||
local gameInterface = modules.game_interface
|
||||
|
||||
consoleTextEdit:setVisible(true)
|
||||
consoleTextEdit:setText("")
|
||||
|
||||
g_keyboard.unbindKeyUp("Space")
|
||||
g_keyboard.unbindKeyUp("Enter")
|
||||
|
||||
gameInterface.unbindWalkKey("W")
|
||||
gameInterface.unbindWalkKey("D")
|
||||
gameInterface.unbindWalkKey("S")
|
||||
gameInterface.unbindWalkKey("A")
|
||||
|
||||
consoleToggleChat:setTooltip(tr("Disable chat mode"))
|
||||
end
|
||||
|
||||
function disableChat()
|
||||
local gameInterface = modules.game_interface
|
||||
|
||||
consoleTextEdit:setVisible(false)
|
||||
consoleTextEdit:setText("")
|
||||
|
||||
local quickFunc = function()
|
||||
if consoleToggleChat:isChecked() then
|
||||
consoleToggleChat:setChecked(false)
|
||||
end
|
||||
enableChat()
|
||||
end
|
||||
g_keyboard.bindKeyUp("Space", quickFunc)
|
||||
g_keyboard.bindKeyUp("Enter", quickFunc)
|
||||
|
||||
gameInterface.bindWalkKey("W", North)
|
||||
gameInterface.bindWalkKey("D", East)
|
||||
gameInterface.bindWalkKey("S", South)
|
||||
gameInterface.bindWalkKey("A", West)
|
||||
|
||||
consoleToggleChat:setTooltip(tr("Enable chat mode"))
|
||||
end
|
||||
|
||||
function terminate()
|
||||
save()
|
||||
disconnect(g_game, {
|
||||
@@ -1211,4 +1260,4 @@ function offline()
|
||||
g_keyboard.unbindKeyDown('Ctrl+R')
|
||||
end
|
||||
clear()
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user