forked from OTCv8/otclientv8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
78 lines (66 loc) · 2.59 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
-- 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
-- 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",
news = "http://otclient.ovh/api/news.php",
stats = "",
crash = "http://otclient.ovh/api/crash.php",
feedback = "http://otclient.ovh/api/feedback.php"
}
-- Servers accept http login url or ip:port:version
Servers = {
OTClientV8 = "http://otclient.ovh/api/login.php",
OTClientV8proxy = "http://otclient.ovh/api/login.php?proxy=1",
OTClientV8classic = "otclient.ovh:7171:1099",
OTClientV8cwithfeatures = "otclient.ovh:7171:1099:25:30:80:90",
OTClientV8Test = "http://otclient.ovh/api/login2.php"
}
ALLOW_CUSTOM_SERVERS = true -- if true it shows option ANOTHER on server list
-- 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
-- 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", crashLog)
crashed = true
end
if crashLogTxt:len() > 0 then
g_http.post(Services.crash .. "?txt=1", crashLogTxt)
crashed = true
end
if crashed and normalLog:len() > 0 then
g_http.post(Services.crash .. "?txt=2", normalLog)
end
g_resources.deleteCrashLog()
end
-- settings
g_configs.loadSettings("/config.otml")
-- load mods
g_modules.discoverModules()
-- libraries modules 0-99
g_modules.autoLoadModules(99)
g_modules.ensureModuleLoaded("corelib")
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)