From 9807531872762ba68dad1ae8d3ea46ef1401a36e Mon Sep 17 00:00:00 2001 From: Harley White Date: Wed, 7 Apr 2021 14:27:40 -0400 Subject: [PATCH] Fixed number formatting issues --- changelog.md | 2 +- js/utils/NumberFormating.js | 2 +- js/utils/save.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 3a5c5fc..c4f51a4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,5 @@ # The Modding Tree changelog: - +- Fixed formatting for some larger numbers. - Fixed styling challenges. - No longer attempts to display a base currency when there is none. diff --git a/js/utils/NumberFormating.js b/js/utils/NumberFormating.js index 852c15c..0bd5265 100644 --- a/js/utils/NumberFormating.js +++ b/js/utils/NumberFormating.js @@ -6,7 +6,7 @@ function exponentialFormat(num, precision, mantissa = true) { m = new Decimal(1) e = e.add(1) } - e = (e.gte(10000) ? commaFormat(e, 0) : e.toStringWithDecimalPlaces(0)) + e = (e.gte(1e9) ? format(e, 1) : (e.gte(10000) ? commaFormat(e, 0) : e.toStringWithDecimalPlaces(0))) if (mantissa) return m.toStringWithDecimalPlaces(precision) + "e" + e else return "e" + e diff --git a/js/utils/save.js b/js/utils/save.js index 7f9ced2..388c7d2 100644 --- a/js/utils/save.js +++ b/js/utils/save.js @@ -1,6 +1,6 @@ // ************ Save stuff ************ function save() { - localStorage.setItem(modInfo.id, btoa(JSON.stringify(player))); + localStorage.setItem(modInfo.id, btoa(unescape(encodeURIComponent(JSON.stringify(player))))); } function startPlayerBase() { return {