You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

79 lines
1.8 KiB

  1. require('./globals');
  2. let server = require('./server/index');
  3. let components = require('./components/components');
  4. let mods = require('./misc/mods');
  5. let animations = require('./config/animations');
  6. let skins = require('./config/skins');
  7. let factions = require('./config/factions');
  8. let classes = require('./config/spirits');
  9. let spellsConfig = require('./config/spellsConfig');
  10. let spells = require('./config/spells');
  11. let itemTypes = require('./items/config/types');
  12. let recipes = require('./config/recipes/recipes');
  13. let mapList = require('./config/maps/mapList');
  14. let fixes = require('./fixes/fixes');
  15. let profanities = require('./misc/profanities');
  16. const routerConfig = require('./security/routerConfig');
  17. let startup = {
  18. init: function () {
  19. io.init(this.onDbReady.bind(this));
  20. },
  21. onDbReady: async function () {
  22. await fixes.fixDb();
  23. process.on('unhandledRejection', this.onError.bind(this));
  24. process.on('uncaughtException', this.onError.bind(this));
  25. await mods.init();
  26. this.onModsLoaded();
  27. },
  28. onModsLoaded: function () {
  29. animations.init();
  30. routerConfig.init();
  31. classes.init();
  32. spellsConfig.init();
  33. spells.init();
  34. recipes.init();
  35. itemTypes.init();
  36. profanities.init();
  37. mapList.init();
  38. components.init(this.onComponentsReady.bind(this));
  39. },
  40. onComponentsReady: async function () {
  41. skins.init();
  42. factions.init();
  43. await clientConfig.init();
  44. await server.init();
  45. await leaderboard.init();
  46. atlas.init();
  47. },
  48. onError: async function (e) {
  49. if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1)
  50. return;
  51. _.log('Error Logged: ' + e.toString());
  52. _.log(e.stack);
  53. await io.setAsync({
  54. key: new Date(),
  55. table: 'error',
  56. value: e.toString() + ' | ' + e.stack.toString()
  57. });
  58. process.exit();
  59. }
  60. };
  61. startup.init();