Compare commits

...

7 Commits

5 changed files with 156 additions and 84 deletions

View File

@@ -186,6 +186,7 @@ CM.Cache.ChainWrathReward = 0;
CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzy = 0;
CM.Cache.ChainFrenzyReward = 0; CM.Cache.ChainFrenzyReward = 0;
CM.Cache.ChainFrenzyWrathReward = 0; CM.Cache.ChainFrenzyWrathReward = 0;
/********** /**********
* Config * * Config *
**********/ **********/
@@ -286,6 +287,7 @@ CM.ToggleStatsConfig = function(config) {
CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}}; CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', 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', func: function() {CM.Disp.ToggleTimerBar();}}; CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}};
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'};
@@ -295,7 +297,7 @@ for (var i = 0; i < 101; i++) {
CM.ConfigData.Volume.label[i] = i + '%'; CM.ConfigData.Volume.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.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns', func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special 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', func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', func: function() {CM.Disp.ToggleGCTimer();}};
CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'}; CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'};
CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'}; CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'};
@@ -520,9 +522,7 @@ CM.Disp.CreateTimerBar = function() {
CM.Disp.TimerBar.id = 'CMTimerBar'; CM.Disp.TimerBar.id = 'CMTimerBar';
CM.Disp.TimerBar.style.position = 'absolute'; CM.Disp.TimerBar.style.position = 'absolute';
CM.Disp.TimerBar.style.display = 'none'; CM.Disp.TimerBar.style.display = 'none';
CM.Disp.TimerBar.style.bottom = '0px';
CM.Disp.TimerBar.style.height = '48px'; CM.Disp.TimerBar.style.height = '48px';
CM.Disp.TimerBar.style.width = '100%';
CM.Disp.TimerBar.style.fontSize = '10px'; CM.Disp.TimerBar.style.fontSize = '10px';
CM.Disp.TimerBar.style.fontWeight = 'bold'; CM.Disp.TimerBar.style.fontWeight = 'bold';
CM.Disp.TimerBar.style.backgroundColor = 'black'; CM.Disp.TimerBar.style.backgroundColor = 'black';
@@ -552,6 +552,10 @@ CM.Disp.CreateTimerBar = function() {
colorBar.id = bars[i].id colorBar.id = bars[i].id
colorBar.style.display = 'inline-block'; colorBar.style.display = 'inline-block';
colorBar.style.height = '10px'; colorBar.style.height = '10px';
if (bars.length - 1 == i) {
colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px';
}
if (bars[i].color != undefined) { if (bars[i].color != undefined) {
colorBar.style.backgroundColor = bars[i].color; colorBar.style.backgroundColor = bars[i].color;
} }
@@ -612,6 +616,20 @@ CM.Disp.ToggleTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay(); CM.Disp.UpdateBotTimerBarDisplay();
} }
CM.Disp.ToggleTimerBarPos = function() {
if (CM.Config.TimerBarPos == 0) {
CM.Disp.TimerBar.style.width = '30%';
CM.Disp.TimerBar.style.bottom = '';
l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft'));
}
else {
CM.Disp.TimerBar.style.width = '100%';
CM.Disp.TimerBar.style.bottom = '0px';
l('wrapper').appendChild(CM.Disp.TimerBar);
}
CM.Disp.UpdateBotTimerBarDisplay();
}
CM.Disp.UpdateTimerBar = function() { CM.Disp.UpdateTimerBar = function() {
if (CM.Config.TimerBar == 1) { if (CM.Config.TimerBar == 1) {
// label width: 76 timer width: 26 div margin: 20 // label width: 76 timer width: 26 div margin: 20
@@ -621,6 +639,14 @@ CM.Disp.UpdateTimerBar = function() {
if (Game.goldenCookie.life <= 0 && Game.goldenCookie.toDie == 0) { if (Game.goldenCookie.life <= 0 && Game.goldenCookie.toDie == 0) {
CM.Disp.TimerBarGC.style.display = ''; CM.Disp.TimerBarGC.style.display = '';
l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.goldenCookie.minTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px'; l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.goldenCookie.minTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px';
if (Game.goldenCookie.minTime == Game.goldenCookie.maxTime) {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
}
else {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
}
l('CMTimerBarGCBar').style.width = Math.round(Math.min(Game.goldenCookie.maxTime - Game.goldenCookie.minTime, Game.goldenCookie.maxTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px'; l('CMTimerBarGCBar').style.width = Math.round(Math.min(Game.goldenCookie.maxTime - Game.goldenCookie.minTime, Game.goldenCookie.maxTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px';
l('CMTimerBarGCTime').textContent = Math.ceil((Game.goldenCookie.maxTime - Game.goldenCookie.time) / Game.fps); l('CMTimerBarGCTime').textContent = Math.ceil((Game.goldenCookie.maxTime - Game.goldenCookie.time) / Game.fps);
count++; count++;
@@ -683,7 +709,7 @@ CM.Disp.UpdateTimerBar = function() {
} }
CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1) { if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px'; CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px'; l('game').style.bottom = '104px';
} }
@@ -691,13 +717,20 @@ CM.Disp.UpdateBotTimerBarDisplay = function() {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px'; l('game').style.bottom = '56px';
} }
else if (CM.Config.TimerBar == 1) { else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px'; l('game').style.bottom = '48px';
} }
else { // No bars else { // No bars
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
} }
if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) {
l('sectionLeft').style.top = '48px';
}
else {
l('sectionLeft').style.top = '';
}
CM.Disp.UpdateBackground(); CM.Disp.UpdateBackground();
} }
@@ -791,43 +824,45 @@ CM.Disp.ToggleUpBarColor = function() {
} }
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
var blue = 0; if (CM.Config.UpBarColor == 1) {
var green = 0; var blue = 0;
var yellow = 0; var green = 0;
var orange = 0; var yellow = 0;
var red = 0; var orange = 0;
var purple = 0; var red = 0;
var gray = 0; var purple = 0;
var gray = 0;
for (var i in Game.UpgradesInStore) { for (var i in Game.UpgradesInStore) {
var me = Game.UpgradesInStore[i]; var me = Game.UpgradesInStore[i];
if (l('upgrade' + i).childNodes.length > 0) { if (l('upgrade' + i).childNodes.length > 0) {
l('upgrade' + i).childNodes[0].style.backgroundColor = CM.Cache.Upgrades[me.name].color; l('upgrade' + i).childNodes[0].style.backgroundColor = CM.Cache.Upgrades[me.name].color;
}
else {
var div = document.createElement('div');
div.style.width = '17px';
div.style.height = '17px';
div.style.backgroundColor = CM.Cache.Upgrades[me.name].color;
l('upgrade' + i).appendChild(div);
}
if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGreen) green++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorYellow) yellow++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorOrange) orange++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorRed) red++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorPurple) purple++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGray) gray++;
} }
else {
var div = document.createElement('div'); l('CMUpgradeBarBlue').textContent = blue;
div.style.width = '17px'; l('CMUpgradeBarGreen').textContent = green;
div.style.height = '17px'; l('CMUpgradeBarYellow').textContent = yellow;
div.style.backgroundColor = CM.Cache.Upgrades[me.name].color; l('CMUpgradeBarOrange').textContent = orange;
l('upgrade' + i).appendChild(div); l('CMUpgradeBarRed').textContent = red;
} l('CMUpgradeBarPurple').textContent = purple;
if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++; l('CMUpgradeBarGray').textContent = gray;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGreen) green++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorYellow) yellow++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorOrange) orange++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorRed) red++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorPurple) purple++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGray) gray++;
} }
l('CMUpgradeBarBlue').textContent = blue;
l('CMUpgradeBarGreen').textContent = green;
l('CMUpgradeBarYellow').textContent = yellow;
l('CMUpgradeBarOrange').textContent = orange;
l('CMUpgradeBarRed').textContent = red;
l('CMUpgradeBarPurple').textContent = purple;
l('CMUpgradeBarGray').textContent = gray;
} }
CM.Disp.CreateWhiteScreen = function() { CM.Disp.CreateWhiteScreen = function() {
@@ -1034,6 +1069,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(header('Bars/Colors')); frag.appendChild(header('Bars/Colors'));
frag.appendChild(listing('BotBar')); frag.appendChild(listing('BotBar'));
frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBar'));
frag.appendChild(listing('TimerBarPos'));
frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BuildColor'));
frag.appendChild(listing('UpBarColor')); frag.appendChild(listing('UpBarColor'));
@@ -1883,11 +1919,11 @@ CM.Init = function() {
} }
} }
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}};
CM.ConfigPrefix = 'CMConfig'; CM.ConfigPrefix = 'CMConfig';
CM.VersionMajor = '1.0465'; CM.VersionMajor = '1.0465';
CM.VersionMinor = '9'; CM.VersionMinor = '11';
/******* /*******
* Sim * * Sim *

View File

@@ -166,3 +166,4 @@ CM.Cache.ChainWrathReward = 0;
CM.Cache.ChainFrenzy = 0; CM.Cache.ChainFrenzy = 0;
CM.Cache.ChainFrenzyReward = 0; CM.Cache.ChainFrenzyReward = 0;
CM.Cache.ChainFrenzyWrathReward = 0; CM.Cache.ChainFrenzyWrathReward = 0;

View File

@@ -98,6 +98,7 @@ CM.ToggleStatsConfig = function(config) {
CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', func: function() {CM.Disp.ToggleBotBar();}}; CM.ConfigData.BotBar = {label: ['Bottom Bar OFF', 'Bottom Bar ON'], desc: 'Building Information', 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', func: function() {CM.Disp.ToggleTimerBar();}}; CM.ConfigData.TimerBar = {label: ['Timer Bar OFF', 'Timer Bar ON'], desc: 'Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy', func: function() {CM.Disp.ToggleTimerBar();}};
CM.ConfigData.TimerBarPos = {label: ['Timer Bar Position (Top Left)', 'Timer Bar Position (Bottom)'], desc: 'Placement of the Timer Bar', func: function() {CM.Disp.ToggleTimerBarPos();}};
CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}}; CM.ConfigData.BuildColor = {label: ['Building Colors OFF', 'Building Colors ON'], desc: 'Color code buildings', func: function() {CM.Disp.UpdateBuildings();}};
CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}}; CM.ConfigData.UpBarColor = {label: ['Upgrade Bar/Colors OFF', 'Upgrade Bar/Colors ON'], desc: 'Color code upgrades and add a counter', func: function() {CM.Disp.ToggleUpBarColor();}};
CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'}; CM.ConfigData.Flash = {label: ['Flash OFF', 'Flash ON'], desc: 'Flash screen on Golden Cookie/Season Popup'};
@@ -107,7 +108,7 @@ for (var i = 0; i < 101; i++) {
CM.ConfigData.Volume.label[i] = i + '%'; CM.ConfigData.Volume.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.GCSoundURL = {label: 'Golden Cookie Sound URL:', desc: 'URL of the sound to be played when a Golden Cookie spawns'};
CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special spawns', func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.SeaSoundURL = {label: 'Season Special Sound URL:', desc: 'URL of the sound to be played when a Season Special 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', func: function() {CM.Disp.ToggleGCTimer();}}; CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when it has been spawned', func: function() {CM.Disp.ToggleGCTimer();}};
CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'}; CM.ConfigData.Title = {label: ['Title OFF', 'Title ON'], desc: 'Update title with Golden Cookie/Season Popup timers'};
CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'}; CM.ConfigData.Tooltip = {label: ['Tooltip Information OFF', 'Tooltip Information ON'], desc: 'Extra information in tooltip for buildings/upgrades'};

View File

@@ -203,9 +203,7 @@ CM.Disp.CreateTimerBar = function() {
CM.Disp.TimerBar.id = 'CMTimerBar'; CM.Disp.TimerBar.id = 'CMTimerBar';
CM.Disp.TimerBar.style.position = 'absolute'; CM.Disp.TimerBar.style.position = 'absolute';
CM.Disp.TimerBar.style.display = 'none'; CM.Disp.TimerBar.style.display = 'none';
CM.Disp.TimerBar.style.bottom = '0px';
CM.Disp.TimerBar.style.height = '48px'; CM.Disp.TimerBar.style.height = '48px';
CM.Disp.TimerBar.style.width = '100%';
CM.Disp.TimerBar.style.fontSize = '10px'; CM.Disp.TimerBar.style.fontSize = '10px';
CM.Disp.TimerBar.style.fontWeight = 'bold'; CM.Disp.TimerBar.style.fontWeight = 'bold';
CM.Disp.TimerBar.style.backgroundColor = 'black'; CM.Disp.TimerBar.style.backgroundColor = 'black';
@@ -235,6 +233,10 @@ CM.Disp.CreateTimerBar = function() {
colorBar.id = bars[i].id colorBar.id = bars[i].id
colorBar.style.display = 'inline-block'; colorBar.style.display = 'inline-block';
colorBar.style.height = '10px'; colorBar.style.height = '10px';
if (bars.length - 1 == i) {
colorBar.style.borderTopRightRadius = '10px';
colorBar.style.borderBottomRightRadius = '10px';
}
if (bars[i].color != undefined) { if (bars[i].color != undefined) {
colorBar.style.backgroundColor = bars[i].color; colorBar.style.backgroundColor = bars[i].color;
} }
@@ -295,6 +297,20 @@ CM.Disp.ToggleTimerBar = function() {
CM.Disp.UpdateBotTimerBarDisplay(); CM.Disp.UpdateBotTimerBarDisplay();
} }
CM.Disp.ToggleTimerBarPos = function() {
if (CM.Config.TimerBarPos == 0) {
CM.Disp.TimerBar.style.width = '30%';
CM.Disp.TimerBar.style.bottom = '';
l('game').insertBefore(CM.Disp.TimerBar, l('sectionLeft'));
}
else {
CM.Disp.TimerBar.style.width = '100%';
CM.Disp.TimerBar.style.bottom = '0px';
l('wrapper').appendChild(CM.Disp.TimerBar);
}
CM.Disp.UpdateBotTimerBarDisplay();
}
CM.Disp.UpdateTimerBar = function() { CM.Disp.UpdateTimerBar = function() {
if (CM.Config.TimerBar == 1) { if (CM.Config.TimerBar == 1) {
// label width: 76 timer width: 26 div margin: 20 // label width: 76 timer width: 26 div margin: 20
@@ -304,6 +320,14 @@ CM.Disp.UpdateTimerBar = function() {
if (Game.goldenCookie.life <= 0 && Game.goldenCookie.toDie == 0) { if (Game.goldenCookie.life <= 0 && Game.goldenCookie.toDie == 0) {
CM.Disp.TimerBarGC.style.display = ''; CM.Disp.TimerBarGC.style.display = '';
l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.goldenCookie.minTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px'; l('CMTimerBarGCMinBar').style.width = Math.round(Math.max(0, Game.goldenCookie.minTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px';
if (Game.goldenCookie.minTime == Game.goldenCookie.maxTime) {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
}
else {
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
}
l('CMTimerBarGCBar').style.width = Math.round(Math.min(Game.goldenCookie.maxTime - Game.goldenCookie.minTime, Game.goldenCookie.maxTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px'; l('CMTimerBarGCBar').style.width = Math.round(Math.min(Game.goldenCookie.maxTime - Game.goldenCookie.minTime, Game.goldenCookie.maxTime - Game.goldenCookie.time) * maxWidth / Game.goldenCookie.maxTime) + 'px';
l('CMTimerBarGCTime').textContent = Math.ceil((Game.goldenCookie.maxTime - Game.goldenCookie.time) / Game.fps); l('CMTimerBarGCTime').textContent = Math.ceil((Game.goldenCookie.maxTime - Game.goldenCookie.time) / Game.fps);
count++; count++;
@@ -366,7 +390,7 @@ CM.Disp.UpdateTimerBar = function() {
} }
CM.Disp.UpdateBotTimerBarDisplay = function() { CM.Disp.UpdateBotTimerBarDisplay = function() {
if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1) { if (CM.Config.BotBar == 1 && CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
CM.Disp.BotBar.style.bottom = '48px'; CM.Disp.BotBar.style.bottom = '48px';
l('game').style.bottom = '104px'; l('game').style.bottom = '104px';
} }
@@ -374,13 +398,20 @@ CM.Disp.UpdateBotTimerBarDisplay = function() {
CM.Disp.BotBar.style.bottom = '0px'; CM.Disp.BotBar.style.bottom = '0px';
l('game').style.bottom = '56px'; l('game').style.bottom = '56px';
} }
else if (CM.Config.TimerBar == 1) { else if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 1) {
l('game').style.bottom = '48px'; l('game').style.bottom = '48px';
} }
else { // No bars else { // No bars
l('game').style.bottom = '0px'; l('game').style.bottom = '0px';
} }
if (CM.Config.TimerBar == 1 && CM.Config.TimerBarPos == 0) {
l('sectionLeft').style.top = '48px';
}
else {
l('sectionLeft').style.top = '';
}
CM.Disp.UpdateBackground(); CM.Disp.UpdateBackground();
} }
@@ -474,43 +505,45 @@ CM.Disp.ToggleUpBarColor = function() {
} }
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
var blue = 0; if (CM.Config.UpBarColor == 1) {
var green = 0; var blue = 0;
var yellow = 0; var green = 0;
var orange = 0; var yellow = 0;
var red = 0; var orange = 0;
var purple = 0; var red = 0;
var gray = 0; var purple = 0;
var gray = 0;
for (var i in Game.UpgradesInStore) { for (var i in Game.UpgradesInStore) {
var me = Game.UpgradesInStore[i]; var me = Game.UpgradesInStore[i];
if (l('upgrade' + i).childNodes.length > 0) { if (l('upgrade' + i).childNodes.length > 0) {
l('upgrade' + i).childNodes[0].style.backgroundColor = CM.Cache.Upgrades[me.name].color; l('upgrade' + i).childNodes[0].style.backgroundColor = CM.Cache.Upgrades[me.name].color;
}
else {
var div = document.createElement('div');
div.style.width = '17px';
div.style.height = '17px';
div.style.backgroundColor = CM.Cache.Upgrades[me.name].color;
l('upgrade' + i).appendChild(div);
}
if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGreen) green++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorYellow) yellow++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorOrange) orange++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorRed) red++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorPurple) purple++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGray) gray++;
} }
else {
var div = document.createElement('div'); l('CMUpgradeBarBlue').textContent = blue;
div.style.width = '17px'; l('CMUpgradeBarGreen').textContent = green;
div.style.height = '17px'; l('CMUpgradeBarYellow').textContent = yellow;
div.style.backgroundColor = CM.Cache.Upgrades[me.name].color; l('CMUpgradeBarOrange').textContent = orange;
l('upgrade' + i).appendChild(div); l('CMUpgradeBarRed').textContent = red;
} l('CMUpgradeBarPurple').textContent = purple;
if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++; l('CMUpgradeBarGray').textContent = gray;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorBlue) blue++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGreen) green++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorYellow) yellow++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorOrange) orange++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorRed) red++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorPurple) purple++;
else if (CM.Cache.Upgrades[me.name].color == CM.Disp.colorGray) gray++;
} }
l('CMUpgradeBarBlue').textContent = blue;
l('CMUpgradeBarGreen').textContent = green;
l('CMUpgradeBarYellow').textContent = yellow;
l('CMUpgradeBarOrange').textContent = orange;
l('CMUpgradeBarRed').textContent = red;
l('CMUpgradeBarPurple').textContent = purple;
l('CMUpgradeBarGray').textContent = gray;
} }
CM.Disp.CreateWhiteScreen = function() { CM.Disp.CreateWhiteScreen = function() {
@@ -717,6 +750,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(header('Bars/Colors')); frag.appendChild(header('Bars/Colors'));
frag.appendChild(listing('BotBar')); frag.appendChild(listing('BotBar'));
frag.appendChild(listing('TimerBar')); frag.appendChild(listing('TimerBar'));
frag.appendChild(listing('TimerBarPos'));
frag.appendChild(listing('BuildColor')); frag.appendChild(listing('BuildColor'));
frag.appendChild(listing('UpBarColor')); frag.appendChild(listing('UpBarColor'));

View File

@@ -125,9 +125,9 @@ CM.Init = function() {
} }
} }
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}}; CM.ConfigDefault = {BotBar: 1, TimerBar: 1, TimerBarPos: 0, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCSoundURL: 'http://freesound.org/data/previews/66/66717_931655-lq.mp3', SeaSoundURL: 'http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3', GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 1, ToolWrink: 1, Stats: 1, UpStats: 1, SayTime: 1, Scale: 2, StatsPref: {Lucky: 1, Chain: 1, HC: 1, Wrink: 1, Sea: 1}};
CM.ConfigPrefix = 'CMConfig'; CM.ConfigPrefix = 'CMConfig';
CM.VersionMajor = '1.0465'; CM.VersionMajor = '1.0465';
CM.VersionMinor = '9'; CM.VersionMinor = '11';