mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-15 02:32:22 +00:00
Reset should unassign Stat Points
Squashed commit of the following:
commit c3c2c364118a90f893ea7fca0a943ea64299234a
Author: Matteo Pagliazzi <matteopagliazzi@gmail.com>
Date: Sun May 3 22:36:57 2020 +0200
increase timeout to 100ms to allow a correct route change before reload
commit 5fd85345ce4a1d3684ca991db7f666803c899e63
Merge: a73b5c942b 33331554d3
Author: Matteo Pagliazzi <matteopagliazzi@gmail.com>
Date: Sun May 3 22:35:33 2020 +0200
Merge branch 'develop' of https://github.com/PitiTheGrey/habitica into PitiTheGrey-develop
commit 33331554d3da85134fd8b2a625a00d150da9e2e1
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Sun May 3 22:14:33 2020 +0200
Order fixed.
Rekord after reset
commit 3374ed29dbe37cd7416a3ef3eb9b9519f1488078
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Sun May 3 22:01:07 2020 +0200
Return to page then reset
commit a73b5c942b577dd357ce76380a0102c6823f66c1
Merge: 888f2c8217 0887141ec4
Author: Matteo Pagliazzi <matteopagliazzi@gmail.com>
Date: Sun May 3 21:44:16 2020 +0200
Merge branch 'develop' of https://github.com/PitiTheGrey/habitica into PitiTheGrey-develop
commit 0887141ec47fa8c7fb912f459416f6fa20d271b5
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Sun May 3 20:42:50 2020 +0200
Remove 2nd try (sorry)
commit e5534a7cba989ef8197a06ee6e5a4adb80992dba
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Sun May 3 20:14:49 2020 +0200
removed unnecessary lines of code
commit 888f2c8217611d367bee912b63d4cc3f4def59bb
Merge: aeba14f2e9 e5c5f7f1d0
Author: Matteo Pagliazzi <matteopagliazzi@gmail.com>
Date: Sun May 3 19:43:02 2020 +0200
Merge branch 'develop' of https://github.com/PitiTheGrey/habitica into PitiTheGrey-develop
commit e5c5f7f1d005e38a54341ca104a1d6632323bd75
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Sat May 2 14:54:14 2020 +0200
Page reload after reset button pressed
commit 1c7385f774f12f4d02adf0370bc692622e81f22c
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Tue Apr 28 22:23:59 2020 +0200
Update reset.js
commit 6a8ad34aa6eace9c621d52dded8d6e4200352e33
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Tue Apr 28 22:15:08 2020 +0200
Update reset.js
Resets int, con, per, str to 0
and Points to 1
commit ba6de48ee367aabf4a87f86eac03aeb8d3f1c2e0
Author: PitiTheGrey <35431804+PitiTheGrey@users.noreply.github.com>
Date: Tue Apr 28 22:10:16 2020 +0200
Update reset.js
Test if habitica/Website/common/script/ops/reset.js resets
int, con, per, str to 0
and Points to 1.
This commit is contained in:
parent
aeba14f2e9
commit
ca4efa21cf
3 changed files with 23 additions and 4 deletions
|
|
@ -52,6 +52,22 @@ describe('shared.ops.reset', () => {
|
|||
expect(user.stats.lvl).to.equal(1);
|
||||
});
|
||||
|
||||
it('resets user\'s stat points (str, con, int, per, points)', () => {
|
||||
user.stats.str = 2;
|
||||
user.stats.con = 2;
|
||||
user.stats.int = 2;
|
||||
user.stats.per = 2;
|
||||
user.stats.points = 2;
|
||||
|
||||
reset(user);
|
||||
|
||||
expect(user.stats.str).to.equal(0);
|
||||
expect(user.stats.con).to.equal(0);
|
||||
expect(user.stats.int).to.equal(0);
|
||||
expect(user.stats.per).to.equal(0);
|
||||
expect(user.stats.points).to.equal(1);
|
||||
});
|
||||
|
||||
it('resets user\'s gold', () => {
|
||||
user.stats.gp = 20;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,9 @@ export default {
|
|||
this.$root.$emit('bv::hide::modal', 'reset');
|
||||
},
|
||||
async reset () {
|
||||
const response = await axios.post('/api/v4/user/reset');
|
||||
// @TODO: Not sure if this is correct
|
||||
this.$store.user = response.data.data.user;
|
||||
await axios.post('/api/v4/user/reset');
|
||||
this.$router.push('/');
|
||||
this.$root.$emit('bv::hide::modal', 'reset');
|
||||
setTimeout(() => window.location.reload(true), 100);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ import i18n from '../i18n';
|
|||
export default function reset (user, tasks = []) {
|
||||
user.stats.hp = 50;
|
||||
user.stats.lvl = 1;
|
||||
user.stats.points = 1;
|
||||
user.stats.con = 0;
|
||||
user.stats.str = 0;
|
||||
user.stats.per = 0;
|
||||
user.stats.int = 0;
|
||||
user.stats.gp = 0;
|
||||
user.stats.exp = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue