Added functionality for ScaleSeparator
This commit is contained in:
@@ -786,7 +786,7 @@ CM.ConfigGroups = {
|
|||||||
Notification: "Notification",
|
Notification: "Notification",
|
||||||
Tooltip: "Tooltips",
|
Tooltip: "Tooltips",
|
||||||
Statistics: "Statitics",
|
Statistics: "Statitics",
|
||||||
Other: "Other"},
|
Notation: "Notation"},
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: An array (CM.ConfigData) containing all Config options
|
* Section: An array (CM.ConfigData) containing all Config options
|
||||||
@@ -912,10 +912,10 @@ CM.ConfigData.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd
|
|||||||
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
|
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
|
||||||
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
||||||
|
|
||||||
// Statistics
|
// Notation
|
||||||
CM.ConfigData.Scale = {type: 'bool', group: 'Other', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.Scale = {type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Other', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Other', label: ['. for decimals', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Disp *
|
* Disp *
|
||||||
@@ -1085,7 +1085,6 @@ CM.Disp.GetTimeColor = function(time) {
|
|||||||
* @param {any} frac Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
* @param {any} frac Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
||||||
* @param {number} forced Used to force (type 3) in certains cases
|
* @param {number} forced Used to force (type 3) in certains cases
|
||||||
* @returns {string} Formatted number
|
* @returns {string} Formatted number
|
||||||
* TODO: Add functionality to choose amount of decimals and separators
|
|
||||||
*/
|
*/
|
||||||
CM.Disp.Beautify = function(num, frac, forced) {
|
CM.Disp.Beautify = function(num, frac, forced) {
|
||||||
var decimals = CM.Config.ScaleDecimals + 1;
|
var decimals = CM.Config.ScaleDecimals + 1;
|
||||||
@@ -1104,10 +1103,11 @@ CM.Disp.Beautify = function(num, frac, forced) {
|
|||||||
return num
|
return num
|
||||||
}
|
}
|
||||||
else if (-1 < timesTenToPowerThree && timesTenToPowerThree < 2) {
|
else if (-1 < timesTenToPowerThree && timesTenToPowerThree < 2) {
|
||||||
|
// TODO: Add changing separators of thousands and making this cut-off user configurable
|
||||||
answer = Math.round(num * 100) / 100;
|
answer = Math.round(num * 100) / 100;
|
||||||
}
|
}
|
||||||
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
|
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
|
||||||
answer = num[0] + '.'
|
answer = num[0] + (CM.Config.ScaleSeparator ? ',' : '.');
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < decimals - 1) {
|
while (i < decimals - 1) {
|
||||||
answer += num[i + 2]; // num has a 0-based index and [1] is a '.'
|
answer += num[i + 2]; // num has a 0-based index and [1] is a '.'
|
||||||
@@ -1132,7 +1132,7 @@ CM.Disp.Beautify = function(num, frac, forced) {
|
|||||||
numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length))
|
numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length))
|
||||||
i = 0
|
i = 0
|
||||||
while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) {
|
while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) {
|
||||||
answer += restOfNumber[i];
|
answer += (CM.Config.ScaleSeparator && restOfNumber[i] == '.' ? ',' : restOfNumber[i]);
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]);
|
answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]);
|
||||||
@@ -4181,7 +4181,8 @@ CM.ConfigDefault = {
|
|||||||
GrimoireBar: 1,
|
GrimoireBar: 1,
|
||||||
Scale: 2,
|
Scale: 2,
|
||||||
ScaleDecimals: 2,
|
ScaleDecimals: 2,
|
||||||
OptionsPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Other: 1},
|
ScaleSeparator: 0,
|
||||||
|
OptionsPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Notation: 1},
|
||||||
StatsPref: {Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
|
StatsPref: {Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
|
||||||
Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
|
Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
|
||||||
SortBuildings: 0,
|
SortBuildings: 0,
|
||||||
|
|||||||
10
src/Data.js
10
src/Data.js
@@ -46,7 +46,7 @@ CM.ConfigGroups = {
|
|||||||
Notification: "Notification",
|
Notification: "Notification",
|
||||||
Tooltip: "Tooltips",
|
Tooltip: "Tooltips",
|
||||||
Statistics: "Statitics",
|
Statistics: "Statitics",
|
||||||
Other: "Other"},
|
Notation: "Notation"},
|
||||||
|
|
||||||
/********
|
/********
|
||||||
* Section: An array (CM.ConfigData) containing all Config options
|
* Section: An array (CM.ConfigData) containing all Config options
|
||||||
@@ -172,8 +172,8 @@ CM.ConfigData.TimeFormat = {type: 'bool', group: 'Statistics', label: ['Time XXd
|
|||||||
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
|
CM.ConfigData.DetailedTime = {type: 'bool', group: 'Statistics', label: ['Detailed Time OFF', 'Detailed Time ON'], desc: 'Change how time is displayed in certain statistics and tooltips', toggle: true, func: function() {CM.Disp.ToggleDetailedTime();}};
|
||||||
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
CM.ConfigData.GrimoireBar = {type: 'bool', group: 'Statistics', label: ['Grimoire Magic Meter Timer OFF', 'Grimoire Magic Meter Timer ON'], desc: 'A timer on how long before the Grimoire magic meter is full', toggle: true};
|
||||||
|
|
||||||
// Statistics
|
// Notation
|
||||||
CM.ConfigData.Scale = {type: 'bool', group: 'Other', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.Scale = {type: 'bool', group: 'Notation', label: ['Game\'s Setting Scale', 'Metric', 'Short Scale', 'Scientific Notation', 'Engineering Notation'], desc: 'Change how long numbers are handled', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Other', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.ScaleDecimals = {type: 'bool', group: 'Notation', label: ['1 decimals', '2 decimals', '3 decimals'], desc: 'Set the number of decimals used when applicable', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Other', label: ['. for decimals', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
CM.ConfigData.ScaleSeparator = {type: 'bool', group: 'Notation', label: ['. for decimals (Standard)', '. for thousands'], desc: 'Set the separator used for decimals and thousands', toggle: false, func: function() {CM.Disp.RefreshScale();}};
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,6 @@ CM.Disp.GetTimeColor = function(time) {
|
|||||||
* @param {any} frac Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
* @param {any} frac Used in some scenario's by CM.Backup.Beautify (Game's original function)
|
||||||
* @param {number} forced Used to force (type 3) in certains cases
|
* @param {number} forced Used to force (type 3) in certains cases
|
||||||
* @returns {string} Formatted number
|
* @returns {string} Formatted number
|
||||||
* TODO: Add functionality to choose amount of decimals and separators
|
|
||||||
*/
|
*/
|
||||||
CM.Disp.Beautify = function(num, frac, forced) {
|
CM.Disp.Beautify = function(num, frac, forced) {
|
||||||
var decimals = CM.Config.ScaleDecimals + 1;
|
var decimals = CM.Config.ScaleDecimals + 1;
|
||||||
@@ -185,10 +184,11 @@ CM.Disp.Beautify = function(num, frac, forced) {
|
|||||||
return num
|
return num
|
||||||
}
|
}
|
||||||
else if (-1 < timesTenToPowerThree && timesTenToPowerThree < 2) {
|
else if (-1 < timesTenToPowerThree && timesTenToPowerThree < 2) {
|
||||||
|
// TODO: Add changing separators of thousands and making this cut-off user configurable
|
||||||
answer = Math.round(num * 100) / 100;
|
answer = Math.round(num * 100) / 100;
|
||||||
}
|
}
|
||||||
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
|
else if (CM.Config.Scale == 3 && !forced || forced == 3) { // Scientific notation, 123456789 => 1.235E+8
|
||||||
answer = num[0] + '.'
|
answer = num[0] + (CM.Config.ScaleSeparator ? ',' : '.');
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < decimals - 1) {
|
while (i < decimals - 1) {
|
||||||
answer += num[i + 2]; // num has a 0-based index and [1] is a '.'
|
answer += num[i + 2]; // num has a 0-based index and [1] is a '.'
|
||||||
@@ -213,7 +213,7 @@ CM.Disp.Beautify = function(num, frac, forced) {
|
|||||||
numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length))
|
numbersToAdd = (restOfNumber.indexOf('.') > -1 ? restOfNumber.indexOf('.') + 1 + decimals : (restOfNumber.length))
|
||||||
i = 0
|
i = 0
|
||||||
while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) {
|
while (i < numbersToAdd - 1 && i < restOfNumber.length - 1) {
|
||||||
answer += restOfNumber[i];
|
answer += (CM.Config.ScaleSeparator && restOfNumber[i] == '.' ? ',' : restOfNumber[i]);
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]);
|
answer += (i + 1 < restOfNumber.length ? Math.round(restOfNumber[i] + '.' + restOfNumber[i + 1]) : restOfNumber[i]);
|
||||||
|
|||||||
@@ -552,7 +552,8 @@ CM.ConfigDefault = {
|
|||||||
GrimoireBar: 1,
|
GrimoireBar: 1,
|
||||||
Scale: 2,
|
Scale: 2,
|
||||||
ScaleDecimals: 2,
|
ScaleDecimals: 2,
|
||||||
OptionsPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Other: 1},
|
ScaleSeparator: 0,
|
||||||
|
OptionsPref: {BarsColors: 1, Calculation: 1, Notification: 1, Tooltip: 1, Statistics: 1, Notation: 1},
|
||||||
StatsPref: {Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
|
StatsPref: {Lucky: 1, Conjure: 1, Chain: 1, Prestige: 1, Wrink: 1, Sea: 1, Misc: 1},
|
||||||
Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
|
Colors : {Blue: '#4bb8f0', Green: '#00ff00', Yellow: '#ffff00', Orange: '#ff7f00', Red: '#ff0000', Purple: '#ff00ff', Gray: '#b3b3b3', Pink: '#ff1493', Brown: '#8b4513'},
|
||||||
SortBuildings: 0,
|
SortBuildings: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user