Added notification on garden tick (based on @doorajar code) (Issue #180) and minor code formatting cleanup
This commit is contained in:
@@ -549,6 +549,13 @@ for (var i = 0; i < 101; i++) {
|
|||||||
CM.ConfigData.SeaVolume.label[i] = 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.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.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.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.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.TooltipAmor = {label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
|
||||||
@@ -1457,6 +1464,16 @@ CM.Disp.CheckSeasonPopup = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CM.Disp.CheckGardenTick = function() {
|
||||||
|
if (Game.Objects['Farm'].minigameLoaded && CM.Disp.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) {
|
||||||
|
if (CM.Disp.lastGardenNextStep != 0 && CM.Disp.lastGardenNextStep < Date.now()) {
|
||||||
|
CM.Disp.Flash(3, 'GardFlash');
|
||||||
|
CM.Disp.PlaySound(CM.Config.GardSoundURL, 'GardSound', 'GardVolume');
|
||||||
|
}
|
||||||
|
CM.Disp.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CM.Disp.UpdateTitle = function() {
|
CM.Disp.UpdateTitle = function() {
|
||||||
if (Game.OnAscend || CM.Config.Title == 0) {
|
if (Game.OnAscend || CM.Config.Title == 0) {
|
||||||
document.title = CM.Cache.Title;
|
document.title = CM.Cache.Title;
|
||||||
@@ -1664,7 +1681,7 @@ CM.Disp.AddMenuPref = function(title) {
|
|||||||
frag.appendChild(listing('AvgClicksHist'));
|
frag.appendChild(listing('AvgClicksHist'));
|
||||||
frag.appendChild(listing('ToolWarnCautBon'));
|
frag.appendChild(listing('ToolWarnCautBon'));
|
||||||
|
|
||||||
frag.appendChild(header('Golden Cookie/Season Popup Emphasis'));
|
frag.appendChild(header('Notification'));
|
||||||
frag.appendChild(listing('GCFlash'));
|
frag.appendChild(listing('GCFlash'));
|
||||||
frag.appendChild(listing('GCSound'));
|
frag.appendChild(listing('GCSound'));
|
||||||
frag.appendChild(vol('GCVolume'));
|
frag.appendChild(vol('GCVolume'));
|
||||||
@@ -1675,6 +1692,10 @@ CM.Disp.AddMenuPref = function(title) {
|
|||||||
frag.appendChild(listing('SeaSound'));
|
frag.appendChild(listing('SeaSound'));
|
||||||
frag.appendChild(vol('SeaVolume'));
|
frag.appendChild(vol('SeaVolume'));
|
||||||
frag.appendChild(url('SeaSoundURL'));
|
frag.appendChild(url('SeaSoundURL'));
|
||||||
|
frag.appendChild(listing('GardFlash'));
|
||||||
|
frag.appendChild(listing('GardSound'));
|
||||||
|
frag.appendChild(vol('GardVolume'));
|
||||||
|
frag.appendChild(url('GardSoundURL'));
|
||||||
frag.appendChild(listing('Title'));
|
frag.appendChild(listing('Title'));
|
||||||
|
|
||||||
frag.appendChild(header('Tooltip'));
|
frag.appendChild(header('Tooltip'));
|
||||||
@@ -2582,6 +2603,7 @@ CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM
|
|||||||
CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink};
|
CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink};
|
||||||
CM.Disp.lastGoldenCookieState = 0;
|
CM.Disp.lastGoldenCookieState = 0;
|
||||||
CM.Disp.lastSeasonPopupState = 0;
|
CM.Disp.lastSeasonPopupState = 0;
|
||||||
|
CM.Disp.lastGardenNextStep = 0;
|
||||||
CM.Disp.goldenShimmer;
|
CM.Disp.goldenShimmer;
|
||||||
CM.Disp.seasonPopShimmer;
|
CM.Disp.seasonPopShimmer;
|
||||||
CM.Disp.lastAscendState = -1;
|
CM.Disp.lastAscendState = -1;
|
||||||
@@ -2795,6 +2817,9 @@ CM.Loop = function() {
|
|||||||
// Check Season Popup
|
// Check Season Popup
|
||||||
CM.Disp.CheckSeasonPopup();
|
CM.Disp.CheckSeasonPopup();
|
||||||
|
|
||||||
|
// Check Garden Tick
|
||||||
|
CM.Disp.CheckGardenTick();
|
||||||
|
|
||||||
// Update Average CPS (might need to move)
|
// Update Average CPS (might need to move)
|
||||||
CM.Cache.UpdateAvgCPS()
|
CM.Cache.UpdateAvgCPS()
|
||||||
}
|
}
|
||||||
@@ -2873,6 +2898,10 @@ CM.ConfigDefault = {
|
|||||||
SeaSound: 1,
|
SeaSound: 1,
|
||||||
SeaVolume: 100,
|
SeaVolume: 100,
|
||||||
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||||
|
GardFlash: 1,
|
||||||
|
GardSound: 1,
|
||||||
|
GardVolume: 100,
|
||||||
|
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||||
Title: 1,
|
Title: 1,
|
||||||
TooltipBuildUp: 1,
|
TooltipBuildUp: 1,
|
||||||
TooltipAmor: 0,
|
TooltipAmor: 0,
|
||||||
|
|||||||
@@ -155,6 +155,13 @@ for (var i = 0; i < 101; i++) {
|
|||||||
CM.ConfigData.SeaVolume.label[i] = 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.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.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.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.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.TooltipAmor = {label: ['Buildings Tooltip Amortization Information OFF', 'Buildings Tooltip Amortization Information ON'], desc: 'Add amortization information to buildings tooltip', toggle: true};
|
||||||
|
|||||||
17
src/Disp.js
17
src/Disp.js
@@ -884,6 +884,16 @@ CM.Disp.CheckSeasonPopup = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CM.Disp.CheckGardenTick = function() {
|
||||||
|
if (Game.Objects['Farm'].minigameLoaded && CM.Disp.lastGardenNextStep != Game.Objects['Farm'].minigame.nextStep) {
|
||||||
|
if (CM.Disp.lastGardenNextStep != 0 && CM.Disp.lastGardenNextStep < Date.now()) {
|
||||||
|
CM.Disp.Flash(3, 'GardFlash');
|
||||||
|
CM.Disp.PlaySound(CM.Config.GardSoundURL, 'GardSound', 'GardVolume');
|
||||||
|
}
|
||||||
|
CM.Disp.lastGardenNextStep = Game.Objects['Farm'].minigame.nextStep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CM.Disp.UpdateTitle = function() {
|
CM.Disp.UpdateTitle = function() {
|
||||||
if (Game.OnAscend || CM.Config.Title == 0) {
|
if (Game.OnAscend || CM.Config.Title == 0) {
|
||||||
document.title = CM.Cache.Title;
|
document.title = CM.Cache.Title;
|
||||||
@@ -1091,7 +1101,7 @@ CM.Disp.AddMenuPref = function(title) {
|
|||||||
frag.appendChild(listing('AvgClicksHist'));
|
frag.appendChild(listing('AvgClicksHist'));
|
||||||
frag.appendChild(listing('ToolWarnCautBon'));
|
frag.appendChild(listing('ToolWarnCautBon'));
|
||||||
|
|
||||||
frag.appendChild(header('Golden Cookie/Season Popup Emphasis'));
|
frag.appendChild(header('Notification'));
|
||||||
frag.appendChild(listing('GCFlash'));
|
frag.appendChild(listing('GCFlash'));
|
||||||
frag.appendChild(listing('GCSound'));
|
frag.appendChild(listing('GCSound'));
|
||||||
frag.appendChild(vol('GCVolume'));
|
frag.appendChild(vol('GCVolume'));
|
||||||
@@ -1102,6 +1112,10 @@ CM.Disp.AddMenuPref = function(title) {
|
|||||||
frag.appendChild(listing('SeaSound'));
|
frag.appendChild(listing('SeaSound'));
|
||||||
frag.appendChild(vol('SeaVolume'));
|
frag.appendChild(vol('SeaVolume'));
|
||||||
frag.appendChild(url('SeaSoundURL'));
|
frag.appendChild(url('SeaSoundURL'));
|
||||||
|
frag.appendChild(listing('GardFlash'));
|
||||||
|
frag.appendChild(listing('GardSound'));
|
||||||
|
frag.appendChild(vol('GardVolume'));
|
||||||
|
frag.appendChild(url('GardSoundURL'));
|
||||||
frag.appendChild(listing('Title'));
|
frag.appendChild(listing('Title'));
|
||||||
|
|
||||||
frag.appendChild(header('Tooltip'));
|
frag.appendChild(header('Tooltip'));
|
||||||
@@ -2009,6 +2023,7 @@ CM.Disp.colors = [CM.Disp.colorBlue, CM.Disp.colorGreen, CM.Disp.colorYellow, CM
|
|||||||
CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink};
|
CM.Disp.buffColors = {'Frenzy': CM.Disp.colorYellow, 'Dragon Harvest': CM.Disp.colorBrown, 'Elder frenzy': CM.Disp.colorGreen, 'Clot': CM.Disp.colorRed, 'Click frenzy': CM.Disp.colorBlue, 'Dragonflight': CM.Disp.colorPink};
|
||||||
CM.Disp.lastGoldenCookieState = 0;
|
CM.Disp.lastGoldenCookieState = 0;
|
||||||
CM.Disp.lastSeasonPopupState = 0;
|
CM.Disp.lastSeasonPopupState = 0;
|
||||||
|
CM.Disp.lastGardenNextStep = 0;
|
||||||
CM.Disp.goldenShimmer;
|
CM.Disp.goldenShimmer;
|
||||||
CM.Disp.seasonPopShimmer;
|
CM.Disp.seasonPopShimmer;
|
||||||
CM.Disp.lastAscendState = -1;
|
CM.Disp.lastAscendState = -1;
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ CM.Loop = function() {
|
|||||||
// Check Season Popup
|
// Check Season Popup
|
||||||
CM.Disp.CheckSeasonPopup();
|
CM.Disp.CheckSeasonPopup();
|
||||||
|
|
||||||
|
// Check Garden Tick
|
||||||
|
CM.Disp.CheckGardenTick();
|
||||||
|
|
||||||
// Update Average CPS (might need to move)
|
// Update Average CPS (might need to move)
|
||||||
CM.Cache.UpdateAvgCPS()
|
CM.Cache.UpdateAvgCPS()
|
||||||
}
|
}
|
||||||
@@ -263,6 +266,10 @@ CM.ConfigDefault = {
|
|||||||
SeaSound: 1,
|
SeaSound: 1,
|
||||||
SeaVolume: 100,
|
SeaVolume: 100,
|
||||||
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
SeaSoundURL: 'https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3',
|
||||||
|
GardFlash: 1,
|
||||||
|
GardSound: 1,
|
||||||
|
GardVolume: 100,
|
||||||
|
GardSoundURL: 'https://freesound.org/data/previews/103/103046_861714-lq.mp3',
|
||||||
Title: 1,
|
Title: 1,
|
||||||
TooltipBuildUp: 1,
|
TooltipBuildUp: 1,
|
||||||
TooltipAmor: 0,
|
TooltipAmor: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user