Compare commits

..

17 Commits

Author SHA1 Message Date
Aktanusa
a8d404aca7 Version change 2014-08-26 13:27:59 -04:00
Aktanusa
989ef30f4a Fixed upgrades still having color boxes even when it is off in preferences (Issue #21) and fixed graphical glitch with timer bars on a cookie chain 2014-08-26 13:27:10 -04:00
Aktanusa
e4bca75da1 More minor optimizations/typo fixes for the timer bar 2014-08-24 22:49:44 -04:00
Aktanusa
418b1a7d2e Very minor optimization on timer bar creation. 2014-08-24 22:18:09 -04:00
Aktanusa
db41ada262 Added the option to move the timer bars to the top left of the screen. Also added a nice visual rounding to the right side of the bars. 2014-08-24 22:14:27 -04:00
Aktanusa
27833773c9 Forgot compile for last commit 2014-08-17 10:58:53 -04:00
Aktanusa
1742ce201c Version change and minor cleanup 2014-08-17 10:57:36 -04:00
Aktanusa
850f16ca4c Fixed minor flaw in README 2014-08-17 02:00:43 -04:00
Aktanusa
4d445c676c Added the option to change sounds played when a Golden Cookie/Season Special spawns (Fixed issue #17) 2014-08-17 01:55:45 -04:00
Aktanusa
f9ac7aa549 Fixed userscript section on README 2014-08-16 16:48:29 -04:00
Aktanusa
a7e2b2cf35 Merge branch 'dev' of https://github.com/Aktanusa/CookieMonster into dev 2014-08-16 10:05:24 -04:00
Aktanusa
55fc259849 Changed default Golden Cookie sound (issue #17) 2014-08-16 10:04:59 -04:00
Aktanusa
c9a1e60d50 Changed default Golden Cookie sound (issue #17 2014-08-16 10:03:15 -04:00
Aktanusa
188a622c97 A single word corrected by anonymous 2014-08-16 09:59:00 -04:00
Aktanusa
ccc01ab5dc Fixed issue #14 (tooltip is cut off at bottom) 2014-07-14 09:50:27 -04:00
Aktanusa
ee1545fca0 Added the option to turn off wrinkler tooltip (issue #13) 2014-07-11 21:30:41 -04:00
Aktanusa
267b40bfa1 Version change, minor optimizations in wrinker tooltip/reset bonus income tooltip, move wrinkler tooltip a little right to minor game 2014-07-11 21:17:49 -04:00
6 changed files with 308 additions and 139 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 *
**********/ **********/
@@ -202,11 +203,19 @@ CM.LoadConfig = function() {
var mod = false; var mod = false;
for (var i in CM.ConfigDefault) { for (var i in CM.ConfigDefault) {
if (i != 'StatsPref') { if (i != 'StatsPref') {
if (i.indexOf('SoundURL') == -1) {
if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) { if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) {
mod = true; mod = true;
CM.Config[i] = CM.ConfigDefault[i]; CM.Config[i] = CM.ConfigDefault[i];
} }
} }
else { // Sound URLs
if (CM.Config[i] == undefined || typeof CM.Config[i] != 'string') {
mod = true;
CM.Config[i] = CM.ConfigDefault[i];
}
}
}
else { // Statistics Preferences else { // Statistics Preferences
if (CM.Config[i] == undefined) { if (CM.Config[i] == undefined) {
mod = true; mod = true;
@@ -278,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'};
@@ -286,11 +296,14 @@ CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
for (var i = 0; i < 101; i++) { for (var i = 0; i < 101; i++) {
CM.ConfigData.Volume.label[i] = i + '%'; CM.ConfigData.Volume.label[i] = i + '%';
} }
CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when has been spawned', func: function() {CM.Disp.ToggleGCTimer();}}; 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'};
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'};
CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}}; CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}};
CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}};
CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it'};
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'};
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'};
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}};
@@ -509,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';
@@ -541,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;
} }
@@ -601,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
@@ -610,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++;
@@ -672,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';
} }
@@ -680,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();
} }
@@ -780,6 +824,7 @@ CM.Disp.ToggleUpBarColor = function() {
} }
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
if (CM.Config.UpBarColor == 1) {
var blue = 0; var blue = 0;
var green = 0; var green = 0;
var yellow = 0; var yellow = 0;
@@ -818,6 +863,7 @@ CM.Disp.UpdateUpgrades = function() {
l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarPurple').textContent = purple;
l('CMUpgradeBarGray').textContent = gray; l('CMUpgradeBarGray').textContent = gray;
} }
}
CM.Disp.CreateWhiteScreen = function() { CM.Disp.CreateWhiteScreen = function() {
CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen = document.createElement('div');
@@ -901,7 +947,7 @@ CM.Disp.CheckGoldenCookie = function() {
} }
CM.Disp.Flash(3); CM.Disp.Flash(3);
CM.Disp.PlaySound('http://cookie-monster.autopergamene.eu/mp3/bell.mp3'); CM.Disp.PlaySound(CM.Config.GCSoundURL);
} }
else if (CM.Config.GCTimer == 1) CM.Disp.GCTimer.style.display = 'none'; else if (CM.Config.GCTimer == 1) CM.Disp.GCTimer.style.display = 'none';
} }
@@ -915,7 +961,7 @@ CM.Disp.CheckGoldenCookie = function() {
CM.Disp.EmphSeasonPopup = function() { CM.Disp.EmphSeasonPopup = function() {
if (Game.season=='christmas') { if (Game.season=='christmas') {
CM.Disp.Flash(3); CM.Disp.Flash(3);
CM.Disp.PlaySound('http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3'); CM.Disp.PlaySound(CM.Config.SeaSoundURL);
} }
} }
@@ -951,6 +997,18 @@ CM.Disp.UpdateTitle = function() {
} }
} }
CM.Disp.CreateResetTooltip = function() {
CM.Disp.ResetTooltipPlaceholder = document.createElement('div');
var resetTitleDesc = document.createElement('div');
resetTitleDesc.style.minWidth = '260px';
resetTitleDesc.style.marginBottom = '4px';
var div = document.createElement('div');
div.style.textAlign = 'left';
div.textContent = 'The bonus income you would get from new heavenly chips/reset achievements if you have the same buildings/upgrades after reset';
resetTitleDesc.appendChild(div);
CM.Disp.ResetTooltipPlaceholder.appendChild(resetTitleDesc);
}
CM.Disp.AddMenuPref = function(title) { CM.Disp.AddMenuPref = function(title) {
var header = function(text) { var header = function(text) {
var div = document.createElement('div'); var div = document.createElement('div');
@@ -982,9 +1040,36 @@ CM.Disp.AddMenuPref = function(title) {
return div; return div;
} }
var url = function(config) {
var div = document.createElement('div');
div.className = 'listing';
var span = document.createElement('span');
span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span);
var input = document.createElement('input');
input.id = CM.ConfigPrefix + config;
input.className = 'option';
input.type = 'text';
input.value = CM.Config[config];
input.style.width = '300px';
div.appendChild(input);
div.appendChild(document.createTextNode(' '));
var a = document.createElement('a');
a.className = 'option';
a.onclick = function() {CM.Config[config] = l(CM.ConfigPrefix + config).value;CM.SaveConfig(CM.Config);};
a.textContent = 'Save';
div.appendChild(a);
var label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc;
div.appendChild(label);
return div;
}
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'));
@@ -1012,6 +1097,8 @@ CM.Disp.AddMenuPref = function(title) {
volLabel.textContent = CM.ConfigData[volConfig].desc; volLabel.textContent = CM.ConfigData[volConfig].desc;
volume.appendChild(volLabel); volume.appendChild(volLabel);
frag.appendChild(volume); frag.appendChild(volume);
frag.appendChild(url('GCSoundURL'));
frag.appendChild(url('SeaSoundURL'));
frag.appendChild(listing('GCTimer')); frag.appendChild(listing('GCTimer'));
frag.appendChild(listing('Title')); frag.appendChild(listing('Title'));
@@ -1019,6 +1106,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(listing('Tooltip')); frag.appendChild(listing('Tooltip'));
frag.appendChild(listing('ToolWarnCaut')); frag.appendChild(listing('ToolWarnCaut'));
frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('ToolWarnCautPos'));
frag.appendChild(listing('ToolWrink'));
frag.appendChild(header('Statistics')); frag.appendChild(header('Statistics'));
frag.appendChild(listing('Stats')); frag.appendChild(listing('Stats'));
@@ -1187,16 +1275,7 @@ CM.Disp.AddMenuStats = function(title) {
resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')) resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income '))
var resetTitleSpan = document.createElement('span'); var resetTitleSpan = document.createElement('span');
resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); };
var resetTitlePlaceholder = document.createElement('div'); resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));};
var resetTitleDesc = document.createElement('div');
resetTitleDesc.style.minWidth = '260px';
resetTitleDesc.style.marginBottom = '4px';
var resetTitleDiv = document.createElement('div');
resetTitleDiv.style.textAlign = 'left';
resetTitleDiv.textContent = 'The bonus income you would get from new heavenly chips/reset achievements if you have the same buildings/upgrades after reset';
resetTitleDesc.appendChild(resetTitleDiv);
resetTitlePlaceholder.appendChild(resetTitleDesc);
resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(resetTitlePlaceholder.innerHTML));};
resetTitleSpan.style.cursor = 'default'; resetTitleSpan.style.cursor = 'default';
resetTitleSpan.style.display = 'inline-block'; resetTitleSpan.style.display = 'inline-block';
resetTitleSpan.style.height = '10px'; resetTitleSpan.style.height = '10px';
@@ -1346,6 +1425,14 @@ CM.Disp.RefreshMenu = function() {
if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu(); if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu();
} }
CM.Disp.UpdateTooltipLocation = function() {
Game.tooltip.tta.style.top = Math.max(0, Math.min((l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - CM.Disp.TooltipWarnCaut.clientHeight - 64, Game.mouseY - 48)) + 'px';
if (Game.tooltip.origin == 'wrink') {
Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px';
Game.tooltip.tta.style.right = 'auto';
}
}
CM.Disp.CreateTooltipWarnCaut = function() { CM.Disp.CreateTooltipWarnCaut = function() {
CM.Disp.TooltipWarnCaut = document.createElement('div'); CM.Disp.TooltipWarnCaut = document.createElement('div');
CM.Disp.TooltipWarnCaut.style.position = 'absolute'; CM.Disp.TooltipWarnCaut.style.position = 'absolute';
@@ -1610,7 +1697,7 @@ CM.Disp.AddWrinklerAreaDetect = function() {
} }
CM.Disp.CheckWrinklerTooltip = function() { CM.Disp.CheckWrinklerTooltip = function() {
if (CM.Disp.TooltipWrinklerArea == 1) { if (CM.Config.ToolWrink == 1 && CM.Disp.TooltipWrinklerArea == 1) {
var showingTooltip = false; var showingTooltip = false;
var mouseInWrinkler = function (x, y, rect) { var mouseInWrinkler = function (x, y, rect) {
var dx = x + Math.sin(-rect.r) * (-(rect.h / 2 - rect.o)), dy = y + Math.cos(-rect.r) * (-(rect.h / 2 - rect.o)); var dx = x + Math.sin(-rect.r) * (-(rect.h / 2 - rect.o)), dy = y + Math.cos(-rect.r) * (-(rect.h / 2 - rect.o));
@@ -1626,6 +1713,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
var me = Game.wrinklers[i]; var me = Game.wrinklers[i];
var rect = {w: 100, h: 200, r: (-me.r) * Math.PI / 180, o: 10}; var rect = {w: 100, h: 200, r: (-me.r) * Math.PI / 180, o: 10};
if (me.phase > 0 && Game.LeftBackground && Game.mouseX < Game.LeftBackground.canvas.width && mouseInWrinkler(Game.mouseX - me.x, Game.mouseY - me.y, rect)) { if (me.phase > 0 && Game.LeftBackground && Game.mouseX < Game.LeftBackground.canvas.width && mouseInWrinkler(Game.mouseX - me.x, Game.mouseY - me.y, rect)) {
showingTooltip = true;
if (CM.Disp.TooltipWrinklerCache[i] == 0) { if (CM.Disp.TooltipWrinklerCache[i] == 0) {
var placeholder = document.createElement('div'); var placeholder = document.createElement('div');
var wrinkler = document.createElement('div'); var wrinkler = document.createElement('div');
@@ -1640,7 +1728,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
CM.Disp.TooltipWrinkler = i; CM.Disp.TooltipWrinkler = i;
CM.Disp.TooltipWrinklerCache[i] = 1; CM.Disp.TooltipWrinklerCache[i] = 1;
} }
showingTooltip = true; else break;
} }
else { else {
CM.Disp.TooltipWrinklerCache[i] = 0; CM.Disp.TooltipWrinklerCache[i] = 0;
@@ -1653,7 +1741,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
} }
CM.Disp.UpdateWrinklerTooltip = function() { CM.Disp.UpdateWrinklerTooltip = function() {
if (l('CMTooltipWrinkler') != null) { if (CM.Config.ToolWrink == 1 && l('CMTooltipWrinkler') != null) {
var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;
sucked *= 1.1; sucked *= 1.1;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
@@ -1661,13 +1749,6 @@ CM.Disp.UpdateWrinklerTooltip = function() {
} }
} }
CM.Disp.UpdateTooltipWrinklerLocation = function() {
if (Game.tooltip.origin == 'wrink') {
Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 20) + 'px';
Game.tooltip.tta.style.right = 'auto';
}
}
CM.Disp.ToggleSayTime = function() { CM.Disp.ToggleSayTime = function() {
if (CM.Config.SayTime == 1) { if (CM.Config.SayTime == 1) {
Game.sayTime = CM.Disp.sayTime; Game.sayTime = CM.Disp.sayTime;
@@ -1746,8 +1827,8 @@ CM.ReplaceNative = function() {
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip')); eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip'));
Game.tooltip.update = function() { Game.tooltip.update = function() {
CM.Backup.tooltip.updateMod(); CM.Backup.tooltip.updateMod();
CM.Disp.UpdateTooltipWrinklerLocation();
CM.Disp.UpdateTooltipWarnCaut(); CM.Disp.UpdateTooltipWarnCaut();
CM.Disp.UpdateTooltipLocation();
} }
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades; CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
@@ -1822,6 +1903,7 @@ CM.Init = function() {
CM.Disp.CreateUpgradeBar(); CM.Disp.CreateUpgradeBar();
CM.Disp.CreateWhiteScreen(); CM.Disp.CreateWhiteScreen();
CM.Disp.CreateGCTimer(); CM.Disp.CreateGCTimer();
CM.Disp.CreateResetTooltip();
CM.Disp.CreateTooltipWarnCaut(); CM.Disp.CreateTooltipWarnCaut();
CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipBuild();
CM.Disp.AddTooltipBuild10(); CM.Disp.AddTooltipBuild10();
@@ -1837,11 +1919,11 @@ CM.Init = function() {
} }
} }
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 0, 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 = '8'; CM.VersionMinor = '11';
/******* /*******
* Sim * * Sim *

View File

@@ -26,7 +26,7 @@ This index is computed for buildings and upgrades. If the relevant option is ena
* Purple : (upgrades) This item has a worse BCI than any building * Purple : (upgrades) This item has a worse BCI than any building
* Gray : (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth. * Gray : (upgrades) This item has not been calculated and/or cannot be calculated due to no definitive worth.
Note : For this index, **lower is better**, meaning a building with a BCI of 1 is more interesting that one with a BCI of 3. Note : For this index, **lower is better**, meaning a building with a BCI of 1 is more interesting than one with a BCI of 3.
## What it doesn't do ## What it doesn't do
@@ -73,8 +73,13 @@ If you'd rather use the addon as a script via per example *Greasemonkey* or *Tam
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==
(function () { javascript:(function() {
var checkReady = setInterval(function() {
if (Game.ready != undefined && Game.ready) {
Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js'); Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js');
clearInterval(checkReady);
}
}, 1000);
}()); }());
``` ```

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

@@ -14,11 +14,19 @@ CM.LoadConfig = function() {
var mod = false; var mod = false;
for (var i in CM.ConfigDefault) { for (var i in CM.ConfigDefault) {
if (i != 'StatsPref') { if (i != 'StatsPref') {
if (i.indexOf('SoundURL') == -1) {
if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) { if (CM.Config[i] == undefined || !(CM.Config[i] > -1 && CM.Config[i] < CM.ConfigData[i].label.length)) {
mod = true; mod = true;
CM.Config[i] = CM.ConfigDefault[i]; CM.Config[i] = CM.ConfigDefault[i];
} }
} }
else { // Sound URLs
if (CM.Config[i] == undefined || typeof CM.Config[i] != 'string') {
mod = true;
CM.Config[i] = CM.ConfigDefault[i];
}
}
}
else { // Statistics Preferences else { // Statistics Preferences
if (CM.Config[i] == undefined) { if (CM.Config[i] == undefined) {
mod = true; mod = true;
@@ -90,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'};
@@ -98,11 +107,14 @@ CM.ConfigData.Volume = {label: [], desc: 'Volume of the sound'};
for (var i = 0; i < 101; i++) { for (var i = 0; i < 101; i++) {
CM.ConfigData.Volume.label[i] = i + '%'; CM.ConfigData.Volume.label[i] = i + '%';
} }
CM.ConfigData.GCTimer = {label: ['Golden Cookie Timer OFF', 'Golden Cookie Timer ON'], desc: 'A timer on the Golden Cookie when has been spawned', func: function() {CM.Disp.ToggleGCTimer();}}; 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'};
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'};
CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}}; CM.ConfigData.ToolWarnCaut = {label: ['Tooltip Warning/Caution OFF', 'Tooltip Warning/Caution ON'], desc: 'A warning/caution when buying if it will put the bank under the amount needed for max "Lucky!"/"Lucky!" (Frenzy) rewards', func: function() {CM.Disp.ToggleToolWarnCaut();}};
CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}}; CM.ConfigData.ToolWarnCautPos = {label: ['Tooltip Warning/Caution Position (Left)', 'Tooltip Warning/Caution Position (Bottom)'], desc: 'Placement of the warning/caution boxes', func: function() {CM.Disp.ToggleToolWarnCautPos();}};
CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'], desc: 'Shows the amount of cookies a wrinkler will give when popping it'};
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!'};
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 3 seconds'};
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', func: function() {CM.Disp.ToggleSayTime();}};

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,6 +505,7 @@ CM.Disp.ToggleUpBarColor = function() {
} }
CM.Disp.UpdateUpgrades = function() { CM.Disp.UpdateUpgrades = function() {
if (CM.Config.UpBarColor == 1) {
var blue = 0; var blue = 0;
var green = 0; var green = 0;
var yellow = 0; var yellow = 0;
@@ -512,6 +544,7 @@ CM.Disp.UpdateUpgrades = function() {
l('CMUpgradeBarPurple').textContent = purple; l('CMUpgradeBarPurple').textContent = purple;
l('CMUpgradeBarGray').textContent = gray; l('CMUpgradeBarGray').textContent = gray;
} }
}
CM.Disp.CreateWhiteScreen = function() { CM.Disp.CreateWhiteScreen = function() {
CM.Disp.WhiteScreen = document.createElement('div'); CM.Disp.WhiteScreen = document.createElement('div');
@@ -595,7 +628,7 @@ CM.Disp.CheckGoldenCookie = function() {
} }
CM.Disp.Flash(3); CM.Disp.Flash(3);
CM.Disp.PlaySound('http://cookie-monster.autopergamene.eu/mp3/bell.mp3'); CM.Disp.PlaySound(CM.Config.GCSoundURL);
} }
else if (CM.Config.GCTimer == 1) CM.Disp.GCTimer.style.display = 'none'; else if (CM.Config.GCTimer == 1) CM.Disp.GCTimer.style.display = 'none';
} }
@@ -609,7 +642,7 @@ CM.Disp.CheckGoldenCookie = function() {
CM.Disp.EmphSeasonPopup = function() { CM.Disp.EmphSeasonPopup = function() {
if (Game.season=='christmas') { if (Game.season=='christmas') {
CM.Disp.Flash(3); CM.Disp.Flash(3);
CM.Disp.PlaySound('http://www.freesound.org/data/previews/121/121099_2193266-lq.mp3'); CM.Disp.PlaySound(CM.Config.SeaSoundURL);
} }
} }
@@ -645,6 +678,18 @@ CM.Disp.UpdateTitle = function() {
} }
} }
CM.Disp.CreateResetTooltip = function() {
CM.Disp.ResetTooltipPlaceholder = document.createElement('div');
var resetTitleDesc = document.createElement('div');
resetTitleDesc.style.minWidth = '260px';
resetTitleDesc.style.marginBottom = '4px';
var div = document.createElement('div');
div.style.textAlign = 'left';
div.textContent = 'The bonus income you would get from new heavenly chips/reset achievements if you have the same buildings/upgrades after reset';
resetTitleDesc.appendChild(div);
CM.Disp.ResetTooltipPlaceholder.appendChild(resetTitleDesc);
}
CM.Disp.AddMenuPref = function(title) { CM.Disp.AddMenuPref = function(title) {
var header = function(text) { var header = function(text) {
var div = document.createElement('div'); var div = document.createElement('div');
@@ -676,9 +721,36 @@ CM.Disp.AddMenuPref = function(title) {
return div; return div;
} }
var url = function(config) {
var div = document.createElement('div');
div.className = 'listing';
var span = document.createElement('span');
span.className = 'option';
span.textContent = CM.ConfigData[config].label + ' ';
div.appendChild(span);
var input = document.createElement('input');
input.id = CM.ConfigPrefix + config;
input.className = 'option';
input.type = 'text';
input.value = CM.Config[config];
input.style.width = '300px';
div.appendChild(input);
div.appendChild(document.createTextNode(' '));
var a = document.createElement('a');
a.className = 'option';
a.onclick = function() {CM.Config[config] = l(CM.ConfigPrefix + config).value;CM.SaveConfig(CM.Config);};
a.textContent = 'Save';
div.appendChild(a);
var label = document.createElement('label');
label.textContent = CM.ConfigData[config].desc;
div.appendChild(label);
return div;
}
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'));
@@ -706,6 +778,8 @@ CM.Disp.AddMenuPref = function(title) {
volLabel.textContent = CM.ConfigData[volConfig].desc; volLabel.textContent = CM.ConfigData[volConfig].desc;
volume.appendChild(volLabel); volume.appendChild(volLabel);
frag.appendChild(volume); frag.appendChild(volume);
frag.appendChild(url('GCSoundURL'));
frag.appendChild(url('SeaSoundURL'));
frag.appendChild(listing('GCTimer')); frag.appendChild(listing('GCTimer'));
frag.appendChild(listing('Title')); frag.appendChild(listing('Title'));
@@ -713,6 +787,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(listing('Tooltip')); frag.appendChild(listing('Tooltip'));
frag.appendChild(listing('ToolWarnCaut')); frag.appendChild(listing('ToolWarnCaut'));
frag.appendChild(listing('ToolWarnCautPos')); frag.appendChild(listing('ToolWarnCautPos'));
frag.appendChild(listing('ToolWrink'));
frag.appendChild(header('Statistics')); frag.appendChild(header('Statistics'));
frag.appendChild(listing('Stats')); frag.appendChild(listing('Stats'));
@@ -881,16 +956,7 @@ CM.Disp.AddMenuStats = function(title) {
resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income ')) resetTitleFrag.appendChild(document.createTextNode('Reset Bonus Income '))
var resetTitleSpan = document.createElement('span'); var resetTitleSpan = document.createElement('span');
resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); }; resetTitleSpan.onmouseout = function() { Game.tooltip.hide(); };
var resetTitlePlaceholder = document.createElement('div'); resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(CM.Disp.ResetTooltipPlaceholder.innerHTML));};
var resetTitleDesc = document.createElement('div');
resetTitleDesc.style.minWidth = '260px';
resetTitleDesc.style.marginBottom = '4px';
var resetTitleDiv = document.createElement('div');
resetTitleDiv.style.textAlign = 'left';
resetTitleDiv.textContent = 'The bonus income you would get from new heavenly chips/reset achievements if you have the same buildings/upgrades after reset';
resetTitleDesc.appendChild(resetTitleDiv);
resetTitlePlaceholder.appendChild(resetTitleDesc);
resetTitleSpan.onmouseover = function() {Game.tooltip.draw(this, escape(resetTitlePlaceholder.innerHTML));};
resetTitleSpan.style.cursor = 'default'; resetTitleSpan.style.cursor = 'default';
resetTitleSpan.style.display = 'inline-block'; resetTitleSpan.style.display = 'inline-block';
resetTitleSpan.style.height = '10px'; resetTitleSpan.style.height = '10px';
@@ -1040,6 +1106,14 @@ CM.Disp.RefreshMenu = function() {
if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu(); if (CM.Config.UpStats && Game.onMenu == 'stats' && Game.drawT % (Game.fps * 3) != 0 && Game.drawT % Game.fps == 0) Game.UpdateMenu();
} }
CM.Disp.UpdateTooltipLocation = function() {
Game.tooltip.tta.style.top = Math.max(0, Math.min((l('game').clientHeight + l('topBar').clientHeight) - Game.tooltip.tt.clientHeight - CM.Disp.TooltipWarnCaut.clientHeight - 64, Game.mouseY - 48)) + 'px';
if (Game.tooltip.origin == 'wrink') {
Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 25) + 'px';
Game.tooltip.tta.style.right = 'auto';
}
}
CM.Disp.CreateTooltipWarnCaut = function() { CM.Disp.CreateTooltipWarnCaut = function() {
CM.Disp.TooltipWarnCaut = document.createElement('div'); CM.Disp.TooltipWarnCaut = document.createElement('div');
CM.Disp.TooltipWarnCaut.style.position = 'absolute'; CM.Disp.TooltipWarnCaut.style.position = 'absolute';
@@ -1304,7 +1378,7 @@ CM.Disp.AddWrinklerAreaDetect = function() {
} }
CM.Disp.CheckWrinklerTooltip = function() { CM.Disp.CheckWrinklerTooltip = function() {
if (CM.Disp.TooltipWrinklerArea == 1) { if (CM.Config.ToolWrink == 1 && CM.Disp.TooltipWrinklerArea == 1) {
var showingTooltip = false; var showingTooltip = false;
var mouseInWrinkler = function (x, y, rect) { var mouseInWrinkler = function (x, y, rect) {
var dx = x + Math.sin(-rect.r) * (-(rect.h / 2 - rect.o)), dy = y + Math.cos(-rect.r) * (-(rect.h / 2 - rect.o)); var dx = x + Math.sin(-rect.r) * (-(rect.h / 2 - rect.o)), dy = y + Math.cos(-rect.r) * (-(rect.h / 2 - rect.o));
@@ -1320,6 +1394,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
var me = Game.wrinklers[i]; var me = Game.wrinklers[i];
var rect = {w: 100, h: 200, r: (-me.r) * Math.PI / 180, o: 10}; var rect = {w: 100, h: 200, r: (-me.r) * Math.PI / 180, o: 10};
if (me.phase > 0 && Game.LeftBackground && Game.mouseX < Game.LeftBackground.canvas.width && mouseInWrinkler(Game.mouseX - me.x, Game.mouseY - me.y, rect)) { if (me.phase > 0 && Game.LeftBackground && Game.mouseX < Game.LeftBackground.canvas.width && mouseInWrinkler(Game.mouseX - me.x, Game.mouseY - me.y, rect)) {
showingTooltip = true;
if (CM.Disp.TooltipWrinklerCache[i] == 0) { if (CM.Disp.TooltipWrinklerCache[i] == 0) {
var placeholder = document.createElement('div'); var placeholder = document.createElement('div');
var wrinkler = document.createElement('div'); var wrinkler = document.createElement('div');
@@ -1334,7 +1409,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
CM.Disp.TooltipWrinkler = i; CM.Disp.TooltipWrinkler = i;
CM.Disp.TooltipWrinklerCache[i] = 1; CM.Disp.TooltipWrinklerCache[i] = 1;
} }
showingTooltip = true; else break;
} }
else { else {
CM.Disp.TooltipWrinklerCache[i] = 0; CM.Disp.TooltipWrinklerCache[i] = 0;
@@ -1347,7 +1422,7 @@ CM.Disp.CheckWrinklerTooltip = function() {
} }
CM.Disp.UpdateWrinklerTooltip = function() { CM.Disp.UpdateWrinklerTooltip = function() {
if (l('CMTooltipWrinkler') != null) { if (CM.Config.ToolWrink == 1 && l('CMTooltipWrinkler') != null) {
var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked; var sucked = Game.wrinklers[CM.Disp.TooltipWrinkler].sucked;
sucked *= 1.1; sucked *= 1.1;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05; if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
@@ -1355,13 +1430,6 @@ CM.Disp.UpdateWrinklerTooltip = function() {
} }
} }
CM.Disp.UpdateTooltipWrinklerLocation = function() {
if (Game.tooltip.origin == 'wrink') {
Game.tooltip.tta.style.left = (Game.mouseX + l('tooltip').offsetWidth + 20) + 'px';
Game.tooltip.tta.style.right = 'auto';
}
}
CM.Disp.ToggleSayTime = function() { CM.Disp.ToggleSayTime = function() {
if (CM.Config.SayTime == 1) { if (CM.Config.SayTime == 1) {
Game.sayTime = CM.Disp.sayTime; Game.sayTime = CM.Disp.sayTime;

View File

@@ -33,8 +33,8 @@ CM.ReplaceNative = function() {
eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip')); eval('CM.Backup.tooltip.updateMod = ' + Game.tooltip.update.toString().split('this').join('Game.tooltip'));
Game.tooltip.update = function() { Game.tooltip.update = function() {
CM.Backup.tooltip.updateMod(); CM.Backup.tooltip.updateMod();
CM.Disp.UpdateTooltipWrinklerLocation();
CM.Disp.UpdateTooltipWarnCaut(); CM.Disp.UpdateTooltipWarnCaut();
CM.Disp.UpdateTooltipLocation();
} }
CM.Backup.RebuildUpgrades = Game.RebuildUpgrades; CM.Backup.RebuildUpgrades = Game.RebuildUpgrades;
@@ -109,6 +109,7 @@ CM.Init = function() {
CM.Disp.CreateUpgradeBar(); CM.Disp.CreateUpgradeBar();
CM.Disp.CreateWhiteScreen(); CM.Disp.CreateWhiteScreen();
CM.Disp.CreateGCTimer(); CM.Disp.CreateGCTimer();
CM.Disp.CreateResetTooltip();
CM.Disp.CreateTooltipWarnCaut(); CM.Disp.CreateTooltipWarnCaut();
CM.Disp.AddTooltipBuild(); CM.Disp.AddTooltipBuild();
CM.Disp.AddTooltipBuild10(); CM.Disp.AddTooltipBuild10();
@@ -124,9 +125,9 @@ CM.Init = function() {
} }
} }
CM.ConfigDefault = {BotBar: 1, TimerBar: 1, BuildColor: 1, UpBarColor: 1, Flash: 1, Sound: 1, Volume: 100, GCTimer: 1, Title: 1, Tooltip: 1, ToolWarnCaut: 1, ToolWarnCautPos: 0, 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 = '8'; CM.VersionMinor = '11';