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.
 
 
 

77 lines
1.8 KiB

  1. require('./globals');
  2. let server = require('./server');
  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 mapList = require('./config/maps/mapList');
  13. let sheets = require('./security/sheets');
  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. animations.init();
  26. mods.init(this.onModsLoaded.bind(this));
  27. },
  28. onModsLoaded: function () {
  29. routerConfig.init();
  30. classes.init();
  31. spellsConfig.init();
  32. spells.init();
  33. itemTypes.init();
  34. profanities.init();
  35. mapList.init();
  36. components.init(this.onComponentsReady.bind(this));
  37. },
  38. onComponentsReady: function () {
  39. skins.init();
  40. factions.init();
  41. clientConfig.init();
  42. server.init(this.onServerReady.bind(this));
  43. },
  44. onServerReady: async function () {
  45. await leaderboard.init();
  46. atlas.init();
  47. sheets.init();
  48. },
  49. onError: async function (e) {
  50. if (e.toString().indexOf('ERR_IPC_CHANNEL_CLOSED') > -1)
  51. return;
  52. _.log('Error Logged: ' + e.toString());
  53. _.log(e.stack);
  54. await io.setAsync({
  55. key: new Date(),
  56. table: 'error',
  57. value: e.toString() + ' | ' + e.stack.toString()
  58. });
  59. process.exit();
  60. }
  61. };
  62. startup.init();