mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-19 04:14:40 +00:00
Set up system to calculate if Mountmaster should be awarded
This commit is contained in:
parent
c0f51379e7
commit
3389d418ce
2 changed files with 17 additions and 1 deletions
12
dist/habitrpg-shared.js
vendored
12
dist/habitrpg-shared.js
vendored
|
|
@ -15450,7 +15450,7 @@ api.wrap = function(user, main) {
|
|||
return typeof cb === "function" ? cb(null, user) : void 0;
|
||||
},
|
||||
release2: function(req, cb) {
|
||||
var pet;
|
||||
var mountCount, pet;
|
||||
if (user.balance < 2) {
|
||||
return typeof cb === "function" ? cb({
|
||||
code: 401,
|
||||
|
|
@ -15460,7 +15460,11 @@ api.wrap = function(user, main) {
|
|||
user.balance -= 2;
|
||||
user.items.currentMount = "";
|
||||
user.items.currentPet = "";
|
||||
mountCount = 0;
|
||||
for (pet in content.pets) {
|
||||
if (user.items.mounts[pet]) {
|
||||
mountCount++;
|
||||
}
|
||||
delete user.items.mounts[pet];
|
||||
user.items.pets[pet] = 0;
|
||||
}
|
||||
|
|
@ -15468,6 +15472,12 @@ api.wrap = function(user, main) {
|
|||
user.achievements.beastMasterCount = 0;
|
||||
}
|
||||
user.achievements.beastMasterCount++;
|
||||
if (mountCount === 90) {
|
||||
if (!user.achievements.mountMasterCount) {
|
||||
user.achievements.mountMasterCount = 0;
|
||||
}
|
||||
user.achievements.mountMasterCount++;
|
||||
}
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, user) : void 0;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -754,12 +754,18 @@ api.wrap = (user, main=true) ->
|
|||
user.balance -= 2
|
||||
user.items.currentMount = ""
|
||||
user.items.currentPet = ""
|
||||
mountCount = 0
|
||||
for pet of content.pets
|
||||
mountCount++ if user.items.mounts[pet]
|
||||
delete user.items.mounts[pet]
|
||||
user.items.pets[pet] = 0
|
||||
if not user.achievements.beastMasterCount
|
||||
user.achievements.beastMasterCount = 0
|
||||
user.achievements.beastMasterCount++
|
||||
if mountCount == 90
|
||||
if not user.achievements.mountMasterCount
|
||||
user.achievements.mountMasterCount = 0
|
||||
user.achievements.mountMasterCount++
|
||||
cb? null, user
|
||||
|
||||
# buy is for gear, purchase is for gem-purchaseables (i know, I know...)
|
||||
|
|
|
|||
Loading…
Reference in a new issue