mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +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) {
|
export function addPinnedGearByClass (user) {
|
||||||
const newPinnedItems = selectGearToPin(user);
|
const newPinnedItems = selectGearToPin(user);
|
||||||
|
|
||||||
newPinnedItems.forEach(item => {
|
for (const item of newPinnedItems) {
|
||||||
const itemInfo = getItemInfo(user, 'marketGear', item);
|
const itemInfo = getItemInfo(user, 'marketGear', item);
|
||||||
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
|
addPinnedGear(user, itemInfo.pinType, itemInfo.path);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeItemByPath (user, path) {
|
export function removeItemByPath (user, path) {
|
||||||
|
|
@ -82,10 +82,10 @@ export function removeItemByPath (user, path) {
|
||||||
export function removePinnedGearByClass (user) {
|
export function removePinnedGearByClass (user) {
|
||||||
const currentPinnedItems = selectGearToPin(user);
|
const currentPinnedItems = selectGearToPin(user);
|
||||||
|
|
||||||
currentPinnedItems.forEach(item => {
|
for (const item of currentPinnedItems) {
|
||||||
const itemInfo = getItemInfo(user, 'marketGear', item);
|
const itemInfo = getItemInfo(user, 'marketGear', item);
|
||||||
removeItemByPath(user, itemInfo.path);
|
removeItemByPath(user, itemInfo.path);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
export function removePinnedGearAddPossibleNewOnes (user, itemPath, newItemKey) {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export default function releaseBoth (user, req = {}) {
|
||||||
user.items.currentPet = '';
|
user.items.currentPet = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(content.pets).forEach(animal => {
|
for (const animal of Object.keys(content.pets)) {
|
||||||
if (user.items.pets[animal] === -1) {
|
if (user.items.pets[animal] === -1) {
|
||||||
giveTriadBingo = false;
|
giveTriadBingo = false;
|
||||||
} else if (!user.items.pets[animal]) {
|
} else if (!user.items.pets[animal]) {
|
||||||
|
|
@ -62,7 +62,7 @@ export default function releaseBoth (user, req = {}) {
|
||||||
|
|
||||||
user.items.pets[animal] = 0;
|
user.items.pets[animal] = 0;
|
||||||
user.items.mounts[animal] = null;
|
user.items.mounts[animal] = null;
|
||||||
});
|
}
|
||||||
|
|
||||||
if (user.markModified) {
|
if (user.markModified) {
|
||||||
user.markModified('items.pets');
|
user.markModified('items.pets');
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ export default function releaseMounts (user, req = {}, analytics) {
|
||||||
user.items.currentMount = '';
|
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) {
|
if (user.items.mounts[mount] === null || user.items.mounts[mount] === undefined) {
|
||||||
giveMountMasterAchievement = false;
|
giveMountMasterAchievement = false;
|
||||||
}
|
}
|
||||||
user.items.mounts[mount] = null;
|
user.items.mounts[mount] = null;
|
||||||
});
|
}
|
||||||
|
|
||||||
if (user.markModified) user.markModified('items.mounts');
|
if (user.markModified) user.markModified('items.mounts');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ export default function releasePets (user, req = {}, analytics) {
|
||||||
user.items.currentPet = '';
|
user.items.currentPet = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(content.pets).forEach(pet => {
|
for (const pet of Object.keys(content.pets)) {
|
||||||
if (!user.items.pets[pet]) {
|
if (!user.items.pets[pet]) {
|
||||||
giveBeastMasterAchievement = false;
|
giveBeastMasterAchievement = false;
|
||||||
}
|
}
|
||||||
user.items.pets[pet] = 0;
|
user.items.pets[pet] = 0;
|
||||||
});
|
}
|
||||||
|
|
||||||
if (user.markModified) user.markModified('items.pets');
|
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));
|
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[stat] += value;
|
||||||
user.stats.points -= value;
|
user.stats.points -= value;
|
||||||
if (stat === 'int') user.stats.mp += value;
|
if (stat === 'int') user.stats.mp += value;
|
||||||
});
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
user.stats,
|
user.stats,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue