-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
92 lines (76 loc) · 3.09 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
-- CONFIG
APP_NAME = "otclientv8" -- important, change it, it's name for config dir and files in appdata
APP_VERSION = 1341 -- 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 = "http://otclient.ovh/api/updater.php",
stats = "",
crash = "http://otclient.ovh/api/crash.php",
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 = {
--[[ OTClientV8 = "http://otclient.ovh/api/login.php",
OTClientV8proxy = "http://otclient.ovh/api/login.php?proxy=1",
OTClientV8c = "otclient.ovh:7171:1099:25:30:80:90",
OTClientV8Test = "http://otclient.ovh/api/login2.php",
Evoulinia = "evolunia.net:7171:1098",
GarneraTest = "garnera-global.net:7171:1100",
LocalTestServ = "127.0.0.1:7171:1098:110:30:93" ]]
}
--Server = "ws://otclient.ovh:3000/"
--Server = "ws://127.0.0.1:88/"
--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")
-- CONFIG END
-- print first terminal message
g_logger.info(os.date("== application started at %b %d %Y %X"))
g_logger.info(g_app.getName() .. ' ' .. g_app.getVersion() .. ' rev ' .. g_app.getBuildRevision() .. ' (' .. g_app.getBuildCommit() .. ') made by ' .. g_app.getAuthor() .. ' built on ' .. g_app.getBuildDate() .. ' for arch ' .. g_app.getBuildArch())
if not g_resources.directoryExists("/data") then
g_logger.fatal("Data dir doesn't exist.")
end
if not g_resources.directoryExists("/modules") then
g_logger.fatal("Modules dir doesn't exist.")
end
-- settings
g_configs.loadSettings("/config.otml")
-- set layout
local settings = g_configs.getSettings()
local layout = DEFAULT_LAYOUT
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()
g_modules.ensureModuleLoaded("corelib")
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")
-- game modules 500-999
g_modules.autoLoadModules(999)
g_modules.ensureModuleLoaded("game_interface")
-- 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()