Froze the gold tick

This commit is contained in:
2019-06-19 20:33:03 +10:00
parent 13c1f45d1d
commit 74696d717b
3 changed files with 26 additions and 3 deletions
+5 -3
View File
@@ -18,13 +18,15 @@ const statisticsRequest = (connection) => (req, res) => {
//determine the correct tick rate based on the current gold average
//NOTE: copy/pasted
let tickRate = (() => {
//TMP: freeze the tick rate
return null;
if (results[0].goldAverage < 120) return 5;
if (results[0].goldAverage < 130) return 15;
if (results[0].goldAverage < 140) return 30;
return 60; //slow it way down
})();
let nextTick = tickRate - (new Date()).getMinutes() % tickRate;
let nextTick = tickRate ? tickRate - (new Date()).getMinutes() % tickRate : null;
let query = 'SELECT COUNT(*) AS activity FROM accounts WHERE lastActivityTime >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY);';
connection.query(query, (err, results) => {
@@ -49,8 +51,8 @@ const statisticsRequest = (connection) => (req, res) => {
'Scientist Total': scientistTotal,
'Spy Total': { string: '[Classified]', color: 'red' },
'Gold Average': `${round(goldAverage)}`,
'Gold Tick Rate': `${tickRate} minutes`,
'Gold Next Tick': `${nextTick} minute${nextTick === 1 ? '' : 's'} from now`
'Gold Tick Rate': tickRate ? `${tickRate} minutes` : { string: 'Frozen', color: 'red' },
'Gold Next Tick': nextTick ? `${nextTick} minute${nextTick === 1 ? '' : 's'} from now` : { string: 'Frozen', color: 'red' }
});
res.end();
});