mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
Many changes
* IMPORTANT: dat/spr should now be placed in /data/things/ * Rename game_tibiafiles to game_things * Make battle list algorithm much faster * Split UITabBar into UITabBar and UIMoveableTabBar * Fix other minor issues
This commit is contained in:
@@ -30,7 +30,8 @@ local function tryLogin(charInfo, tries)
|
||||
|
||||
CharacterList.destroyLoadBox()
|
||||
|
||||
g_game.loginWorld(G.account, G.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName)
|
||||
local locale = modules.client_locales.getCurrentLocale().name
|
||||
g_game.loginWorld(G.account, G.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName, locale)
|
||||
|
||||
loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to game server...'))
|
||||
connect(loadBox, { onCancel = function()
|
||||
@@ -82,6 +83,7 @@ local function resendWait()
|
||||
if selected then
|
||||
local charInfo = { worldHost = selected.worldHost,
|
||||
worldPort = selected.worldPort,
|
||||
worldName = selected.worldName,
|
||||
characterName = selected.characterName }
|
||||
tryLogin(charInfo)
|
||||
end
|
||||
@@ -119,9 +121,19 @@ function onGameConnectionError(message, code)
|
||||
end
|
||||
end
|
||||
|
||||
function onGameUpdateNeeded(signature)
|
||||
CharacterList.destroyLoadBox()
|
||||
errorBox = displayErrorBox(tr("Update needed"), tr('Enter with your account again to update your client.'))
|
||||
errorBox.onOk = function()
|
||||
errorBox = nil
|
||||
CharacterList.showAgain()
|
||||
end
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function CharacterList.init()
|
||||
connect(g_game, { onLoginError = onGameLoginError })
|
||||
connect(g_game, { onUpdateNeeded = onGameUpdateNeeded })
|
||||
connect(g_game, { onConnectionError = onGameConnectionError })
|
||||
connect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||
connect(g_game, { onLoginWait = onLoginWait })
|
||||
@@ -134,6 +146,7 @@ end
|
||||
|
||||
function CharacterList.terminate()
|
||||
disconnect(g_game, { onLoginError = onGameLoginError })
|
||||
disconnect(g_game, { onUpdateNeeded = onGameUpdateNeeded })
|
||||
disconnect(g_game, { onConnectionError = onGameConnectionError })
|
||||
disconnect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||
disconnect(g_game, { onLoginWait = onLoginWait })
|
||||
@@ -208,6 +221,7 @@ function CharacterList.create(characters, account, otui)
|
||||
|
||||
-- these are used by login
|
||||
widget.characterName = characterInfo.name
|
||||
widget.worldName = characterInfo.worldName
|
||||
widget.worldHost = characterInfo.worldIp
|
||||
widget.worldPort = characterInfo.worldPort
|
||||
|
||||
@@ -281,6 +295,7 @@ function CharacterList.doLogin()
|
||||
if selected then
|
||||
local charInfo = { worldHost = selected.worldHost,
|
||||
worldPort = selected.worldPort,
|
||||
worldName = selected.worldName,
|
||||
characterName = selected.characterName }
|
||||
charactersWindow:hide()
|
||||
tryLogin(charInfo)
|
||||
|
@@ -58,6 +58,17 @@ local function onChangeProtocol(combobox, option)
|
||||
protocolBox:setTooltip("Supports Client" .. (#clients > 1 and "s" or "") .. ": " .. table.toString(clients))
|
||||
end
|
||||
|
||||
local function onUpdateNeeded(protocol, signature)
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
|
||||
if updateFunc then
|
||||
local continueFunc = EnterGame.show
|
||||
local cancelFunc = EnterGame.show
|
||||
updateFunc(signature, continueFunc, cancelFunc)
|
||||
end
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function EnterGame.init()
|
||||
enterGame = g_ui.displayUI('entergame')
|
||||
@@ -118,6 +129,7 @@ end
|
||||
|
||||
function EnterGame.terminate()
|
||||
g_keyboard.unbindKeyDown('Ctrl+G')
|
||||
removeEvent(autoLoginEvent)
|
||||
enterGame:destroy()
|
||||
enterGame = nil
|
||||
enterGameButton:destroy()
|
||||
@@ -183,6 +195,7 @@ function EnterGame.doLogin()
|
||||
protocolLogin.onError = onError
|
||||
protocolLogin.onMotd = onMotd
|
||||
protocolLogin.onCharacterList = onCharacterList
|
||||
protocolLogin.onUpdateNeeded = onUpdateNeeded
|
||||
|
||||
loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...'))
|
||||
connect(loadBox, { onCancel = function(msgbox)
|
||||
@@ -197,8 +210,9 @@ function EnterGame.doLogin()
|
||||
g_game.setClientVersion(clientVersions[#clientVersions])
|
||||
end
|
||||
|
||||
if modules.game_tibiafiles.isLoaded() then
|
||||
protocolLogin:login(G.host, G.port, G.account, G.password)
|
||||
if modules.game_things.isLoaded() then
|
||||
local locale = modules.client_locales.getCurrentLocale().name
|
||||
protocolLogin:login(G.host, G.port, G.account, G.password, locale)
|
||||
else
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
@@ -264,3 +278,9 @@ function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeig
|
||||
if not windowHeight then windowHeight = 200 end
|
||||
enterGame:setHeight(windowHeight)
|
||||
end
|
||||
|
||||
function EnterGame.setServerInfo(message)
|
||||
local label = enterGame:getChildById('serverInfoLabel')
|
||||
label:setText(message)
|
||||
end
|
||||
|
||||
|
@@ -12,7 +12,7 @@ EnterGameWindow
|
||||
anchors.top: parent.top
|
||||
text-auto-resize: true
|
||||
|
||||
TextEdit
|
||||
PasswordTextEdit
|
||||
id: accountNameTextEdit
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@@ -86,7 +86,7 @@ EnterGameWindow
|
||||
CheckBox
|
||||
id: rememberPasswordBox
|
||||
!text: tr('Remember password')
|
||||
!tooltip: tr('Remember account and password when starts otclient')
|
||||
!tooltip: tr('Remember account and password when starts client')
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
@@ -97,7 +97,7 @@ EnterGameWindow
|
||||
id: autoLoginBox
|
||||
enabled: false
|
||||
!text: tr('Auto login')
|
||||
!tooltip: tr('Open charlist automatically when starting otclient')
|
||||
!tooltip: tr('Open charlist automatically when starting client')
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
@@ -109,3 +109,10 @@ EnterGameWindow
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
@onClick: EnterGame.doLogin()
|
||||
|
||||
Label
|
||||
id: serverInfoLabel
|
||||
font: verdana-11px-rounded
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
color: green
|
||||
|
Reference in New Issue
Block a user