This commit is contained in:
OTCv8
2020-07-23 02:37:11 +02:00
parent a65844f182
commit 929ab400ed
19 changed files with 489 additions and 84 deletions

View File

@@ -125,11 +125,13 @@ end
function onGameConnectionError(message, code)
CharacterList.destroyLoadBox()
local text = translateNetworkError(code, g_game.getProtocolGame() and g_game.getProtocolGame():isConnecting(), message)
errorBox = displayErrorBox(tr("Connection Error"), text)
errorBox.onOk = function()
errorBox = nil
CharacterList.showAgain()
if (not g_game.isOnline() or code ~= 2) and not errorBox then -- code 2 is normal disconnect, end of file
local text = translateNetworkError(code, g_game.getProtocolGame() and g_game.getProtocolGame():isConnecting(), message)
errorBox = displayErrorBox(tr("Connection Error"), text)
errorBox.onOk = function()
errorBox = nil
CharacterList.showAgain()
end
end
scheduleAutoReconnect()
end
@@ -144,8 +146,8 @@ function onGameUpdateNeeded(signature)
end
function onGameEnd()
CharacterList.showAgain()
scheduleAutoReconnect()
CharacterList.showAgain()
end
function onLogout()
@@ -163,7 +165,7 @@ function scheduleAutoReconnect()
end
function executeAutoReconnect()
if not autoReconnectButton or not autoReconnectButton:isOn() then
if not autoReconnectButton or not autoReconnectButton:isOn() or g_game.isOnline() then
return
end
if errorBox then

View File

@@ -63,6 +63,12 @@ local function onUpdateNeeded(protocol, signature)
return EnterGame.onError(tr('Your client needs updating, try redownloading it.'))
end
local function onProxyList(protocol, proxies)
for _, proxy in ipairs(proxies) do
g_proxy.addProxy(proxy["host"], proxy["port"], proxy["priority"])
end
end
local function parseFeatures(features)
for feature_id, value in pairs(features) do
if value == "1" or value == "true" or value == true then
@@ -468,6 +474,7 @@ function EnterGame.doLogin()
protocolLogin.onSessionKey = onSessionKey
protocolLogin.onCharacterList = onCharacterList
protocolLogin.onUpdateNeeded = onUpdateNeeded
protocolLogin.onProxyList = onProxyList
EnterGame.hide()
loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...'))