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:
Sabe Jones
2018-01-29 15:02:55 -06:00
committed by GitHub
parent 23dd402e79
commit 99ab9726b4
2 changed files with 24 additions and 3 deletions

View File

@@ -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);