Merge pull request #744 from DanielNoord/missingachievements
Missingachievements
This commit is contained in:
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js
vendored
2
dist/CookieMonster.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonster.js.map
vendored
2
dist/CookieMonster.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -522,9 +522,16 @@ const Config = {
|
|||||||
'bool',
|
'bool',
|
||||||
'Statistics',
|
'Statistics',
|
||||||
['Missing upgrades OFF', 'Missing upgrades ON'],
|
['Missing upgrades OFF', 'Missing upgrades ON'],
|
||||||
'Shows missing upgrades in stats menu',
|
'Shows missing upgrades in statistics menu',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
MissingAchievements: new SettingStandard(
|
||||||
|
'bool',
|
||||||
|
'Statistics',
|
||||||
|
['Missing Achievements OFF', 'Missing Normal Achievements ON'],
|
||||||
|
'Shows missing normal achievements in statistics menu.',
|
||||||
|
false,
|
||||||
|
),
|
||||||
UpStats: new SettingStandard(
|
UpStats: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'Statistics',
|
'Statistics',
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ const ConfigDefault = {
|
|||||||
TooltipAscendButton: 1,
|
TooltipAscendButton: 1,
|
||||||
Stats: 1,
|
Stats: 1,
|
||||||
MissingUpgrades: 1,
|
MissingUpgrades: 1,
|
||||||
|
MissingAchievements: 0,
|
||||||
UpStats: 1,
|
UpStats: 1,
|
||||||
HeavenlyChipsTarget: 1,
|
HeavenlyChipsTarget: 1,
|
||||||
ShowMissedGC: 1,
|
ShowMissedGC: 1,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
* This function handles all custom drawing for the Game.Draw() function.
|
* This function handles all custom drawing for the Game.Draw() function.
|
||||||
* It is hooked on 'draw' by CM.RegisterHooks()
|
* It is hooked on 'draw' by CM.RegisterHooks()
|
||||||
*/
|
*/
|
||||||
export default function Draw() {
|
export default function CMDrawHook() {
|
||||||
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
|
// Draw autosave timer in stats menu, this must be done here to make it count down correctly
|
||||||
if (
|
if (
|
||||||
Game.prefs.autosave &&
|
Game.prefs.autosave &&
|
||||||
@@ -17,6 +17,7 @@ import PopAllNormalWrinklers from '../../HelperFunctions/PopWrinklers';
|
|||||||
import { ClickTimes, CookieTimes } from '../../VariablesAndData';
|
import { ClickTimes, CookieTimes } from '../../VariablesAndData';
|
||||||
import GetCPS from '../../HelperFunctions/GetCPS';
|
import GetCPS from '../../HelperFunctions/GetCPS';
|
||||||
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
import { Beautify } from '../../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
|
import AddMissingAchievements from './CreateMissingAchievements';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds stats created by CookieMonster to the stats page
|
* This function adds stats created by CookieMonster to the stats page
|
||||||
@@ -191,4 +192,7 @@ export default function AddMenuStats(title) {
|
|||||||
if (CMOptions.MissingUpgrades) {
|
if (CMOptions.MissingUpgrades) {
|
||||||
AddMissingUpgrades();
|
AddMissingUpgrades();
|
||||||
}
|
}
|
||||||
|
if (CMOptions.MissingAchievements) {
|
||||||
|
AddMissingAchievements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/* eslint-disable no-param-reassign */
|
||||||
|
import { CMOptions } from '../../../Config/VariablesAndData';
|
||||||
|
|
||||||
|
function CrateTooltipLockedAchievements(me) {
|
||||||
|
const tags = [];
|
||||||
|
if (me.pool === 'shadow') tags.push('Shadow Achievement', '#9700cf');
|
||||||
|
else tags.push('Achievement', 0);
|
||||||
|
tags.push('Locked', 0);
|
||||||
|
|
||||||
|
let neuromancy = 0;
|
||||||
|
if (Game.Has('Neuromancy') || (Game.sesame && me.pool === 'debug'))
|
||||||
|
neuromancy = 1;
|
||||||
|
if (neuromancy && me.won === 0) tags.push('Click to win!', '#00c462');
|
||||||
|
else if (neuromancy && me.won > 0) tags.push('Click to lose!', '#00c462');
|
||||||
|
|
||||||
|
let { icon } = me;
|
||||||
|
if (me.iconFunction) icon = me.iconFunction();
|
||||||
|
|
||||||
|
let { desc } = me;
|
||||||
|
if (me.descFunc) desc = me.descFunc('stats');
|
||||||
|
|
||||||
|
let tagsStr = '';
|
||||||
|
for (let i = 0; i < tags.length; i += 2) {
|
||||||
|
if (i % 2 === 0)
|
||||||
|
tagsStr += ` <div class="tag" style="color:${
|
||||||
|
tags[i + 1] === 0 ? '#fff' : tags[i + 1]
|
||||||
|
};">[${tags[i]}]</div>`;
|
||||||
|
}
|
||||||
|
tagsStr = tagsStr.substring(1);
|
||||||
|
|
||||||
|
return `<div style="padding:8px 4px;min-width:350px;opacity:0.5">
|
||||||
|
<div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;background-position:${
|
||||||
|
-icon[0] * 48
|
||||||
|
}px ${-icon[1] * 48}px;"></div>
|
||||||
|
<div class="name">${me.name}</div>
|
||||||
|
${tagsStr}<div class="line"></div><div class="description">${desc}</div></div>
|
||||||
|
${
|
||||||
|
Game.sesame
|
||||||
|
? `<div style="font-size:9px;">Id : ${me.id} | Order : ${Math.floor(
|
||||||
|
me.order,
|
||||||
|
)}${me.tier ? ` | Tier : ${me.tier}` : ''}</div>`
|
||||||
|
: ''
|
||||||
|
}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function overwrites the crates of missing achievements
|
||||||
|
*/
|
||||||
|
export default function AddMissingAchievements() {
|
||||||
|
let achievs;
|
||||||
|
Object.values(document.querySelectorAll('div.title')).forEach((i) => {
|
||||||
|
if (i.textContent.includes('Achievements')) {
|
||||||
|
achievs = i.parentElement.querySelectorAll('div.listing.crateBox')[0];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (CMOptions.MissingAchievements) {
|
||||||
|
Object.values(achievs.children).forEach((achievsCrate) => {
|
||||||
|
if (!achievsCrate.className.includes('enabled')) {
|
||||||
|
const id = achievsCrate.onclick.toString().match(/(?<=\[).*(?=\])/g)[0];
|
||||||
|
const { icon } = Game.AchievementsById[id];
|
||||||
|
achievsCrate.style.backgroundPosition = `${-icon[0] * 48}px ${
|
||||||
|
-icon[1] * 48
|
||||||
|
}px`;
|
||||||
|
achievsCrate.onmouseover = function () {
|
||||||
|
if (!Game.mouseDown) {
|
||||||
|
Game.setOnCrate(this);
|
||||||
|
Game.tooltip.dynamic = 1;
|
||||||
|
Game.tooltip.draw(
|
||||||
|
this,
|
||||||
|
function () {
|
||||||
|
return (function () {
|
||||||
|
return CrateTooltipLockedAchievements(
|
||||||
|
Game.AchievementsById[id],
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
},
|
||||||
|
'top',
|
||||||
|
);
|
||||||
|
Game.tooltip.wobble();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||||
import Draw from '../Disp/Draw';
|
import CMDrawHook from '../Disp/DrawHook';
|
||||||
import CMClickHook from '../Main/ClickHook';
|
import CMClickHook from '../Main/ClickHook';
|
||||||
import InitializeCookieMonster from '../Main/Initialization';
|
import InitializeCookieMonster from '../Main/Initialization';
|
||||||
import CMLoopHook from '../Main/LoopHook';
|
import CMLoopHook from '../Main/LoopHook';
|
||||||
@@ -22,7 +22,7 @@ export default function init() {
|
|||||||
}
|
}
|
||||||
if (proceed) {
|
if (proceed) {
|
||||||
InitializeCookieMonster();
|
InitializeCookieMonster();
|
||||||
Game.registerHook('draw', Draw);
|
Game.registerHook('draw', CMDrawHook);
|
||||||
Game.registerHook('logic', CMLoopHook);
|
Game.registerHook('logic', CMLoopHook);
|
||||||
Game.registerHook('click', CMClickHook);
|
Game.registerHook('click', CMClickHook);
|
||||||
isInitializing = false;
|
isInitializing = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user