Merge pull request #322 from hydroflame/time-since-bitnode

added time since last bitnode timer
This commit is contained in:
danielyxie 2018-06-22 15:13:03 -05:00 committed by GitHub
commit 5ad481893b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

@ -201,6 +201,7 @@ function PlayerObject() {
this.lastUpdate = 0; this.lastUpdate = 0;
this.totalPlaytime = 0; this.totalPlaytime = 0;
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
//Production since last Augmentation installation //Production since last Augmentation installation
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
@ -390,6 +391,7 @@ PlayerObject.prototype.prestigeSourceFile = function() {
this.corporation = 0; this.corporation = 0;
this.playtimeSinceLastAug = 0; this.playtimeSinceLastAug = 0;
this.playtimeSinceLastBitnode = 0;
this.scriptProdSinceLastAug = 0; this.scriptProdSinceLastAug = 0;
} }

@ -503,8 +503,10 @@ function loadImportedGame(saveObj, saveString) {
var time = numCyclesOffline * Engine._idleSpeed; var time = numCyclesOffline * Engine._idleSpeed;
if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;} if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}
if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;} if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}
if (Player.playtimeSinceLastBitnode == null) {Player.playtimeSinceLastBitnode = 0;}
Player.totalPlaytime += time; Player.totalPlaytime += time;
Player.playtimeSinceLastAug += time; Player.playtimeSinceLastAug += time;
Player.playtimeSinceLastBitnode += time;
//Re-apply augmentations //Re-apply augmentations
Player.reapplyAllAugmentations(); Player.reapplyAllAugmentations();

@ -576,6 +576,11 @@ let Engine = {
intText = 'Intelligence: ' + (Player.intelligence).toLocaleString() + "<br><br><br>"; intText = 'Intelligence: ' + (Player.intelligence).toLocaleString() + "<br><br><br>";
} }
let bitNodeTimeText = "";
if(Player.sourceFiles.length > 0) {
bitNodeTimeText = 'Time played since last Bitnode destroyed: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastBitnode) + '<br>';
}
Engine.Display.characterInfo.appendChild(createElement("pre", { Engine.Display.characterInfo.appendChild(createElement("pre", {
innerHTML: innerHTML:
'<b>General</b><br><br>' + '<b>General</b><br><br>' +
@ -629,6 +634,7 @@ let Engine = {
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' + 'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>' +
'Augmentations installed: ' + Player.augmentations.length + '<br>' + 'Augmentations installed: ' + Player.augmentations.length + '<br>' +
'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' + 'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(Player.playtimeSinceLastAug) + '<br>' +
bitNodeTimeText +
'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime), 'Time played: ' + convertTimeMsToTimeElapsedString(Player.totalPlaytime),
})); }));
@ -914,8 +920,10 @@ let Engine = {
var time = numCycles * Engine._idleSpeed; var time = numCycles * Engine._idleSpeed;
if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;} if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}
if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;} if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}
if (Player.playtimeSinceLastBitnode == null) {Player.playtimeSinceLastBitnode = 0;}
Player.totalPlaytime += time; Player.totalPlaytime += time;
Player.playtimeSinceLastAug += time; Player.playtimeSinceLastAug += time;
Player.playtimeSinceLastBitnode += time;
//Start Manual hack //Start Manual hack
if (Player.startAction == true) { if (Player.startAction == true) {
@ -1335,8 +1343,10 @@ let Engine = {
var time = numCyclesOffline * Engine._idleSpeed; var time = numCyclesOffline * Engine._idleSpeed;
if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;} if (Player.totalPlaytime == null) {Player.totalPlaytime = 0;}
if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;} if (Player.playtimeSinceLastAug == null) {Player.playtimeSinceLastAug = 0;}
if (Player.playtimeSinceLastBitnode == null) {Player.playtimeSinceLastBitnode = 0;}
Player.totalPlaytime += time; Player.totalPlaytime += time;
Player.playtimeSinceLastAug += time; Player.playtimeSinceLastAug += time;
Player.playtimeSinceLastBitnode += time;
Player.lastUpdate = Engine._lastUpdate; Player.lastUpdate = Engine._lastUpdate;
Engine.start(); //Run main game loop and Scripts loop Engine.start(); //Run main game loop and Scripts loop