mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 12:48:52 +00:00
restore for...of
This commit is contained in:
parent
e0e9811ab6
commit
415f28995d
5 changed files with 12 additions and 12 deletions
|
|
@ -62,10 +62,10 @@ export function addPinnedGear (user, type, path) {
|
|||
export function addPinnedGearByClass (user) {
|
||||
const newPinnedItems = selectGearToPin(user);
|
||||
|
||||
newPinnedItems.forEach(item => {
|
||||
for (const item of newPinnedItems) {
|
||||
const itemInfo = getItemInfo(user, 'marketGear', item);
|
||||
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function removeItemByPath (user, path) {
|
||||
|
|
@ -82,10 +82,10 @@ export function removeItemByPath (user, path) {
|
|||
export function removePinnedGearByClass (user) {
|
||||
const currentPinnedItems = selectGearToPin(user);
|
||||
|
||||
currentPinnedItems.forEach(item => {
|
||||
for (const item of currentPinnedItems) {
|
||||
const itemInfo = getItemInfo(user, 'marketGear', item);
|
||||
removeItemByPath(user, itemInfo.path);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default function releaseBoth (user, req = {}) {
|
|||
user.items.currentPet = '';
|
||||
}
|
||||
|
||||
Object.keys(content.pets).forEach(animal => {
|
||||
for (const animal of Object.keys(content.pets)) {
|
||||
if (user.items.pets[animal] === -1) {
|
||||
giveTriadBingo = false;
|
||||
} else if (!user.items.pets[animal]) {
|
||||
|
|
@ -62,7 +62,7 @@ export default function releaseBoth (user, req = {}) {
|
|||
|
||||
user.items.pets[animal] = 0;
|
||||
user.items.mounts[animal] = null;
|
||||
});
|
||||
}
|
||||
|
||||
if (user.markModified) {
|
||||
user.markModified('items.pets');
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ export default function releaseMounts (user, req = {}, analytics) {
|
|||
user.items.currentMount = '';
|
||||
}
|
||||
|
||||
Object.keys(content.pets).forEach(mount => {
|
||||
for (const mount of Object.keys(content.pets)) {
|
||||
if (user.items.mounts[mount] === null || user.items.mounts[mount] === undefined) {
|
||||
giveMountMasterAchievement = false;
|
||||
}
|
||||
user.items.mounts[mount] = null;
|
||||
});
|
||||
}
|
||||
|
||||
if (user.markModified) user.markModified('items.mounts');
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ export default function releasePets (user, req = {}, analytics) {
|
|||
user.items.currentPet = '';
|
||||
}
|
||||
|
||||
Object.keys(content.pets).forEach(pet => {
|
||||
for (const pet of Object.keys(content.pets)) {
|
||||
if (!user.items.pets[pet]) {
|
||||
giveBeastMasterAchievement = false;
|
||||
}
|
||||
user.items.pets[pet] = 0;
|
||||
});
|
||||
}
|
||||
|
||||
if (user.markModified) user.markModified('items.pets');
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ export default function allocateBulk (user, req = {}) {
|
|||
throw new NotAuthorized(i18n.t('notEnoughAttrPoints', req.language));
|
||||
}
|
||||
|
||||
Object.entries(stats).forEach(([stat, value]) => {
|
||||
for (const [stat, value] of Object.entries(stats)) {
|
||||
user.stats[stat] += value;
|
||||
user.stats.points -= value;
|
||||
if (stat === 'int') user.stats.mp += value;
|
||||
});
|
||||
}
|
||||
|
||||
return [
|
||||
user.stats,
|
||||
|
|
|
|||
Loading…
Reference in a new issue