Show cookies from clicking in stats #698

This commit is contained in:
Daniël van Noord
2021-04-03 16:00:00 +02:00
parent bfc54bf9de
commit e1c6f60726
11 changed files with 49 additions and 9 deletions

View File

@@ -50,6 +50,14 @@ export class CMAvgQueue {
}
return ret / time;
}
calcSum(timePeriod) {
let time = timePeriod;
if (time > this.maxLength) time = this.maxLength;
if (time > this.queue.length) time = this.queue.length;
if (time === 0) return 0;
return this.queue.slice(-time).reduce((a, b) => a + b, 0);
}
}
/**

View File

@@ -1,4 +1,5 @@
/* eslint-disable no-unused-vars */
import { ClickTimes } from '../Disp/VariablesAndData';
import { CMAvgQueue, InitCookiesDiff } from './CPS/AverageQueue';
import CacheAvgCPS from './CPS/CPS';
import CacheDragonAuras from './Dragon/CacheDragonAuras';
@@ -15,7 +16,10 @@ import {
CacheGoldenAndWrathCookiesMults,
CacheStatsCookies,
} from './Stats/Stats';
import { HeavenlyChipsDiff } from './VariablesAndData';
import {
CacheAverageCookiesFromClicks,
HeavenlyChipsDiff,
} from './VariablesAndData';
import CacheWrinklers from './Wrinklers/Wrinklers';
/**
@@ -31,6 +35,9 @@ export default function InitCache() {
CacheSeasonSpec();
InitCookiesDiff();
HeavenlyChipsDiff = new CMAvgQueue(5); // Used by CM.Cache.CacheHeavenlyChipsPS()
CacheAverageCookiesFromClicks = new CMAvgQueue(
ClickTimes[ClickTimes.length - 1] * 20,
);
CacheHeavenlyChipsPS();
CacheAvgCPS();
CacheIncome();

View File

@@ -39,6 +39,7 @@ export let CacheCurrWrinklerCount = 0;
export let CacheUpgrades = {};
export let CacheAverageClicks = {};
export let CacheAverageCookiesFromClicks;
export let CacheMissingUpgrades = {};
export let CacheMissingUpgradesPrestige = {};