Do not fatal cause of missing spr/dat anymore.
This commit is contained in:
parent
10c564f90e
commit
e27423660c
|
@ -37,11 +37,6 @@ function Client.init()
|
||||||
g_window.setIcon(resolvepath('clienticon.png'))
|
g_window.setIcon(resolvepath('clienticon.png'))
|
||||||
g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
|
g_keyboard.bindKeyDown('Ctrl+Shift+R', Client.reloadScripts)
|
||||||
|
|
||||||
-- load default client version
|
|
||||||
local clientVersion = g_settings.getInteger('client-version')
|
|
||||||
if not clientVersion or clientVersion == 0 then clientVersion = 960 end
|
|
||||||
g_game.setClientVersion(clientVersion)
|
|
||||||
|
|
||||||
connect(g_app, { onRun =
|
connect(g_app, { onRun =
|
||||||
function()
|
function()
|
||||||
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
-- Play startup music (The Silver Tree, by Mattias Westlund)
|
||||||
|
|
|
@ -67,9 +67,7 @@ function EnterGame.init()
|
||||||
local host = g_settings.get('host')
|
local host = g_settings.get('host')
|
||||||
local port = g_settings.get('port')
|
local port = g_settings.get('port')
|
||||||
local autologin = g_settings.getBoolean('autologin')
|
local autologin = g_settings.getBoolean('autologin')
|
||||||
local clientVersion = g_game.getClientVersion()
|
local clientVersion = g_settings.getInteger('client-version')
|
||||||
|
|
||||||
if not clientVersion or clientVersion == 0 then clientVersion = 960 end
|
|
||||||
|
|
||||||
if port == nil or port == 0 then port = 7171 end
|
if port == nil or port == 0 then port = 7171 end
|
||||||
|
|
||||||
|
@ -85,7 +83,10 @@ function EnterGame.init()
|
||||||
for _i, proto in pairs(g_game.getSupportedProtocols()) do
|
for _i, proto in pairs(g_game.getSupportedProtocols()) do
|
||||||
protocolBox:addOption(proto)
|
protocolBox:addOption(proto)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if clientVersion then
|
||||||
protocolBox:setCurrentOption(clientVersion)
|
protocolBox:setCurrentOption(clientVersion)
|
||||||
|
end
|
||||||
|
|
||||||
-- only open entergame when app starts
|
-- only open entergame when app starts
|
||||||
if not g_app.isRunning() then
|
if not g_app.isRunning() then
|
||||||
|
|
|
@ -45,6 +45,9 @@ end
|
||||||
function UIItem:onDestroy()
|
function UIItem:onDestroy()
|
||||||
if self == g_ui.getDraggingWidget() and self.hoveredWho then
|
if self == g_ui.getDraggingWidget() and self.hoveredWho then
|
||||||
self.hoveredWho:setBorderWidth(0)
|
self.hoveredWho:setBorderWidth(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.hoveredWho then
|
||||||
self.hoveredWho = nil
|
self.hoveredWho = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
filename = 'Tibia'
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
connect(g_game, { onClientVersionChange = load })
|
connect(g_game, { onClientVersionChange = load })
|
||||||
end
|
end
|
||||||
|
@ -6,14 +8,24 @@ function terminate()
|
||||||
disconnect(g_game, { onClientVersionChange = load })
|
disconnect(g_game, { onClientVersionChange = load })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function setFileName(name)
|
||||||
|
filename = name
|
||||||
|
end
|
||||||
|
|
||||||
function load()
|
function load()
|
||||||
local version = g_game.getClientVersion()
|
local version = g_game.getClientVersion()
|
||||||
local datPath = resolvepath(version .. '/Tibia.dat')
|
local datPath = resolvepath(version .. '/' .. filename .. '.dat')
|
||||||
local sprPath = resolvepath(version .. '/Tibia.spr')
|
local sprPath = resolvepath(version .. '/' .. filename .. '.spr')
|
||||||
|
|
||||||
|
local errorMessage = ''
|
||||||
if not g_things.loadDat(datPath) then
|
if not g_things.loadDat(datPath) then
|
||||||
fatal(tr("Unable to load dat file, please place a valid dat in '%s'", datPath))
|
errorMessage = errorMessage .. tr("Unable to load dat file, please place a valid dat in '%s'", datPath) .. '\n'
|
||||||
end
|
end
|
||||||
if not g_sprites.loadSpr(sprPath) then
|
if not g_sprites.loadSpr(sprPath) then
|
||||||
fatal(tr("Unable to load spr file, please place a valid spr in '%s'", sprPath))
|
errorMessage = errorMessage .. tr("Unable to load spr file, please place a valid spr in '%s'", sprPath) .. '\n'
|
||||||
|
end
|
||||||
|
|
||||||
|
if errorMessage:len() > 0 then
|
||||||
|
displayErrorBox(tr('Error'), errorMessage)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue