fix(client): Sort gear by stat from class bonus (#7710)

* Accounting for class bonus when sorting equipment by stats. closes #7701

* Fixing unintended impact on last page and including special classes

* Addressing comments
This commit is contained in:
Travis
2016-06-23 05:55:00 -07:00
committed by Blade Barringer
parent d5a354b499
commit 0af1ced462
2 changed files with 14 additions and 4 deletions

View File

@@ -62,6 +62,16 @@ habitrpg.controller("InventoryCtrl",
var item = Content.gear.flat[key]; var item = Content.gear.flat[key];
var bonusMultiplier = 1;
if (item.klass === User.user.stats.class || item.specialClass === User.user.stats.class) {
bonusMultiplier = 1.5;
}
item._effectiveStr = item.str * bonusMultiplier;
item._effectiveCon = item.con * bonusMultiplier;
item._effectivePer = item.per * bonusMultiplier;
item._effectiveInt = item.int * bonusMultiplier;
if (!$scope.gearByClass[item.klass]) { if (!$scope.gearByClass[item.klass]) {
$scope.gearByClass[item.klass] = []; $scope.gearByClass[item.klass] = [];
} }

View File

@@ -1,10 +1,10 @@
habitrpg.controller('SortableInventoryController', ['$scope', habitrpg.controller('SortableInventoryController', ['$scope',
function ($scope) { function ($scope) {
var attributeSort = { var attributeSort = {
constitution: ['-con', '-(con+int+per+str)'], constitution: ['-(_effectiveCon)', '-(_effectiveCon+_effectiveInt+_effectivePer+_effectiveStr)'],
intelligence: ['-int', '-(con+int+per+str)'], intelligence: ['-(_effectiveInt)', '-(_effectiveCon+_effectiveInt+_effectivePer+_effectiveStr)'],
perception: ['-per', '-(con+int+per+str)'], perception: ['-(_effectivePer)', '-(_effectiveCon+_effectiveInt+_effectivePer+_effectiveStr)'],
strength: ['-str', '-(con+int+per+str)'], strength: ['-(_effectiveStr)', '-(_effectiveCon+_effectiveInt+_effectivePer+_effectiveStr)'],
set: 'set' set: 'set'
} }