diff --git a/src/Player.js b/src/Player.js old mode 100644 new mode 100755 index 1a55ad0cd..9edddb8ff --- a/src/Player.js +++ b/src/Player.js @@ -20,17 +20,14 @@ import {AllServers, Server, AddToAllServers} from "./Server"; import {Settings} from "./Settings"; import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps"; import {SourceFiles, applySourceFile} from "./SourceFile"; - import Decimal from "decimal.js"; import {numeralWrapper} from "./ui/numeralFormat"; - import {dialogBoxCreate} from "../utils/DialogBox"; import {clearEventListeners} from "../utils/uiHelpers/clearEventListeners"; import {createRandomIp} from "../utils/IPAddress"; import {Reviver, Generic_toJSON, Generic_fromJSON} from "../utils/JSONReviver"; -import {formatNumber, - convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions"; +import {convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions"; const CYCLES_PER_SEC = 1000 / CONSTANTS.MilliPerCycle; @@ -721,17 +718,17 @@ PlayerObject.prototype.work = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + " at " + this.companyName + " (Current Company Reputation: " + - formatNumber(companyRep, 0) + ")

" + + numeralWrapper.format(companyRep, '0,0') + ")

" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + - "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyGainRate * CYCLES_PER_SEC, 2) + " / sec)

" + - formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * CYCLES_PER_SEC, 4) + " / sec) reputation for this company

" + - formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * CYCLES_PER_SEC, 4) + " / sec) hacking exp

" + - formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * CYCLES_PER_SEC, 4) + " / sec) strength exp
" + - formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * CYCLES_PER_SEC, 4) + " / sec) defense exp
" + - formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * CYCLES_PER_SEC, 4) + " / sec) dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * CYCLES_PER_SEC, 4) + " / sec) agility exp

" + - formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * CYCLES_PER_SEC, 4) + " / sec) charisma exp

" + + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + " ($" + numeralWrapper.format(this.workMoneyGainRate * CYCLES_PER_SEC, '0,0.00') + " / sec)

" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " (" + numeralWrapper.format(this.workRepGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) reputation for this company

" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workHackExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) hacking exp

" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workStrExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDefExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDexExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workAgiExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) agility exp

" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workChaExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) charisma exp

" + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish, " + "but you will only gain half of the reputation you've earned so far." } @@ -750,14 +747,14 @@ PlayerObject.prototype.finishWork = function(cancelled, sing=false) { this.updateSkillLevels(); var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + - formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + - formatNumber(this.workChaExpGained, 4) + " charisma exp
"; + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + "
" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " reputation for the company
" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp
"; if (cancelled) { txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + @@ -774,14 +771,14 @@ PlayerObject.prototype.finishWork = function(cancelled, sing=false) { if (sing) { var res = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " and " + - "earned $" + formatNumber(this.workMoneyGained, 2) + ", " + - formatNumber(this.workRepGained, 4) + " reputation, " + - formatNumber(this.workHackExpGained, 4) + " hacking exp, " + - formatNumber(this.workStrExpGained, 4) + " strength exp, " + - formatNumber(this.workDefExpGained, 4) + " defense exp, " + - formatNumber(this.workDexExpGained, 4) + " dexterity exp, " + - formatNumber(this.workAgiExpGained, 4) + " agility exp, and " + - formatNumber(this.workChaExpGained, 4) + " charisma exp."; + "earned $" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + ", " + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " reputation, " + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp, and " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp."; this.resetWorkStatus(); return res; } @@ -843,17 +840,17 @@ PlayerObject.prototype.workPartTime = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName + " at " + Player.companyName + " (Current Company Reputation: " + - formatNumber(companyRep, 0) + ")

" + + numeralWrapper.format(companyRep, '0,0') + ")

" + "You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + - "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyGainRate * CYCLES_PER_SEC, 2) + " / sec)

" + - formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * CYCLES_PER_SEC, 4) + " / sec) reputation for this company

" + - formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * CYCLES_PER_SEC, 4) + " / sec) hacking exp

" + - formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * CYCLES_PER_SEC, 4) + " / sec) strength exp
" + - formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * CYCLES_PER_SEC, 4) + " / sec) defense exp
" + - formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * CYCLES_PER_SEC, 4) + " / sec) dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * CYCLES_PER_SEC, 4) + " / sec) agility exp

" + - formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * CYCLES_PER_SEC, 4) + " / sec) charisma exp

" + + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + " ($" + numeralWrapper.format(this.workMoneyGainRate * CYCLES_PER_SEC, '0,0.00') + " / sec)

" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " (" + numeralWrapper.format(this.workRepGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) reputation for this company

" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workHackExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) hacking exp

" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workStrExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDefExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDexExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workAgiExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) agility exp

" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workChaExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) charisma exp

" + "You will automatically finish after working for 8 hours. You can cancel earlier if you wish,
" + "and there will be no penalty because this is a part-time job."; @@ -868,14 +865,14 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) { this.updateSkillLevels(); var txt = "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the company
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + - formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + - formatNumber(this.workChaExpGained, 4) + " charisma exp
"; + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + "
" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " reputation for the company
" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp
"; txt = "You worked for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + txt; if (!sing) {dialogBoxCreate(txt);} @@ -886,14 +883,14 @@ PlayerObject.prototype.finishWorkPartTime = function(sing=false) { if (sing) { var res = "You worked for " + convertTimeMsToTimeElapsedString(this.timeWorked) + " and " + "earned a total of " + - "$" + formatNumber(this.workMoneyGained, 2) + ", " + - formatNumber(this.workRepGained, 4) + " reputation, " + - formatNumber(this.workHackExpGained, 4) + " hacking exp, " + - formatNumber(this.workStrExpGained, 4) + " strength exp, " + - formatNumber(this.workDefExpGained, 4) + " defense exp, " + - formatNumber(this.workDexExpGained, 4) + " dexterity exp, " + - formatNumber(this.workAgiExpGained, 4) + " agility exp, and " + - formatNumber(this.workChaExpGained, 4) + " charisma exp"; + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + ", " + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " reputation, " + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp, and " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp"; this.resetWorkStatus(); return res; } @@ -1012,17 +1009,17 @@ PlayerObject.prototype.workForFaction = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + - " (Current Faction Reputation: " + formatNumber(faction.playerReputation, 0) + ").
" + + " (Current Faction Reputation: " + numeralWrapper.format(faction.playerReputation, '0,0') + ").
" + "You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You have earned:

" + - "$" + formatNumber(this.workMoneyGained, 2) + " (" + formatNumber(this.workMoneyGainRate * CYCLES_PER_SEC, 2) + " / sec)

" + - formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * CYCLES_PER_SEC, 4) + " / sec) reputation for this faction

" + - formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * CYCLES_PER_SEC, 4) + " / sec) hacking exp

" + - formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * CYCLES_PER_SEC, 4) + " / sec) strength exp
" + - formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * CYCLES_PER_SEC, 4) + " / sec) defense exp
" + - formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * CYCLES_PER_SEC, 4) + " / sec) dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * CYCLES_PER_SEC, 4) + " / sec) agility exp

" + - formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * CYCLES_PER_SEC, 4) + " / sec) charisma exp

" + + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + " (" + numeralWrapper.format(this.workMoneyGainRate * CYCLES_PER_SEC, '0,0.00') + " / sec)

" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " (" + numeralWrapper.format(this.workRepGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) reputation for this faction

" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workHackExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) hacking exp

" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workStrExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDefExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDexExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workAgiExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) agility exp

" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workChaExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) charisma exp

" + "You will automatically finish after working for 20 hours. You can cancel earlier if you wish.
" + "There is no penalty for cancelling earlier."; @@ -1038,14 +1035,14 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) { var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "You earned a total of:
" + - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workRepGained, 4) + " reputation for the faction
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + - formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + - formatNumber(this.workChaExpGained, 4) + " charisma exp
"; + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + "
" + + numeralWrapper.format(this.workRepGained, '0,0.0000') + " reputation for the faction
" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp
"; if (!sing) {dialogBoxCreate(txt);} var mainMenu = document.getElementById("mainmenu-container"); @@ -1058,13 +1055,13 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, sing=false) { if (sing) { var res="You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + ". " + "You earned " + - formatNumber(this.workRepGained, 4) + " rep, " + - formatNumber(this.workHackExpGained, 4) + " hacking exp, " + - formatNumber(this.workStrExpGained, 4) + " str exp, " + - formatNumber(this.workDefExpGained, 4) + " def exp, " + - formatNumber(this.workDexExpGained, 4) + " dex exp, " + - formatNumber(this.workAgiExpGained, 4) + " agi exp, and " + - formatNumber(this.workChaExpGained, 4) + " cha exp."; + numeralWrapper.format(this.workRepGained, '0,0.0000') + " rep, " + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " str exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " def exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dex exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agi exp, and " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " cha exp."; this.resetWorkStatus(); return res; } @@ -1350,14 +1347,14 @@ PlayerObject.prototype.takeClass = function(numCycles) { var txt = document.getElementById("work-in-progress-text"); txt.innerHTML = "You have been " + className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "

" + "This has cost you:
" + - "$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyLossRate * CYCLES_PER_SEC, 2) + " / sec)

" + + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + " ($" + numeralWrapper.format(this.workMoneyLossRate * CYCLES_PER_SEC, '0,0.00') + " / sec)

" + "You have gained:
" + - formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * CYCLES_PER_SEC, 4) + " / sec) hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * CYCLES_PER_SEC, 4) + " / sec) strength exp
" + - formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * CYCLES_PER_SEC, 4) + " / sec) defense exp
" + - formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * CYCLES_PER_SEC, 4) + " / sec) dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * CYCLES_PER_SEC, 4) + " / sec) agility exp
" + - formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * CYCLES_PER_SEC, 4) + " / sec) charisma exp
" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workHackExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) hacking exp
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workStrExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDefExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workDexExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workAgiExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) agility exp
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " (" + numeralWrapper.format(this.workChaExpGainRate * CYCLES_PER_SEC, '0,0.0000') + " / sec) charisma exp
" + "You may cancel at any time"; } @@ -1373,14 +1370,14 @@ PlayerObject.prototype.finishClass = function(sing=false) { this.updateSkillLevels(); var txt = "After " + this.className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ",
" + - "you spent a total of $" + formatNumber(this.workMoneyGained * -1, 2) + ".

" + + "you spent a total of $" + numeralWrapper.format(this.workMoneyGained * -1, '0,0.00') + ".

" + "You earned a total of:
" + - formatNumber(this.workHackExpGained, 4) + " hacking exp
" + - formatNumber(this.workStrExpGained, 4) + " strength exp
" + - formatNumber(this.workDefExpGained, 4) + " defense exp
" + - formatNumber(this.workDexExpGained, 4) + " dexterity exp
" + - formatNumber(this.workAgiExpGained, 4) + " agility exp
" + - formatNumber(this.workChaExpGained, 4) + " charisma exp
"; + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp
"; if (!sing) {dialogBoxCreate(txt);} var mainMenu = document.getElementById("mainmenu-container"); @@ -1391,14 +1388,14 @@ PlayerObject.prototype.finishClass = function(sing=false) { Engine.loadLocationContent(); if (sing) { var res="After " + this.className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ", " + - "you spent a total of $" + formatNumber(this.workMoneyGained * -1, 2) + ". " + + "you spent a total of $" + numeralWrapper.format(this.workMoneyGained * -1, '0,0.00') + ". " + "You earned a total of: " + - formatNumber(this.workHackExpGained, 3) + " hacking exp, " + - formatNumber(this.workStrExpGained, 3) + " strength exp, " + - formatNumber(this.workDefExpGained, 3) + " defense exp, " + - formatNumber(this.workDexExpGained, 3) + " dexterity exp, " + - formatNumber(this.workAgiExpGained, 3) + " agility exp, and " + - formatNumber(this.workChaExpGained, 3) + " charisma exp"; + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility exp, and " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma exp"; this.resetWorkStatus(); return res; } @@ -1489,23 +1486,23 @@ PlayerObject.prototype.finishCrime = function(cancelled) { if(this.singFnCrimeWorkerScript.disableLogs.ALL == null && this.singFnCrimeWorkerScript.disableLogs.commitCrime == null) { this.singFnCrimeWorkerScript.scriptRef.log("Crime successful! Gained " + numeralWrapper.format(this.workMoneyGained, "$0.000a") + ", " + - formatNumber(this.workHackExpGained, 3) + " hack exp, " + - formatNumber(this.workStrExpGained, 3) + " str exp, " + - formatNumber(this.workDefExpGained, 3) + " def exp, " + - formatNumber(this.workDexExpGained, 3) + " dex exp, " + - formatNumber(this.workAgiExpGained, 3) + " agi exp, " + - formatNumber(this.workChaExpGained, 3) + " cha exp."); + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hack exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " str exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " def exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dex exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agi exp, " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " cha exp."); } } else { dialogBoxCreate("Crime successful!

" + "You gained:
"+ - "$" + formatNumber(this.workMoneyGained, 2) + "
" + - formatNumber(this.workHackExpGained, 4) + " hacking experience
" + - formatNumber(this.workStrExpGained, 4) + " strength experience
" + - formatNumber(this.workDefExpGained, 4) + " defense experience
" + - formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + - formatNumber(this.workAgiExpGained, 4) + " agility experience
" + - formatNumber(this.workChaExpGained, 4) + " charisma experience"); + "$" + numeralWrapper.format(this.workMoneyGained, '0,0.00') + "
" + + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking experience
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength experience
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense experience
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity experience
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility experience
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma experience"); } } else { @@ -1519,22 +1516,22 @@ PlayerObject.prototype.finishCrime = function(cancelled) { if (this.committingCrimeThruSingFn) { if(this.singFnCrimeWorkerScript.disableLogs.ALL == null && this.singFnCrimeWorkerScript.disableLogs.commitCrime == null) { this.singFnCrimeWorkerScript.scriptRef.log("Crime failed! Gained " + - formatNumber(this.workHackExpGained, 3) + " hack exp, " + - formatNumber(this.workStrExpGained, 3) + " str exp, " + - formatNumber(this.workDefExpGained, 3) + " def exp, " + - formatNumber(this.workDexExpGained, 3) + " dex exp, " + - formatNumber(this.workAgiExpGained, 3) + " agi exp, " + - formatNumber(this.workChaExpGained, 3) + " cha exp."); + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hack exp, " + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " str exp, " + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " def exp, " + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dex exp, " + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agi exp, " + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " cha exp."); } } else { dialogBoxCreate("Crime failed!

" + "You gained:
"+ - formatNumber(this.workHackExpGained, 4) + " hacking experience
" + - formatNumber(this.workStrExpGained, 4) + " strength experience
" + - formatNumber(this.workDefExpGained, 4) + " defense experience
" + - formatNumber(this.workDexExpGained, 4) + " dexterity experience
" + - formatNumber(this.workAgiExpGained, 4) + " agility experience
" + - formatNumber(this.workChaExpGained, 4) + " charisma experience"); + numeralWrapper.format(this.workHackExpGained, '0,0.0000') + " hacking experience
" + + numeralWrapper.format(this.workStrExpGained, '0,0.0000') + " strength experience
" + + numeralWrapper.format(this.workDefExpGained, '0,0.0000') + " defense experience
" + + numeralWrapper.format(this.workDexExpGained, '0,0.0000') + " dexterity experience
" + + numeralWrapper.format(this.workAgiExpGained, '0,0.0000') + " agility experience
" + + numeralWrapper.format(this.workChaExpGained, '0,0.0000') + " charisma experience"); } } diff --git a/src/SaveObject.js b/src/SaveObject.js old mode 100644 new mode 100755 index bf4bb9be2..965ab6792 --- a/src/SaveObject.js +++ b/src/SaveObject.js @@ -24,7 +24,7 @@ import {Reviver, Generic_toJSON, import {createElement} from "../utils/uiHelpers/createElement"; import {createPopup} from "../utils/uiHelpers/createPopup"; import {createStatusText} from "./ui/createStatusText"; -import {formatNumber} from "../utils/StringHelperFunctions"; +import {numeralWrapper} from "./ui/numeralFormat"; import {removeElementById} from "../utils/uiHelpers/removeElementById"; import Decimal from "decimal.js"; @@ -517,8 +517,8 @@ function loadImportedGame(saveObj, saveString) { Player.lastUpdate = Engine._lastUpdate; Engine.start(); //Run main game loop and Scripts loop dialogBoxCreate("While you were offline, your scripts generated $" + - formatNumber(offlineProductionFromScripts, 2) + " and your Hacknet Nodes generated $" + - formatNumber(offlineProductionFromHacknetNodes, 2) + ""); + numeralWrapper.format(offlineProductionFromScripts, '0,0.00') + " and your Hacknet Nodes generated $" + + numeralWrapper.format(offlineProductionFromHacknetNodes, '0,0.00') + ""); return true; }