mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
Format name as a feature, do not connect if dont have dat/spr
This commit is contained in:
@@ -37,11 +37,6 @@ function Client.init()
|
||||
g_window.setIcon(resolvepath('clienticon.png'))
|
||||
g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
|
||||
|
||||
local clientVersion = g_settings.getInteger('client-version')
|
||||
if clientVersion ~= 0 then
|
||||
g_game.setClientVersion(clientVersion)
|
||||
end
|
||||
|
||||
connect(g_app, { onRun =
|
||||
function()
|
||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||
@@ -58,6 +53,11 @@ function Client.terminate()
|
||||
g_settings.set('window-size', g_window.getUnmaximizedSize())
|
||||
g_settings.set('window-pos', g_window.getUnmaximizedPos())
|
||||
g_settings.set('window-maximized', g_window.isMaximized())
|
||||
g_settings.set('client-version', g_game.getClientVersion())
|
||||
|
||||
local clientVersion = g_game.getClientVersion()
|
||||
if clientVersion ~= 0 then
|
||||
g_settings.set('client-version', clientVersion)
|
||||
end
|
||||
|
||||
Client = nil
|
||||
end
|
||||
|
@@ -169,7 +169,14 @@ function EnterGame.doLogin()
|
||||
|
||||
g_game.chooseRsa(G.host)
|
||||
g_game.setClientVersion(clientVersion)
|
||||
protocolLogin:login(G.host, G.port, G.account, G.password)
|
||||
|
||||
if modules.game_tibiafiles.isLoaded() then
|
||||
protocolLogin:login(G.host, G.port, G.account, G.password)
|
||||
else
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
EnterGame.show()
|
||||
end
|
||||
end
|
||||
|
||||
function EnterGame.displayMotd()
|
||||
|
@@ -1,4 +1,5 @@
|
||||
filename = 'Tibia'
|
||||
loaded = false
|
||||
|
||||
function init()
|
||||
connect(g_game, { onClientVersionChange = load })
|
||||
@@ -12,6 +13,10 @@ function setFileName(name)
|
||||
filename = name
|
||||
end
|
||||
|
||||
function isLoaded()
|
||||
return loaded
|
||||
end
|
||||
|
||||
function load()
|
||||
local version = g_game.getClientVersion()
|
||||
local datPath = resolvepath(version .. '/' .. filename .. '.dat')
|
||||
@@ -22,10 +27,17 @@ function load()
|
||||
errorMessage = errorMessage .. tr("Unable to load dat file, please place a valid dat in '%s'", datPath) .. '\n'
|
||||
end
|
||||
if not g_sprites.loadSpr(sprPath) then
|
||||
errorMessage = errorMessage .. tr("Unable to load spr file, please place a valid spr in '%s'", sprPath) .. '\n'
|
||||
errorMessage = errorMessage .. tr("Unable to load spr file, please place a valid spr in '%s'", sprPath)
|
||||
end
|
||||
|
||||
loaded = (errorMessage:len() == 0)
|
||||
|
||||
if errorMessage:len() > 0 then
|
||||
displayErrorBox(tr('Error'), errorMessage)
|
||||
local messageBox = displayErrorBox(tr('Error'), errorMessage)
|
||||
addEvent(function() messageBox:raise() messageBox:focus() end)
|
||||
|
||||
disconnect(g_game, { onClientVersionChange = load })
|
||||
g_game.setClientVersion(0)
|
||||
connect(g_game, { onClientVersionChange = load })
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user