mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
too many changes to list, many regressions were made, master will be UNSTABLE for a few days
This commit is contained in:
@@ -81,7 +81,7 @@ local function completeCommand()
|
||||
end
|
||||
end
|
||||
|
||||
local function onKeyPress(widget, keyCode, keyChar, keyboardModifiers)
|
||||
local function onKeyPress(widget, keyCode, keyText, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
-- execute current command
|
||||
if keyCode == KeyReturn or keyCode == keyEnter then
|
||||
|
1
modules/core/ext/color.lua
Normal file
1
modules/core/ext/color.lua
Normal file
@@ -0,0 +1 @@
|
||||
Color = {}
|
1
modules/core/ext/point.lua
Normal file
1
modules/core/ext/point.lua
Normal file
@@ -0,0 +1 @@
|
||||
Point = {}
|
1
modules/core/ext/rect.lua
Normal file
1
modules/core/ext/rect.lua
Normal file
@@ -0,0 +1 @@
|
||||
Rect = {}
|
1
modules/core/ext/size.lua
Normal file
1
modules/core/ext/size.lua
Normal file
@@ -0,0 +1 @@
|
||||
Size = {}
|
@@ -23,4 +23,4 @@ function toboolean(str)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@@ -6,7 +6,7 @@ local loadBox
|
||||
local characterList
|
||||
|
||||
-- private functions
|
||||
local function onCharactersWindowKeyPress(self, keyCode, keyChar, keyboardModifiers)
|
||||
local function onCharactersWindowKeyPress(self, keyCode, keyText, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
if keyCode == KeyUp or keyCode == KeyTab then
|
||||
characterList:focusPreviousChild(ActiveFocusReason)
|
||||
@@ -47,7 +47,7 @@ local function tryLogin(charInfo, tries)
|
||||
end
|
||||
|
||||
-- save last used character
|
||||
ConfigManager.set('lastUsedCharacter', charInfo.characterName)
|
||||
g_configs.set('lastUsedCharacter', charInfo.characterName)
|
||||
end
|
||||
|
||||
-- public functions
|
||||
@@ -75,7 +75,7 @@ function CharacterList.create(characters, premDays)
|
||||
label.worldHost = worldHost
|
||||
label.worldPort = worldIp
|
||||
|
||||
if i == 1 or ConfigManager.get('lastUsedCharacter') == characterName then
|
||||
if i == 1 or g_configs.get('lastUsedCharacter') == characterName then
|
||||
characterList:focusChild(label, ActiveFocusReason)
|
||||
end
|
||||
end
|
||||
|
@@ -11,8 +11,8 @@ local function clearAccountFields()
|
||||
enterGame:getChildById('accountNameLineEdit'):clearText()
|
||||
enterGame:getChildById('accountPasswordLineEdit'):clearText()
|
||||
enterGame:getChildById('accountNameLineEdit'):focus()
|
||||
ConfigManager.set('account', nil)
|
||||
ConfigManager.set('password', nil)
|
||||
g_configs.set('account', nil)
|
||||
g_configs.set('password', nil)
|
||||
end
|
||||
|
||||
local function onError(protocol, error)
|
||||
@@ -30,9 +30,9 @@ end
|
||||
|
||||
local function onCharacterList(protocol, characters, premDays)
|
||||
if enterGame:getChildById('rememberPasswordBox'):isChecked() then
|
||||
ConfigManager.set('account', EnterGame.account)
|
||||
ConfigManager.set('password', EnterGame.password)
|
||||
ConfigManager.set('autologin', tostring(enterGame:getChildById('autoLoginBox'):isChecked()))
|
||||
g_configs.set('account', EnterGame.account)
|
||||
g_configs.set('password', EnterGame.password)
|
||||
g_configs.set('autologin', tostring(enterGame:getChildById('autoLoginBox'):isChecked()))
|
||||
else
|
||||
clearAccountFields()
|
||||
end
|
||||
@@ -40,9 +40,9 @@ local function onCharacterList(protocol, characters, premDays)
|
||||
loadBox:destroy()
|
||||
CharacterList.create(characters, premDays)
|
||||
|
||||
local lastMotdNumber = tonumber(ConfigManager.get("motd"))
|
||||
local lastMotdNumber = tonumber(g_configs.get("motd"))
|
||||
if motdNumber and motdNumber ~= lastMotdNumber then
|
||||
ConfigManager.set("motd", motdNumber)
|
||||
g_configs.set("motd", motdNumber)
|
||||
local motdBox = displayInfoBox("Message of the day", motdMessage)
|
||||
motdBox.onOk = CharacterList.show
|
||||
CharacterList.hide()
|
||||
@@ -53,11 +53,11 @@ end
|
||||
function EnterGame.create()
|
||||
enterGame = UI.display('entergame.otui')
|
||||
|
||||
local account = ConfigManager.get('account')
|
||||
local password = ConfigManager.get('password')
|
||||
local host = ConfigManager.get('host')
|
||||
local port = tonumber(ConfigManager.get('port'))
|
||||
local autologin = toboolean(ConfigManager.get('autologin'))
|
||||
local account = g_configs.get('account')
|
||||
local password = g_configs.get('password')
|
||||
local host = g_configs.get('host')
|
||||
local port = tonumber(g_configs.get('port'))
|
||||
local autologin = toboolean(g_configs.get('autologin'))
|
||||
|
||||
enterGame:getChildById('accountNameLineEdit'):setText(account)
|
||||
enterGame:getChildById('accountPasswordLineEdit'):setText(password)
|
||||
@@ -93,8 +93,8 @@ function EnterGame.doLogin()
|
||||
EnterGame.port = enterGame:getChildById('serverPortLineEdit'):getText()
|
||||
EnterGame.hide()
|
||||
|
||||
ConfigManager.set('host', EnterGame.host)
|
||||
ConfigManager.set('port', EnterGame.port)
|
||||
g_configs.set('host', EnterGame.host)
|
||||
g_configs.set('port', EnterGame.port)
|
||||
|
||||
local protocolLogin = ProtocolLogin.create()
|
||||
protocolLogin.onError = onError
|
||||
|
@@ -1,5 +1,5 @@
|
||||
-- private functions
|
||||
local function onGameKeyPress(self, keyCode, keyChar, keyboardModifiers)
|
||||
local function onGameKeyPress(self, keyCode, keyText, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardCtrlModifier then
|
||||
if keyCode == KeyG then
|
||||
CharacterList.show()
|
||||
|
@@ -6,8 +6,8 @@ local fpsEnabled = false
|
||||
local vsyncEnabled = false
|
||||
|
||||
function getConfig(name, default)
|
||||
if ConfigManager.exists(name) then
|
||||
local val = string.trim(ConfigManager.get(name))
|
||||
if g_configs.exists(name) then
|
||||
local val = string.trim(g_configs.get(name))
|
||||
if val == 'true' or val == 'false' then
|
||||
return toboolean(val)
|
||||
else
|
||||
@@ -15,7 +15,7 @@ function getConfig(name, default)
|
||||
end
|
||||
else
|
||||
if default ~= nil then
|
||||
ConfigManager.set(name, default)
|
||||
g_configs.set(name, default)
|
||||
return default
|
||||
else
|
||||
return nil
|
||||
@@ -24,13 +24,13 @@ function getConfig(name, default)
|
||||
end
|
||||
|
||||
function setConfig(name, value)
|
||||
ConfigManager.set(name, tostring(value))
|
||||
g_configs.set(name, tostring(value))
|
||||
end
|
||||
|
||||
-- private functions
|
||||
function Options.enableVsync(on)
|
||||
vsyncEnabled = on
|
||||
setVerticalSync(on)
|
||||
g_window.setVerticalSync(on)
|
||||
setConfig('vsync', on)
|
||||
end
|
||||
|
||||
|
16
modules/otclient/otclient.lua
Normal file
16
modules/otclient/otclient.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
OTClient = { }
|
||||
|
||||
-- TODO: load and save configurations
|
||||
function OTClient.init()
|
||||
g_window.move({ x=220, y=220 })
|
||||
g_window.resize({ width=800, height=600 })
|
||||
g_window.setTitle('OTClient')
|
||||
g_window.setIcon('otcicon.png')
|
||||
|
||||
addEvent(g_window.show)
|
||||
return true
|
||||
end
|
||||
|
||||
function OTClient.terminate()
|
||||
g_window.hide()
|
||||
end
|
@@ -3,6 +3,8 @@ Module
|
||||
description: Load all other otclient modules
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
autoLoadPriority: 10
|
||||
dependencies:
|
||||
- core
|
||||
- background
|
||||
@@ -16,3 +18,10 @@ Module
|
||||
- chat
|
||||
- outfit
|
||||
- tibiafiles
|
||||
|
||||
onLoad: |
|
||||
require 'otclient'
|
||||
return OTClient.init()
|
||||
|
||||
onUnload: |
|
||||
OTClient.terminate()
|
||||
|
@@ -5,9 +5,9 @@ local currentToolTip
|
||||
|
||||
-- private functions
|
||||
local function moveToolTip(tooltip)
|
||||
local pos = getMouseCursorPos()
|
||||
local pos = g_window.getMousePos()
|
||||
pos.y = pos.y + 1
|
||||
local xdif = getScreenSize().width - (pos.x + tooltip:getWidth())
|
||||
local xdif = g_window.getSize().width - (pos.x + tooltip:getWidth())
|
||||
if xdif < 2 then
|
||||
pos.x = pos.x - tooltip:getWidth() - 3
|
||||
else
|
||||
|
@@ -4,6 +4,7 @@ Module
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoLoad: true
|
||||
autoLoadPriority: 2
|
||||
dependencies:
|
||||
- core
|
||||
|
||||
|
Reference in New Issue
Block a user