Merge pull request #634 from DanielNoord/fix/bugs

Fix/bugs
This commit is contained in:
Daniël van Noord
2021-03-09 21:37:58 +01:00
committed by GitHub
4 changed files with 7 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -80,6 +80,9 @@ class CMAvgQueue {
for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) { for (let i = this.queue.length - 1; i >= 0 && i > this.queue.length - 1 - timePeriod; i--) {
ret += this.queue[i]; ret += this.queue[i];
} }
if (ret === 0) {
return 0;
}
return ret / timePeriod; return ret / timePeriod;
} }
} }
@@ -346,7 +349,6 @@ CM.Cache.CacheSeaSpec = function () {
* @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds * @global {number} CM.Cache.HCPerSecond The Heavenly Chips per second in the last five seconds
*/ */
CM.Cache.CacheHeavenlyChipsPS = function () { CM.Cache.CacheHeavenlyChipsPS = function () {
CM.Cache.HCPerSecond = 0; // Mainly there to not throw errors during initialization
const currDate = Math.floor(Date.now() / 1000); const currDate = Math.floor(Date.now() / 1000);
// Only calculate every new second // Only calculate every new second
if ((Game.T / Game.fps) % 1 === 0) { if ((Game.T / Game.fps) % 1 === 0) {

View File

@@ -1214,7 +1214,7 @@ CM.Disp.Tooltip = function (type, name) {
else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden else if (type === 'ha') l('tooltip').innerHTML = Game.ObjectsById[2].minigame.toolTooltip(1)(); // Harvest all button in garden
// Adds area for extra tooltip-sections // Adds area for extra tooltip-sections
if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || type === 'p' || type === 'ha') { if ((type === 'b' && Game.buyMode === 1) || type === 'u' || type === 's' || type === 'g' || (type === 'p' && !Game.keys[16]) || type === 'ha') {
const area = document.createElement('div'); const area = document.createElement('div');
area.id = 'CMTooltipArea'; area.id = 'CMTooltipArea';
l('tooltip').appendChild(area); l('tooltip').appendChild(area);
@@ -1584,7 +1584,7 @@ CM.Disp.UpdateTooltipGrimoire = function () {
*/ */
CM.Disp.UpdateTooltipGardenPlots = function () { CM.Disp.UpdateTooltipGardenPlots = function () {
const minigame = Game.Objects.Farm.minigame; const minigame = Game.Objects.Farm.minigame;
if (CM.Options.TooltipLump && minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] !== 0) { if (CM.Options.TooltipPlots && minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] !== 0) {
const mature = minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][1] > minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].matureBase; const mature = minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][1] > minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].matureBase;
const plantName = minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].name; const plantName = minigame.plantsById[minigame.plot[CM.Disp.tooltipName[1]][CM.Disp.tooltipName[0]][0] - 1].name;
l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Reward (Current / Maximum)')); l('CMTooltipBorder').appendChild(CM.Disp.TooltipCreateHeader('Reward (Current / Maximum)'));

View File

@@ -170,7 +170,7 @@ CM.Main.ReplaceNative = function () {
* If the options is 1 (on) bulkPrice is under cookies you can't buy the building. * If the options is 1 (on) bulkPrice is under cookies you can't buy the building.
*/ */
Game.ClickProduct = function (what) { Game.ClickProduct = function (what) {
if (!CM.Options.BulkBuyBlock || Game.ObjectsById[what].bulkPrice < Game.cookies) { if (!CM.Options.BulkBuyBlock || (Game.ObjectsById[what].bulkPrice < Game.cookies || Game.buyMode === -1)) {
CM.Backup.ClickProduct(what); CM.Backup.ClickProduct(what);
} }
}; };