[Automated] Merge dev into gh-pages
This commit is contained in:
2
dist/CookieMonsterDev.js
vendored
2
dist/CookieMonsterDev.js
vendored
File diff suppressed because one or more lines are too long
2
dist/CookieMonsterDev.js.map
vendored
2
dist/CookieMonsterDev.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -22,11 +22,11 @@ function CacheColour(target, amount) {
|
|||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode &&
|
||||||
amount === 1
|
amount === 1
|
||||||
) {
|
) {
|
||||||
target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
target[i].color = ColourOfPP(
|
target[i].colour = ColourOfPP(
|
||||||
target[i],
|
target[i],
|
||||||
BuildingGetPrice(
|
BuildingGetPrice(
|
||||||
i,
|
i,
|
||||||
@@ -42,7 +42,7 @@ function CacheColour(target, amount) {
|
|||||||
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
|
j < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;
|
||||||
j++
|
j++
|
||||||
) {
|
) {
|
||||||
if (target[i].pp === CachePPArray[j][0]) target[i].color = ColourGray; // eslint-disable-line no-param-reassign
|
if (target[i].pp === CachePPArray[j][0]) target[i].colour = ColourGray; // eslint-disable-line no-param-reassign
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ export default function CacheBuildingsPP() {
|
|||||||
)
|
)
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop = 0; // Otherwise breaks during initialization
|
||||||
|
|
||||||
// Calculate PP and colors
|
// Calculate PP and colours
|
||||||
CachePP(CacheObjects1, 1);
|
CachePP(CacheObjects1, 1);
|
||||||
CachePP(CacheObjects10, 10);
|
CachePP(CacheObjects10, 10);
|
||||||
CachePP(CacheObjects100, 100);
|
CachePP(CacheObjects100, 100);
|
||||||
|
|||||||
@@ -15,18 +15,18 @@ import { CacheMinPP, CachePPArray } from '../VariablesAndData';
|
|||||||
* It is called by CM.Cache.CacheBuildingsPP(), CM.Cache.CacheBuildingsBulkPP() and CM.Cache.CacheUpgradePP()
|
* It is called by CM.Cache.CacheBuildingsPP(), CM.Cache.CacheBuildingsBulkPP() and CM.Cache.CacheUpgradePP()
|
||||||
* @params {object} obj The obj of which the pp value should be checked
|
* @params {object} obj The obj of which the pp value should be checked
|
||||||
* @params {number} price The price of the object
|
* @params {number} price The price of the object
|
||||||
* @returns {string} color The colour assosciated with the pp value
|
* @returns {string} colour The colour assosciated with the pp value
|
||||||
*/
|
*/
|
||||||
export default function ColourOfPP(me, price) {
|
export default function ColourOfPP(me, price) {
|
||||||
let color = '';
|
let colour = '';
|
||||||
// Colour based on PP
|
// Colour based on PP
|
||||||
if (me.pp <= 0 || me.pp === Infinity) color = ColourGray;
|
if (me.pp <= 0 || me.pp === Infinity) colour = ColourGray;
|
||||||
else if (me.pp < CacheMinPP) color = ColourBlue;
|
else if (me.pp < CacheMinPP) colour = ColourBlue;
|
||||||
else if (me.pp === CacheMinPP) color = ColourGreen;
|
else if (me.pp === CacheMinPP) colour = ColourGreen;
|
||||||
else if (me.pp < CachePPArray[10][0]) color = ColourYellow;
|
else if (me.pp < CachePPArray[10][0]) colour = ColourYellow;
|
||||||
else if (me.pp < CachePPArray[20][0]) color = ColourOrange;
|
else if (me.pp < CachePPArray[20][0]) colour = ColourOrange;
|
||||||
else if (me.pp < CachePPArray[30][0]) color = ColourRed;
|
else if (me.pp < CachePPArray[30][0]) colour = ColourRed;
|
||||||
else color = ColourPurple;
|
else colour = ColourPurple;
|
||||||
|
|
||||||
// Colour based on price in terms of CPS
|
// Colour based on price in terms of CPS
|
||||||
if (
|
if (
|
||||||
@@ -40,11 +40,11 @@ export default function ColourOfPP(me, price) {
|
|||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
color = ColourBlue;
|
colour = ColourBlue;
|
||||||
}
|
}
|
||||||
// Colour based on being able to purchase
|
// Colour based on being able to purchase
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable) {
|
||||||
if (price - Game.cookies > 0) color = ColourRed;
|
if (price - Game.cookies > 0) colour = ColourRed;
|
||||||
}
|
}
|
||||||
return color;
|
return colour;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ export default function CacheUpgradePP() {
|
|||||||
} else CacheUpgrades[i].pp = Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
} else CacheUpgrades[i].pp = Game.Upgrades[i].getPrice() / CacheUpgrades[i].bonus;
|
||||||
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
|
if (Number.isNaN(CacheUpgrades[i].pp)) CacheUpgrades[i].pp = Infinity;
|
||||||
|
|
||||||
CacheUpgrades[i].color = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
|
CacheUpgrades[i].colour = ColourOfPP(CacheUpgrades[i], Game.Upgrades[i].getPrice());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,16 @@ import UpdateUpgrades from '../../Disp/BuildingsUpgrades/Upgrades';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This function toggles the upgrade bar and the colours of upgrades
|
* This function toggles the upgrade bar and the colours of upgrades
|
||||||
* It is called by a change in CM.Options.UpBarColor
|
* It is called by a change in CM.Options.UpBarColour
|
||||||
*/
|
*/
|
||||||
export default function ToggleUpgradeBarAndColor() {
|
export default function ToggleUpgradeBarAndColour() {
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor === 1) {
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour === 1) {
|
||||||
// Colours and bar on
|
// Colours and bar on
|
||||||
l('CMUpgradeBar').style.display = '';
|
l('CMUpgradeBar').style.display = '';
|
||||||
UpdateUpgrades();
|
UpdateUpgrades();
|
||||||
} else if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor === 2) {
|
} else if (
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour === 2
|
||||||
|
) {
|
||||||
// Colours on and bar off
|
// Colours on and bar off
|
||||||
l('CMUpgradeBar').style.display = 'none';
|
l('CMUpgradeBar').style.display = 'none';
|
||||||
UpdateUpgrades();
|
UpdateUpgrades();
|
||||||
|
|||||||
@@ -2,23 +2,23 @@ import { ColourGreen, ColourOrange, ColourRed, ColourYellow } from '../Variables
|
|||||||
import FormatTime from './FormatTime';
|
import FormatTime from './FormatTime';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns the color to be used for time-strings
|
* This function returns the colour to be used for time-strings
|
||||||
* @param {number} time Time to be coloured
|
* @param {number} time Time to be coloured
|
||||||
* @returns {{string, string}} {text, color} Both the formatted time and color as strings in an array
|
* @returns {{string, string}} {text, colour} Both the formatted time and colour as strings in an array
|
||||||
*/
|
*/
|
||||||
export default function GetTimeColour(time) {
|
export default function GetTimeColour(time) {
|
||||||
let color;
|
let colour;
|
||||||
let text;
|
let text;
|
||||||
if (time <= 0) {
|
if (time <= 0) {
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat)
|
||||||
text = '00:00:00:00:00';
|
text = '00:00:00:00:00';
|
||||||
else text = 'Done!';
|
else text = 'Done!';
|
||||||
color = ColourGreen;
|
colour = ColourGreen;
|
||||||
} else {
|
} else {
|
||||||
text = FormatTime(time);
|
text = FormatTime(time);
|
||||||
if (time > 300) color = ColourRed;
|
if (time > 300) colour = ColourRed;
|
||||||
else if (time > 60) color = ColourOrange;
|
else if (time > 60) colour = ColourOrange;
|
||||||
else color = ColourYellow;
|
else colour = ColourYellow;
|
||||||
}
|
}
|
||||||
return { text, color };
|
return { text, colour };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* This function toggle the locked state of a building
|
|
||||||
* @param {number} index Index of the row to change
|
|
||||||
*/
|
|
||||||
export default function ToggleBuildingLock(index) {
|
|
||||||
if (l(`productLock${index}`).innerHTML === 'Unlocked') {
|
|
||||||
l(`productLock${index}`).innerHTML = 'Locked';
|
|
||||||
l(`row${index}`).children[3].style.pointerEvents = 'none';
|
|
||||||
} else {
|
|
||||||
l(`productLock${index}`).innerHTML = 'Unlocked';
|
|
||||||
l(`row${index}`).children[3].style.pointerEvents = 'auto';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,7 @@ export default function UpdateBuildings() {
|
|||||||
Object.keys(target).forEach((i) => {
|
Object.keys(target).forEach((i) => {
|
||||||
l(`productPrice${Game.Objects[i].id}`).style.color =
|
l(`productPrice${Game.Objects[i].id}`).style.color =
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[
|
||||||
`Colour${target[i].color}`
|
`Colour${target[i].colour}`
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
l(`storeBulk${CacheMinPPBulk}`).style.color =
|
l(`storeBulk${CacheMinPPBulk}`).style.color =
|
||||||
@@ -89,14 +89,14 @@ export default function UpdateBuildings() {
|
|||||||
const o = {};
|
const o = {};
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.pp = CacheObjects1[k].pp;
|
o.pp = CacheObjects1[k].pp;
|
||||||
o.color = CacheObjects1[k].color;
|
o.colour = CacheObjects1[k].colour;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
// Sort by pp colour group, then by pp.
|
// Sort by pp colour group, then by pp.
|
||||||
arr.sort((a, b) =>
|
arr.sort((a, b) =>
|
||||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||||
? a.pp - b.pp
|
? a.pp - b.pp
|
||||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
|
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 2
|
||||||
@@ -105,14 +105,14 @@ export default function UpdateBuildings() {
|
|||||||
const o = {};
|
const o = {};
|
||||||
o.name = k;
|
o.name = k;
|
||||||
o.pp = target[k].pp;
|
o.pp = target[k].pp;
|
||||||
o.color = target[k].color;
|
o.colour = target[k].colour;
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
// Sort by pp colour group, then by pp.
|
// Sort by pp colour group, then by pp.
|
||||||
arr.sort((a, b) =>
|
arr.sort((a, b) =>
|
||||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||||
? a.pp - b.pp
|
? a.pp - b.pp
|
||||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
|
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings === 3
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ function CreateUpgradeBarLegend() {
|
|||||||
title.textContent = 'Legend';
|
title.textContent = 'Legend';
|
||||||
legend.appendChild(title);
|
legend.appendChild(title);
|
||||||
|
|
||||||
const legendLine = function (color, text) {
|
const legendLine = function (colour, text) {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.style.verticalAlign = 'middle';
|
div.style.verticalAlign = 'middle';
|
||||||
const span = document.createElement('span');
|
const span = document.createElement('span');
|
||||||
span.className = ColourBackPre + color;
|
span.className = ColourBackPre + colour;
|
||||||
span.style.display = 'inline-block';
|
span.style.display = 'inline-block';
|
||||||
span.style.height = '10px';
|
span.style.height = '10px';
|
||||||
span.style.width = '10px';
|
span.style.width = '10px';
|
||||||
@@ -70,10 +70,10 @@ export default function CreateUpgradeBar() {
|
|||||||
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
|
Game.tooltip.draw(this, escape(placeholder.innerHTML), 'store');
|
||||||
};
|
};
|
||||||
|
|
||||||
const upgradeNumber = function (id, color) {
|
const upgradeNumber = function (id, colour) {
|
||||||
const span = document.createElement('span');
|
const span = document.createElement('span');
|
||||||
span.id = id;
|
span.id = id;
|
||||||
span.className = ColourTextPre + color;
|
span.className = ColourTextPre + colour;
|
||||||
span.style.width = '14.28571428571429%';
|
span.style.width = '14.28571428571429%';
|
||||||
span.style.display = 'inline-block';
|
span.style.display = 'inline-block';
|
||||||
span.textContent = '0';
|
span.textContent = '0';
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function UpdateUpgrades() {
|
|||||||
let addedColour = false;
|
let addedColour = false;
|
||||||
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
for (let j = 0; j < l(`upgrade${i}`).childNodes.length; j += 1) {
|
||||||
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
|
if (l(`upgrade${i}`).childNodes[j].className.indexOf(ColourBackPre) !== -1) {
|
||||||
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].color;
|
l(`upgrade${i}`).childNodes[j].className = ColourBackPre + CacheUpgrades[me.name].colour;
|
||||||
addedColour = true;
|
addedColour = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -42,16 +42,16 @@ export default function UpdateUpgrades() {
|
|||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.style.width = '10px';
|
div.style.width = '10px';
|
||||||
div.style.height = '10px';
|
div.style.height = '10px';
|
||||||
div.className = ColourBackPre + CacheUpgrades[me.name].color;
|
div.className = ColourBackPre + CacheUpgrades[me.name].colour;
|
||||||
l(`upgrade${i}`).appendChild(div);
|
l(`upgrade${i}`).appendChild(div);
|
||||||
}
|
}
|
||||||
if (CacheUpgrades[me.name].color === ColourBlue) blue += 1;
|
if (CacheUpgrades[me.name].colour === ColourBlue) blue += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourGreen) green += 1;
|
else if (CacheUpgrades[me.name].colour === ColourGreen) green += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourYellow) yellow += 1;
|
else if (CacheUpgrades[me.name].colour === ColourYellow) yellow += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourOrange) orange += 1;
|
else if (CacheUpgrades[me.name].colour === ColourOrange) orange += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourRed) red += 1;
|
else if (CacheUpgrades[me.name].colour === ColourRed) red += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourPurple) purple += 1;
|
else if (CacheUpgrades[me.name].colour === ColourPurple) purple += 1;
|
||||||
else if (CacheUpgrades[me.name].color === ColourGray) gray += 1;
|
else if (CacheUpgrades[me.name].colour === ColourGray) gray += 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
l('CMUpgradeBarBlue').textContent = blue;
|
l('CMUpgradeBarBlue').textContent = blue;
|
||||||
@@ -71,16 +71,16 @@ export default function UpdateUpgrades() {
|
|||||||
o.name = Game.UpgradesInStore[x].name;
|
o.name = Game.UpgradesInStore[x].name;
|
||||||
o.price = Game.UpgradesInStore[x].basePrice;
|
o.price = Game.UpgradesInStore[x].basePrice;
|
||||||
o.pp = CacheUpgrades[o.name].pp;
|
o.pp = CacheUpgrades[o.name].pp;
|
||||||
o.color = CacheUpgrades[o.name].color;
|
o.colour = CacheUpgrades[o.name].colour;
|
||||||
arr.push(o);
|
arr.push(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades) {
|
||||||
// Sort by pp colour group, then by pp.
|
// Sort by pp colour group, then by pp.
|
||||||
arr.sort((a, b) =>
|
arr.sort((a, b) =>
|
||||||
ColoursOrdering.indexOf(a.color) === ColoursOrdering.indexOf(b.color)
|
ColoursOrdering.indexOf(a.colour) === ColoursOrdering.indexOf(b.colour)
|
||||||
? a.pp - b.pp
|
? a.pp - b.pp
|
||||||
: ColoursOrdering.indexOf(a.color) - ColoursOrdering.indexOf(b.color),
|
: ColoursOrdering.indexOf(a.colour) - ColoursOrdering.indexOf(b.colour),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
arr.sort((a, b) => a.price - b.price);
|
arr.sort((a, b) => a.price - b.price);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function CMDrawHook() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update colors
|
// Update colours
|
||||||
UpdateBuildings();
|
UpdateBuildings();
|
||||||
UpdateUpgrades();
|
UpdateUpgrades();
|
||||||
UpdateUpgradeSectionsHeight();
|
UpdateUpgradeSectionsHeight();
|
||||||
|
|||||||
@@ -11,23 +11,23 @@ import {
|
|||||||
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
* This function returns Name and Colour as object for sugar lump type that is given as input param.
|
||||||
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
* It is called by CM.Disp.UpdateTooltipSugarLump()
|
||||||
* @param {string} type Sugar Lump Type.
|
* @param {string} type Sugar Lump Type.
|
||||||
* @returns {{string}, {string}} text, color An array containing the text and display-color of the sugar lump
|
* @returns {{string}, {string}} text, colour An array containing the text and display-colour of the sugar lump
|
||||||
*/
|
*/
|
||||||
export default function GetLumpColour(type) {
|
export default function GetLumpColour(type) {
|
||||||
if (type === 0) {
|
if (type === 0) {
|
||||||
return { text: 'Normal', color: ColourGray };
|
return { text: 'Normal', colour: ColourGray };
|
||||||
}
|
}
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
return { text: 'Bifurcated', color: ColourGreen };
|
return { text: 'Bifurcated', colour: ColourGreen };
|
||||||
}
|
}
|
||||||
if (type === 2) {
|
if (type === 2) {
|
||||||
return { text: 'Golden', color: ColourYellow };
|
return { text: 'Golden', colour: ColourYellow };
|
||||||
}
|
}
|
||||||
if (type === 3) {
|
if (type === 3) {
|
||||||
return { text: 'Meaty', color: ColourOrange };
|
return { text: 'Meaty', colour: ColourOrange };
|
||||||
}
|
}
|
||||||
if (type === 4) {
|
if (type === 4) {
|
||||||
return { text: 'Caramelized', color: ColourPurple };
|
return { text: 'Caramelized', colour: ColourPurple };
|
||||||
}
|
}
|
||||||
return { text: 'Unknown Sugar Lump', color: ColourRed };
|
return { text: 'Unknown Sugar Lump', colour: ColourRed };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ export function CreateBotBar() {
|
|||||||
table.style.whiteSpace = 'nowrap';
|
table.style.whiteSpace = 'nowrap';
|
||||||
const tbody = table.appendChild(document.createElement('tbody'));
|
const tbody = table.appendChild(document.createElement('tbody'));
|
||||||
|
|
||||||
const firstCol = function (text, color) {
|
const firstCol = function (text, colour) {
|
||||||
const td = document.createElement('td');
|
const td = document.createElement('td');
|
||||||
td.style.textAlign = 'right';
|
td.style.textAlign = 'right';
|
||||||
td.className = ColourTextPre + color;
|
td.className = ColourTextPre + colour;
|
||||||
td.textContent = text;
|
td.textContent = text;
|
||||||
return td;
|
return td;
|
||||||
};
|
};
|
||||||
@@ -86,7 +86,7 @@ export function UpdateBotBar() {
|
|||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
|
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className =
|
||||||
ColourTextPre + target[i].color;
|
ColourTextPre + target[i].colour;
|
||||||
let PPString;
|
let PPString;
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
||||||
PPString = FormatTime(Math.round(target[i].pp));
|
PPString = FormatTime(Math.round(target[i].pp));
|
||||||
@@ -96,7 +96,7 @@ export function UpdateBotBar() {
|
|||||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||||
);
|
);
|
||||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
|
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className =
|
||||||
ColourTextPre + timeColour.color;
|
ColourTextPre + timeColour.colour;
|
||||||
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
if (timeColour.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
||||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||||
count
|
count
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ColourBackPre, ColourBlue, ColourTextPre } from '../VariablesAndData';
|
|||||||
* This function creates an indivudual timer for the timer bar
|
* This function creates an indivudual timer for the timer bar
|
||||||
* @param {string} id An id to identify the timer
|
* @param {string} id An id to identify the timer
|
||||||
* @param {string} name The title of the timer
|
* @param {string} name The title of the timer
|
||||||
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
|
* @param [{{string}, {string}}, ...] bars ([id, colour]) The id and colours of individual parts of the timer
|
||||||
*/
|
*/
|
||||||
export function CreateTimer(id, name, bars) {
|
export function CreateTimer(id, name, bars) {
|
||||||
const timerBar = document.createElement('div');
|
const timerBar = document.createElement('div');
|
||||||
@@ -36,20 +36,20 @@ export function CreateTimer(id, name, bars) {
|
|||||||
div.appendChild(type);
|
div.appendChild(type);
|
||||||
|
|
||||||
for (let i = 0; i < bars.length; i++) {
|
for (let i = 0; i < bars.length; i++) {
|
||||||
const colorBar = document.createElement('span');
|
const colourBar = document.createElement('span');
|
||||||
colorBar.id = bars[i].id;
|
colourBar.id = bars[i].id;
|
||||||
colorBar.style.display = 'inline-block';
|
colourBar.style.display = 'inline-block';
|
||||||
colorBar.style.height = '10px';
|
colourBar.style.height = '10px';
|
||||||
colorBar.style.verticalAlign = 'text-top';
|
colourBar.style.verticalAlign = 'text-top';
|
||||||
colorBar.style.textAlign = 'center';
|
colourBar.style.textAlign = 'center';
|
||||||
if (bars.length - 1 === i) {
|
if (bars.length - 1 === i) {
|
||||||
colorBar.style.borderTopRightRadius = '10px';
|
colourBar.style.borderTopRightRadius = '10px';
|
||||||
colorBar.style.borderBottomRightRadius = '10px';
|
colourBar.style.borderBottomRightRadius = '10px';
|
||||||
}
|
}
|
||||||
if (typeof bars[i].color !== 'undefined') {
|
if (typeof bars[i].colour !== 'undefined') {
|
||||||
colorBar.className = ColourBackPre + bars[i].color;
|
colourBar.className = ColourBackPre + bars[i].colour;
|
||||||
}
|
}
|
||||||
div.appendChild(colorBar);
|
div.appendChild(colourBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
const timer = document.createElement('span');
|
const timer = document.createElement('span');
|
||||||
|
|||||||
@@ -26,21 +26,21 @@ export function CreateTimerBar() {
|
|||||||
|
|
||||||
// Create standard Autosave bar
|
// Create standard Autosave bar
|
||||||
const CMTimerBarAutosave = CreateTimer('CMTimerBarAutosave', 'Autosave', [
|
const CMTimerBarAutosave = CreateTimer('CMTimerBarAutosave', 'Autosave', [
|
||||||
{ id: 'CMTimerBarAutosaveBar', color: ColourPurple },
|
{ id: 'CMTimerBarAutosaveBar', colour: ColourPurple },
|
||||||
]);
|
]);
|
||||||
TimerBar.appendChild(CMTimerBarAutosave);
|
TimerBar.appendChild(CMTimerBarAutosave);
|
||||||
|
|
||||||
// Create standard Golden Cookie bar
|
// Create standard Golden Cookie bar
|
||||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||||
{ id: 'CMTimerBarGCMinBar', color: ColourGray },
|
{ id: 'CMTimerBarGCMinBar', colour: ColourGray },
|
||||||
{ id: 'CMTimerBarGCBar', color: ColourPurple },
|
{ id: 'CMTimerBarGCBar', colour: ColourPurple },
|
||||||
]);
|
]);
|
||||||
TimerBar.appendChild(CMTimerBarGC);
|
TimerBar.appendChild(CMTimerBarGC);
|
||||||
|
|
||||||
// Create standard Reindeer bar
|
// Create standard Reindeer bar
|
||||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||||
{ id: 'CMTimerBarRenMinBar', color: ColourGray },
|
{ id: 'CMTimerBarRenMinBar', colour: ColourGray },
|
||||||
{ id: 'CMTimerBarRenBar', color: ColourOrange },
|
{ id: 'CMTimerBarRenBar', colour: ColourOrange },
|
||||||
]);
|
]);
|
||||||
TimerBar.appendChild(CMTimerBarRen);
|
TimerBar.appendChild(CMTimerBarRen);
|
||||||
const TimerBarBuffTimers = document.createElement('div');
|
const TimerBarBuffTimers = document.createElement('div');
|
||||||
@@ -118,9 +118,17 @@ export function UpdateTimerBar() {
|
|||||||
) / Game.fps,
|
) / Game.fps,
|
||||||
);
|
);
|
||||||
else l('CMTimerBarGCBar').textContent = '';
|
else l('CMTimerBarGCBar').textContent = '';
|
||||||
l('CMTimerBarGCTime').textContent = Math.ceil(
|
const chanceToSpawn =
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
(Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) /
|
||||||
|
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime),
|
||||||
|
) ** 5;
|
||||||
|
l('CMTimerBarGCTime').textContent = `${Math.ceil(
|
||||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
|
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
|
||||||
);
|
)} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', {
|
||||||
|
style: 'percent',
|
||||||
|
})}`;
|
||||||
numberOfTimers += 1;
|
numberOfTimers += 1;
|
||||||
} else l('CMTimerBarGC').style.display = 'none';
|
} else l('CMTimerBarGC').style.display = 'none';
|
||||||
|
|
||||||
@@ -153,9 +161,17 @@ export function UpdateTimerBar() {
|
|||||||
) / Game.fps,
|
) / Game.fps,
|
||||||
);
|
);
|
||||||
else l('CMTimerBarRenBar').textContent = '';
|
else l('CMTimerBarRenBar').textContent = '';
|
||||||
l('CMTimerBarRenTime').textContent = Math.ceil(
|
const chanceToSpawn =
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
(Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) /
|
||||||
|
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime),
|
||||||
|
) ** 5;
|
||||||
|
l('CMTimerBarRenTime').textContent = `${Math.ceil(
|
||||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
|
||||||
);
|
)} ${chanceToSpawn < 0.01 ? '<' : ''}${chanceToSpawn.toLocaleString('en', {
|
||||||
|
style: 'percent',
|
||||||
|
})}`;
|
||||||
numberOfTimers += 1;
|
numberOfTimers += 1;
|
||||||
} else {
|
} else {
|
||||||
l('CMTimerBarRen').style.display = 'none';
|
l('CMTimerBarRen').style.display = 'none';
|
||||||
@@ -171,7 +187,7 @@ export function UpdateTimerBar() {
|
|||||||
]);
|
]);
|
||||||
timer.style.display = '';
|
timer.style.display = '';
|
||||||
let classColour = '';
|
let classColour = '';
|
||||||
// Gives specific timers specific colors
|
// Gives specific timers specific colours
|
||||||
if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') {
|
if (typeof BuffColours[Game.buffs[i].name] !== 'undefined') {
|
||||||
classColour = BuffColours[Game.buffs[i].name];
|
classColour = BuffColours[Game.buffs[i].name];
|
||||||
} else classColour = ColourPurple;
|
} else classColour = ColourPurple;
|
||||||
|
|||||||
@@ -53,18 +53,18 @@ export function TooltipCreateWarningSection() {
|
|||||||
TooltipWarn.style.bottom = 'auto';
|
TooltipWarn.style.bottom = 'auto';
|
||||||
TooltipWarn.id = 'CMDispTooltipWarningParent';
|
TooltipWarn.id = 'CMDispTooltipWarningParent';
|
||||||
|
|
||||||
const create = function (boxId, color, labelTextFront, labelTextBack, deficitId) {
|
const create = function (boxId, colour, labelTextFront, labelTextBack, deficitId) {
|
||||||
const box = document.createElement('div');
|
const box = document.createElement('div');
|
||||||
box.id = boxId;
|
box.id = boxId;
|
||||||
box.style.display = 'none';
|
box.style.display = 'none';
|
||||||
box.style.transition = 'opacity 0.1s ease-out';
|
box.style.transition = 'opacity 0.1s ease-out';
|
||||||
box.className = ColourBorderPre + color;
|
box.className = ColourBorderPre + colour;
|
||||||
box.style.padding = '2px';
|
box.style.padding = '2px';
|
||||||
box.style.background = '#000 url(img/darkNoise.png)';
|
box.style.background = '#000 url(img/darkNoise.png)';
|
||||||
const labelDiv = document.createElement('div');
|
const labelDiv = document.createElement('div');
|
||||||
box.appendChild(labelDiv);
|
box.appendChild(labelDiv);
|
||||||
const labelSpan = document.createElement('span');
|
const labelSpan = document.createElement('span');
|
||||||
labelSpan.className = ColourTextPre + color;
|
labelSpan.className = ColourTextPre + colour;
|
||||||
labelSpan.style.fontWeight = 'bold';
|
labelSpan.style.fontWeight = 'bold';
|
||||||
labelSpan.textContent = labelTextFront;
|
labelSpan.textContent = labelTextFront;
|
||||||
labelDiv.appendChild(labelSpan);
|
labelDiv.appendChild(labelSpan);
|
||||||
|
|||||||
@@ -26,6 +26,19 @@ import * as Create from '../CreateTooltip';
|
|||||||
* This function adds extra info to the Building tooltips
|
* This function adds extra info to the Building tooltips
|
||||||
*/
|
*/
|
||||||
export default function Building() {
|
export default function Building() {
|
||||||
|
let target;
|
||||||
|
if (Game.buyMode === 1) {
|
||||||
|
LastTargetTooltipBuilding = target;
|
||||||
|
} else {
|
||||||
|
target = LastTargetTooltipBuilding;
|
||||||
|
}
|
||||||
|
if (Game.buyBulk === 1) target = CacheObjects1;
|
||||||
|
else if (Game.buyBulk === 10) target = CacheObjects10;
|
||||||
|
else if (Game.buyBulk === 100) target = CacheObjects100;
|
||||||
|
|
||||||
|
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
||||||
|
TooltipBonusIncome = target[TooltipName].bonus;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade === 1 &&
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade === 1 &&
|
||||||
Game.buyMode === 1
|
Game.buyMode === 1
|
||||||
@@ -33,19 +46,6 @@ export default function Building() {
|
|||||||
const tooltipBox = l('CMTooltipBorder');
|
const tooltipBox = l('CMTooltipBorder');
|
||||||
Create.TooltipCreateCalculationSection(tooltipBox);
|
Create.TooltipCreateCalculationSection(tooltipBox);
|
||||||
|
|
||||||
let target;
|
|
||||||
if (Game.buyMode === 1) {
|
|
||||||
LastTargetTooltipBuilding = target;
|
|
||||||
} else {
|
|
||||||
target = LastTargetTooltipBuilding;
|
|
||||||
}
|
|
||||||
if (Game.buyBulk === 1) target = CacheObjects1;
|
|
||||||
else if (Game.buyBulk === 10) target = CacheObjects10;
|
|
||||||
else if (Game.buyBulk === 100) target = CacheObjects100;
|
|
||||||
|
|
||||||
TooltipPrice = Game.Objects[TooltipName].bulkPrice;
|
|
||||||
TooltipBonusIncome = target[TooltipName].bonus;
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade ===
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade ===
|
||||||
1 &&
|
1 &&
|
||||||
@@ -62,11 +62,11 @@ export default function Building() {
|
|||||||
: '.'
|
: '.'
|
||||||
}01% of income)`;
|
}01% of income)`;
|
||||||
}
|
}
|
||||||
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].color;
|
l('CMTooltipBorder').className = ColourTextPre + target[TooltipName].colour;
|
||||||
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
if (Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime)
|
||||||
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
|
l('CMTooltipPP').textContent = FormatTime(target[TooltipName].pp);
|
||||||
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
else l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
|
||||||
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].color;
|
l('CMTooltipPP').className = ColourTextPre + target[TooltipName].colour;
|
||||||
const timeColour = GetTimeColour(
|
const timeColour = GetTimeColour(
|
||||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||||
);
|
);
|
||||||
@@ -74,7 +74,7 @@ export default function Building() {
|
|||||||
if (timeColour.text === 'Done!' && Game.cookies < target[TooltipName].price) {
|
if (timeColour.text === 'Done!' && Game.cookies < target[TooltipName].price) {
|
||||||
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
||||||
} else l('CMTooltipTime').textContent = timeColour.text;
|
} else l('CMTooltipTime').textContent = timeColour.text;
|
||||||
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
|
l('CMTooltipTime').className = ColourTextPre + timeColour.colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add "production left till next achievement"-bar
|
// Add "production left till next achievement"-bar
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function Grimoire() {
|
|||||||
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
|
CalculateGrimoireRefillTime(minigame.magic, minigame.magicM, spellCost),
|
||||||
);
|
);
|
||||||
time.textContent = timeColour.text;
|
time.textContent = timeColour.text;
|
||||||
time.className = ColourTextPre + timeColour.color;
|
time.className = ColourTextPre + timeColour.colour;
|
||||||
|
|
||||||
// Time left untill magic spent is recovered
|
// Time left untill magic spent is recovered
|
||||||
if (spellCost <= minigame.magic) {
|
if (spellCost <= minigame.magic) {
|
||||||
@@ -46,7 +46,7 @@ export default function Grimoire() {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
recover.textContent = recoverColour.text;
|
recover.textContent = recoverColour.text;
|
||||||
recover.className = ColourTextPre + recoverColour.color;
|
recover.className = ColourTextPre + recoverColour.colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
|
// Extra information on cookies gained when spell is Conjure Baked Goods (Name === 0)
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ export default function SugarLump() {
|
|||||||
tooltipBox.appendChild(lumpType);
|
tooltipBox.appendChild(lumpType);
|
||||||
const lumpColour = GetLumpColour(Game.lumpCurrentType);
|
const lumpColour = GetLumpColour(Game.lumpCurrentType);
|
||||||
lumpType.textContent = lumpColour.text;
|
lumpType.textContent = lumpColour.text;
|
||||||
lumpType.className = ColourTextPre + lumpColour.color;
|
lumpType.className = ColourTextPre + lumpColour.colour;
|
||||||
} else l('CMTooltipArea').style.display = 'none';
|
} else l('CMTooltipArea').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default function Upgrade() {
|
|||||||
}01% of income)`;
|
}01% of income)`;
|
||||||
}
|
}
|
||||||
l('CMTooltipBorder').className =
|
l('CMTooltipBorder').className =
|
||||||
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If clicking power upgrade
|
// If clicking power upgrade
|
||||||
@@ -73,7 +73,7 @@ export default function Upgrade() {
|
|||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
l('CMTooltipPP').className =
|
l('CMTooltipPP').className =
|
||||||
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].color;
|
ColourTextPre + CacheUpgrades[Game.UpgradesInStore[TooltipName].name].colour;
|
||||||
}
|
}
|
||||||
const timeColour = GetTimeColour(
|
const timeColour = GetTimeColour(
|
||||||
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
(TooltipPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS(),
|
||||||
@@ -85,7 +85,7 @@ export default function Upgrade() {
|
|||||||
) {
|
) {
|
||||||
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
l('CMTooltipTime').textContent = `${timeColour.text} (with Wrink)`;
|
||||||
} else l('CMTooltipTime').textContent = timeColour.text;
|
} else l('CMTooltipTime').textContent = timeColour.text;
|
||||||
l('CMTooltipTime').className = ColourTextPre + timeColour.color;
|
l('CMTooltipTime').className = ColourTextPre + timeColour.colour;
|
||||||
|
|
||||||
// Add extra info to Chocolate egg tooltip
|
// Add extra info to Chocolate egg tooltip
|
||||||
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
if (Game.UpgradesInStore[TooltipName].name === 'Chocolate egg') {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import ToggleBuildingLock from './ToggleBuildingLock';
|
import toggleBuildingLock from './toggleBuildingLock';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function adds a lock button to the "building view" in the middle section
|
* This function adds a lock button to the "building view" in the middle section
|
||||||
*/
|
*/
|
||||||
export default function CreateBuildingLockButtons() {
|
export default function createBuildingLockButtons() {
|
||||||
Object.keys(l('rows').children).forEach((index) => {
|
Object.keys(l('rows').children).forEach((index) => {
|
||||||
const productButtons = l('rows').children[index].children[1];
|
const productButtons = l('rows').children[index].children[1];
|
||||||
const button = document.createElement('div');
|
const button = document.createElement('div');
|
||||||
button.id = `productLock${Number(index) + 1}`;
|
button.id = `productLock${Number(index) + 1}`;
|
||||||
button.className = 'productButton';
|
button.className = 'productButton';
|
||||||
button.innerHTML = 'Unlocked';
|
button.innerHTML = 'Lock';
|
||||||
button.onclick = function () {
|
button.onclick = function () {
|
||||||
ToggleBuildingLock(Number(index) + 1);
|
toggleBuildingLock(Number(index) + 1);
|
||||||
};
|
};
|
||||||
productButtons.appendChild(button);
|
productButtons.appendChild(button);
|
||||||
});
|
});
|
||||||
35
src/Disp/buildingTiles/toggleBuildingLock.js
Normal file
35
src/Disp/buildingTiles/toggleBuildingLock.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* This function toggle the locked state of a building
|
||||||
|
* @param {number} index Index of the row to change
|
||||||
|
*/
|
||||||
|
export default function toggleBuildingLock(index) {
|
||||||
|
if (l(`productLock${index}`).innerHTML === 'Lock') {
|
||||||
|
// Add to storing array
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.push(
|
||||||
|
index.toString(),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update styles
|
||||||
|
l(`row${index}`).style.pointerEvents = 'none';
|
||||||
|
l(`row${index}`).style.opacity = '0.4';
|
||||||
|
l(`productLock${index}`).innerHTML = 'Unlock';
|
||||||
|
l(`productLock${index}`).style.pointerEvents = 'auto';
|
||||||
|
} else {
|
||||||
|
// Remove from storing array
|
||||||
|
if (
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.includes(
|
||||||
|
index.toString(),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames =
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.filter(
|
||||||
|
(value) => value !== index.toString(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update styles
|
||||||
|
l(`productLock${index}`).innerHTML = 'Lock';
|
||||||
|
l(`row${index}`).style.pointerEvents = 'auto';
|
||||||
|
l(`row${index}`).style.opacity = '1';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ 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';
|
||||||
|
import load from './load';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This creates a init function for the CM object. Per Game code/comments:
|
* This creates a init function for the CM object. Per Game code/comments:
|
||||||
@@ -30,5 +31,10 @@ export default function init() {
|
|||||||
Game.registerHook('click', CMClickHook);
|
Game.registerHook('click', CMClickHook);
|
||||||
Game.registerHook('draw', CMDrawHook);
|
Game.registerHook('draw', CMDrawHook);
|
||||||
Game.registerHook('logic', CMLoopHook);
|
Game.registerHook('logic', CMLoopHook);
|
||||||
|
|
||||||
|
// Load default settings if no previous saveData is found
|
||||||
|
if (typeof Game.modSaveData.cookieMonsterMod === 'undefined') {
|
||||||
|
load('{}');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,36 @@ import InitData from '../Sim/InitializeData/InitData';
|
|||||||
*/
|
*/
|
||||||
export default function load(str) {
|
export default function load(str) {
|
||||||
InitData();
|
InitData();
|
||||||
|
|
||||||
|
// Load saveData
|
||||||
saveAndLoadingFunctions.loadMod('cookieMonsterMod', str, settings, headers, CMLoopHook);
|
saveAndLoadingFunctions.loadMod('cookieMonsterMod', str, settings, headers, CMLoopHook);
|
||||||
UpdateColours();
|
|
||||||
if (
|
if (
|
||||||
|
typeof Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames ===
|
||||||
|
'undefined'
|
||||||
|
) {
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update display with colours and locking of minigames
|
||||||
|
UpdateColours();
|
||||||
|
for (
|
||||||
|
let index = 0;
|
||||||
|
index < Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.length;
|
||||||
|
index++
|
||||||
|
) {
|
||||||
|
const buildingIndex =
|
||||||
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames[index];
|
||||||
|
l(`row${buildingIndex}`).style.pointerEvents = 'none';
|
||||||
|
l(`row${buildingIndex}`).style.opacity = '0.4';
|
||||||
|
l(`productLock${buildingIndex}`).innerHTML = 'Unlock';
|
||||||
|
l(`productLock${buildingIndex}`).style.pointerEvents = 'auto';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify of update
|
||||||
|
if (
|
||||||
|
typeof Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.version !== 'undefined' &&
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.version !==
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.version !==
|
||||||
`${VersionMajor}.${VersionMinor}`
|
`${VersionMajor}.${VersionMinor}`
|
||||||
) {
|
) {
|
||||||
if (Game.prefs.popups)
|
if (Game.prefs.popups)
|
||||||
Game.Popup(
|
Game.Popup(
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import ReplaceTooltips from './ReplaceGameElements/Tooltips';
|
|||||||
import ReplaceNative from './ReplaceGameFunctions/ReplaceNative';
|
import ReplaceNative from './ReplaceGameFunctions/ReplaceNative';
|
||||||
import { LastModCount } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
import { LastModCount } from './VariablesAndData'; // eslint-disable-line no-unused-vars
|
||||||
import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea';
|
import AddWrinklerAreaDetect from './WrinklerArea/AddDetectArea';
|
||||||
import CreateBuildingLockButtons from '../Disp/Buildings/CreateBuildingLockButtons';
|
import createBuildingLockButtons from '../Disp/buildingTiles/createBuildingLockButtons';
|
||||||
import createMenuInfo from '../Disp/MenuSections/createMenuInfo';
|
import createMenuInfo from '../Disp/MenuSections/createMenuInfo';
|
||||||
import createMenuOptions from '../Disp/MenuSections/createMenuOptions';
|
import createMenuOptions from '../Disp/MenuSections/createMenuOptions';
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ export default function InitializeCookieMonster() {
|
|||||||
});
|
});
|
||||||
CreateWrinklerButtons();
|
CreateWrinklerButtons();
|
||||||
UpdateBuildingUpgradeStyle();
|
UpdateBuildingUpgradeStyle();
|
||||||
CreateBuildingLockButtons();
|
createBuildingLockButtons();
|
||||||
|
|
||||||
ReplaceTooltips();
|
ReplaceTooltips();
|
||||||
AddWrinklerAreaDetect();
|
AddWrinklerAreaDetect();
|
||||||
|
|||||||
@@ -2,36 +2,36 @@ import { before, beforeEach, describe, it } from 'mocha';
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { l, Game } from '../../GlobalsForTesting';
|
import { l, Game } from '../../GlobalsForTesting';
|
||||||
|
|
||||||
import ToggleUpgradeBarAndColor from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour';
|
import ToggleUpgradeBarAndColour from '../../../src/Config/Toggles/ToggleUpgradeBarAndColour';
|
||||||
|
|
||||||
describe('ToggleUpgradeBarAndColor', () => {
|
describe('ToggleUpgradeBarAndColour', () => {
|
||||||
global.l = l;
|
global.l = l;
|
||||||
global.Game = Game;
|
global.Game = Game;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
global.domids = {};
|
global.domids = {};
|
||||||
ToggleUpgradeBarAndColor();
|
ToggleUpgradeBarAndColour();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UpBarColor = 0', () => {
|
describe('UpBarColour = 0', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 0;
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour = 0;
|
||||||
});
|
});
|
||||||
it('Toggle style correctly', () => {
|
it('Toggle style correctly', () => {
|
||||||
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
|
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('UpBarColor = 1', () => {
|
describe('UpBarColour = 1', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 1;
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour = 1;
|
||||||
});
|
});
|
||||||
it('Toggle style correctly', () => {
|
it('Toggle style correctly', () => {
|
||||||
assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef
|
assert.equal(domids.CMUpgradeBar.style.display, ''); // eslint-disable-line no-undef
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('UpBarColor = 2', () => {
|
describe('UpBarColour = 2', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor = 2;
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour = 2;
|
||||||
});
|
});
|
||||||
it('Toggle style correctly', () => {
|
it('Toggle style correctly', () => {
|
||||||
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
|
assert.equal(domids.CMUpgradeBar.style.display, 'none'); // eslint-disable-line no-undef
|
||||||
|
|||||||
@@ -5,25 +5,25 @@ import GetTimeColour from '../../src/Disp/BeautifyAndFormatting/GetTimeColour';
|
|||||||
|
|
||||||
describe('GetTimeColour', () => {
|
describe('GetTimeColour', () => {
|
||||||
it('Format when time is less than 60', () => {
|
it('Format when time is less than 60', () => {
|
||||||
expect(GetTimeColour(59).color).to.deep.equal('Yellow');
|
expect(GetTimeColour(59).colour).to.deep.equal('Yellow');
|
||||||
});
|
});
|
||||||
it('Format when time is more than 60', () => {
|
it('Format when time is more than 60', () => {
|
||||||
expect(GetTimeColour(61).color).to.deep.equal('Orange');
|
expect(GetTimeColour(61).colour).to.deep.equal('Orange');
|
||||||
});
|
});
|
||||||
it('Format when time is more than 300', () => {
|
it('Format when time is more than 300', () => {
|
||||||
expect(GetTimeColour(301).color).to.deep.equal('Red');
|
expect(GetTimeColour(301).colour).to.deep.equal('Red');
|
||||||
});
|
});
|
||||||
describe('TimeFormat = 0', () => {
|
describe('TimeFormat = 0', () => {
|
||||||
before(() => {
|
before(() => {
|
||||||
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0;
|
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat = 0;
|
||||||
});
|
});
|
||||||
it('Format when time is 0', () => {
|
it('Format when time is 0', () => {
|
||||||
expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', color: 'Green' });
|
expect(GetTimeColour(0)).to.deep.equal({ text: 'Done!', colour: 'Green' });
|
||||||
});
|
});
|
||||||
it('Format when time is negative', () => {
|
it('Format when time is negative', () => {
|
||||||
expect(GetTimeColour(-1)).to.deep.equal({
|
expect(GetTimeColour(-1)).to.deep.equal({
|
||||||
text: 'Done!',
|
text: 'Done!',
|
||||||
color: 'Green',
|
colour: 'Green',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -34,13 +34,13 @@ describe('GetTimeColour', () => {
|
|||||||
it('Format when time is 0', () => {
|
it('Format when time is 0', () => {
|
||||||
expect(GetTimeColour(0)).to.deep.equal({
|
expect(GetTimeColour(0)).to.deep.equal({
|
||||||
text: '00:00:00:00:00',
|
text: '00:00:00:00:00',
|
||||||
color: 'Green',
|
colour: 'Green',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('Format when time is negative', () => {
|
it('Format when time is negative', () => {
|
||||||
expect(GetTimeColour(-1)).to.deep.equal({
|
expect(GetTimeColour(-1)).to.deep.equal({
|
||||||
text: '00:00:00:00:00',
|
text: '00:00:00:00:00',
|
||||||
color: 'Green',
|
colour: 'Green',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user