Merge branch 'dev' of https://github.com/Aktanusa/CookieMonster into gardentooltip
This commit is contained in:
42
src/Disp.js
42
src/Disp.js
@@ -196,8 +196,11 @@ CM.Disp.Beautify = function(num, floats, forced) {
|
||||
return num.toString()
|
||||
}
|
||||
else if (0.001 < num && num < CM.Options.ScaleCutoff) {
|
||||
answer = num.toFixed(0);
|
||||
answer = num.toFixed(2);
|
||||
if (CM.Options.ScaleSeparator) answer = answer.toLocaleString('nl');
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (answer[answer.length - 1] == "0" | answer[answer.length - 1] == ".") answer = answer.slice(0, -1)
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
else if (CM.Options.Scale == 4 && !forced || forced == 4) { // Scientific notation, 123456789 => 1.235E+8
|
||||
@@ -609,6 +612,10 @@ CM.Disp.UpdateTimerBar = function() {
|
||||
if (numberOfTimers != 0) {
|
||||
CM.Disp.TimerBar.style.height = numberOfTimers * 12 + 2 + 'px';
|
||||
}
|
||||
if (CM.Disp.LastNumberOfTimers != numberOfTimers) {
|
||||
CM.Disp.LastNumberOfTimers = numberOfTimers
|
||||
CM.Disp.UpdateBotTimerBarPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,11 +691,11 @@ CM.Disp.UpdateBotTimerBarPosition = function() {
|
||||
*/
|
||||
CM.Disp.UpdateBuildings = function() {
|
||||
if (Game.buyMode == 1) {
|
||||
var target = '';
|
||||
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
|
||||
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
|
||||
else target = 'Objects';
|
||||
if (CM.Options.BuildColor == 1) {
|
||||
var target = '';
|
||||
if (Game.buyBulk == 10 && CM.Options.BulkBuildColor == 1) target = 'Objects10';
|
||||
else if (Game.buyBulk == 100 && CM.Options.BulkBuildColor == 1) target = 'Objects100';
|
||||
else target = 'Objects';
|
||||
for (var i in CM.Cache[target]) {
|
||||
l('productPrice' + Game.Objects[i].id).style.color = CM.Options.Colors[CM.Cache[target][i].color];
|
||||
}
|
||||
@@ -1374,6 +1381,9 @@ CM.Disp.TooltipCreateWarningSection = function() {
|
||||
CM.Disp.UpdateTooltip = function() {
|
||||
CM.Sim.CopyData();
|
||||
if (l('tooltipAnchor').style.display != 'none' && l('CMTooltipArea')) {
|
||||
if (CM.Options.TooltipInfo == 0) {
|
||||
l('CMTooltipArea').style.display = "none";
|
||||
}
|
||||
l('CMTooltipArea').innerHTML = '';
|
||||
tooltipBox = CM.Disp.TooltipCreateTooltipBox();
|
||||
l('CMTooltipArea').appendChild(tooltipBox);
|
||||
@@ -2007,22 +2017,24 @@ CM.Disp.CreatePrefOption = function(config) {
|
||||
return div;
|
||||
}
|
||||
else if (CM.ConfigData[config].type == "color") {
|
||||
var div = document.createElement('div');
|
||||
for (var i = 0; i < CM.Disp.colors.length; i++) {
|
||||
var div = document.createElement('div');
|
||||
div.className = 'listing';
|
||||
var innerDiv = document.createElement('div');
|
||||
innerDiv.className = 'listing';
|
||||
var input = document.createElement('input');
|
||||
input.id = CM.ConfigPrefix + 'Color' + CM.Disp.colors[i];
|
||||
input.className = 'option';
|
||||
input.style.width = '65px';
|
||||
input.setAttribute('value', CM.Options.Colors[CM.Disp.colors[i]]);
|
||||
div.appendChild(input);
|
||||
innerDiv.appendChild(input);
|
||||
eval('var change = function() {CM.Options.Colors[\'' + CM.Disp.colors[i] + '\'] = l(CM.ConfigPrefix + \'Color\' + \'' + CM.Disp.colors[i] + '\').value; CM.Disp.UpdateColors(); CM.Config.SaveConfig();}');
|
||||
var jscolorpicker = new jscolor.color(input, {hash: true, caps: false, pickerZIndex: 1000000, pickerPosition: 'right', onImmediateChange: change});
|
||||
var label = document.createElement('label');
|
||||
label.textContent = CM.ConfigData.Colors.desc[CM.Disp.colors[i]];
|
||||
div.appendChild(label);
|
||||
return div;
|
||||
innerDiv.appendChild(label);
|
||||
div.appendChild(innerDiv)
|
||||
}
|
||||
return div
|
||||
}
|
||||
else if (CM.ConfigData[config].type == "numscale") {
|
||||
var div = document.createElement('div');
|
||||
@@ -2143,9 +2155,9 @@ CM.Disp.AddMenuStats = function(title) {
|
||||
var popFattestA = document.createElement('a');
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
|
||||
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };;
|
||||
popFattestFrag.appendChild(popFattestA);
|
||||
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Wrinkler (id: ' + CM.Cache.WrinklersFattest[1] + ")", popFattestFrag));
|
||||
stats.appendChild(CM.Disp.CreateStatsListing("basic", 'Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ' + (CM.Cache.WrinklersFattest[1] ? CM.Cache.WrinklersFattest[1] : "None") + ")", popFattestFrag));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2652,7 +2664,9 @@ CM.Disp.AddMissingUpgrades = function() {
|
||||
l('menu').children[5].appendChild(upgrades)
|
||||
}
|
||||
if (CM.Cache.MissingUpgrades) {
|
||||
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
|
||||
if (Game.UpgradesOwned) {
|
||||
var normalUpgradesOwned = Game.UpgradesByPool[""].length + Game.UpgradesByPool["tech"].length - l('menu').children[6].childNodes[2].children.length;
|
||||
} else var normalUpgradesOwned = 0;
|
||||
var title = document.createElement('div');
|
||||
title.id = "CMMissingUpgradesTitle";
|
||||
title.className = "listing";
|
||||
@@ -2724,7 +2738,7 @@ CM.Disp.CreateWrinklerButtons = function() {
|
||||
popFattestA.id = "PopFattestWrinklerButton"
|
||||
popFattestA.textContent = 'Pop Single Fattest';
|
||||
popFattestA.className = 'option';
|
||||
popFattestA.onclick = function() { Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
|
||||
popFattestA.onclick = function() {if (CM.Cache.WrinklersFattest[1]) Game.wrinklers[CM.Cache.WrinklersFattest[1]].hp = 0; };
|
||||
l('sectionLeftExtra').children[0].append(popFattestA);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user