From a58bf4ee2b72d8c1669fd4975dea8ac17f7cc7e9 Mon Sep 17 00:00:00 2001 From: MathWhiz Date: Wed, 8 Jun 2016 17:47:06 -0400 Subject: [PATCH] Turn automaticAllocation to false when resetting or rebirthing closes #7627 fixes #7620 --- common/script/ops/rebirth.js | 2 ++ common/script/ops/reset.js | 2 ++ test/common/ops/rebirth.js | 16 ++++++++++++++++ test/common/ops/reset.js | 16 ++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/common/script/ops/rebirth.js b/common/script/ops/rebirth.js index 57bdfc181b..e1fab0b68b 100644 --- a/common/script/ops/rebirth.js +++ b/common/script/ops/rebirth.js @@ -52,6 +52,8 @@ module.exports = function rebirth (user, tasks = [], req = {}, analytics) { stats.lvl = 1; stats.class = 'warrior'; + user.preferences.automaticAllocation = false; + _.each(USERSTATSLIST, function resetStats (value) { stats[value] = 0; }); diff --git a/common/script/ops/reset.js b/common/script/ops/reset.js index 3e48fa4f2d..f788356242 100644 --- a/common/script/ops/reset.js +++ b/common/script/ops/reset.js @@ -18,6 +18,8 @@ module.exports = function reset (user, tasks = [], req = {}) { resetGear(user); + user.preferences.automaticAllocation = false; + if (req.v2 === true) { return user; } else { diff --git a/test/common/ops/rebirth.js b/test/common/ops/rebirth.js index 9916144669..9fd766b863 100644 --- a/test/common/ops/rebirth.js +++ b/test/common/ops/rebirth.js @@ -233,4 +233,20 @@ describe('shared.ops.rebirth', () => { expect(user.achievements.rebirths).to.equal(2); expect(user.achievements.rebirthLevel).to.equal(MAX_LEVEL); }); + + it('keeps automaticAllocation false', () => { + user.preferences.automaticAllocation = false; + + rebirth(user); + + expect(user.preferences.automaticAllocation).to.be.false; + }); + + it('sets automaticAllocation to false when true', () => { + user.preferences.automaticAllocation = true; + + rebirth(user); + + expect(user.preferences.automaticAllocation).to.be.false; + }); }); diff --git a/test/common/ops/reset.js b/test/common/ops/reset.js index 50ebf90cb5..107f15f27c 100644 --- a/test/common/ops/reset.js +++ b/test/common/ops/reset.js @@ -76,4 +76,20 @@ describe('shared.ops.reset', () => { expect(user.tasksOrder.dailys).to.be.empty; expect(user.tasksOrder.rewards).to.be.empty; }); + + it('keeps automaticAllocation false', () => { + user.preferences.automaticAllocation = false; + + reset(user); + + expect(user.preferences.automaticAllocation).to.be.false; + }); + + it('sets automaticAllocation to false when true', () => { + user.preferences.automaticAllocation = true; + + reset(user); + + expect(user.preferences.automaticAllocation).to.be.false; + }); });