mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Allow user to buy numbered special gear (#9823)
* fix(buy): allow user to buy numbered special gear * fix(buy): correct content constant
This commit is contained in:
@@ -37,10 +37,10 @@ module.exports = function buyGear (user, req = {}, analytics) {
|
||||
|
||||
let itemIndex = Number(item.index);
|
||||
|
||||
if (Number.isInteger(itemIndex)) {
|
||||
if (Number.isInteger(itemIndex) && content.classes.includes(item.klass)) {
|
||||
let previousLevelGear = key.replace(/[0-9]/, itemIndex - 1);
|
||||
let hasPreviousLevelGear = user.items.gear.owned[previousLevelGear];
|
||||
let checkIndexToType = itemIndex > (item.type === 'weapon' ? 0 : 1);
|
||||
let checkIndexToType = itemIndex > (item.type === 'weapon' || item.type === 'shield' && item.klass === 'rogue' ? 0 : 1);
|
||||
|
||||
if (checkIndexToType && !hasPreviousLevelGear) {
|
||||
throw new NotAuthorized(i18n.t('previousGearNotOwned', req.language));
|
||||
@@ -52,7 +52,6 @@ module.exports = function buyGear (user, req = {}, analytics) {
|
||||
message = handleTwoHanded(user, item, undefined, req);
|
||||
}
|
||||
|
||||
|
||||
removePinnedGearAddPossibleNewOnes(user, `gear.flat.${item.key}`, item.key);
|
||||
|
||||
if (item.last) ultimateGear(user);
|
||||
|
||||
Reference in New Issue
Block a user