Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ <h2>Total $ / hour&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;{{ref.totalMo
Recommendations Filters<span class="pull-right fa" ng-class="{'fa-chevron-down': accOpen2[1], 'fa-chevron-right': !accOpen2[1]}"></span>
</div>
</uib-accordion-heading>
<label>Show <input type="number" class="form-control" min="1" data-ng-model="ref.unlockAmounts"># unlocks</label>
<br>
<br>
<div class="row text-center bottom-margin">
<div class="col-sm-4">
<label><input type="checkbox" class="form-inline" data-ng-model="ref.noSingles"> Don't show +1 upgrades</label>
Expand Down
76 changes: 40 additions & 36 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
$scope[planets[k]].noSingles = obj[planets[k]].noSingles || false;
$scope[planets[k]].noTens = obj[planets[k]].noTens || false;
$scope[planets[k]].noHundreds = obj[planets[k]].noHundreds || false;
if (obj[planets[k]].unlockAmounts != null) {
$scope[planets[k]].unlockAmounts = obj[planets[k]].unlockAmounts;
}
if ('suit' in obj[planets[k]]) {
$scope[planets[k]].suits[obj[planets[k]].suit][0] = true;
}
Expand Down Expand Up @@ -460,17 +463,12 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
while (inc.length > 3 - (loc.noSingles ? 1 : 0) - (loc.noTens ? 1 : 0) - (loc.noHundreds ? 1 : 0)) {
inc.pop();
}
if (i === 1 && $scope.isWorld('earth')) {
for (j = 1; j < 4; j++) {
k = getDifferenceNBonus(loc, i, j);
if (k !== null) {
inc.push(k);
}
}
} else {
k = getDifferenceNBonus(loc, i, 1);
for (j = 1; j <= loc.unlockAmounts; j++) {
k = getDifferenceNBonus(loc, i, j);
if (k !== null) {
inc.push(k);
} else {
break;
}
}
if (!loc.hasMegaTickets) {
Expand All @@ -479,6 +477,9 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
inc.push(k);
}
}
if (loc.investments[i][1] < highestSharedLevel) {
highestSharedLevel = loc.investments[i][1];
}
for (j = 0; j < inc.length; j++) {
tempPlanet.investments = deepCopy(loc.investments);
tempPlanet.investments[i][1] += inc[j];
Expand Down Expand Up @@ -519,36 +520,36 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
break;
}
}
tempUnlock = 0;
tempPlanet.investments = deepCopy(loc.investments);
tempPlanet.cashUpgrades = deepCopy(loc.cashUpgrades);
for (i = 1; i < loc.investments.length; i++) {
if (loc.investments[i][1] < highestSharedLevel) {
highestSharedLevel = loc.investments[i][1];
for (i = 1; i <= loc.unlockAmounts; i++) {
tempUnlock = 0;
tempPlanet.investments = deepCopy(loc.investments);
tempPlanet.cashUpgrades = deepCopy(loc.cashUpgrades);
for (j = 0; j < loc.unlocks[loc.investments.length].length; j++) {
if (loc.unlocks[loc.investments.length][j][0] > highestSharedLevel) {
highestSharedLevel = loc.unlocks[loc.investments.length][j][0];
break;
}
}
}
for (i = 0; i < loc.unlocks[loc.investments.length].length; i++) {
if (loc.unlocks[loc.investments.length][i][0] > highestSharedLevel) {
highestSharedLevel = loc.unlocks[loc.investments.length][i][0];
if (j == loc.unlocks[loc.investments.length].length) {
break;
}
}
for (i = 0; i < tempPlanet.investments.length; i++) {
if (tempPlanet.investments[i][1] < highestSharedLevel) {
tempUnlock += calcUnlockCost(loc, i, tempPlanet.investments[i][1], highestSharedLevel - tempPlanet.investments[i][1]);
tempPlanet.investments[i][1] = highestSharedLevel;
for (j = 0; j < tempPlanet.investments.length; j++) {
if (tempPlanet.investments[j][1] < highestSharedLevel) {
tempUnlock += calcUnlockCost(loc, j, tempPlanet.investments[j][1], highestSharedLevel - tempPlanet.investments[j][1]);
tempPlanet.investments[j][1] = highestSharedLevel;
}
}
}
calcState(tempPlanet);
tempUnlockTime = tempUnlock / loc.totalMoneyPerSecond;
tempPercentageIncrease = (tempPlanet.totalMoneyPerSecond - loc.totalMoneyPerSecond) * 100 / loc.totalMoneyPerSecond;
if ((loc.filterTime === null || loc.filterTime > tempUnlockTime) && ($scope.filterTime.percentage === null || $scope.filterTime.percentage < tempPercentageIncrease)) {
upgradeScore = calcUpgradeScore(tempPlanet, loc, tempUnlockTime);
if (upgradeScore > max) {
max = upgradeScore;
maxObj = ['all', highestSharedLevel];
calcState(tempPlanet);
tempUnlockTime = tempUnlock / loc.totalMoneyPerSecond;
tempPercentageIncrease = (tempPlanet.totalMoneyPerSecond - loc.totalMoneyPerSecond) * 100 / loc.totalMoneyPerSecond;
if ((loc.filterTime === null || loc.filterTime > tempUnlockTime) && ($scope.filterTime.percentage === null || $scope.filterTime.percentage < tempPercentageIncrease)) {
upgradeScore = calcUpgradeScore(tempPlanet, loc, tempUnlockTime);
if (upgradeScore > max) {
max = upgradeScore;
maxObj = ['all', highestSharedLevel];
}
loc.recTable.push(['all', highestSharedLevel, upgradeScore, tempUnlock, tempUnlock / loc.totalMoneyPerSecond, tempPlanet.totalMoneyPerSecond - loc.totalMoneyPerSecond, tempPercentageIncrease]);
}
loc.recTable.push(['all', highestSharedLevel, upgradeScore, tempUnlock, tempUnlock / loc.totalMoneyPerSecond, tempPlanet.totalMoneyPerSecond - loc.totalMoneyPerSecond, tempPercentageIncrease]);
}
loc.rec = maxObj;
$scope.reverse = true;
Expand Down Expand Up @@ -915,7 +916,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
}
}
string += '\r\n ], \r\n "noSingles": ' + loc.noSingles + ',\r\n "noTens": ' + loc.noTens + ',\r\n "noHundreds": ' + loc.noHundreds + ',\r\n "platinumboost": ' + loc.platinumboost;
string += '\r\n ], \r\n "noSingles": ' + loc.noSingles + ',\r\n "noTens": ' + loc.noTens + ',\r\n "noHundreds": ' + loc.noHundreds + ',\r\n "unlockAmounts": ' + loc.unlockAmounts + ',\r\n "platinumboost": ' + loc.platinumboost;
for (i = 0; i < loc.suits.length; i++) {
if (loc.suits[i][0] === true) {
string += ',\r\n "suit": ' + i;
Expand Down Expand Up @@ -1325,8 +1326,10 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
loc.recommendation = 'Buy all to level ' + loc.rec[1];
} else if (loc.rec[0] === 'level') {
loc.recommendation = 'Buy ' + loc.investments[loc.rec[1]][0] + ' to level ' + loc.rec[2] + '.';
} else if (loc.recTable.length > 0) {
loc.recommendation = 'Buy ' + $filter('rec')(loc.recTable[0][0], loc) + ' Cash Upgrade.';
} else {
loc.recommendation = 'Buy ' + $filter('rec')(loc.recTable[0][0], loc) + ' Cash Upgrade.'
loc.recommendation = '';
}
};

Expand Down Expand Up @@ -1457,6 +1460,7 @@ advApp.controller('advController', ['$document', '$filter', '$scope', function($
}
$scope[planets[p]].totalMoneyPerSecond = 0;
$scope[planets[p]].triples = 0;
$scope[planets[p]].unlockAmounts = 1;
$scope[planets[p]].unlocks = [];
$scope[planets[p]].viewLifetimeEarnings = 0;
$scope[planets[p]].viewNumAngels = 0;
Expand Down