Merge pull request #836 from DanielNoord/tillnextachiev

Make current season green in Stats section #821
This commit is contained in:
Daniël van Noord
2021-05-30 11:47:27 +02:00
committed by GitHub
4 changed files with 58 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -84,6 +84,28 @@ export function StatsListing(type, name, text, placeholder) {
return div; return div;
} }
/**
* This function creates an stats-listing-object for the stats page for missing items displays
* It is called by CM.Disp.AddMenuStats()
* @param {string} type The type fo the listing
* @param {string} name The name of the option
* @param {object} text The text-object of the option
* @param {bool} current Whether the season of the item is the current season
* @returns {object} div The option object
*/
export function StatsMissDispListing(type, name, text, current) {
const div = document.createElement('div');
div.className = 'listing';
const listingName = document.createElement('b');
listingName.textContent = name;
if (current === true) listingName.style.color = CMOptions.ColourGreen;
div.appendChild(listingName);
div.appendChild(document.createTextNode(': '));
div.appendChild(text);
return div;
}
/** /**
* This function creates a tooltip containing all missing holiday items contained in the list theMissDisp * This function creates a tooltip containing all missing holiday items contained in the list theMissDisp
* @param {list} theMissDisp A list of the missing holiday items * @param {list} theMissDisp A list of the missing holiday items

View File

@@ -41,7 +41,12 @@ import ResetBonus from '../../../Sim/SimulationEvents/ResetAscension';
import GetCPS from '../../HelperFunctions/GetCPS'; import GetCPS from '../../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank'; import GetWrinkConfigBank from '../../HelperFunctions/GetWrinkConfigBank';
import { ColourGreen, ColourRed, ColourTextPre } from '../../VariablesAndData'; import { ColourGreen, ColourRed, ColourTextPre } from '../../VariablesAndData';
import { StatsListing, StatsHeader, StatsMissDisp } from './CreateDOMElements'; import {
StatsListing,
StatsHeader,
StatsMissDisp,
StatsMissDispListing,
} from './CreateDOMElements';
import Beautify from '../../BeautifyAndFormatting/Beautify'; import Beautify from '../../BeautifyAndFormatting/Beautify';
import FormatTime from '../../BeautifyAndFormatting/FormatTime'; import FormatTime from '../../BeautifyAndFormatting/FormatTime';
@@ -697,10 +702,11 @@ export function SeasonSection() {
if (CMOptions.Header.Sea) { if (CMOptions.Header.Sea) {
if (missingHalloweenCookies.length !== 0) { if (missingHalloweenCookies.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Halloween cookies left to buy', 'Halloween cookies left to buy',
StatsMissDisp(missingHalloweenCookies), StatsMissDisp(missingHalloweenCookies),
Game.season === 'halloween',
), ),
); );
let failRateHalloween = 0.95; let failRateHalloween = 0.95;
@@ -715,7 +721,7 @@ export function SeasonSection() {
} }
const obtainedCookiesChance = missingHalloweenCookies.length / 7; const obtainedCookiesChance = missingHalloweenCookies.length / 7;
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Chance of receiving a cookie from wrinkler/shiny wrinkler', 'Chance of receiving a cookie from wrinkler/shiny wrinkler',
document.createTextNode( document.createTextNode(
@@ -723,15 +729,17 @@ export function SeasonSection() {
(1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100, (1 - failRateHalloween * 0.9) * obtainedCookiesChance * 100,
)}%`, )}%`,
), ),
Game.season === 'halloween',
), ),
); );
} }
if (missingChristmasCookies.length !== 0) { if (missingChristmasCookies.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Christmas cookies left to buy', 'Christmas cookies left to buy',
StatsMissDisp(missingChristmasCookies), StatsMissDisp(missingChristmasCookies),
Game.season === 'christmas',
), ),
); );
let failRateChristmas = 0.8; let failRateChristmas = 0.8;
@@ -746,21 +754,23 @@ export function SeasonSection() {
} }
const obtainedCookiesChance = missingChristmasCookies.length / 7; const obtainedCookiesChance = missingChristmasCookies.length / 7;
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Chance of receiving a cookie from reindeer', 'Chance of receiving a cookie from reindeer',
document.createTextNode( document.createTextNode(
`${Beautify((1 - failRateChristmas) * obtainedCookiesChance * 100)}%`, `${Beautify((1 - failRateChristmas) * obtainedCookiesChance * 100)}%`,
), ),
Game.season === 'christmas',
), ),
); );
} }
if (missingValentineCookies.length !== 0) { if (missingValentineCookies.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Valentine cookies left to buy', 'Valentine cookies left to buy',
StatsMissDisp(missingValentineCookies), StatsMissDisp(missingValentineCookies),
Game.season === 'valentines',
), ),
); );
} }
@@ -790,40 +800,53 @@ export function SeasonSection() {
}; };
if (missingNormalEggs.length !== 0) { if (missingNormalEggs.length !== 0) {
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Normal easter eggs left to unlock', 'Normal easter eggs left to unlock',
StatsMissDisp(missingNormalEggs), StatsMissDisp(missingNormalEggs),
Game.season === 'easter',
), ),
); );
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Chance of receiving an egg from wrinkler/golden cookie', 'Chance of receiving an egg from wrinkler/golden cookie',
document.createTextNode( document.createTextNode(
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(dropRateEgg(0.9)[0] * 100)}%`, `${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(dropRateEgg(0.9)[0] * 100)}%`,
), ),
Game.season === 'easter',
), ),
); );
} }
if (missingRareEggs.length !== 0) { if (missingRareEggs.length !== 0) {
section.appendChild( section.appendChild(
StatsListing('basic', 'Rare easter eggs left to unlock', StatsMissDisp(missingRareEggs)), StatsMissDispListing(
'basic',
'Rare easter eggs left to unlock',
StatsMissDisp(missingRareEggs),
Game.season === 'easter',
),
); );
section.appendChild( section.appendChild(
StatsListing( StatsMissDispListing(
'basic', 'basic',
'Chance of receiving a rare egg from wrinkler/golden cookie', 'Chance of receiving a rare egg from wrinkler/golden cookie',
document.createTextNode( document.createTextNode(
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(dropRateEgg(0.9)[1] * 100)}%`, `${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(dropRateEgg(0.9)[1] * 100)}%`,
), ),
Game.season === 'easter',
), ),
); );
} }
if (Game.season === 'christmas') if (Game.season === 'christmas')
section.appendChild( section.appendChild(
StatsListing('basic', 'Reindeer reward', document.createTextNode(Beautify(CacheSeaSpec))), StatsMissDispListing(
'basic',
'Reindeer reward',
document.createTextNode(Beautify(CacheSeaSpec)),
true,
),
); );
if (choEgg) { if (choEgg) {
section.appendChild( section.appendChild(