Skip to content

Commit

Permalink
Merge pull request #222 from jshepler/luckyPrestigeStats
Browse files Browse the repository at this point in the history
Lucky prestige stats
  • Loading branch information
AmethystMoon authored Nov 23, 2020
2 parents deb309c + ac015ab commit bd98741
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 2 deletions.
54 changes: 53 additions & 1 deletion CookieMonster.js
Original file line number Diff line number Diff line change
Expand Up @@ -2155,15 +2155,16 @@ CM.Disp.AddMenuStats = function(title) {
if (CM.Config.StatsPref.Prestige) {
var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)));
var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0));

stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax))));

var cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
var cookiesNextSmall = document.createElement('small');
cookiesNextSmall.textContent = ' (' + (CM.Disp.FormatTime(neededCook / CM.Cache.AvgCPSChoEgg, 1)) + ')';
cookiesNextFrag.appendChild(cookiesNextSmall);
stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag));
stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips))));

var resetBonus = CM.Sim.ResetBonus(possiblePresMax);
var resetFrag = document.createDocumentFragment();
resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));
Expand All @@ -2174,6 +2175,57 @@ CM.Disp.AddMenuStats = function(title) {
resetFrag.appendChild(resetSmall);
}
stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag));

var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
var willGet = willHave - currentPrestige;
var addCommas = (n) =>
{
var s1 = n.toString();
var s2 = '';
for (var i in s1)
{
if ((s1.length - i) % 3 == 0 && i > 0)
s2 += ',';

s2 += s1[i];
}

return s2;
};

if (!Game.Has('Lucky digit'))
{
var delta7 = 7 - (willHave % 10);
if (delta7 < 0) delta7 += 10;
var next7Reset = willGet + delta7;
var next7Total = willHave + delta7;
var frag7 = document.createDocumentFragment();
frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")"));
stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7));
}

if (!Game.Has('Lucky number'))
{
var delta777 = 777 - (willHave % 1000);
if (delta777 < 0) delta777 += 1000;
var next777Reset = willGet + delta777;
var next777Total = willHave + delta777;
var frag777 = document.createDocumentFragment();
frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")"));
stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777));
}

if (!Game.Has('Lucky payout'))
{
var delta777777 = 777777 - (willHave % 1000000);
if (delta777777 < 0) delta777777 += 1000000;
var next777777Reset = willGet + delta777777;
var next777777Total = willHave + delta777777;
var frag777777 = document.createDocumentFragment();
frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")"));
stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777));
}
}

if (Game.cpsSucked > 0) {
Expand Down
54 changes: 53 additions & 1 deletion src/Disp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1528,15 +1528,16 @@ CM.Disp.AddMenuStats = function(title) {
if (CM.Config.StatsPref.Prestige) {
var possiblePresMax = Math.floor(Game.HowMuchPrestige(CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0)));
var neededCook = Game.HowManyCookiesReset(possiblePresMax + 1) - (CM.Cache.RealCookiesEarned + Game.cookiesReset + CM.Cache.WrinkGodBank + (choEgg ? CM.Cache.lastChoEgg : 0));

stats.appendChild(listing(listingQuest('Prestige Level (CUR / MAX)', 'PrestMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.prestige) + ' / ' + Beautify(possiblePresMax))));

var cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
var cookiesNextSmall = document.createElement('small');
cookiesNextSmall.textContent = ' (' + (CM.Disp.FormatTime(neededCook / CM.Cache.AvgCPSChoEgg, 1)) + ')';
cookiesNextFrag.appendChild(cookiesNextSmall);
stats.appendChild(listing(listingQuest('Cookies To Next Level', 'NextPrestTooltipPlaceholder'), cookiesNextFrag));
stats.appendChild(listing(listingQuest('Heavenly Chips (CUR / MAX)', 'HeavenChipMaxTooltipPlaceholder'), document.createTextNode(Beautify(Game.heavenlyChips) + ' / ' + Beautify((possiblePresMax - Game.prestige) + Game.heavenlyChips))));

var resetBonus = CM.Sim.ResetBonus(possiblePresMax);
var resetFrag = document.createDocumentFragment();
resetFrag.appendChild(document.createTextNode(Beautify(resetBonus)));
Expand All @@ -1547,6 +1548,57 @@ CM.Disp.AddMenuStats = function(title) {
resetFrag.appendChild(resetSmall);
}
stats.appendChild(listing(listingQuest('Reset Bonus Income', 'ResetTooltipPlaceholder'), resetFrag));

var currentPrestige = Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
var willHave = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned));
var willGet = willHave - currentPrestige;
var addCommas = (n) =>
{
var s1 = n.toString();
var s2 = '';
for (var i in s1)
{
if ((s1.length - i) % 3 == 0 && i > 0)
s2 += ',';

s2 += s1[i];
}

return s2;
};

if (!Game.Has('Lucky digit'))
{
var delta7 = 7 - (willHave % 10);
if (delta7 < 0) delta7 += 10;
var next7Reset = willGet + delta7;
var next7Total = willHave + delta7;
var frag7 = document.createDocumentFragment();
frag7.appendChild(document.createTextNode(addCommas(next7Total) + " / " + addCommas(next7Reset) + " (+" + delta7 + ")"));
stats.appendChild(listing('Next "Lucky Digit" (total / reset)', frag7));
}

if (!Game.Has('Lucky number'))
{
var delta777 = 777 - (willHave % 1000);
if (delta777 < 0) delta777 += 1000;
var next777Reset = willGet + delta777;
var next777Total = willHave + delta777;
var frag777 = document.createDocumentFragment();
frag777.appendChild(document.createTextNode(addCommas(next777Total) + " / " + addCommas(next777Reset) + " (+" + delta777 + ")"));
stats.appendChild(listing('Next "Lucky Number" (total / reset)', frag777));
}

if (!Game.Has('Lucky payout'))
{
var delta777777 = 777777 - (willHave % 1000000);
if (delta777777 < 0) delta777777 += 1000000;
var next777777Reset = willGet + delta777777;
var next777777Total = willHave + delta777777;
var frag777777 = document.createDocumentFragment();
frag777777.appendChild(document.createTextNode(addCommas(next777777Total) + " / " + addCommas(next777777Reset) + " (+" + delta777777 + ")"));
stats.appendChild(listing('Next "Lucky Payout" (total / reset)', frag777777));
}
}

if (Game.cpsSucked > 0) {
Expand Down

0 comments on commit bd98741

Please sign in to comment.