Merge pull request #399 from DanielNoord/fix/cleanupdisp
Preliminary overhaul of CM.Disp and related code
This commit is contained in:
2955
CookieMonster.js
2955
CookieMonster.js
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,9 @@
|
||||
* Cache *
|
||||
*********/
|
||||
|
||||
/********
|
||||
* Section: UNSORTED */
|
||||
|
||||
CM.Cache.AddQueue = function() {
|
||||
CM.Cache.Queue = document.createElement('script');
|
||||
CM.Cache.Queue.type = 'text/javascript';
|
||||
@@ -524,4 +527,6 @@ CM.Cache.MissingCookies = Game.Upgrades;
|
||||
CM.Cache.UpgradesOwned = -1;
|
||||
CM.Cache.MissingUpgradesString = null;
|
||||
CM.Cache.MissingCookiesString = null;
|
||||
|
||||
CM.Cache.seasonPopShimmer;
|
||||
CM.Cache.goldenShimmersByID = {};
|
||||
CM.Cache.spawnedGoldenShimmer = 0;
|
||||
|
||||
115
src/Config.js
115
src/Config.js
@@ -51,7 +51,7 @@ CM.LoadConfig = function() {
|
||||
if (mod) CM.SaveConfig(CM.Config);
|
||||
CM.Loop(); // Do loop once
|
||||
for (var i in CM.ConfigDefault) {
|
||||
if (i != 'StatsPref' && i != 'MenuPref' && typeof CM.ConfigData[i].func !== 'undefined') {
|
||||
if (i != 'StatsPref' && i != 'OptionsPref' && typeof CM.ConfigData[i].func !== 'undefined') {
|
||||
CM.ConfigData[i].func();
|
||||
}
|
||||
}
|
||||
@@ -114,12 +114,12 @@ CM.ToggleStatsConfig = function(config) {
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
|
||||
CM.ToggleMenuConfig = function(config) {
|
||||
if (CM.Config.MenuPref[config] == 0) {
|
||||
CM.Config.MenuPref[config]++;
|
||||
CM.ToggleOptionsConfig = function(config) {
|
||||
if (CM.Config.OptionsPref[config] == 0) {
|
||||
CM.Config.OptionsPref[config]++;
|
||||
}
|
||||
else {
|
||||
CM.Config.MenuPref[config]--;
|
||||
CM.Config.OptionsPref[config]--;
|
||||
}
|
||||
CM.SaveConfig(CM.Config);
|
||||
}
|
||||
@@ -151,107 +151,4 @@ CM.CheckNotificationPermissions = function(ToggleOnOff) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function() {CM.Disp.ToggleBotBar();}};
|
||||
CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}};
|
||||
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
||||
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.BulkBuildColor = {label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.ColorPPBulkMode = {label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
|
||||
CM.ConfigData.UpBarColor = {label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpBarColor();}};
|
||||
CM.ConfigData.Colors = {
|
||||
desc: {
|
||||
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels',
|
||||
Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels',
|
||||
Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels',
|
||||
Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels',
|
||||
Gray: 'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Pink: 'Color Pink. Used for Dragonflight bar',
|
||||
Brown: 'Color Brown. Used for Dragon Harvest bar'
|
||||
},
|
||||
func: function() {CM.Disp.UpdateColors();}
|
||||
};
|
||||
CM.ConfigData.UpgradeBarFixedPos = {label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
|
||||
CM.ConfigData.CalcWrink = {label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true};
|
||||
CM.ConfigData.CPSMode = {label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
|
||||
CM.ConfigData.AvgCPSHist = {label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
|
||||
CM.ConfigData.AvgClicksHist = {label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
|
||||
CM.ConfigData.ToolWarnBon = {label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
|
||||
CM.ConfigData.GCNotification = {label: ['Golden Cookie Notification OFF', 'Golden Cookie Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.GCNotification);}};
|
||||
CM.ConfigData.GCFlash = {label: ['Golden Cookie Flash OFF', 'Golden Cookie Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true};
|
||||
CM.ConfigData.GCSound = {label: ['Golden Cookie Sound OFF', 'Golden Cookie Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true};
|
||||
CM.ConfigData.GCVolume = {label: [], desc: 'Volume of the Golden Cookie sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.GCVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
|
||||
CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}};
|
||||
CM.ConfigData.Favicon = {label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}};
|
||||
CM.ConfigData.FortuneNotification = {label: ['Fortune Cookie Notification OFF', 'Fortune Cookie Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.FortuneNotification);}};
|
||||
CM.ConfigData.FortuneFlash = {label: ['Fortune Cookie Flash OFF', 'Fortune Cookie Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true};
|
||||
CM.ConfigData.FortuneSound = {label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true};
|
||||
CM.ConfigData.FortuneVolume = {label: [], desc: 'Volume of the Fortune Cookie sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.FortuneVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.FortuneSoundURL = {label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'};
|
||||
CM.ConfigData.SeaNotification = {label: ['Season Special Notification OFF', 'Season Special Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.SeaNotification);}};
|
||||
CM.ConfigData.SeaFlash = {label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true};
|
||||
CM.ConfigData.SeaSound = {label: ['Season Special Sound OFF', 'Season Special Sound ON'], desc: 'Play a sound on Season Popup', toggle: true};
|
||||
CM.ConfigData.SeaVolume = {label: [], desc: 'Volume of the Season Special sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.SeaVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'};
|
||||
CM.ConfigData.GardFlash = {label: ['Garden Tick Flash OFF', 'Garden Tick Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true};
|
||||
CM.ConfigData.GardSound = {label: ['Garden Tick Sound OFF', 'Garden Tick Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true};
|
||||
CM.ConfigData.GardVolume = {label: [], desc: 'Volume of the Garden Tick sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.GardVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GardSoundURL = {label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
|
||||
CM.ConfigData.MagicNotification = {label: ['Magic Max Notification OFF', 'Magic Max Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.MagicNotification);}};
|
||||
CM.ConfigData.MagicFlash = {label: ['Magic Max Flash OFF', 'Magic Max Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true};
|
||||
CM.ConfigData.MagicSound = {label: ['Magic Max Sound OFF', 'Magic Max Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true};
|
||||
CM.ConfigData.MagicVolume = {label: [], desc: 'Volume of the Max Magic sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.MagicVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.MagicSoundURL = {label: 'Magic Max Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'};
|
||||
CM.ConfigData.WrinklerNotification = {label: ['Wrinkler Notification OFF', 'Wrinkler Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.WrinklerNotification);}};
|
||||
CM.ConfigData.WrinklerFlash = {label: ['Wrinkler Flash OFF', 'Wrinkler Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true};
|
||||
CM.ConfigData.WrinklerSound = {label: ['Wrinkler Sound OFF', 'Wrinkler Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true};
|
||||
CM.ConfigData.WrinklerVolume = {label: [], desc: 'Volume of the Wrinkler sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.WrinklerVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.WrinklerSoundURL = {label: 'Wrinkler Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'};
|
||||
CM.ConfigData.WrinklerMaxNotification = {label: ['Wrinkler Max Notification OFF', 'Wrinkler Max Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.WrinklerMaxNotification);}};
|
||||
CM.ConfigData.WrinklerMaxFlash = {label: ['Wrinkler Max Flash OFF', 'Wrinkler Max Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true};
|
||||
CM.ConfigData.WrinklerMaxSound = {label: ['Wrinkler Max Sound OFF', 'Wrinkler Max Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true};
|
||||
CM.ConfigData.WrinklerMaxVolume = {label: [], desc: 'Volume of the Wrinkler Max sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.WrinklerMaxVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.WrinklerMaxSoundURL = {label: 'Wrinkler Max Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared'};
|
||||
CM.ConfigData.Title = {label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
|
||||
CM.ConfigData.TooltipBuildUp = {label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true};
|
||||
CM.ConfigData.TooltipAmor = {label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
|
||||
CM.ConfigData.ToolWarnLucky = {label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', toggle: true};
|
||||
CM.ConfigData.ToolWarnConjure = {label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
|
||||
CM.ConfigData.ToolWarnPos = {label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
|
||||
CM.ConfigData.TooltipGrim = {label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
||||
CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
||||
CM.ConfigData.TooltipLump = {label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
||||
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
||||
CM.ConfigData.MissingUpgrades = {label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true};
|
||||
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false};
|
||||
CM.ConfigData.TimeFormat = {label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false};
|
||||
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}};
|
||||
CM.ConfigData.GrimoireBar = {label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
||||
CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||
CM.ConfigData.SortBuildings = {label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.SortUpgrades = {label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}};
|
||||
}
|
||||
142
src/Data.js
142
src/Data.js
@@ -31,3 +31,145 @@ CM.Data.HalloCookies = ['Skull cookies', 'Ghost cookies', 'Bat cookies', 'Slime
|
||||
CM.Data.ChristCookies = ['Christmas tree biscuits', 'Snowflake biscuits', 'Snowman biscuits', 'Holly biscuits', 'Candy cane biscuits', 'Bell biscuits', 'Present biscuits'];
|
||||
CM.Data.ValCookies = ['Pure heart biscuits', 'Ardent heart biscuits', 'Sour heart biscuits', 'Weeping heart biscuits', 'Golden heart biscuits', 'Eternal heart biscuits', 'Prism heart biscuits'];
|
||||
|
||||
|
||||
/********
|
||||
* Section: Data for the various scales used by CookieMonster */
|
||||
CM.Data.metric = ['', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
CM.Data.shortScale = ['', 'M', 'B', 'Tr', 'Quadr', 'Quint', 'Sext', 'Sept', 'Oct', 'Non', 'Dec', 'Undec', 'Duodec', 'Tredec', 'Quattuordec', 'Quindec', 'Sexdec', 'Septendec', 'Octodec', 'Novemdec', 'Vigint', 'Unvigint', 'Duovigint', 'Trevigint', 'Quattuorvigint'];
|
||||
|
||||
/********
|
||||
* Section: An array containing all Config groups and their to-be displayed title */
|
||||
|
||||
CM.ConfigGroups = {
|
||||
BarsColors: "Bars/Colors",
|
||||
Calculation: "Calculation",
|
||||
Notification: "Notification",
|
||||
Tooltip: "Tooltips",
|
||||
Statistics: "Statitics",
|
||||
Other: "Other"},
|
||||
|
||||
/********
|
||||
* Section: An array (CM.ConfigData) containing all Config options
|
||||
*
|
||||
* Each array has the following items
|
||||
* @item {string} type The type of option (bool(ean), vol(ume), url or color)
|
||||
* @item {string} group The options-group the option belongs to
|
||||
* @item {[string, ...]} label A list of the various configurations of the option
|
||||
* @item {string} desc Description to be used in options menu
|
||||
* @item {boolean} toggle Whether it should be displayed as a grey/white toggle in the options menu
|
||||
* @item {function} func A function to be called when the option is toggled
|
||||
*/
|
||||
|
||||
// Barscolors
|
||||
CM.ConfigData.BotBar = {type: 'bool', group: 'BarsColors', label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', toggle: true, func: function() {CM.Disp.ToggleBotBar();}};
|
||||
CM.ConfigData.TimerBar = {type: 'bool', group: 'BarsColors', label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', toggle: true, func: function() {CM.Disp.ToggleTimerBar();}};
|
||||
CM.ConfigData.TimerBarPos = {type: 'bool', group: 'BarsColors', label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', toggle: false, func: function() {CM.Disp.ToggleTimerBarPos();}};
|
||||
CM.ConfigData.SortBuildings = {type: 'bool', group: 'BarsColors', label: ['Sort Buildings: Default', 'Sort Buildings: PP'], desc: 'Sort the display of buildings in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.SortUpgrades = {type: 'bool', group: 'BarsColors', label: ['Sort Upgrades: Default', 'Sort Upgrades: PP'], desc: 'Sort the display of upgrades in either default order or by PP', toggle: false, func: function () { CM.Disp.UpdateUpgrades();}};
|
||||
CM.ConfigData.BuildColor = {type: 'bool', group: 'BarsColors', label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', toggle: true, func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.BulkBuildColor = {type: 'bool', group: 'BarsColors', label: ['Bulk Building Colors (Single Building Color)', 'Bulk Building Colors (Calculated Bulk Color)'], desc: 'Color code bulk buildings based on single buildings color or calculated bulk value color', toggle: false, func: function() {CM.Disp.UpdateBuildings();}};
|
||||
CM.ConfigData.ColorPPBulkMode = {type: 'bool', group: 'BarsColors', label: ['Color of PP (Compared to Single)', 'Color of PP (Compared to Bulk)'], desc: 'Color PP-values based on comparison with single purchase or with selected bulk-buy mode', toggle: false};
|
||||
CM.ConfigData.UpBarColor = {type: 'bool', group: 'BarsColors', label: ['Upgrade Colors/Bar OFF', 'Upgrade Colors with Bar ON', 'Upgrade Colors without Bar ON'], desc: 'Color code upgrades and optionally add a counter bar', toggle: false, func: function() {CM.Disp.ToggleUpgradeBarAndColor();}};
|
||||
CM.ConfigData.Colors = { type: 'color', group: 'BarsColors',
|
||||
desc: {
|
||||
Blue: 'Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels',
|
||||
Green: 'Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels',
|
||||
Yellow: 'Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels',
|
||||
Orange: 'Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels',
|
||||
Red: 'Color Red. Used to show worst PP building, for Clot bar, and for various labels',
|
||||
Purple: 'Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels',
|
||||
Gray: 'Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar',
|
||||
Pink: 'Color Pink. Used for Dragonflight bar',
|
||||
Brown: 'Color Brown. Used for Dragon Harvest bar'
|
||||
},
|
||||
func: function() {CM.Disp.UpdateColors();}
|
||||
};
|
||||
CM.ConfigData.UpgradeBarFixedPos = {type: 'bool', group: 'BarsColors', label: ['Upgrade Bar Fixed Position OFF', 'Upgrade Bar Fixed Position ON'], desc: 'Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling', toggle: true, func: function() {CM.Disp.ToggleUpgradeBarFixedPos();}};
|
||||
|
||||
// Calculation
|
||||
CM.ConfigData.CalcWrink = {type: 'bool', group: 'Calculation', label: ['Calculate with Wrinklers OFF', 'Calculate with Wrinklers ON'], desc: 'Calculate times and average Cookies Per Second with Wrinklers', toggle: true};
|
||||
CM.ConfigData.CPSMode = {type: 'bool', group: 'Calculation', label: ['Current Cookies Per Second', 'Average Cookies Per Second'], desc: 'Calculate times using current Cookies Per Second or average Cookies Per Second', toggle: false};
|
||||
CM.ConfigData.AvgCPSHist = {type: 'bool', group: 'Calculation', label: ['Average CPS for past 10s', 'Average CPS for past 15s', 'Average CPS for past 30s', 'Average CPS for past 1m', 'Average CPS for past 5m', 'Average CPS for past 10m', 'Average CPS for past 15m', 'Average CPS for past 30m'], desc: 'How much time average Cookies Per Second should consider', toggle: false};
|
||||
CM.ConfigData.AvgClicksHist = {type: 'bool', group: 'Calculation', label: ['Average Cookie Clicks for past 1s', 'Average Cookie Clicks for past 5s', 'Average Cookie Clicks for past 10s', 'Average Cookie Clicks for past 15s', 'Average Cookie Clicks for past 30s'], desc: 'How much time average Cookie Clicks should consider', toggle: false};
|
||||
CM.ConfigData.ToolWarnBon = {type: 'bool', group: 'Calculation', label: ['Calculate Tooltip Warning With Bonus CPS OFF', 'Calculate Tooltip Warning With Bonus CPS ON'], desc: 'Calculate the warning with or without the bonus CPS you get from buying', toggle: true};
|
||||
|
||||
// Notification
|
||||
CM.ConfigData.GCNotification = {type: 'bool', group: 'Notification', label: ['Golden Cookie Notification OFF', 'Golden Cookie Notification ON'], desc: 'Create a notification when Golden Cookie spawns', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.GCNotification);}};
|
||||
CM.ConfigData.GCFlash = {type: 'bool', group: 'Notification', label: ['Golden Cookie Flash OFF', 'Golden Cookie Flash ON'], desc: 'Flash screen on Golden Cookie', toggle: true};
|
||||
CM.ConfigData.GCSound = {type: 'bool', group: 'Notification', label: ['Golden Cookie Sound OFF', 'Golden Cookie Sound ON'], desc: 'Play a sound on Golden Cookie', toggle: true};
|
||||
CM.ConfigData.GCVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Golden Cookie sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.GCVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GCSoundURL = {type: 'url', group: 'Notification', label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
|
||||
CM.ConfigData.GCTimer = {type: 'bool', group: 'Notification', label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', toggle: true, func: function() {CM.Disp.ToggleGCTimer();}};
|
||||
CM.ConfigData.Favicon = {type: 'bool', group: 'Notification', label: ['Favicon OFF', 'Favicon ON'], desc: 'Update favicon with Golden/Wrath Cookie', toggle: true, func: function() {CM.Disp.UpdateFavicon();}};
|
||||
CM.ConfigData.FortuneNotification = {type: 'bool', group: 'Notification', label: ['Fortune Cookie Notification OFF', 'Fortune Cookie Notification ON'], desc: 'Create a notification when Fortune Cookie is on the Ticker', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.FortuneNotification);}};
|
||||
CM.ConfigData.FortuneFlash = {type: 'bool', group: 'Notification', label: ['Fortune Cookie Flash OFF', 'Fortune Cookie Flash ON'], desc: 'Flash screen on Fortune Cookie', toggle: true};
|
||||
CM.ConfigData.FortuneSound = {type: 'bool', group: 'Notification', label: ['Fortune Cookie Sound OFF', 'Fortune Cookie Sound ON'], desc: 'Play a sound on Fortune Cookie', toggle: true};
|
||||
CM.ConfigData.FortuneVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Fortune Cookie sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.FortuneVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.FortuneSoundURL = {type: 'url', group: 'Notification', label: 'Fortune Cookie Sound URL:', desc: 'URL of the sound to be played when the Ticker has a Fortune Cookie'};
|
||||
CM.ConfigData.SeaNotification = {type: 'bool', group: 'Notification', label: ['Season Special Notification OFF', 'Season Special Notification ON'], desc: 'Create a notification on Season Popup', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.SeaNotification);}};
|
||||
CM.ConfigData.SeaFlash = {type: 'bool', group: 'Notification', label: ['Season Special Flash OFF', 'Season Special Flash ON'], desc: 'Flash screen on Season Popup', toggle: true};
|
||||
CM.ConfigData.SeaSound = {type: 'bool', group: 'Notification', label: ['Season Special Sound OFF', 'Season Special Sound ON'], desc: 'Play a sound on Season Popup', toggle: true};
|
||||
CM.ConfigData.SeaVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Season Special sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.SeaVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.SeaSoundURL = {type: 'url', group: 'Notification', label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns'};
|
||||
CM.ConfigData.GardFlash = {type: 'bool', group: 'Notification', label: ['Garden Tick Flash OFF', 'Garden Tick Flash ON'], desc: 'Flash screen on Garden Tick', toggle: true};
|
||||
CM.ConfigData.GardSound = {type: 'bool', group: 'Notification', label: ['Garden Tick Sound OFF', 'Garden Tick Sound ON'], desc: 'Play a sound on Garden Tick', toggle: true};
|
||||
CM.ConfigData.GardVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Garden Tick sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.GardVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.GardSoundURL = {type: 'url', group: 'Notification', label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
|
||||
CM.ConfigData.MagicNotification = {type: 'bool', group: 'Notification', label: ['Magic Max Notification OFF', 'Magic Max Notification ON'], desc: 'Create a notification when magic reaches maximum', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.MagicNotification);}};
|
||||
CM.ConfigData.MagicFlash = {type: 'bool', group: 'Notification', label: ['Magic Max Flash OFF', 'Magic Max Flash ON'], desc: 'Flash screen when magic reaches maximum', toggle: true};
|
||||
CM.ConfigData.MagicSound = {type: 'bool', group: 'Notification', label: ['Magic Max Sound OFF', 'Magic Max Sound ON'], desc: 'Play a sound when magic reaches maximum', toggle: true};
|
||||
CM.ConfigData.MagicVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Max Magic sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.MagicVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.MagicSoundURL = {type: 'url', group: 'Notification', label: 'Magic Max Sound URL:', desc: 'URL of the sound to be played when magic reaches maxium'};
|
||||
CM.ConfigData.WrinklerNotification = {type: 'bool', group: 'Notification', label: ['Wrinkler Notification OFF', 'Wrinkler Notification ON'], desc: 'Create a notification when a Wrinkler appears', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.WrinklerNotification);}};
|
||||
CM.ConfigData.WrinklerFlash = {type: 'bool', group: 'Notification', label: ['Wrinkler Flash OFF', 'Wrinkler Flash ON'], desc: 'Flash screen when a Wrinkler appears', toggle: true};
|
||||
CM.ConfigData.WrinklerSound = {type: 'bool', group: 'Notification', label: ['Wrinkler Sound OFF', 'Wrinkler Sound ON'], desc: 'Play a sound when a Wrinkler appears', toggle: true};
|
||||
CM.ConfigData.WrinklerVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Wrinkler sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.WrinklerVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.WrinklerSoundURL = {type: 'url', group: 'Notification', label: 'Wrinkler Sound URL:', desc: 'URL of the sound to be played when a Wrinkler appears'};
|
||||
CM.ConfigData.WrinklerMaxNotification = {type: 'bool', group: 'Notification', label: ['Wrinkler Max Notification OFF', 'Wrinkler Max Notification ON'], desc: 'Create a notification when the maximum amount of Wrinklers has appeared', toggle: true, func: function () {CM.CheckNotificationPermissions(CM.Config.WrinklerMaxNotification);}};
|
||||
CM.ConfigData.WrinklerMaxFlash = {type: 'bool', group: 'Notification', label: ['Wrinkler Max Flash OFF', 'Wrinkler Max Flash ON'], desc: 'Flash screen when the maximum amount of Wrinklers has appeared', toggle: true};
|
||||
CM.ConfigData.WrinklerMaxSound = {type: 'bool', group: 'Notification', label: ['Wrinkler Max Sound OFF', 'Wrinkler Max Sound ON'], desc: 'Play a sound when the maximum amount of Wrinklers has appeared', toggle: true};
|
||||
CM.ConfigData.WrinklerMaxVolume = {type: 'vol', group: 'Notification', label: [], desc: 'Volume of the Wrinkler Max sound'};
|
||||
for (var i = 0; i < 101; i++) {
|
||||
CM.ConfigData.WrinklerMaxVolume.label[i] = i + '%';
|
||||
}
|
||||
CM.ConfigData.WrinklerMaxSoundURL = {type: 'url', group: 'Notification', label: 'Wrinkler Max Sound URL:', desc: 'URL of the sound to be played when the maximum amount of Wrinklers has appeared'};
|
||||
CM.ConfigData.Title = {type: 'bool', group: 'Notification', label: ['Title OFF', 'Title ON', 'Title Pinned Tab Highlight'], desc: 'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns', toggle: true};
|
||||
|
||||
// Tooltip
|
||||
CM.ConfigData.TooltipBuildUp = {type: 'bool', group: 'Tooltip', label: ['Buildings/Upgrades Tooltip Information OFF', 'Buildings/Upgrades Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades', toggle: true};
|
||||
CM.ConfigData.TooltipAmor = {type: 'bool', group: 'Tooltip', label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
|
||||
CM.ConfigData.ToolWarnLucky = {type: 'bool', group: 'Tooltip', label: ['Tooltip Lucky Warning OFF', 'Tooltip Lucky Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', toggle: true};
|
||||
CM.ConfigData.ToolWarnConjure = {type: 'bool', group: 'Tooltip', label: ['Tooltip Conjure Warning OFF', 'Tooltip Conjure Warning ON'], desc: 'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards', toggle: true};
|
||||
CM.ConfigData.ToolWarnPos = {type: 'bool', group: 'Tooltip', label: ['Tooltip Warning Position (Left)', 'Tooltip Warning Position (Bottom)'], desc: 'Placement of the warning boxes', toggle: false, func: function() {CM.Disp.ToggleToolWarnPos();}};
|
||||
CM.ConfigData.TooltipGrim = {type: 'bool', group: 'Tooltip', label: ['Grimoire Tooltip Information OFF', 'Grimoire Tooltip Information ON'], desc: 'Extra information in tooltip for grimoire', toggle: true};
|
||||
CM.ConfigData.ToolWrink = {type: 'bool', group: 'Tooltip', label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it', toggle: true};
|
||||
CM.ConfigData.TooltipLump = {type: 'bool', group: 'Tooltip', label: ['Sugar Lump Tooltip OFF', 'Sugar Lump Tooltip ON'], desc: 'Shows the current Sugar Lump type in Sugar lump tooltip.', toggle: true};
|
||||
|
||||
// Statistics
|
||||
CM.ConfigData.Stats = {type: 'bool', group: 'Statistics', label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
|
||||
CM.ConfigData.MissingUpgrades = {type: 'bool', group: 'Statistics', label: ['Missing Upgrades OFF', 'Missing Upgrades ON'], desc: 'Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.', toggle: true};
|
||||
CM.ConfigData.UpStats = {type: 'bool', group: 'Statistics', label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false};
|
||||
CM.ConfigData.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle: false};
|
||||
CM.ConfigData.SayTime = {type: 'bool', group: 'Statistics', label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}};
|
||||
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
||||
|
||||
// Statistics
|
||||
CM.ConfigData.Scale = {type: 'bool', group: 'Other', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||
2449
src/Disp.js
2449
src/Disp.js
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,8 @@ RunCookieMonsterHeader = function() {
|
||||
|
||||
CM.Disp = {};
|
||||
|
||||
CM.Main = {};
|
||||
|
||||
CM.Sim = {};
|
||||
}
|
||||
|
||||
|
||||
236
src/Main.js
236
src/Main.js
@@ -18,14 +18,12 @@ CM.ReplaceNative = function() {
|
||||
eval('CM.Backup.tooltip.drawMod = ' + Game.tooltip.draw.toString().split('this').join('Game.tooltip'));
|
||||
Game.tooltip.draw = function(from, text, origin) {
|
||||
CM.Backup.tooltip.drawMod(from, text, origin);
|
||||
CM.Disp.DrawTooltipWarn();
|
||||
}
|
||||
|
||||
CM.Backup.tooltip.update = Game.tooltip.update;
|
||||
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this.').join('Game.tooltip.'));
|
||||
Game.tooltip.update = function() {
|
||||
CM.Backup.tooltip.updateMod();
|
||||
CM.Disp.UpdateTooltipWarn();
|
||||
CM.Disp.UpdateTooltipLocation();
|
||||
}
|
||||
|
||||
@@ -51,10 +49,12 @@ CM.ReplaceNative = function() {
|
||||
CM.ReplaceNativeGrimoire();
|
||||
}
|
||||
|
||||
// TODO: Move this ReplaceTooltip function too other ReplaceTooltip functions
|
||||
// OR: Move all other into this function
|
||||
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
|
||||
Game.RebuildUpgrades = function() {
|
||||
CM.Backup.RebuildUpgrades();
|
||||
CM.Disp.AddTooltipUpgrade();
|
||||
CM.Disp.ReplaceTooltipUpgrade();
|
||||
Game.CalculateGains();
|
||||
}
|
||||
|
||||
@@ -165,14 +165,15 @@ CM.Loop = function() {
|
||||
CM.Cache.RemakePP();
|
||||
|
||||
// Update colors
|
||||
CM.Disp.UpdateBotBarOther();
|
||||
CM.Disp.UpdateBuildings();
|
||||
CM.Disp.UpdateUpgrades();
|
||||
|
||||
// Redraw timers
|
||||
CM.Disp.UpdateBotBarTime();
|
||||
CM.Disp.UpdateTimerBar();
|
||||
|
||||
// Update Bottom Bar
|
||||
CM.Disp.UpdateBotBar();
|
||||
|
||||
// Update Tooltip
|
||||
CM.Disp.UpdateTooltip();
|
||||
|
||||
@@ -184,23 +185,13 @@ CM.Loop = function() {
|
||||
CM.Disp.RefreshMenu();
|
||||
}
|
||||
|
||||
// Check Golden Cookies
|
||||
CM.Disp.CheckGoldenCookie();
|
||||
|
||||
// Check Fortune Cookies
|
||||
CM.Disp.CheckTickerFortune();
|
||||
|
||||
// Check Season Popup
|
||||
CM.Disp.CheckSeasonPopup();
|
||||
|
||||
// Check Garden Tick
|
||||
CM.Disp.CheckGardenTick();
|
||||
|
||||
// Check Grimoire Meter
|
||||
CM.Disp.CheckMagicMeter();
|
||||
|
||||
// Check Wrinklers
|
||||
CM.Disp.CheckWrinklerCount();
|
||||
// Check all changing minigames and game-states
|
||||
CM.Main.CheckGoldenCookie();
|
||||
CM.Main.CheckTickerFortune();
|
||||
CM.Main.CheckSeasonPopup();
|
||||
CM.Main.CheckGardenTick();
|
||||
CM.Main.CheckMagicMeter();
|
||||
CM.Main.CheckWrinklerCount();
|
||||
|
||||
// Update Average CPS (might need to move)
|
||||
CM.Cache.UpdateAvgCPS()
|
||||
@@ -233,13 +224,12 @@ CM.DelayInit = function() {
|
||||
CM.Disp.CreateWhiteScreen();
|
||||
CM.Disp.CreateFavicon();
|
||||
for (var i in CM.Disp.TooltipText) {
|
||||
CM.Disp.CreateTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
|
||||
CM.Disp.CreateSimpleTooltip(CM.Disp.TooltipText[i][0], CM.Disp.TooltipText[i][1], CM.Disp.TooltipText[i][2]);
|
||||
}
|
||||
CM.Disp.CreateTooltipWarn();
|
||||
CM.Disp.AddTooltipBuild();
|
||||
CM.Disp.AddTooltipGrimoire();
|
||||
CM.Disp.AddTooltipLump();
|
||||
CM.Disp.AddWrinklerAreaDetect();
|
||||
CM.Disp.ReplaceTooltipBuild();
|
||||
CM.Disp.ReplaceTooltipGrimoire();
|
||||
CM.Disp.ReplaceTooltipLump();
|
||||
CM.Main.AddWrinklerAreaDetect();
|
||||
CM.Cache.InitCookiesDiff();
|
||||
CM.ReplaceNative();
|
||||
CM.ReplaceNativeGrimoire();
|
||||
@@ -256,9 +246,197 @@ CM.DelayInit = function() {
|
||||
Game.Win('Third-party');
|
||||
}
|
||||
|
||||
/********
|
||||
* Section: Functions related to checking for changes in Minigames/GC's/Ticker
|
||||
* TODO: Annotate functions
|
||||
* TODO: Possibly move this section */
|
||||
|
||||
/**
|
||||
* Auxilirary function that finds all currently spawned shimmers.
|
||||
* CM.Cache.spawnedGoldenShimmer stores the non-user spawned cookie to later determine data for the favicon and tab-title
|
||||
* It is called by CM.CM.Main.CheckGoldenCookie
|
||||
*/
|
||||
CM.Main.FindShimmer = function() {
|
||||
CM.Main.currSpawnedGoldenCookieState = 0;
|
||||
CM.Cache.goldenShimmersByID = {}
|
||||
for (var i in Game.shimmers) {
|
||||
CM.Cache.goldenShimmersByID[Game.shimmers[i].id] = Game.shimmers[i]
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'golden') {
|
||||
CM.Cache.spawnedGoldenShimmer = Game.shimmers[i];
|
||||
CM.Main.currSpawnedGoldenCookieState += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks for changes in the amount of Golden Cookies
|
||||
* It is called by CM.Loop
|
||||
* TODO: Remove the delete function, as it does not delete correctly and crowds CM.Disp.GCTimers
|
||||
*/
|
||||
CM.Main.CheckGoldenCookie = function() {
|
||||
CM.Main.FindShimmer();
|
||||
for (var i in CM.Disp.GCTimers) {
|
||||
if (typeof CM.Cache.goldenShimmersByID[i] == "undefined") {
|
||||
CM.Disp.GCTimers[i].parentNode.removeChild(CM.Disp.GCTimers[i]);
|
||||
// TODO remove delete here
|
||||
delete CM.Disp.GCTimers[i];
|
||||
}
|
||||
}
|
||||
if (CM.Main.lastGoldenCookieState != Game.shimmerTypes['golden'].n) {
|
||||
CM.Main.lastGoldenCookieState = Game.shimmerTypes['golden'].n;
|
||||
if (CM.Main.lastGoldenCookieState) {
|
||||
if (CM.Main.lastSpawnedGoldenCookieState < CM.Main.currSpawnedGoldenCookieState) {
|
||||
CM.Disp.Flash(3, 'GCFlash');
|
||||
CM.Disp.PlaySound(CM.Config.GCSoundURL, 'GCSound', 'GCVolume');
|
||||
CM.Disp.Notification('GCNotification', "Golden Cookie Spawned", "A Golden Cookie has spawned. Click it now!")
|
||||
}
|
||||
CM.Disp.UpdateFavicon();
|
||||
|
||||
for (var i in Game.shimmers) {
|
||||
if (typeof CM.Disp.GCTimers[Game.shimmers[i].id] == "undefined") {
|
||||
CM.Disp.CreateGCTimer(Game.shimmers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CM.Main.lastSpawnedGoldenCookieState = CM.Main.currSpawnedGoldenCookieState
|
||||
if (CM.Main.currSpawnedGoldenCookieState == 0) CM.Cache.spawnedGoldenShimmer = 0;
|
||||
}
|
||||
else if (CM.Config.GCTimer == 1 && CM.Main.lastGoldenCookieState) {
|
||||
for (var i in CM.Disp.GCTimers) {
|
||||
CM.Disp.GCTimers[i].style.opacity = CM.Cache.goldenShimmersByID[i].l.style.opacity;
|
||||
CM.Disp.GCTimers[i].style.transform = CM.Cache.goldenShimmersByID[i].l.style.transform;
|
||||
CM.Disp.GCTimers[i].textContent = Math.ceil(CM.Cache.goldenShimmersByID[i].life / Game.fps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if there is reindeer that has spawned
|
||||
* It is called by CM.Loop
|
||||
*/
|
||||
CM.Main.CheckSeasonPopup = function() {
|
||||
if (CM.Main.lastSeasonPopupState != Game.shimmerTypes['reindeer'].spawned) {
|
||||
CM.Main.lastSeasonPopupState = Game.shimmerTypes['reindeer'].spawned;
|
||||
for (var i in Game.shimmers) {
|
||||
if (Game.shimmers[i].spawnLead && Game.shimmers[i].type == 'reindeer') {
|
||||
CM.Cache.seasonPopShimmer = Game.shimmers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
CM.Disp.Flash(3, 'SeaFlash');
|
||||
CM.Disp.PlaySound(CM.Config.SeaSoundURL, 'SeaSound', 'SeaVolume');
|
||||
CM.Disp.Notification('SeaNotification',"Reindeer sighted!", "A Reindeer has spawned. Click it now!")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if there is a fortune cookie on the ticker
|
||||
* It is called by CM.Loop
|
||||
*/
|
||||
CM.Main.CheckTickerFortune = function() {
|
||||
if (CM.Main.lastTickerFortuneState != (Game.TickerEffect && Game.TickerEffect.type == 'fortune')) {
|
||||
CM.Main.lastTickerFortuneState = (Game.TickerEffect && Game.TickerEffect.type == 'fortune');
|
||||
if (CM.Main.lastTickerFortuneState) {
|
||||
CM.Disp.Flash(3, 'FortuneFlash');
|
||||
CM.Disp.PlaySound(CM.Config.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
|
||||
CM.Disp.Notification('FortuneNotification', "Fortune Cookie found", "A Fortune Cookie has appeared on the Ticker.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if a garden tick has happened
|
||||
* It is called by CM.Loop
|
||||
*/
|
||||
CM.Main.CheckGardenTick = function() {
|
||||
if (Game.Objects['Farm'].minigameLoaded && CM.Main.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) {
|
||||
if (CM.Main.lastGardenNextStep != 0 && CM.Main.lastGardenNextStep < Date.now()) {
|
||||
CM.Disp.Flash(3, 'GardFlash');
|
||||
CM.Disp.PlaySound(CM.Config.GardSoundURL, 'GardSound', 'GardVolume');
|
||||
}
|
||||
CM.Main.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if the magic meter is full
|
||||
* It is called by CM.Loop
|
||||
*/
|
||||
CM.Main.CheckMagicMeter = function() {
|
||||
if (Game.Objects['Wizard tower'].minigameLoaded && CM.Config.GrimoireBar == 1) {
|
||||
var minigame = Game.Objects['Wizard tower'].minigame;
|
||||
if (minigame.magic < minigame.magicM) CM.Main.lastMagicBarFull = false;
|
||||
else if (!CM.Main.lastMagicBarFull) {
|
||||
CM.Main.lastMagicBarFull = true;
|
||||
CM.Disp.Flash(3, 'MagicFlash');
|
||||
CM.Disp.PlaySound(CM.Config.MagicSoundURL, 'MagicSound', 'MagicVolume');
|
||||
CM.Disp.Notification('MagicNotification', "Magic Meter full", "Your Magic Meter is full. Cast a spell!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if any new Wrinklers have popped up
|
||||
* It is called by CM.Loop
|
||||
*/
|
||||
CM.Main.CheckWrinklerCount = function() {
|
||||
if (Game.elderWrath > 0) {
|
||||
var CurrentWrinklers = 0;
|
||||
for (var i in Game.wrinklers) {
|
||||
if (Game.wrinklers[i].phase == 2) CurrentWrinklers++;
|
||||
}
|
||||
if (CurrentWrinklers > CM.Main.lastWrinklerCount) {
|
||||
CM.Main.lastWrinklerCount = CurrentWrinklers
|
||||
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxFlash) {
|
||||
CM.Disp.Flash(3, 'WrinklerMaxFlash');
|
||||
} else {
|
||||
CM.Disp.Flash(3, 'WrinklerFlash');
|
||||
}
|
||||
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxSound) {
|
||||
CM.Disp.PlaySound(CM.Config.WrinklerMaxSoundURL, 'WrinklerMaxSound', 'WrinklerMaxVolume');
|
||||
} else {
|
||||
CM.Disp.PlaySound(CM.Config.WrinklerSoundURL, 'WrinklerSound', 'WrinklerVolume');
|
||||
}
|
||||
if (CurrentWrinklers == Game.getWrinklersMax() && CM.Config.WrinklerMaxNotification) {
|
||||
CM.Disp.Notification('WrinklerMaxNotification', "Maximum Wrinklers Reached", "You have reached your maximum ammount of wrinklers")
|
||||
} else {
|
||||
CM.Disp.Notification('WrinklerNotification', "A Wrinkler appeared", "A new wrinkler has appeared")
|
||||
}
|
||||
} else {
|
||||
CM.Main.lastWrinklerCount = CurrentWrinklers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates .onmouseover/out events that determine if the mouse is hovering-over a Wrinkler
|
||||
* It is called by CM.DelayInit
|
||||
* TODO: The system for displaying wrinklers should ideally use a similar system as other tooltips
|
||||
* Thus, writing a CM.Disp.ReplaceTooltipWrinkler function etc.
|
||||
*/
|
||||
CM.Main.AddWrinklerAreaDetect = function() {
|
||||
l('backgroundLeftCanvas').onmouseover = function() {CM.Disp.TooltipWrinklerArea = 1;};
|
||||
l('backgroundLeftCanvas').onmouseout = function() {
|
||||
CM.Disp.TooltipWrinklerArea = 0;
|
||||
Game.tooltip.hide();
|
||||
for (var i in Game.wrinklers) {
|
||||
CM.Disp.TooltipWrinklerCache[i] = 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
CM.HasReplaceNativeGrimoireLaunch = false;
|
||||
CM.HasReplaceNativeGrimoireDraw = false;
|
||||
|
||||
CM.Main.lastGoldenCookieState = 0;
|
||||
CM.Main.lastSpawnedGoldenCookieState = 0;
|
||||
CM.Main.currSpawnedGoldenCookieState
|
||||
CM.Main.lastTickerFortuneState = 0;
|
||||
CM.Main.lastSeasonPopupState = 0;
|
||||
CM.Main.lastGardenNextStep = 0;
|
||||
CM.Main.lastMagicBarFull = 0;
|
||||
CM.Main.lastWrinklerCount = 0;
|
||||
|
||||
CM.ConfigDefault = {
|
||||
BotBar: 1,
|
||||
TimerBar: 1,
|
||||
@@ -325,7 +503,7 @@ CM.ConfigDefault = {
|
||||
SayTime: 1,
|
||||
GrimoireBar: 1,
|
||||
Scale: 2,
|
||||
MenuPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Other: 1},
|
||||
OptionsPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Other: 1},
|
||||
StatsPref: {Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
|
||||
Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
|
||||
SortBuildings: 0,
|
||||
|
||||
@@ -118,7 +118,7 @@ CM.Sim.eff = function(name) {
|
||||
return CM.Sim.effs[name]
|
||||
}
|
||||
else {
|
||||
return Game.effs[name];
|
||||
return CM.Sim.effs[name];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ CM.Sim.CalculateGains = function() {
|
||||
var mult = 1;
|
||||
// Include minigame effects
|
||||
var effs={};
|
||||
for (var i in CM.Cache.Objects) {
|
||||
for (var i in Game.Objects) {
|
||||
// TODO Store minigames and effects in Cache
|
||||
// Include possibility of new/modded building and new/modded minigames
|
||||
if (CM.Sim.Objects[i].minigameLoaded && CM.Sim.Objects[i].minigame.effs) {
|
||||
|
||||
Reference in New Issue
Block a user