diff --git a/CookieMonster.js b/CookieMonster.js index 894ae36..6677100 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -348,7 +348,7 @@ CM.Cache.CacheDragonCost = function() { cost += price; CM.Sim.Objects[target].amount--; } - CM.Cache.CostDragonUpgrade = CM.Disp.Beautify(cost); + CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); } } else { @@ -358,6 +358,7 @@ CM.Cache.CacheDragonCost = function() { target = j; if (Game.Objects[target].amount < amount) { CM.Cache.CostDragonUpgrade = "Not enough buildings to sell"; + break } else { for (var i = 0; i < amount; i++) { @@ -368,8 +369,8 @@ CM.Cache.CacheDragonCost = function() { CM.Sim.Objects[target].amount--; } } + CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); } - CM.Cache.CostDragonUpgrade = CM.Disp.Beautify(cost); } } CM.Cache.lastDragonLevel = Game.dragonLevel; @@ -3023,8 +3024,8 @@ CM.Disp.AddDragonLevelUpTooltip = function() { if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) != null) { for (let i = 0; i < l('specialPopup').childNodes.length; i++) { if (l('specialPopup').childNodes[i].className == "optionBox") { - l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(this, CM.Cache.CostDragonUpgrade, 'this'); Game.tooltip.wobble();} - l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide=1;} + l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `
${CM.Cache.CostDragonUpgrade}
`, 'this'); Game.tooltip.wobble();} + l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide = 1;} } } } diff --git a/src/Cache.js b/src/Cache.js index 49cd373..3b8b437 100644 --- a/src/Cache.js +++ b/src/Cache.js @@ -317,7 +317,7 @@ CM.Cache.CacheDragonCost = function() { cost += price; CM.Sim.Objects[target].amount--; } - CM.Cache.CostDragonUpgrade = CM.Disp.Beautify(cost); + CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); } } else { @@ -327,6 +327,7 @@ CM.Cache.CacheDragonCost = function() { target = j; if (Game.Objects[target].amount < amount) { CM.Cache.CostDragonUpgrade = "Not enough buildings to sell"; + break } else { for (var i = 0; i < amount; i++) { @@ -337,8 +338,8 @@ CM.Cache.CacheDragonCost = function() { CM.Sim.Objects[target].amount--; } } + CM.Cache.CostDragonUpgrade = "Cost to rebuy: " + CM.Disp.Beautify(cost); } - CM.Cache.CostDragonUpgrade = CM.Disp.Beautify(cost); } } CM.Cache.lastDragonLevel = Game.dragonLevel; diff --git a/src/Disp.js b/src/Disp.js index 469c8ed..ecbc026 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -1847,8 +1847,8 @@ CM.Disp.AddDragonLevelUpTooltip = function() { if ((l('specialPopup').className.match(/onScreen/) && l('specialPopup').children[0].style.background.match(/dragon/)) != null) { for (let i = 0; i < l('specialPopup').childNodes.length; i++) { if (l('specialPopup').childNodes[i].className == "optionBox") { - l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(this, CM.Cache.CostDragonUpgrade, 'this'); Game.tooltip.wobble();} - l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide=1;} + l('specialPopup').children[i].onmouseover = function() {CM.Cache.CacheDragonCost(); Game.tooltip.dynamic = 1; Game.tooltip.draw(l('specialPopup'), `
${CM.Cache.CostDragonUpgrade}
`, 'this'); Game.tooltip.wobble();} + l('specialPopup').children[i].onmouseout = function() {Game.tooltip.shouldHide = 1;} } } }