Make current season green in Stats section #821

This commit is contained in:
Daniël van Noord
2021-05-30 11:45:51 +02:00
parent 734f3c38c2
commit 865fc3b227
4 changed files with 58 additions and 13 deletions

View File

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