mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Add error code to onError protocol event
This commit is contained in:
@@ -123,7 +123,7 @@ function onGameLoginError(message)
|
||||
end
|
||||
end
|
||||
|
||||
function onGameConnectionError(message)
|
||||
function onGameConnectionError(code, message)
|
||||
CharacterList.destroyLoadBox()
|
||||
errorBox = displayErrorBox(tr("Login Error"), message)
|
||||
errorBox.onOk = function()
|
||||
|
@@ -7,21 +7,14 @@ local motdButton
|
||||
local enterGameButton
|
||||
|
||||
-- private functions
|
||||
local function clearAccountFields()
|
||||
enterGame:getChildById('accountNameTextEdit'):clearText()
|
||||
enterGame:getChildById('accountPasswordTextEdit'):clearText()
|
||||
enterGame:getChildById('accountNameTextEdit'):focus()
|
||||
g_settings.remove('account')
|
||||
g_settings.remove('password')
|
||||
end
|
||||
|
||||
local function onError(protocol, message, connectionError)
|
||||
local function onError(protocol, message, errorCode)
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
|
||||
if not connectionError then
|
||||
clearAccountFields()
|
||||
if not errorCode then
|
||||
EnterGame.clearAccountFields()
|
||||
end
|
||||
|
||||
local errorBox = displayErrorBox(tr('Login Error'), message)
|
||||
connect(errorBox, { onOk = EnterGame.show })
|
||||
end
|
||||
@@ -38,7 +31,7 @@ local function onCharacterList(protocol, characters, premDays)
|
||||
g_settings.set('password', g_crypt.encrypt(G.password))
|
||||
g_settings.set('autologin', enterGame:getChildById('autoLoginBox'):isChecked())
|
||||
else
|
||||
clearAccountFields()
|
||||
EnterGame.clearAccountFields()
|
||||
end
|
||||
|
||||
loadBox:destroy()
|
||||
@@ -123,6 +116,15 @@ function EnterGame.openWindow()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function EnterGame.clearAccountFields()
|
||||
enterGame:getChildById('accountNameTextEdit'):clearText()
|
||||
enterGame:getChildById('accountPasswordTextEdit'):clearText()
|
||||
enterGame:getChildById('accountNameTextEdit'):focus()
|
||||
g_settings.remove('account')
|
||||
g_settings.remove('password')
|
||||
end
|
||||
|
||||
function EnterGame.doLogin()
|
||||
G.account = enterGame:getChildById('accountNameTextEdit'):getText()
|
||||
G.password = enterGame:getChildById('accountPasswordTextEdit'):getText()
|
||||
|
Reference in New Issue
Block a user