From 74696d717be5bbf5e32b66f5729699b6109c4947 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 19 Jun 2019 20:33:03 +1000 Subject: [PATCH] Froze the gold tick --- public/news/2019-06-19-01.md | 12 ++++++++++++ server/profiles.js | 9 +++++++++ server/statistics.js | 8 +++++--- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 public/news/2019-06-19-01.md diff --git a/public/news/2019-06-19-01.md b/public/news/2019-06-19-01.md new file mode 100644 index 0000000..b04e5fc --- /dev/null +++ b/public/news/2019-06-19-01.md @@ -0,0 +1,12 @@ +It's Freezing In Here! +--- +_19 June 2019_ + +I've frozen the gold tick due to the recent surge in the gold supply. This is a temporary measure, as I'm hoping it'll drop to a more reasonable level as players do their thing. + +I'm hoping to pull another all nighter tonight, simply because I do my best work at night. I'm also planning on releasing "content updates" every Sunday my time to keep everyone entertained. I'll try to add _something_ new gameplay-wise every week. + +I've also noticed that the active player count has dropped to a worryingly low level, but this is because I haven't been advertising this game. I plan to post this across reddit again, so... new players inbound, hopefully. + +I need to pull myself out of this comfy bed. + diff --git a/server/profiles.js b/server/profiles.js index 9795644..306081b 100644 --- a/server/profiles.js +++ b/server/profiles.js @@ -479,6 +479,8 @@ const runGoldTick = (connection) => { //determine the correct tick rate based on the current gold average 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; @@ -489,6 +491,13 @@ const runGoldTick = (connection) => { if (oldTickRate !== tickRate) { if (goldTickJob) goldTickJob.stop(); + //TMP: freeze the tickRate + if (tickRate === null) { + log('Tick rate frozen'); + oldTickRate = tickRate; + return; + } + goldTickJob = new CronJob(`0 */${tickRate} * * * *`, () => { let query = 'UPDATE profiles SET gold = gold + recruits;'; connection.query(query, (err) => { diff --git a/server/statistics.js b/server/statistics.js index 482fc36..17aa8e3 100644 --- a/server/statistics.js +++ b/server/statistics.js @@ -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(); });