More rebalancing on hacknet Nodes. Tab in script editor works..not super smooth though. Focus on textarea when script editor opens. code in tututorial now properly ignores all whitespace

This commit is contained in:
Daniel Xie 2017-05-15 22:06:25 -05:00
parent 58e9cc91da
commit f1b7d78ba3
6 changed files with 53 additions and 34 deletions

@ -39,4 +39,11 @@ Private beta feedback
Also not really a big deal, but I'm at 110% zoom on chrome and the tutorial window
covers some of the text
Now, only other suggestion before sleep would be to be able to buy multiple Hacknet upgrades in one click
Now, only other suggestion before sleep would be to be able to buy multiple Hacknet upgrades in one click
1) - multiple commands to do the same thing? (why?) <--- there are a few of these in the initial help... clear/cls, scan/netstat, connect/telnet... Maybe just pick one to unclutter it?
2) - "Wrong Command! Try Again!" seemed a bit out of place for a terminal. Trying to repro this, it seems you may have already fixed it?
3) - If you can help it, please don't require the code to be exactly pasted from the tutorial to finish the tutorial. I copied the code and then "corrected" the brackets and spacing... and it wouldn't let me continue. :D
5) - As a programmer... you cannot take the TAB key from us in the script editor. :neutral_face: Not sure how the game itself is coded, but if you've got to EAT a ghost-tab just to give me one in-editor... let me tab out my code in-script, or I'll go mad.
6) - Maybe show total $ somewhere onscreen at all (or most) times. $/sec would also be good to know, depending on if you want the player to know that. Bottom of the menu on the left is an empty enough place to keep these.
7) - default the focus to in-editor when you nano up a new script, so you can start typing immediately upon commanding one to be created.

@ -18,13 +18,13 @@ CONSTANTS = {
BaseCostForHacknetNodeCore: 1000000,
/* Hacknet Node constants */
HacknetNodeMoneyGainPerLevel: 0.75,
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
HacknetNodeMoneyGainPerLevel: 1,
HacknetNodePurchaseNextMult: 1.30, //Multiplier when purchasing an additional hacknet node
HacknetNodeUpgradeLevelMult: 1.06, //Multiplier for cost when upgrading level
HacknetNodeUpgradeRamMult: 1.25, //Multiplier for cost when upgrading RAM
HacknetNodeUpgradeCoreMult: 1.45, //Multiplier for cost when buying another core
HacknetNodeUpgradeRamMult: 1.20, //Multiplier for cost when upgrading RAM
HacknetNodeUpgradeCoreMult: 1.40, //Multiplier for cost when buying another core
HacknetNodeMaxLevel: 500,
HacknetNodeMaxLevel: 200,
HacknetNodeMaxRam: 64,
HacknetNodeMaxCores: 16,
@ -58,7 +58,7 @@ CONSTANTS = {
ServerGrowthRate: 1.00075,
//Maximum number of log entries for a script
MaxLogCapacity: 20,
MaxLogCapacity: 40,
//How much a TOR router costs
TorRouterCost: 100000,

@ -19,7 +19,7 @@ HacknetNode.prototype.updateMoneyGainRate = function() {
//Each CPU core doubles the speed. Every 1GB of ram adds 15% increase
this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
Math.pow(1.05, this.ram-1) *
this.numCores * Player.hacknet_node_money_mult;
((this.numCores + 1) / 2) * Player.hacknet_node_money_mult;
if (isNaN(this.moneyGainRatePerSecond)) {
this.moneyGainRatePerSecond = 0;
dialogBoxCreate("Error in calculating Hacknet Node production. Please report to game developer");

@ -433,6 +433,7 @@ PlayerObject.prototype.startWork = function() {
//Remove all old event listeners from Cancel button
var newCancelButton = clearEventListeners("work-in-progress-cancel-button");
newCancelButton.innerHTML = "Cancel Work";
newCancelButton.addEventListener("click", function() {
Player.finishWork(true);
return false;
@ -508,6 +509,7 @@ PlayerObject.prototype.startWorkPartTime = function() {
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours;
var newCancelButton = clearEventListeners("work-in-progress-cancel-button");
newCancelButton.innerHTML = "Stop Working";
newCancelButton.addEventListener("click", function() {
Player.finishWorkPartTime();
return false;
@ -632,13 +634,9 @@ PlayerObject.prototype.startFactionWork = function(faction) {
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
var cancelButton = clearEventListeners("work-in-progress-cancel-button");
cancelButton.innerHTML = "Stop Faction Work";
cancelButton.addEventListener("click", function() {
Player.finishFactionWork(true, faction);
return false;
});
@ -836,13 +834,9 @@ PlayerObject.prototype.startCreateProgramWork = function(programName, time) {
this.createProgramName = programName;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
var cancelButton = clearEventListeners("work-in-progress-cancel-button");
cancelButton.innerHTML = "Cancel work on creating program";
cancelButton.addEventListener("click", function() {
Player.finishCreateProgramWork(true, programName);
return false;
});
@ -957,13 +951,16 @@ PlayerObject.prototype.startClass = function(costMult, expMult, className) {
this.workAgiExpGainRate = agiExp * this.agility_exp_mult;
this.workChaExpGainRate = chaExp * this.charisma_exp_mult;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
var cancelButton = clearEventListeners("work-in-progress-cancel-button");
if (className == CONSTANTS.ClassGymStrength ||
className == CONSTANTS.ClassGymDefense ||
className == CONSTANTS.ClassGymDexterity ||
className == CONSTANTS.ClassGymAgility) {
cancelButton.innerHTML = "Stop training at gym";
} else {
cancelButton.innerHTML = "Stop taking course";
}
cancelButton.addEventListener("click", function() {
Player.finishClass();
return false;
});
@ -1049,6 +1046,7 @@ PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, ag
//Remove all old event listeners from Cancel button
var newCancelButton = clearEventListeners("work-in-progress-cancel-button")
newCancelButton.innerHTML = "Cancel crime"
newCancelButton.addEventListener("click", function() {
Player.finishCrime(true);
return false;

@ -3,16 +3,29 @@
*/
//Initialize the 'save and close' button on script editor page
function scriptEditorSaveCloseInit() {
function scriptEditorInit() {
var closeButton = document.getElementById("script-editor-save-and-close-button");
closeButton.addEventListener("click", function() {
saveAndCloseScriptEditor();
return false;
});
var textareas = document.getElementsByTagName('textarea');
var count = textareas.length;
for(var i=0;i<count;i++){
textareas[i].onkeydown = function(e){
if(e.keyCode==9 || e.which==9){
e.preventDefault();
var s = this.selectionStart;
this.value = this.value.substring(0,this.selectionStart) + "\t" + this.value.substring(this.selectionEnd);
this.selectionEnd = s+1;
}
}
}
};
document.addEventListener("DOMContentLoaded", scriptEditorSaveCloseInit, false);
document.addEventListener("DOMContentLoaded", scriptEditorInit, false);
//Define key commands in script editor (ctrl o to save + close, etc.)
$(document).keydown(function(e) {
@ -32,8 +45,8 @@ function saveAndCloseScriptEditor() {
return;
}
var code = document.getElementById("script-editor-text").value;
code = code.replace(/\s\s+/g, '');
if (code.indexOf("while(true) {hack('foodnstuff');}") == -1) {
code = code.replace(/\s/g, "");
if (code.indexOf("while(true){hack('foodnstuff');}") == -1) {
dialogBoxCreate("Please copy and paste the code from the tutorial!");
return;
}
@ -112,7 +125,7 @@ Script.prototype.saveScript = function() {
if (Engine.currentPage == Engine.Page.ScriptEditor) {
//Update code and filename
var code = document.getElementById("script-editor-text").value;
this.code = code;
this.code = code.replace(/^\s+|\s+$/g, '');
var filename = document.getElementById("script-editor-filename").value + ".script";
this.filename = filename;

@ -110,6 +110,7 @@ var Engine = {
document.getElementById("script-editor-filename").value = filename;
}
document.getElementById("script-editor-text").value = code;
document.getElementById("script-editor-text").focus();
Engine.currentPage = Engine.Page.ScriptEditor;
},