Guest User

Untitled

a guest
May 31st, 2021
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- CONFIG
  2. APP_NAME = "DBUniverse"  -- important, change it, it's name for config dir and files in appdata
  3. APP_VERSION = 1341       -- client version for updater and login to identify outdated client
  4. DEFAULT_LAYOUT = "default" -- on android it's forced to "mobile", check code bellow
  5.  
  6. -- If you don't use updater or other service, set it to updater = ""
  7. Services = {
  8.   website = "http://testserver.net", -- currently not used
  9.   updater = "http://testserver.net/updater/updater_advanced.php",
  10.   stats = "",
  11.   crash = "http://otclient.ovh/api/crash.php",
  12.   feedback = "http://otclient.ovh/api/feedback.php",
  13.   status = ""
  14. }
  15.  
  16. -- Servers accept http login url, websocket login url or ip:port:version
  17. Servers = {
  18.   Localhost = "127.0.0.1:7171:860"
  19. }
  20.  
  21. --USE_NEW_ENERGAME = true -- uses entergamev2 based on websockets instead of entergame
  22. ALLOW_CUSTOM_SERVERS = false -- if true it shows option ANOTHER on server list
  23.  
  24. g_app.setName("DBUniverse")
  25. -- CONFIG END
  26.  
  27. -- print first terminal message
  28. g_logger.info(os.date("== application started at %b %d %Y %X"))
  29. --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())
  30.  
  31. if not g_resources.directoryExists("/data") then
  32.   g_logger.fatal("Data dir doesn't exist.")
  33. end
  34.  
  35. if not g_resources.directoryExists("/modules") then
  36.   g_logger.fatal("Modules dir doesn't exist.")
  37. end
  38.  
  39. -- settings
  40. g_configs.loadSettings("/config.otml")
  41.  
  42. -- set layout
  43. local settings = g_configs.getSettings()
  44. local layout = DEFAULT_LAYOUT
  45. if g_app.isMobile() then
  46.   layout = "mobile"
  47. elseif settings:exists('layout') then
  48.   layout = settings:getValue('layout')
  49. end
  50. g_resources.setLayout(layout)
  51. g_logger.info(layout)
  52.  
  53. -- load mods
  54. g_modules.discoverModules()
  55. g_modules.ensureModuleLoaded("corelib")
  56.  
  57. local function loadModules()
  58.   -- libraries modules 0-99
  59.   g_modules.autoLoadModules(99)
  60.   g_modules.ensureModuleLoaded("gamelib")
  61.  
  62.   -- client modules 100-499
  63.   g_modules.autoLoadModules(499)
  64.   g_modules.ensureModuleLoaded("client")
  65.  
  66.   -- game modules 500-999
  67.   g_modules.autoLoadModules(999)
  68.   g_modules.ensureModuleLoaded("game_interface")
  69.  
  70.   -- mods 1000-9999
  71.   g_modules.autoLoadModules(9999)
  72. end
  73.  
  74. -- report crash
  75. if type(Services.crash) == 'string' and Services.crash:len() > 4 and g_modules.getModule("crash_reporter") then
  76.   g_modules.ensureModuleLoaded("crash_reporter")
  77. end
  78.  
  79. -- run updater, must use data.zip
  80. if type(Services.updater) == 'string' and Services.updater:len() > 4
  81.   and g_resources.isLoadedFromArchive() and g_modules.getModule("updater") then
  82.   g_modules.ensureModuleLoaded("updater")
  83.   return Updater.init(loadModules)
  84. end
  85.  
  86. loadModules()
  87.  
RAW Paste Data