diff --git a/server/game2006service/tasks/factory.js b/server/game2006service/tasks/factory.js index 0ff3a34b..8345ea4d 100644 --- a/server/game2006service/tasks/factory.js +++ b/server/game2006service/tasks/factory.js @@ -8,6 +8,7 @@ function add(name) { function init() { add('fragment'); add('damping'); + add('season'); } exports.init = init; diff --git a/server/game2006service/tasks/season.js b/server/game2006service/tasks/season.js new file mode 100644 index 00000000..0da9c51c --- /dev/null +++ b/server/game2006service/tasks/season.js @@ -0,0 +1,32 @@ +const app = require('j7/app'); +const utils = require('j7/utils'); +const metaFactory = require('../metadata/factory'); + +const constant = require('../constant'); + +class Season { + async start() { + while (true) { + await this.doRoutine(utils.getUtcTime()); + const nowTime = utils.getUtcTime(); + const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE); + const sleepTime = daySeconds + 3600 * 24 - nowTime; + await utils.sleep(sleepTime*1000); + } + } + + async doRoutine(nowTime) { + try { + + } + catch(err) { + console.log(err); + } + } +} + +function init() { + (new Season()).start(); +} + +exports.init = init; \ No newline at end of file