Merge branch 'JCBourgo-patch-1' into dev

This commit is contained in:
Aktanusa
2016-05-02 21:22:02 -04:00
2 changed files with 49 additions and 17 deletions

View File

@@ -145,5 +145,6 @@ CM.ConfigData.ToolWrink = {label: ['Wrinkler Tooltip OFF', 'Wrinkler Tooltip ON'
CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true}; CM.ConfigData.Stats = {label: ['Statistics OFF', 'Statistics ON'], desc: 'Extra Cookie Monster statistics!', toggle: true};
CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false}; CM.ConfigData.UpStats = {label: ['Statistics Update Rate (Default)', 'Statistics Update Rate (1s)'], desc: 'Default Game rate is once every 5 seconds', toggle: false};
CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}}; CM.ConfigData.SayTime = {label: ['Format Time OFF', 'Format Time ON'], desc: 'Change how time is displayed in statistics', toggle: true, func: function() {CM.Disp.ToggleSayTime();}};
CM.ConfigData.TimeFormat = {label: ['Time XXy, XXd, XXh, XXm, XXs', 'Time XX:XX:XX:XX:XX'], desc: 'Change the time format', toggle:true};
CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}}; CM.ConfigData.Scale = {label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};

View File

@@ -4,6 +4,36 @@
CM.Disp.FormatTime = function(time, format) { CM.Disp.FormatTime = function(time, format) {
if (time == 'Infinity') return time; if (time == 'Infinity') return time;
if (CM.ConfigData.TimeFormat == 1) {
if (time > 3153600000) return 'XX:XX:XX:XX:XX';
time = Math.ceil(time);
var y = Math.floor(time / 31536000);
var d = Math.floor(time % 31536000 / 86400);
var h = Math.floor(time % 86400 / 3600);
var m = Math.floor(time % 3600 / 60);
var s = Math.floor(time % 60);
var str = '';
if (y < 10) {
str += '0';
}
str += y + ':';
if (d < 10) {
str += '0';
}
str += d + ':';
if (h < 10) {
str += '0';
}
str += h + ':';
if (m < 10) {
str += '0';
}
str += m + ':';
if (s < 10) {
str += '0';
}
str += s + ':';
} else {
if (time > 777600000) return format ? 'Over 9000 days!' : '>9000d'; if (time > 777600000) return format ? 'Over 9000 days!' : '>9000d';
time = Math.ceil(time); time = Math.ceil(time);
var d = Math.floor(time / 86400); var d = Math.floor(time / 86400);
@@ -21,7 +51,7 @@ CM.Disp.FormatTime = function(time, format) {
str += m + (format ? (m == 1 ? ' minute' : ' minutes') : 'm') + ', '; str += m + (format ? (m == 1 ? ' minute' : ' minutes') : 'm') + ', ';
} }
str += s + (format ? (s == 1 ? ' second' : ' seconds') : 's'); str += s + (format ? (s == 1 ? ' second' : ' seconds') : 's');
}
return str; return str;
} }
@@ -957,6 +987,7 @@ CM.Disp.AddMenuPref = function(title) {
frag.appendChild(listing('Stats')); frag.appendChild(listing('Stats'));
frag.appendChild(listing('UpStats')); frag.appendChild(listing('UpStats'));
frag.appendChild(listing('SayTime')); frag.appendChild(listing('SayTime'));
frag.appendChild(listing('TimeFormat'));
frag.appendChild(header('Other')); frag.appendChild(header('Other'));
frag.appendChild(listing('Scale')); frag.appendChild(listing('Scale'));