Option to play sound at full Grimoire Meter (#337)

This commit is contained in:
DanielNoord
2020-11-24 13:29:02 +01:00
committed by GitHub
parent 935ce42305
commit eda7514001
4 changed files with 66 additions and 0 deletions

View File

@@ -580,6 +580,13 @@ for (var i = 0; i < 101; i++) {
CM.ConfigData.GardVolume.label[i] = 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.GardSoundURL = {label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
CM.ConfigData.MagicFlash = {label: ['Magic Max Flash OFF', 'Magic Max Flash ON'], desc: 'Flash screen when magic reaches maxium', toggle: true};
CM.ConfigData.MagicSound = {label: ['Magic Max Sound OFF', 'Magic Max Sound ON'], desc: 'Play a sound when magic reaches maxium', 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.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};
@@ -1635,6 +1642,20 @@ CM.Disp.CheckGardenTick = function() {
} }
} }
CM.Disp.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.Disp.lastMagicBarFull = false;
}
else if (!CM.Disp.lastMagicBarFull) {
CM.Disp.lastMagicBarFull = true;
CM.Disp.Flash(3, 'MagicFlash');
CM.Disp.PlaySound(CM.Config.MagicSoundURL, 'MagicSound', 'MagicVolume');
}
}
}
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;
@@ -1874,6 +1895,10 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(listing('GardSound')); frag.appendChild(listing('GardSound'));
frag.appendChild(vol('GardVolume')); frag.appendChild(vol('GardVolume'));
frag.appendChild(url('GardSoundURL')); frag.appendChild(url('GardSoundURL'));
frag.appendChild(listing('MagicFlash'));
frag.appendChild(listing('MagicSound'));
frag.appendChild(vol('MagicVolume'));
frag.appendChild(url('MagicSoundURL'));
frag.appendChild(listing('Title')); frag.appendChild(listing('Title'));
frag.appendChild(header('Tooltip')); frag.appendChild(header('Tooltip'));
@@ -2943,6 +2968,7 @@ CM.Disp.lastGoldenCookieState = 0;
CM.Disp.lastTickerFortuneState = 0; CM.Disp.lastTickerFortuneState = 0;
CM.Disp.lastSeasonPopupState = 0; CM.Disp.lastSeasonPopupState = 0;
CM.Disp.lastGardenNextStep = 0; CM.Disp.lastGardenNextStep = 0;
CM.Disp.lastMagicBarFull = 0;
CM.Disp.goldenShimmer; CM.Disp.goldenShimmer;
CM.Disp.seasonPopShimmer; CM.Disp.seasonPopShimmer;
CM.Disp.lastAscendState = -1; CM.Disp.lastAscendState = -1;
@@ -3166,6 +3192,9 @@ CM.Loop = function() {
// Check Garden Tick // Check Garden Tick
CM.Disp.CheckGardenTick(); CM.Disp.CheckGardenTick();
// Check Grimoire Meter
CM.Disp.CheckMagicMeter();
// Update Average CPS (might need to move) // Update Average CPS (might need to move)
CM.Cache.UpdateAvgCPS() CM.Cache.UpdateAvgCPS()
} }
@@ -3254,6 +3283,10 @@ CM.ConfigDefault = {
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',
MagicFlash: 1,
MagicSound: 1,
MagicVolume: 100,
MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
Title: 1, Title: 1,
TooltipBuildUp: 1, TooltipBuildUp: 1,
TooltipAmor: 0, TooltipAmor: 0,

View File

@@ -170,6 +170,13 @@ for (var i = 0; i < 101; i++) {
CM.ConfigData.GardVolume.label[i] = 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.GardSoundURL = {label: 'Garden Tick Sound URL:', desc: 'URL of the sound to be played when the garden ticks'};
CM.ConfigData.MagicFlash = {label: ['Magic Max Flash OFF', 'Magic Max Flash ON'], desc: 'Flash screen when magic reaches maxium', toggle: true};
CM.ConfigData.MagicSound = {label: ['Magic Max Sound OFF', 'Magic Max Sound ON'], desc: 'Play a sound when magic reaches maxium', 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.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};

View File

@@ -1003,6 +1003,20 @@ CM.Disp.CheckGardenTick = function() {
} }
} }
CM.Disp.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.Disp.lastMagicBarFull = false;
}
else if (!CM.Disp.lastMagicBarFull) {
CM.Disp.lastMagicBarFull = true;
CM.Disp.Flash(3, 'MagicFlash');
CM.Disp.PlaySound(CM.Config.MagicSoundURL, 'MagicSound', 'MagicVolume');
}
}
}
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;
@@ -1242,6 +1256,10 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(listing('GardSound')); frag.appendChild(listing('GardSound'));
frag.appendChild(vol('GardVolume')); frag.appendChild(vol('GardVolume'));
frag.appendChild(url('GardSoundURL')); frag.appendChild(url('GardSoundURL'));
frag.appendChild(listing('MagicFlash'));
frag.appendChild(listing('MagicSound'));
frag.appendChild(vol('MagicVolume'));
frag.appendChild(url('MagicSoundURL'));
frag.appendChild(listing('Title')); frag.appendChild(listing('Title'));
frag.appendChild(header('Tooltip')); frag.appendChild(header('Tooltip'));
@@ -2311,6 +2329,7 @@ CM.Disp.lastGoldenCookieState = 0;
CM.Disp.lastTickerFortuneState = 0; CM.Disp.lastTickerFortuneState = 0;
CM.Disp.lastSeasonPopupState = 0; CM.Disp.lastSeasonPopupState = 0;
CM.Disp.lastGardenNextStep = 0; CM.Disp.lastGardenNextStep = 0;
CM.Disp.lastMagicBarFull = 0;
CM.Disp.goldenShimmer; CM.Disp.goldenShimmer;
CM.Disp.seasonPopShimmer; CM.Disp.seasonPopShimmer;
CM.Disp.lastAscendState = -1; CM.Disp.lastAscendState = -1;

View File

@@ -195,6 +195,9 @@ CM.Loop = function() {
// Check Garden Tick // Check Garden Tick
CM.Disp.CheckGardenTick(); CM.Disp.CheckGardenTick();
// Check Grimoire Meter
CM.Disp.CheckMagicMeter();
// Update Average CPS (might need to move) // Update Average CPS (might need to move)
CM.Cache.UpdateAvgCPS() CM.Cache.UpdateAvgCPS()
} }
@@ -283,6 +286,10 @@ CM.ConfigDefault = {
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',
MagicFlash: 1,
MagicSound: 1,
MagicVolume: 100,
MagicSoundURL: 'https://freesound.org/data/previews/221/221683_1015240-lq.mp3',
Title: 1, Title: 1,
TooltipBuildUp: 1, TooltipBuildUp: 1,
TooltipAmor: 0, TooltipAmor: 0,