Skip to content

Commit

Permalink
Added stat to show missing Fortune upgrades left to buy (Issue #263 and
Browse files Browse the repository at this point in the history
  • Loading branch information
Aktanusa committed Oct 11, 2019
1 parent fa6b998 commit a920e9e
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 84 deletions.
119 changes: 77 additions & 42 deletions CookieMonster.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,30 @@ CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale',
* Data *
********/

CM.Data.Fortunes = [
'Fortune #001',
'Fortune #002',
'Fortune #003',
'Fortune #004',
'Fortune #005',
'Fortune #006',
'Fortune #007',
'Fortune #008',
'Fortune #009',
'Fortune #010',
'Fortune #011',
'Fortune #012',
'Fortune #013',
'Fortune #014',
'Fortune #015',
'Fortune #016',
'Fortune #017',
'Fortune #100',
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104'
];
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits'];
Expand Down Expand Up @@ -1840,6 +1864,45 @@ CM.Disp.AddMenuStats = function(title) {
frag.appendChild(span);
return frag;
}

var createMissDisp = function(theMissDisp) {
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(theMissDisp.length + ' '));
var span = document.createElement('span');
span.onmouseout = function() { Game.tooltip.hide(); };
var placeholder = document.createElement('div');
var missing = document.createElement('div');
missing.style.minWidth = '140px';
missing.style.marginBottom = '4px';
var title = document.createElement('div');
title.className = 'name';
title.style.marginBottom = '4px';
title.style.textAlign = 'center';
title.textContent = 'Missing';
missing.appendChild(title);
for (var i in theMissDisp) {
var div = document.createElement('div');
div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theMissDisp[i]));
missing.appendChild(div);
}
placeholder.appendChild(missing);
span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));};
span.style.cursor = 'default';
span.style.display = 'inline-block';
span.style.height = '10px';
span.style.width = '10px';
span.style.borderRadius = '5px';
span.style.textAlign = 'center';
span.style.backgroundColor = '#C0C0C0';
span.style.color = 'black';
span.style.fontSize = '9px';
span.style.verticalAlign = 'bottom';
span.textContent = '?';
frag.appendChild(span);
return frag;
}


stats.appendChild(header('Lucky Cookies', 'Lucky'));
if (CM.Config.StatsPref.Lucky) {
Expand Down Expand Up @@ -2067,48 +2130,11 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(header('Season Specials', 'Sea'));
if (CM.Config.StatsPref.Sea) {
if (specDisp) {
var createSpecDisp = function(theSpecDisp) {
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(theSpecDisp.length + ' '));
var span = document.createElement('span');
span.onmouseout = function() { Game.tooltip.hide(); };
var placeholder = document.createElement('div');
var missing = document.createElement('div');
missing.style.minWidth = '140px';
missing.style.marginBottom = '4px';
var title = document.createElement('div');
title.className = 'name';
title.style.marginBottom = '4px';
title.style.textAlign = 'center';
title.textContent = 'Missing';
missing.appendChild(title);
for (var i in theSpecDisp) {
var div = document.createElement('div');
div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theSpecDisp[i]));
missing.appendChild(div);
}
placeholder.appendChild(missing);
span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));};
span.style.cursor = 'default';
span.style.display = 'inline-block';
span.style.height = '10px';
span.style.width = '10px';
span.style.borderRadius = '5px';
span.style.textAlign = 'center';
span.style.backgroundColor = '#C0C0C0';
span.style.color = 'black';
span.style.fontSize = '9px';
span.style.verticalAlign = 'bottom';
span.textContent = '?';
frag.appendChild(span);
return frag;
}
if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createSpecDisp(halloCook)));
if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createSpecDisp(christCook)));
if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createSpecDisp(valCook)));
if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createSpecDisp(normEggs)));
if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createSpecDisp(rareEggs)));
if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createMissDisp(halloCook)));
if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createMissDisp(christCook)));
if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createMissDisp(valCook)));
if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createMissDisp(normEggs)));
if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createMissDisp(rareEggs)));
}

if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec))));
Expand All @@ -2128,6 +2154,15 @@ CM.Disp.AddMenuStats = function(title) {
document.createTextNode(Beautify(CM.Cache.AvgCPS, 3))
));
stats.appendChild(listing('Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Config.AvgClicksHist] + (CM.Config.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1))));
if (Game.Has('Fortune cookies')) {
var fortunes = [];
for (var i in CM.Data.Fortunes) {
if (!Game.Has(CM.Data.Fortunes[i])) {
fortunes.push(CM.Data.Fortunes[i]);
}
}
if (fortunes.length != 0) stats.appendChild(listing('Fortune Upgrades Left to Buy', createMissDisp(fortunes)));
}
stats.appendChild(listing('Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks))));
}

Expand Down
24 changes: 24 additions & 0 deletions src/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@
* Data *
********/

CM.Data.Fortunes = [
'Fortune #001',
'Fortune #002',
'Fortune #003',
'Fortune #004',
'Fortune #005',
'Fortune #006',
'Fortune #007',
'Fortune #008',
'Fortune #009',
'Fortune #010',
'Fortune #011',
'Fortune #012',
'Fortune #013',
'Fortune #014',
'Fortune #015',
'Fortune #016',
'Fortune #017',
'Fortune #100',
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104'
];
CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime cookies', 'Pumpkin cookies', 'Eyeball cookies', 'Spider cookies'];
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits'];
Expand Down
95 changes: 53 additions & 42 deletions src/Disp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,45 @@ CM.Disp.AddMenuStats = function(title) {
frag.appendChild(span);
return frag;
}

var createMissDisp = function(theMissDisp) {
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(theMissDisp.length + ' '));
var span = document.createElement('span');
span.onmouseout = function() { Game.tooltip.hide(); };
var placeholder = document.createElement('div');
var missing = document.createElement('div');
missing.style.minWidth = '140px';
missing.style.marginBottom = '4px';
var title = document.createElement('div');
title.className = 'name';
title.style.marginBottom = '4px';
title.style.textAlign = 'center';
title.textContent = 'Missing';
missing.appendChild(title);
for (var i in theMissDisp) {
var div = document.createElement('div');
div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theMissDisp[i]));
missing.appendChild(div);
}
placeholder.appendChild(missing);
span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));};
span.style.cursor = 'default';
span.style.display = 'inline-block';
span.style.height = '10px';
span.style.width = '10px';
span.style.borderRadius = '5px';
span.style.textAlign = 'center';
span.style.backgroundColor = '#C0C0C0';
span.style.color = 'black';
span.style.fontSize = '9px';
span.style.verticalAlign = 'bottom';
span.textContent = '?';
frag.appendChild(span);
return frag;
}


stats.appendChild(header('Lucky Cookies', 'Lucky'));
if (CM.Config.StatsPref.Lucky) {
Expand Down Expand Up @@ -1468,48 +1507,11 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(header('Season Specials', 'Sea'));
if (CM.Config.StatsPref.Sea) {
if (specDisp) {
var createSpecDisp = function(theSpecDisp) {
var frag = document.createDocumentFragment();
frag.appendChild(document.createTextNode(theSpecDisp.length + ' '));
var span = document.createElement('span');
span.onmouseout = function() { Game.tooltip.hide(); };
var placeholder = document.createElement('div');
var missing = document.createElement('div');
missing.style.minWidth = '140px';
missing.style.marginBottom = '4px';
var title = document.createElement('div');
title.className = 'name';
title.style.marginBottom = '4px';
title.style.textAlign = 'center';
title.textContent = 'Missing';
missing.appendChild(title);
for (var i in theSpecDisp) {
var div = document.createElement('div');
div.style.textAlign = 'center';
div.appendChild(document.createTextNode(theSpecDisp[i]));
missing.appendChild(div);
}
placeholder.appendChild(missing);
span.onmouseover = function() {Game.tooltip.draw(this, escape(placeholder.innerHTML));};
span.style.cursor = 'default';
span.style.display = 'inline-block';
span.style.height = '10px';
span.style.width = '10px';
span.style.borderRadius = '5px';
span.style.textAlign = 'center';
span.style.backgroundColor = '#C0C0C0';
span.style.color = 'black';
span.style.fontSize = '9px';
span.style.verticalAlign = 'bottom';
span.textContent = '?';
frag.appendChild(span);
return frag;
}
if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createSpecDisp(halloCook)));
if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createSpecDisp(christCook)));
if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createSpecDisp(valCook)));
if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createSpecDisp(normEggs)));
if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createSpecDisp(rareEggs)));
if (halloCook.length != 0) stats.appendChild(listing('Halloween Cookies Left to Buy', createMissDisp(halloCook)));
if (christCook.length != 0) stats.appendChild(listing('Christmas Cookies Left to Buy', createMissDisp(christCook)));
if (valCook.length != 0) stats.appendChild(listing('Valentine Cookies Left to Buy', createMissDisp(valCook)));
if (normEggs.length != 0) stats.appendChild(listing('Normal Easter Eggs Left to Unlock', createMissDisp(normEggs)));
if (rareEggs.length != 0) stats.appendChild(listing('Rare Easter Eggs Left to Unlock', createMissDisp(rareEggs)));
}

if (Game.season == 'christmas') stats.appendChild(listing('Reindeer Reward', document.createTextNode(Beautify(CM.Cache.SeaSpec))));
Expand All @@ -1529,6 +1531,15 @@ CM.Disp.AddMenuStats = function(title) {
document.createTextNode(Beautify(CM.Cache.AvgCPS, 3))
));
stats.appendChild(listing('Average Cookie Clicks Per Second (Past ' + CM.Disp.clickTimes[CM.Config.AvgClicksHist] + (CM.Config.AvgClicksHist == 0 ? ' second' : ' seconds') + ')', document.createTextNode(Beautify(CM.Cache.AvgClicks, 1))));
if (Game.Has('Fortune cookies')) {
var fortunes = [];
for (var i in CM.Data.Fortunes) {
if (!Game.Has(CM.Data.Fortunes[i])) {
fortunes.push(CM.Data.Fortunes[i]);
}
}
if (fortunes.length != 0) stats.appendChild(listing('Fortune Upgrades Left to Buy', createMissDisp(fortunes)));
}
stats.appendChild(listing('Missed Golden Cookies', document.createTextNode(Beautify(Game.missedGoldenClicks))));
}

Expand Down

0 comments on commit a920e9e

Please sign in to comment.