|
|
@ -1,4 +1,5 @@
|
|
|
|
filename = 'Tibia'
|
|
|
|
filename = 'Tibia'
|
|
|
|
|
|
|
|
loaded = false
|
|
|
|
|
|
|
|
|
|
|
|
function init()
|
|
|
|
function init()
|
|
|
|
connect(g_game, { onClientVersionChange = load })
|
|
|
|
connect(g_game, { onClientVersionChange = load })
|
|
|
@ -12,6 +13,10 @@ function setFileName(name)
|
|
|
|
filename = name
|
|
|
|
filename = name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isLoaded()
|
|
|
|
|
|
|
|
return loaded
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function load()
|
|
|
|
function load()
|
|
|
|
local version = g_game.getClientVersion()
|
|
|
|
local version = g_game.getClientVersion()
|
|
|
|
local datPath = resolvepath(version .. '/' .. filename .. '.dat')
|
|
|
|
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'
|
|
|
|
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
|
|
|
|
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
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loaded = (errorMessage:len() == 0)
|
|
|
|
|
|
|
|
|
|
|
|
if errorMessage:len() > 0 then
|
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|
|
|
|