mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-12-16 08:59:46 +01:00
Version 2.4 - http://otclient.net/showthread.php?tid=160
This commit is contained in:
84
init.lua
84
init.lua
@@ -1,27 +1,27 @@
|
||||
-- CONFIG
|
||||
APP_NAME = "otclientv8" -- important, change it, it's name for config dir and files in appdata
|
||||
APP_VERSION = 1337 -- client version for updater and login to identify outdated client
|
||||
DEFAULT_LAYOUT = "retro"
|
||||
APP_NAME = "otclientv8" -- important, change it, it's name for config dir and files in appdata
|
||||
APP_VERSION = 1337 -- client version for updater and login to identify outdated client
|
||||
DEFAULT_LAYOUT = "retro" -- on android it's forced to "mobile", check code bellow
|
||||
|
||||
-- If you don't use updater or other service, set it to updater = ""
|
||||
Services = {
|
||||
website = "http://otclient.ovh", -- currently not used
|
||||
updater = "",
|
||||
updater = "http://otclient.ovh/api/updater.php",
|
||||
stats = "",
|
||||
crash = "http://otclient.ovh/api/crash.php",
|
||||
feedback = "",
|
||||
feedback = "http://otclient.ovh/api/feedback.php",
|
||||
status = "http://otclient.ovh/api/status.php"
|
||||
}
|
||||
|
||||
-- Servers accept http login url, websocket login url or ip:port:version
|
||||
Servers = {
|
||||
-- OTClientV8c = "otclient.ovh:7171:1099:25:30:80:90",
|
||||
-- OTClientV8 = "http://otclient.ovh/api/login.php",
|
||||
-- OTClientV8proxy = "http://otclient.ovh/api/login.php?proxy=1",
|
||||
-- OTClientV8Test = "http://otclient.ovh/api/login2.php",
|
||||
--[[ OTClientV8 = "http://otclient.ovh/api/login.php",
|
||||
OTClientV8c = "otclient.ovh:7171",
|
||||
OTClientV8Test = "http://otclient.ovh/api/login2.php",
|
||||
LocalTestServ = "127.0.0.1:7171:1098:110:30:93" ]]
|
||||
}
|
||||
|
||||
USE_NEW_ENERGAME = false -- not done yet
|
||||
--USE_NEW_ENERGAME = true -- uses entergamev2 based on websockets instead of entergame
|
||||
ALLOW_CUSTOM_SERVERS = true -- if true it shows option ANOTHER on server list
|
||||
|
||||
g_app.setName("OTCv8")
|
||||
@@ -39,52 +39,50 @@ if not g_resources.directoryExists("/modules") then
|
||||
g_logger.fatal("Modules dir doesn't exist.")
|
||||
end
|
||||
|
||||
-- send and delete crash report if exist
|
||||
if Services.crash ~= nil and Services.crash:len() > 4 then
|
||||
local crashLog = g_resources.readCrashLog(false)
|
||||
local crashLogTxt = g_resources.readCrashLog(true)
|
||||
local normalLog = g_logger.getLastLog()
|
||||
local crashed = false
|
||||
if crashLog:len() > 0 then
|
||||
g_http.post(Services.crash .. "?txt=0&version=" .. g_app.getVersion(), crashLog)
|
||||
crashed = true
|
||||
end
|
||||
if crashLogTxt:len() > 0 then
|
||||
g_http.post(Services.crash .. "?txt=1&version=" .. g_app.getVersion(), crashLogTxt)
|
||||
crashed = true
|
||||
end
|
||||
if crashed and normalLog:len() > 0 then
|
||||
g_http.post(Services.crash .. "?txt=2&version=" .. g_app.getVersion(), normalLog)
|
||||
end
|
||||
g_resources.deleteCrashLog()
|
||||
end
|
||||
|
||||
-- settings
|
||||
g_configs.loadSettings("/config.otml")
|
||||
|
||||
-- set layout
|
||||
local settings = g_configs.getSettings()
|
||||
local layout = DEFAULT_LAYOUT
|
||||
if settings:exists('layout') then
|
||||
if g_app.isMobile() then
|
||||
layout = "mobile"
|
||||
elseif settings:exists('layout') then
|
||||
layout = settings:getValue('layout')
|
||||
end
|
||||
g_resources.setLayout(layout)
|
||||
|
||||
-- load mods
|
||||
g_modules.discoverModules()
|
||||
|
||||
-- libraries modules 0-99
|
||||
g_modules.autoLoadModules(99)
|
||||
g_modules.ensureModuleLoaded("corelib")
|
||||
g_modules.ensureModuleLoaded("gamelib")
|
||||
|
||||
local function loadModules()
|
||||
-- libraries modules 0-99
|
||||
g_modules.autoLoadModules(99)
|
||||
g_modules.ensureModuleLoaded("gamelib")
|
||||
|
||||
-- client modules 100-499
|
||||
g_modules.autoLoadModules(499)
|
||||
g_modules.ensureModuleLoaded("client")
|
||||
-- client modules 100-499
|
||||
g_modules.autoLoadModules(499)
|
||||
g_modules.ensureModuleLoaded("client")
|
||||
|
||||
-- game modules 500-999
|
||||
g_modules.autoLoadModules(999)
|
||||
g_modules.ensureModuleLoaded("game_interface")
|
||||
-- game modules 500-999
|
||||
g_modules.autoLoadModules(999)
|
||||
g_modules.ensureModuleLoaded("game_interface")
|
||||
|
||||
-- mods 1000-9999
|
||||
g_modules.autoLoadModules(9999)
|
||||
-- mods 1000-9999
|
||||
g_modules.autoLoadModules(9999)
|
||||
end
|
||||
|
||||
-- report crash
|
||||
if type(Services.crash) == 'string' and Services.crash:len() > 4 and g_modules.getModule("crash_reporter") then
|
||||
g_modules.ensureModuleLoaded("crash_reporter")
|
||||
end
|
||||
|
||||
-- run updater, must use data.zip
|
||||
if type(Services.updater) == 'string' and Services.updater:len() > 4
|
||||
and g_resources.isLoadedFromArchive() and g_modules.getModule("updater") then
|
||||
g_modules.ensureModuleLoaded("updater")
|
||||
return Updater.init(loadModules)
|
||||
end
|
||||
|
||||
loadModules()
|
||||
|
||||
Reference in New Issue
Block a user