New colour settings, changeable flash colour #728
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
@@ -3,6 +3,7 @@ import ConfigData from '../../Data/SettingsData';
|
|||||||
import { CMOptions } from '../VariablesAndData';
|
import { CMOptions } from '../VariablesAndData';
|
||||||
import save from '../../InitSaveLoad/save';
|
import save from '../../InitSaveLoad/save';
|
||||||
import CMLoop from '../../Main/Loop';
|
import CMLoop from '../../Main/Loop';
|
||||||
|
import UpdateColours from '../../Disp/HelperFunctions/UpdateColours';
|
||||||
|
|
||||||
/** Functions related to saving, loading and restoring all settings */
|
/** Functions related to saving, loading and restoring all settings */
|
||||||
|
|
||||||
@@ -41,25 +42,19 @@ export function LoadConfig(settings) {
|
|||||||
if (settings !== undefined) {
|
if (settings !== undefined) {
|
||||||
CMOptions = settings;
|
CMOptions = settings;
|
||||||
|
|
||||||
|
if (typeof CMOptions.Colors !== 'undefined') {
|
||||||
|
delete CMOptions.Colors;
|
||||||
|
}
|
||||||
|
if (typeof CMOptions.Colours !== 'undefined') {
|
||||||
|
delete CMOptions.Colours;
|
||||||
|
}
|
||||||
|
|
||||||
// Check values
|
// Check values
|
||||||
let mod = false;
|
let mod = false;
|
||||||
Object.keys(ConfigDefault).forEach((i) => {
|
Object.keys(ConfigDefault).forEach((i) => {
|
||||||
if (typeof CMOptions[i] === 'undefined') {
|
if (typeof CMOptions[i] === 'undefined') {
|
||||||
mod = true;
|
mod = true;
|
||||||
CMOptions[i] = ConfigDefault[i];
|
CMOptions[i] = ConfigDefault[i];
|
||||||
} else if (i !== 'Header' && i !== 'Colors') {
|
|
||||||
if (i.indexOf('SoundURL') === -1) {
|
|
||||||
if (
|
|
||||||
!(CMOptions[i] > -1 && CMOptions[i] < ConfigData[i].label.length)
|
|
||||||
) {
|
|
||||||
mod = true;
|
|
||||||
CMOptions[i] = ConfigDefault[i];
|
|
||||||
}
|
|
||||||
} else if (typeof CMOptions[i] !== 'string') {
|
|
||||||
// Sound URLs
|
|
||||||
mod = true;
|
|
||||||
CMOptions[i] = ConfigDefault[i];
|
|
||||||
}
|
|
||||||
} else if (i === 'Header') {
|
} else if (i === 'Header') {
|
||||||
Object.keys(ConfigDefault.Header).forEach((j) => {
|
Object.keys(ConfigDefault.Header).forEach((j) => {
|
||||||
if (
|
if (
|
||||||
@@ -70,17 +65,6 @@ export function LoadConfig(settings) {
|
|||||||
CMOptions[i][j] = ConfigDefault[i][j];
|
CMOptions[i][j] = ConfigDefault[i][j];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
// Colors
|
|
||||||
Object.keys(ConfigDefault.Colors).forEach((j) => {
|
|
||||||
if (
|
|
||||||
typeof CMOptions[i][j] === 'undefined' ||
|
|
||||||
typeof CMOptions[i][j] !== 'string'
|
|
||||||
) {
|
|
||||||
mod = true;
|
|
||||||
CMOptions[i][j] = ConfigDefault[i][j];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (mod) SaveConfig();
|
if (mod) SaveConfig();
|
||||||
@@ -94,4 +78,6 @@ export function LoadConfig(settings) {
|
|||||||
// Default values
|
// Default values
|
||||||
LoadConfig(ConfigDefault);
|
LoadConfig(ConfigDefault);
|
||||||
}
|
}
|
||||||
|
Game.UpdateMenu();
|
||||||
|
UpdateColours();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ export class SettingStandard extends Setting {
|
|||||||
}
|
}
|
||||||
/** The colour picker setting class */
|
/** The colour picker setting class */
|
||||||
export class SettingColours extends Setting {
|
export class SettingColours extends Setting {
|
||||||
constructor(type, group, desc, func) {
|
constructor(type, group, desc) {
|
||||||
super(type, group);
|
super(type, group);
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
this.func = func;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import { CMOptions } from '../Config/VariablesAndData';
|
|||||||
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
|
import UpdateBuildings from '../Disp/BuildingsUpgrades/Buildings';
|
||||||
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
import UpdateUpgrades from '../Disp/BuildingsUpgrades/Upgrades';
|
||||||
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
import RefreshScale from '../Disp/HelperFunctions/RefreshScale';
|
||||||
import UpdateColours from '../Disp/HelperFunctions/UpdateColours';
|
|
||||||
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
import { UpdateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||||
import { SimDoSims } from '../Sim/VariablesAndData';
|
import { SimDoSims } from '../Sim/VariablesAndData';
|
||||||
import {
|
import {
|
||||||
@@ -193,30 +192,50 @@ const Config = {
|
|||||||
0,
|
0,
|
||||||
Infinity,
|
Infinity,
|
||||||
),
|
),
|
||||||
Colours: new SettingColours(
|
ColourBlue: new SettingColours(
|
||||||
'colour',
|
'colour',
|
||||||
'Colours',
|
'Colours',
|
||||||
{
|
'Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
|
||||||
Blue:
|
),
|
||||||
'Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels',
|
ColourGreen: new SettingColours(
|
||||||
Green:
|
'colour',
|
||||||
'Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
'Colours',
|
||||||
Yellow:
|
'Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||||
'Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
|
),
|
||||||
Orange:
|
ColourYellow: new SettingColours(
|
||||||
'Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
|
'colour',
|
||||||
Red:
|
'Colours',
|
||||||
'Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
|
'Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels',
|
||||||
Purple:
|
),
|
||||||
'Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
|
ColourOrange: new SettingColours(
|
||||||
Gray:
|
'colour',
|
||||||
'Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
'Colours',
|
||||||
Pink: 'Standard colour is pink. Used for Dragonflight bar',
|
'Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels',
|
||||||
Brown: 'Standard colour is brown. Used for Dragon Harvest bar',
|
),
|
||||||
},
|
ColourRed: new SettingColours(
|
||||||
function () {
|
'colour',
|
||||||
UpdateColours();
|
'Colours',
|
||||||
},
|
'Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels',
|
||||||
|
),
|
||||||
|
ColourPurple: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'Colours',
|
||||||
|
'Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels',
|
||||||
|
),
|
||||||
|
ColourGray: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'Colours',
|
||||||
|
'Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||||
|
),
|
||||||
|
ColourPink: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'Colours',
|
||||||
|
'Standard colour is pink. Used for Dragonflight bar',
|
||||||
|
),
|
||||||
|
ColourBrown: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'Colours',
|
||||||
|
'Standard colour is brown. Used for Dragon Harvest bar',
|
||||||
),
|
),
|
||||||
|
|
||||||
// BarsDisplay
|
// BarsDisplay
|
||||||
@@ -561,6 +580,11 @@ const Config = {
|
|||||||
'Flash screen on golden cookie',
|
'Flash screen on golden cookie',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourGCFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationGC',
|
||||||
|
'The colour of the GC flash, standard colour is white',
|
||||||
|
),
|
||||||
GCSound: new SettingStandard(
|
GCSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationGC',
|
'NotificationGC',
|
||||||
@@ -592,6 +616,11 @@ const Config = {
|
|||||||
'Flash screen on fortune cookie spawn',
|
'Flash screen on fortune cookie spawn',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourFortuneFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationFC',
|
||||||
|
'The colour of the fortune flash, standard colour is white',
|
||||||
|
),
|
||||||
FortuneSound: new SettingStandard(
|
FortuneSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationFC',
|
'NotificationFC',
|
||||||
@@ -623,6 +652,11 @@ const Config = {
|
|||||||
'Flash screen on season popup',
|
'Flash screen on season popup',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourSeaFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationSea',
|
||||||
|
'The colour of the season popup flash, standard colour is white',
|
||||||
|
),
|
||||||
SeaSound: new SettingStandard(
|
SeaSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationSea',
|
'NotificationSea',
|
||||||
@@ -644,6 +678,11 @@ const Config = {
|
|||||||
'Flash screen on garden tick',
|
'Flash screen on garden tick',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourGardFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationGard',
|
||||||
|
'The colour of the garden flash, standard colour is white',
|
||||||
|
),
|
||||||
GardSound: new SettingStandard(
|
GardSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationGard',
|
'NotificationGard',
|
||||||
@@ -675,6 +714,11 @@ const Config = {
|
|||||||
'Flash screen when magic reaches maximum',
|
'Flash screen when magic reaches maximum',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourMagicFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationMagi',
|
||||||
|
'The colour of the magic flash, standard colour is white',
|
||||||
|
),
|
||||||
MagicSound: new SettingStandard(
|
MagicSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationMagi',
|
'NotificationMagi',
|
||||||
@@ -706,6 +750,11 @@ const Config = {
|
|||||||
'Flash screen when a wrinkler appears',
|
'Flash screen when a wrinkler appears',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourWrinklerFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationWrink',
|
||||||
|
'The colour of the wrinkler flash, standard colour is white',
|
||||||
|
),
|
||||||
WrinklerSound: new SettingStandard(
|
WrinklerSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationWrink',
|
'NotificationWrink',
|
||||||
@@ -737,6 +786,11 @@ const Config = {
|
|||||||
'Flash screen when the maximum amount of Wrinklers has appeared',
|
'Flash screen when the maximum amount of Wrinklers has appeared',
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
|
ColourWrinklerMaxFlash: new SettingColours(
|
||||||
|
'colour',
|
||||||
|
'NotificationWrinkMax',
|
||||||
|
'The colour of the maximum wrinkler flash, standard colour is white',
|
||||||
|
),
|
||||||
WrinklerMaxSound: new SettingStandard(
|
WrinklerMaxSound: new SettingStandard(
|
||||||
'bool',
|
'bool',
|
||||||
'NotificationWrinkMax',
|
'NotificationWrinkMax',
|
||||||
|
|||||||
@@ -16,17 +16,15 @@ const ConfigDefault = {
|
|||||||
PPExcludeTop: 0,
|
PPExcludeTop: 0,
|
||||||
PPRigidelMode: 0,
|
PPRigidelMode: 0,
|
||||||
PPSecondsLowerLimit: 0,
|
PPSecondsLowerLimit: 0,
|
||||||
Colours: {
|
ColourBlue: '#4bb8f0',
|
||||||
Blue: '#4bb8f0',
|
ColourGreen: '#00ff00',
|
||||||
Green: '#00ff00',
|
ColourYellow: '#ffff00',
|
||||||
Yellow: '#ffff00',
|
ColourOrange: '#ff7f00',
|
||||||
Orange: '#ff7f00',
|
ColourRed: '#ff0000',
|
||||||
Red: '#ff0000',
|
ColourPurple: '#ff00ff',
|
||||||
Purple: '#ff00ff',
|
ColourGray: '#b3b3b3',
|
||||||
Gray: '#b3b3b3',
|
ColourPink: '#ff1493',
|
||||||
Pink: '#ff1493',
|
ColourBrown: '#8b4513',
|
||||||
Brown: '#8b4513',
|
|
||||||
},
|
|
||||||
BotBar: 1,
|
BotBar: 1,
|
||||||
TimerBar: 1,
|
TimerBar: 1,
|
||||||
TimerBarPos: 0,
|
TimerBarPos: 0,
|
||||||
@@ -66,39 +64,46 @@ const ConfigDefault = {
|
|||||||
GeneralSound: 1,
|
GeneralSound: 1,
|
||||||
GCNotification: 0,
|
GCNotification: 0,
|
||||||
GCFlash: 1,
|
GCFlash: 1,
|
||||||
|
ColourGCFlash: '#ffffff',
|
||||||
GCSound: 1,
|
GCSound: 1,
|
||||||
GCVolume: 100,
|
GCVolume: 100,
|
||||||
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
GCSoundURL: 'https://freesound.org/data/previews/66/66717_931655-lq.mp3',
|
||||||
FortuneNotification: 0,
|
FortuneNotification: 0,
|
||||||
FortuneFlash: 1,
|
FortuneFlash: 1,
|
||||||
|
ColourFortuneFlash: '#ffffff',
|
||||||
FortuneSound: 1,
|
FortuneSound: 1,
|
||||||
FortuneVolume: 100,
|
FortuneVolume: 100,
|
||||||
FortuneSoundURL:
|
FortuneSoundURL:
|
||||||
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
'https://freesound.org/data/previews/174/174027_3242494-lq.mp3',
|
||||||
SeaNotification: 0,
|
SeaNotification: 0,
|
||||||
SeaFlash: 1,
|
SeaFlash: 1,
|
||||||
|
ColourSeaFlash: '#ffffff',
|
||||||
SeaSound: 1,
|
SeaSound: 1,
|
||||||
SeaVolume: 100,
|
SeaVolume: 100,
|
||||||
SeaSoundURL:
|
SeaSoundURL:
|
||||||
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||||
GardFlash: 1,
|
GardFlash: 1,
|
||||||
|
ColourGardFlash: '#ffffff',
|
||||||
GardSound: 1,
|
GardSound: 1,
|
||||||
GardVolume: 100,
|
GardVolume: 100,
|
||||||
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||||
MagicNotification: 0,
|
MagicNotification: 0,
|
||||||
MagicFlash: 1,
|
MagicFlash: 1,
|
||||||
|
ColourMagicFlash: '#ffffff',
|
||||||
MagicSound: 1,
|
MagicSound: 1,
|
||||||
MagicVolume: 100,
|
MagicVolume: 100,
|
||||||
MagicSoundURL:
|
MagicSoundURL:
|
||||||
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
|
||||||
WrinklerNotification: 0,
|
WrinklerNotification: 0,
|
||||||
WrinklerFlash: 1,
|
WrinklerFlash: 1,
|
||||||
|
ColourWrinklerFlash: '#ffffff',
|
||||||
WrinklerSound: 1,
|
WrinklerSound: 1,
|
||||||
WrinklerVolume: 100,
|
WrinklerVolume: 100,
|
||||||
WrinklerSoundURL:
|
WrinklerSoundURL:
|
||||||
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
'https://freesound.org/data/previews/124/124186_8043-lq.mp3',
|
||||||
WrinklerMaxNotification: 0,
|
WrinklerMaxNotification: 0,
|
||||||
WrinklerMaxFlash: 1,
|
WrinklerMaxFlash: 1,
|
||||||
|
ColourWrinklerMaxFlash: '#ffffff',
|
||||||
WrinklerMaxSound: 1,
|
WrinklerMaxSound: 1,
|
||||||
WrinklerMaxVolume: 100,
|
WrinklerMaxVolume: 100,
|
||||||
WrinklerMaxSoundURL:
|
WrinklerMaxSoundURL:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
import { CMOptions } from '../../Config/VariablesAndData';
|
import { CMOptions } from '../../Config/VariablesAndData';
|
||||||
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
import BuildingSell from '../../Sim/SimulationEvents/SellBuilding';
|
||||||
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||||
import { Colours, LastTargetBuildings } from '../VariablesAndData';
|
import { ColoursOrdering, LastTargetBuildings } from '../VariablesAndData';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section: Functions related to right column of the screen (buildings/upgrades)
|
* Section: Functions related to right column of the screen (buildings/upgrades)
|
||||||
@@ -33,7 +33,7 @@ export default function UpdateBuildings() {
|
|||||||
if (CMOptions.BuildColour === 1) {
|
if (CMOptions.BuildColour === 1) {
|
||||||
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 =
|
||||||
CMOptions.Colours[target[i].color];
|
CMOptions[`Colour${target[i].color}`];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.keys(Game.Objects).forEach((i) => {
|
Object.keys(Game.Objects).forEach((i) => {
|
||||||
@@ -72,9 +72,10 @@ export default function UpdateBuildings() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.sort(function (a, b) {
|
arr.sort(function (a, b) {
|
||||||
return Colours.indexOf(a.color) > Colours.indexOf(b.color)
|
return ColoursOrdering.indexOf(a.color) >
|
||||||
|
ColoursOrdering.indexOf(b.color)
|
||||||
? 1
|
? 1
|
||||||
: Colours.indexOf(a.color) < Colours.indexOf(b.color)
|
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color)
|
||||||
? -1
|
? -1
|
||||||
: a.pp < b.pp
|
: a.pp < b.pp
|
||||||
? -1
|
? -1
|
||||||
@@ -89,9 +90,10 @@ export default function UpdateBuildings() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
arr.sort(function (a, b) {
|
arr.sort(function (a, b) {
|
||||||
return Colours.indexOf(a.color) > Colours.indexOf(b.color)
|
return ColoursOrdering.indexOf(a.color) >
|
||||||
|
ColoursOrdering.indexOf(b.color)
|
||||||
? 1
|
? 1
|
||||||
: Colours.indexOf(a.color) < Colours.indexOf(b.color)
|
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color)
|
||||||
? -1
|
? -1
|
||||||
: a.pp < b.pp
|
: a.pp < b.pp
|
||||||
? -1
|
? -1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ColourOrange,
|
ColourOrange,
|
||||||
ColourPurple,
|
ColourPurple,
|
||||||
ColourRed,
|
ColourRed,
|
||||||
Colours,
|
ColoursOrdering,
|
||||||
ColourYellow,
|
ColourYellow,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
@@ -81,9 +81,9 @@ export default function UpdateUpgrades() {
|
|||||||
|
|
||||||
if (CMOptions.SortUpgrades) {
|
if (CMOptions.SortUpgrades) {
|
||||||
arr.sort(function (a, b) {
|
arr.sort(function (a, b) {
|
||||||
return Colours.indexOf(a.color) > Colours.indexOf(b.color)
|
return ColoursOrdering.indexOf(a.color) > ColoursOrdering.indexOf(b.color)
|
||||||
? 1
|
? 1
|
||||||
: Colours.indexOf(a.color) < Colours.indexOf(b.color)
|
: ColoursOrdering.indexOf(a.color) < ColoursOrdering.indexOf(b.color)
|
||||||
? -1
|
? -1
|
||||||
: a.pp < b.pp
|
: a.pp < b.pp
|
||||||
? -1
|
? -1
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import UpdateBuildings from '../BuildingsUpgrades/Buildings';
|
|||||||
import {
|
import {
|
||||||
ColourBackPre,
|
ColourBackPre,
|
||||||
ColourBorderPre,
|
ColourBorderPre,
|
||||||
Colours,
|
ColoursOrdering,
|
||||||
ColourTextPre,
|
ColourTextPre,
|
||||||
} from '../VariablesAndData';
|
} from '../VariablesAndData';
|
||||||
|
|
||||||
@@ -13,19 +13,19 @@ import {
|
|||||||
*/
|
*/
|
||||||
export default function UpdateColours() {
|
export default function UpdateColours() {
|
||||||
let str = '';
|
let str = '';
|
||||||
for (let i = 0; i < Colours.length; i++) {
|
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||||
str += `.${ColourTextPre}${Colours[i]} { color: ${
|
str += `.${ColourTextPre}${ColoursOrdering[i]} { color: ${
|
||||||
CMOptions.Colours[Colours[i]]
|
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||||
}; }\n`;
|
}; }\n`;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < Colours.length; i++) {
|
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||||
str += `.${ColourBackPre}${Colours[i]} { background-color: ${
|
str += `.${ColourBackPre}${ColoursOrdering[i]} { background-color: ${
|
||||||
CMOptions.Colours[Colours[i]]
|
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||||
}; }\n`;
|
}; }\n`;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < Colours.length; i++) {
|
for (let i = 0; i < ColoursOrdering.length; i++) {
|
||||||
str += `.${ColourBorderPre}${Colours[i]} { border: 1px solid ${
|
str += `.${ColourBorderPre}${ColoursOrdering[i]} { border: 1px solid ${
|
||||||
CMOptions.Colours[Colours[i]]
|
CMOptions[`Colour${ColoursOrdering[i]}`]
|
||||||
}; }\n`;
|
}; }\n`;
|
||||||
}
|
}
|
||||||
l('CMCSS').textContent = str;
|
l('CMCSS').textContent = str;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* This function creates a white square over the full screen and appends it to l('wrapper')
|
* This function creates a white square over the full screen and appends it to l('wrapper')
|
||||||
*/
|
*/
|
||||||
export default function CreateWhiteScreen() {
|
export default function CreateFlashScreen() {
|
||||||
const WhiteScreen = document.createElement('div');
|
const WhiteScreen = document.createElement('div');
|
||||||
WhiteScreen.id = 'CMWhiteScreen';
|
WhiteScreen.id = 'CMFlashScreen';
|
||||||
WhiteScreen.style.width = '100%';
|
WhiteScreen.style.width = '100%';
|
||||||
WhiteScreen.style.height = '100%';
|
WhiteScreen.style.height = '100%';
|
||||||
WhiteScreen.style.backgroundColor = 'white';
|
WhiteScreen.style.backgroundColor = 'white';
|
||||||
@@ -20,8 +20,8 @@ import Config from '../../Data/SettingsData';
|
|||||||
import ConfigDefault from '../../Data/SettingsDefault';
|
import ConfigDefault from '../../Data/SettingsDefault';
|
||||||
import RefreshScale from '../HelperFunctions/RefreshScale';
|
import RefreshScale from '../HelperFunctions/RefreshScale';
|
||||||
import UpdateColours from '../HelperFunctions/UpdateColours';
|
import UpdateColours from '../HelperFunctions/UpdateColours';
|
||||||
|
import Flash from '../Notifications/Flash';
|
||||||
import PlaySound from '../Notifications/Sound';
|
import PlaySound from '../Notifications/Sound';
|
||||||
import { Colours } from '../VariablesAndData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function creates a header-object for the options page
|
* This function creates a header-object for the options page
|
||||||
@@ -167,29 +167,36 @@ function CreatePrefOption(config) {
|
|||||||
div.appendChild(label);
|
div.appendChild(label);
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
if (Config[config].type === 'color') {
|
if (Config[config].type === 'colour') {
|
||||||
div.className = '';
|
div.className = '';
|
||||||
for (let i = 0; i < Colours.length; i++) {
|
const innerDiv = document.createElement('div');
|
||||||
const innerDiv = document.createElement('div');
|
innerDiv.className = 'listing';
|
||||||
innerDiv.className = 'listing';
|
const input = document.createElement('input');
|
||||||
const input = document.createElement('input');
|
input.id = config;
|
||||||
input.id = Colours[i];
|
input.style.width = '65px';
|
||||||
input.style.width = '65px';
|
input.setAttribute('value', CMOptions[config]);
|
||||||
input.setAttribute('value', CMOptions.Colours[Colours[i]]);
|
innerDiv.appendChild(input);
|
||||||
innerDiv.appendChild(input);
|
const change = function () {
|
||||||
const change = function () {
|
CMOptions[this.targetElement.id] = this.toHEXString();
|
||||||
CMOptions.Colours[this.targetElement.id] = this.toHEXString();
|
UpdateColours();
|
||||||
UpdateColours();
|
SaveConfig();
|
||||||
SaveConfig();
|
Game.UpdateMenu();
|
||||||
Game.UpdateMenu();
|
};
|
||||||
|
// eslint-disable-next-line no-new
|
||||||
|
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
||||||
|
const label = document.createElement('label');
|
||||||
|
label.textContent = Config[config].desc;
|
||||||
|
innerDiv.appendChild(label);
|
||||||
|
if (config.includes('Flash')) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.className = 'option';
|
||||||
|
a.onclick = function () {
|
||||||
|
Flash(3, config.replace('Colour', ''), true);
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line no-new
|
a.textContent = 'Test flash';
|
||||||
new JsColor(input, { hash: true, position: 'right', onInput: change });
|
innerDiv.appendChild(a);
|
||||||
const label = document.createElement('label');
|
|
||||||
label.textContent = Config.Colours.desc[Colours[i]];
|
|
||||||
innerDiv.appendChild(label);
|
|
||||||
div.appendChild(innerDiv);
|
|
||||||
}
|
}
|
||||||
|
div.appendChild(innerDiv);
|
||||||
jscolor.init();
|
jscolor.init();
|
||||||
return div;
|
return div;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,28 +7,32 @@ import { isInitializing } from '../../InitSaveLoad/Variables';
|
|||||||
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash
|
* @param {number} mode Sets the intensity of the flash, used to recursively dim flash
|
||||||
* All calls of function have use mode === 3
|
* All calls of function have use mode === 3
|
||||||
* @param {string} config The setting in CM.Options that is checked before creating the flash
|
* @param {string} config The setting in CM.Options that is checked before creating the flash
|
||||||
|
* @param {bool} forced Whether the sound should play regardless of settings, used to test the sound
|
||||||
*/
|
*/
|
||||||
export default function Flash(mode, config) {
|
export default function Flash(mode, config, forced) {
|
||||||
// The arguments check makes the sound not play upon initialization of the mod
|
// The arguments check makes the sound not play upon initialization of the mod
|
||||||
if (
|
if (
|
||||||
(CMOptions[config] === 1 && mode === 3 && isInitializing === false) ||
|
((CMOptions[config] === 1 || forced) &&
|
||||||
|
mode === 3 &&
|
||||||
|
isInitializing === false) ||
|
||||||
mode === 1
|
mode === 1
|
||||||
) {
|
) {
|
||||||
l('CMWhiteScreen').style.opacity = '0.5';
|
l('CMFlashScreen').style.backgroundColor = CMOptions[`Colour${config}`];
|
||||||
|
l('CMFlashScreen').style.opacity = '0.5';
|
||||||
if (mode === 3) {
|
if (mode === 3) {
|
||||||
l('CMWhiteScreen').style.display = 'inline';
|
l('CMFlashScreen').style.display = 'inline';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Flash(2, config);
|
Flash(2, config, true);
|
||||||
}, 1000 / Game.fps);
|
}, 1000 / Game.fps);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Flash(0, config);
|
Flash(0, config, true);
|
||||||
}, 1000 / Game.fps);
|
}, 1000 / Game.fps);
|
||||||
}
|
}
|
||||||
} else if (mode === 2) {
|
} else if (mode === 2) {
|
||||||
l('CMWhiteScreen').style.opacity = '1';
|
l('CMFlashScreen').style.opacity = '1';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Flash(1, config);
|
Flash(1, config, true);
|
||||||
}, 1000 / Game.fps);
|
}, 1000 / Game.fps);
|
||||||
} else if (mode === 0) l('CMWhiteScreen').style.display = 'none';
|
} else if (mode === 0) l('CMFlashScreen').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const ColourPurple = 'Purple';
|
|||||||
export const ColourGray = 'Gray';
|
export const ColourGray = 'Gray';
|
||||||
export const ColourPink = 'Pink';
|
export const ColourPink = 'Pink';
|
||||||
export const ColourBrown = 'Brown';
|
export const ColourBrown = 'Brown';
|
||||||
export const Colours = [
|
export const ColoursOrdering = [
|
||||||
ColourGray,
|
ColourGray,
|
||||||
ColourBlue,
|
ColourBlue,
|
||||||
ColourGreen,
|
ColourGreen,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function CheckGardenTick() {
|
|||||||
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
|
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
|
||||||
) {
|
) {
|
||||||
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
|
||||||
Flash(3, 'GardFlash');
|
Flash(3, 'GardFlash', false);
|
||||||
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false);
|
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false);
|
||||||
}
|
}
|
||||||
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default function CheckGoldenCookie() {
|
|||||||
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
LastGoldenCookieState = Game.shimmerTypes.golden.n;
|
||||||
if (LastGoldenCookieState) {
|
if (LastGoldenCookieState) {
|
||||||
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
if (LastSpawnedGoldenCookieState < CurrSpawnedGoldenCookieState) {
|
||||||
Flash(3, 'GCFlash');
|
Flash(3, 'GCFlash', false);
|
||||||
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume', false);
|
PlaySound(CMOptions.GCSoundURL, 'GCSound', 'GCVolume', false);
|
||||||
CreateNotification(
|
CreateNotification(
|
||||||
'GCNotification',
|
'GCNotification',
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function CheckMagicMeter() {
|
|||||||
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
if (minigame.magic < minigame.magicM) LastMagicBarFull = false;
|
||||||
else if (!LastMagicBarFull) {
|
else if (!LastMagicBarFull) {
|
||||||
LastMagicBarFull = true;
|
LastMagicBarFull = true;
|
||||||
Flash(3, 'MagicFlash');
|
Flash(3, 'MagicFlash', false);
|
||||||
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume', false);
|
PlaySound(CMOptions.MagicSoundURL, 'MagicSound', 'MagicVolume', false);
|
||||||
CreateNotification(
|
CreateNotification(
|
||||||
'MagicNotification',
|
'MagicNotification',
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default function CheckSeasonPopup() {
|
|||||||
CacheSeasonPopShimmer = Game.shimmers[i];
|
CacheSeasonPopShimmer = Game.shimmers[i];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Flash(3, 'SeaFlash');
|
Flash(3, 'SeaFlash', false);
|
||||||
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume', false);
|
PlaySound(CMOptions.SeaSoundURL, 'SeaSound', 'SeaVolume', false);
|
||||||
CreateNotification(
|
CreateNotification(
|
||||||
'SeaNotification',
|
'SeaNotification',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function CheckTickerFortune() {
|
|||||||
LastTickerFortuneState =
|
LastTickerFortuneState =
|
||||||
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
|
Game.TickerEffect && Game.TickerEffect.type === 'fortune';
|
||||||
if (LastTickerFortuneState) {
|
if (LastTickerFortuneState) {
|
||||||
Flash(3, 'FortuneFlash');
|
Flash(3, 'FortuneFlash', false);
|
||||||
PlaySound(
|
PlaySound(
|
||||||
CMOptions.FortuneSoundURL,
|
CMOptions.FortuneSoundURL,
|
||||||
'FortuneSound',
|
'FortuneSound',
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ export default function CheckWrinklerCount() {
|
|||||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||||
CMOptions.WrinklerMaxFlash
|
CMOptions.WrinklerMaxFlash
|
||||||
) {
|
) {
|
||||||
Flash(3, 'WrinklerMaxFlash');
|
Flash(3, 'WrinklerMaxFlash', false);
|
||||||
} else {
|
} else {
|
||||||
Flash(3, 'WrinklerFlash');
|
Flash(3, 'WrinklerFlash', false);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
CurrentWrinklers === Game.getWrinklersMax() &&
|
CurrentWrinklers === Game.getWrinklersMax() &&
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import { CacheStatsCookies } from '../Cache/Stats/Stats';
|
|||||||
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
|
import { LoadConfig } from '../Config/SaveLoadReload/SaveLoadReloadSettings';
|
||||||
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
import { VersionMajor, VersionMinor } from '../Data/Moddata';
|
||||||
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
|
import CreateUpgradeBar from '../Disp/BuildingsUpgrades/UpgradeBar';
|
||||||
|
import UpdateColours from '../Disp/HelperFunctions/UpdateColours';
|
||||||
import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
|
import { CreateBotBar } from '../Disp/InfoBars/BottomBar';
|
||||||
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
|
import { CreateTimerBar } from '../Disp/InfoBars/TimerBar';
|
||||||
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
|
import CreateSectionHideButtons from '../Disp/Initialization/CreateSectionHideButtons';
|
||||||
import CreateWrinklerButtons from '../Disp/Initialization/CreateWrinklerButton';
|
import CreateWrinklerButtons from '../Disp/Initialization/CreateWrinklerButton';
|
||||||
import CreateCssArea from '../Disp/Initialization/CssArea';
|
import CreateCssArea from '../Disp/Initialization/CssArea';
|
||||||
import UpdateBuildingUpgradeStyle from '../Disp/Initialization/UpdateBuildingUpgradeStyle';
|
import UpdateBuildingUpgradeStyle from '../Disp/Initialization/UpdateBuildingUpgradeStyle';
|
||||||
import CreateWhiteScreen from '../Disp/Initialization/WhiteScreen';
|
import CreateFlashScreen from '../Disp/Initialization/FlashScreen';
|
||||||
import { CreateFavicon } from '../Disp/TabTitle/FavIcon';
|
import { CreateFavicon } from '../Disp/TabTitle/FavIcon';
|
||||||
import { CreateSimpleTooltip } from '../Disp/Tooltips/Tooltip';
|
import { CreateSimpleTooltip } from '../Disp/Tooltips/Tooltip';
|
||||||
import { CMLastAscendState, TooltipText } from '../Disp/VariablesAndData';
|
import { CMLastAscendState, TooltipText } from '../Disp/VariablesAndData';
|
||||||
@@ -37,7 +38,7 @@ export default function InitializeCookieMonster() {
|
|||||||
CreateBotBar();
|
CreateBotBar();
|
||||||
CreateTimerBar();
|
CreateTimerBar();
|
||||||
CreateUpgradeBar();
|
CreateUpgradeBar();
|
||||||
CreateWhiteScreen();
|
CreateFlashScreen();
|
||||||
CreateSectionHideButtons();
|
CreateSectionHideButtons();
|
||||||
CreateFavicon();
|
CreateFavicon();
|
||||||
Object.keys(TooltipText).forEach((i) => {
|
Object.keys(TooltipText).forEach((i) => {
|
||||||
@@ -58,8 +59,7 @@ export default function InitializeCookieMonster() {
|
|||||||
ReplaceNativeGrimoire();
|
ReplaceNativeGrimoire();
|
||||||
Game.CalculateGains();
|
Game.CalculateGains();
|
||||||
|
|
||||||
LoadConfig(); // Must be after all things are created!
|
LoadConfig();
|
||||||
Game.UpdateMenu();
|
|
||||||
CMLastAscendState = Game.OnAscend;
|
CMLastAscendState = Game.OnAscend;
|
||||||
|
|
||||||
if (Game.prefs.popups)
|
if (Game.prefs.popups)
|
||||||
|
|||||||
Reference in New Issue
Block a user