mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 14:42:28 +01:00
commit
1d255fa4f0
25
index.html
25
index.html
@ -741,17 +741,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Purchase Server Pop-up Box -->
|
||||
<div id="purchase-server-box-container" class="popup-box-container">
|
||||
<div id="purchase-server-box-content" class="popup-box-content">
|
||||
<p id="purchase-server-box-text"> </p>
|
||||
<p id="purchase-server-box-enter-name"> Enter new server hostname: </p>
|
||||
<input type="text" id="purchase-server-box-input" pattern="[a-zA-Z0-9-_]" maxlength="30"> </input>
|
||||
<span id="purchase-server-box-confirm" class="popup-box-button"> Purchase </span>
|
||||
<span id="purchase-server-box-cancel" class="popup-box-button"> Cancel </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Generic Yes/No Pop Up box -->
|
||||
<div id="yes-no-box-container" class="popup-box-container">
|
||||
<div id="yes-no-box-content" class="popup-box-content">
|
||||
@ -771,17 +760,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Purchase Augmentation Pop-up Box -->
|
||||
<div id="purchase-augmentation-box-container" class="popup-box-container">
|
||||
<div id="purchase-augmentation-box-content" class="popup-box-content">
|
||||
<h2 id="purchase-augmentation-box-aug-name"> </h2>
|
||||
<p id="purchase-augmentation-box-aug-info"> </p>
|
||||
<p id="purchase-augmentation-box-text"> </p>
|
||||
<span id="purchase-augmentation-box-confirm" class="popup-box-button"> Purchase </span>
|
||||
<span id="purchase-augmentation-box-cancel" class="popup-box-button"> Cancel </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Faction Invitation Pop-up Box -->
|
||||
<div id="faction-invitation-box-container" class="popup-box-container">
|
||||
<div id="faction-invitation-box-content" class="popup-box-content">
|
||||
@ -980,14 +958,13 @@
|
||||
<script src="utils/StringHelperFunctions.js"></script>
|
||||
<script src="utils/HelperFunctions.js"></script>
|
||||
<script src="utils/DialogBox.js"></script>
|
||||
<script src="utils/PurchaseServerBox.js"></script>
|
||||
<script src="utils/FactionInvitationBox.js"></script>
|
||||
<script src="utils/PurchaseAugmentationBox.js"></script>
|
||||
<script src="utils/GameOptions.js"></script>
|
||||
<script src="utils/LogBox.js"></script>
|
||||
<script src="utils/InfiltrationBox.js"></script>
|
||||
<script src="utils/decimal.js"></script>
|
||||
<script src="utils/YesNoBox.js"></script>
|
||||
<script src="utils/numeral.min.js"></script>
|
||||
|
||||
<!-- Netscript -->
|
||||
<script src="src/NetscriptWorker.js"></script>
|
||||
|
@ -1,5 +1,5 @@
|
||||
CONSTANTS = {
|
||||
Version: "0.27.0",
|
||||
Version: "0.27.1",
|
||||
|
||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||
@ -686,6 +686,12 @@ CONSTANTS = {
|
||||
"World Stock Exchange account and TIX API Access<br>",
|
||||
|
||||
LatestUpdate:
|
||||
"v0.27.1<br>" +
|
||||
"-Changed the way Gang power was calculated to make it scale better late game (BitNode 2 only)<br>" +
|
||||
"-Lowered the respect gain rate in Gangs (Bitnode 2 only)<br>" +
|
||||
"-Added '| grep pattern' option for ls Terminal command. This allows you to only list files that contain a certain pattern<br>" +
|
||||
"-Added break statement in Netscript<br>" +
|
||||
"-Display for some numerical values is now done in shorthand (e.g 1.000m instead of 1,000,000)<br><br>" +
|
||||
"v0.27.0<br>" +
|
||||
"-Added secondary 'prestige' system - featuring Source Files and BitNodes<br>" +
|
||||
"-MILD SPOILERS HERE: Installing 'The Red Pill' Augmentation from Daedalus will unlock a special server called " +
|
||||
@ -699,6 +705,6 @@ CONSTANTS = {
|
||||
"will be much easier to gain faction favor at first, but much harder later on. <br>" +
|
||||
"-Significantly increased Infiltration exp gains<br>" +
|
||||
"-Fixed a bug with company job requirement tooltips<br>" +
|
||||
"-Added scriptRunning(), scriptKill(), and getScriptRam() Netscript functions. See documentation for details<br>" +
|
||||
"-Added scriptRunning(), scriptKill(), and getScriptRam() Netscript functions. See documentation for details<br>" +
|
||||
"-Fixed a bug with deleteServer() Netscript function<br><br>"
|
||||
}
|
||||
|
124
src/Faction.js
124
src/Faction.js
@ -837,13 +837,15 @@ displayFactionContent = function(factionName) {
|
||||
securityWorkDiv.style.display = "none";
|
||||
donateDiv.style.display = "none";
|
||||
|
||||
if (Player.gang && Player.gang.facName != factionName) {
|
||||
var gangDiv = document.getElementById("faction-gang-div");
|
||||
|
||||
if (Player.inGang() && Player.gang.facName != factionName) {
|
||||
//If the player has a gang but its not for this faction
|
||||
gangDiv.style.display = "none";
|
||||
if (gangDiv) {
|
||||
gangDiv.style.display = "none";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var gangDiv = document.getElementById("faction-gang-div");
|
||||
//Create the "manage gang" button if it doesn't exist
|
||||
if (gangDiv == null) {
|
||||
gangDiv = document.createElement("div");
|
||||
@ -1148,6 +1150,120 @@ displayFactionAugmentations = function(factionName) {
|
||||
}
|
||||
}
|
||||
|
||||
purchaseAugmentationBoxCreate = function(aug, fac) {
|
||||
var yesBtn = yesNoBoxGetYesButton(), noBtn = yesNoBoxGetNoButton();
|
||||
yesBtn.innerHTML = "Purchase";
|
||||
noBtn.innerHTML = "Cancel";
|
||||
yesBtn.addEventListener("click", function() {
|
||||
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
|
||||
if (aug.name == AugmentationNames.Targeting2 &&
|
||||
Augmentations[AugmentationNames.Targeting1].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
||||
} else if (aug.name == AugmentationNames.Targeting3 &&
|
||||
Augmentations[AugmentationNames.Targeting2].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
||||
} else if (aug.name == AugmentationNames.CombatRib2 &&
|
||||
Augmentations[AugmentationNames.CombatRib1].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
|
||||
} else if (aug.name == AugmentationNames.CombatRib3 &&
|
||||
Augmentations[AugmentationNames.CombatRib2].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicSpine &&
|
||||
Augmentations[AugmentationNames.BionicSpine].owned == false) {
|
||||
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicLegs &&
|
||||
Augmentations[AugmentationNames.BionicLegs].owned == false) {
|
||||
dialogBoxCreate("You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV2 &&
|
||||
Augmentations[AugmentationNames.ENMCore].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV3 &&
|
||||
Augmentations[AugmentationNames.ENMCoreV2].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
|
||||
} else if ((aug.name == AugmentationNames.ENMCore ||
|
||||
aug.name == AugmentationNames.ENMAnalyzeEngine ||
|
||||
aug.name == AugmentationNames.ENMDMA) &&
|
||||
Augmentations[AugmentationNames.ENM].owned == false) {
|
||||
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
||||
} else if ((aug.name == AugmentationNames.PCDNIOptimizer ||
|
||||
aug.name == AugmentationNames.PCDNINeuralNetwork) &&
|
||||
Augmentations[AugmentationNames.PCDNI].owned == false) {
|
||||
dialogBoxCreate("You must first install the Pc Direct-Neural Interface before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBrachiBlades &&
|
||||
Augmentations[AugmentationNames.BrachiBlades].owned == false) {
|
||||
dialogBoxCreate("You must first install the Brachi Blades augmentation before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicArms &&
|
||||
Augmentations[AugmentationNames.BionicArms].owned == false) {
|
||||
dialogBoxCreate("You must first install the Bionic Arms augmentation before installing this upgrade");
|
||||
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
|
||||
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
queuedAugmentation.level = getNextNeurofluxLevel();
|
||||
}
|
||||
Player.queuedAugmentations.push(queuedAugmentation);
|
||||
|
||||
Player.loseMoney((aug.baseCost * fac.augmentationPriceMult));
|
||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.");
|
||||
|
||||
//If you just purchased Neuroflux Governor, recalculate the cost
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
var nextLevel = getNextNeurofluxLevel();
|
||||
--nextLevel;
|
||||
var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
|
||||
aug.setRequirements(500 * mult, 750000 * mult);
|
||||
|
||||
for (var i = 0; i < Player.queuedAugmentations.length-1; ++i) {
|
||||
aug.baseCost *= CONSTANTS.MultipleAugMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
for (var name in Augmentations) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
displayFactionAugmentations(fac.name);
|
||||
} else {
|
||||
dialogBoxCreate("You don't have enough money to purchase this Augmentation!");
|
||||
}
|
||||
yesNoBoxClose();
|
||||
});
|
||||
noBtn.addEventListener("click", function() {
|
||||
yesNoBoxClose();
|
||||
});
|
||||
|
||||
yesNoBoxCreate("<h2>aug.name</h2><br>" +
|
||||
aug.info + "<br><br>" +
|
||||
"<br>Would you like to purchase the " + aug.name + " Augmentation for $" +
|
||||
formatNumber(aug.baseCost * fac.augmentationPriceMult, 2) + "?");
|
||||
}
|
||||
|
||||
function getNextNeurofluxLevel() {
|
||||
var aug = Augmentations[AugmentationNames.NeuroFluxGovernor];
|
||||
if (aug == null) {
|
||||
for (var i = 0; i < Player.augmentations.length; ++i) {
|
||||
if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
aug = Player.augmentations[i];
|
||||
}
|
||||
}
|
||||
if (aug == null) {
|
||||
console.log("ERROR, Could not find NeuroFlux Governor aug");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
var nextLevel = aug.level + 1;
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
++nextLevel;
|
||||
}
|
||||
}
|
||||
return nextLevel;
|
||||
}
|
||||
|
||||
function processPassiveFactionRepGain(numCycles) {
|
||||
var numTimesGain = (numCycles / 600) * Player.faction_rep_mult;
|
||||
for (var name in Factions) {
|
||||
|
323
src/Gang.js
323
src/Gang.js
@ -58,10 +58,10 @@ function processAllGangPowerGains(numCycles=1) {
|
||||
for (var name in AllGangs) {
|
||||
if (AllGangs.hasOwnProperty(name)) {
|
||||
if (name == playerGangName) {
|
||||
AllGangs[name].power = Player.gang.calculatePower();
|
||||
AllGangs[name].power += Player.gang.calculatePower();
|
||||
} else {
|
||||
var gain = Math.random() * 0.005; //TODO Adjust as necessary
|
||||
AllGangs[name].power += (gain * numCycles);
|
||||
AllGangs[name].power += (gain);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,9 +83,13 @@ function processAllGangTerritory(numCycles=1) {
|
||||
var thisPwr = AllGangs[GangNames[i]].power;
|
||||
var otherPwr = AllGangs[GangNames[other]].power;
|
||||
var thisChance = thisPwr / (thisPwr + otherPwr);
|
||||
|
||||
//Skip calculation if one of the two gangs has zero territory
|
||||
if (AllGangs[GangNames[other]].territory <= 0 || AllGangs[GangNames[i]].territory <= 0) {continue;}
|
||||
|
||||
if (Math.random() < thisChance) {
|
||||
AllGangs[GangNames[i]].territory += 0.0001;
|
||||
AllGangs[GangNames[other]].territory-= 0.0001;
|
||||
AllGangs[GangNames[other]].territory -= 0.0001;
|
||||
} else {
|
||||
AllGangs[GangNames[i]].territory -= 0.0001;
|
||||
AllGangs[GangNames[other]].territory += 0.0001;
|
||||
@ -109,6 +113,7 @@ function Gang(facName, hacking=false) {
|
||||
this.members = []; //Array of GangMembers
|
||||
this.wanted = 1;
|
||||
this.respect = 1;
|
||||
this.power = 0;
|
||||
|
||||
this.isHackingGang = hacking;
|
||||
|
||||
@ -184,6 +189,7 @@ Gang.prototype.processExperienceGains = function(numCycles=1) {
|
||||
}
|
||||
}
|
||||
|
||||
//Calculates power GAIN, which is added onto the Gang's existing power
|
||||
Gang.prototype.calculatePower = function() {
|
||||
var memberTotal = 0;
|
||||
for (var i = 0; i < this.members.length; ++i) {
|
||||
@ -192,7 +198,7 @@ Gang.prototype.calculatePower = function() {
|
||||
memberTotal += this.members[i].calculatePower();
|
||||
}
|
||||
}
|
||||
return (memberTotal);
|
||||
return (0.0005 * memberTotal);
|
||||
}
|
||||
|
||||
Gang.prototype.toJSON = function() {
|
||||
@ -382,49 +388,49 @@ GangMemberTasks = {
|
||||
"Ransomware",
|
||||
"Assign this gang member to create and distribute ransomware<br><br>" +
|
||||
"Earns money - Slightly increases respect - Slightly increases wanted level",
|
||||
{baseRespect: 0.00008, baseWanted: 0.00001, baseMoney: 1,
|
||||
{baseRespect: 0.00005, baseWanted: 0.00001, baseMoney: 1,
|
||||
hackWeight: 100, difficulty: 1}),
|
||||
"Phishing" : new GangMemberTask(
|
||||
"Phishing",
|
||||
"Assign this gang member to attempt phishing scams and attacks<br><br>" +
|
||||
"Earns money - Slightly increases respect - Slightly increases wanted level",
|
||||
{baseRespect: 0.0001, baseWanted: 0.001, baseMoney: 2.5,
|
||||
{baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 2.5,
|
||||
hackWeight: 85, chaWeight: 15, difficulty: 3}),
|
||||
"Identity Theft" : new GangMemberTask(
|
||||
"Identity Theft",
|
||||
"Assign this gang member to attempt identity theft<br><br>" +
|
||||
"Earns money - Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.0003, baseWanted: 0.01, baseMoney: 6,
|
||||
{baseRespect: 0.0001, baseWanted: 0.01, baseMoney: 6,
|
||||
hackWeight: 80, chaWeight: 20, difficulty: 4}),
|
||||
"DDoS Attacks" : new GangMemberTask(
|
||||
"DDoS Attacks",
|
||||
"Assign this gang member to carry out DDoS attacks<br><br>" +
|
||||
"Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.0007, baseWanted: 0.05,
|
||||
{baseRespect: 0.0004, baseWanted: 0.05,
|
||||
hackWeight: 100, difficulty: 7}),
|
||||
"Plant Virus" : new GangMemberTask(
|
||||
"Plant Virus",
|
||||
"Assign this gang member to create and distribute malicious viruses<br><br>" +
|
||||
"Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.001, baseWanted: 0.05,
|
||||
{baseRespect: 0.0006, baseWanted: 0.05,
|
||||
hackWeight: 100, difficulty: 10}),
|
||||
"Fraud & Counterfeiting" : new GangMemberTask(
|
||||
"Fraud & Counterfeiting",
|
||||
"Assign this gang member to commit financial fraud and digital counterfeiting<br><br>" +
|
||||
"Earns money - Slightly increases respect - Slightly increases wanted level",
|
||||
{baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
|
||||
{baseRespect: 0.0008, baseWanted: 0.1, baseMoney: 15,
|
||||
hackWeight: 80, chaWeight: 20, difficulty: 17}),
|
||||
"Money Laundering" : new GangMemberTask(
|
||||
"Money Laundering",
|
||||
"Assign this gang member to launder money<br><br>" +
|
||||
"Earns money - Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.002, baseWanted:0.2, baseMoney: 40,
|
||||
{baseRespect: 0.0009, baseWanted:0.2, baseMoney: 40,
|
||||
hackWeight: 75, chaWeight: 25, difficulty: 20}),
|
||||
"Cyberterrorism" : new GangMemberTask(
|
||||
"Cyberterrorism",
|
||||
"Assign this gang member to commit acts of cyberterrorism<br><br>" +
|
||||
"Greatly increases respect - Greatly increases wanted level",
|
||||
{baseRespect: 0.01, baseWanted: 0.5,
|
||||
{baseRespect: 0.001, baseWanted: 0.5,
|
||||
hackWeight: 80, chaWeight: 20, difficulty: 33}),
|
||||
"Ethical Hacking" : new GangMemberTask(
|
||||
"Ethical Hacking",
|
||||
@ -442,26 +448,26 @@ GangMemberTasks = {
|
||||
"Deal Drugs",
|
||||
"Assign this gang member to sell drugs.<br><br>" +
|
||||
"Earns money - Slightly increases respect - Slightly increases wanted level",
|
||||
{baseRespect: 0.0001, baseWanted: 0.001, baseMoney: 4,
|
||||
{baseRespect: 0.00008, baseWanted: 0.001, baseMoney: 4,
|
||||
agiWeight: 20, dexWeight: 20, chaWeight: 60, difficulty: 3}),
|
||||
"Run a Con" : new GangMemberTask(
|
||||
"Run a Con",
|
||||
"Assign this gang member to run cons<br><br>" +
|
||||
"Earns money - Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.0005, baseWanted: 0.01, baseMoney: 10,
|
||||
{baseRespect: 0.0002, baseWanted: 0.01, baseMoney: 10,
|
||||
strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
|
||||
"Armed Robbery" : new GangMemberTask(
|
||||
"Armed Robbery",
|
||||
"Assign this gang member to commit armed robbery on stores, banks and armored cars<br><br>" +
|
||||
"Earns money - Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.0003, baseWanted: 0.05, baseMoney: 25,
|
||||
{baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 25,
|
||||
hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
|
||||
difficulty: 17}),
|
||||
"Traffick Illegal Arms" : new GangMemberTask(
|
||||
"Traffick Illegal Arms",
|
||||
"Assign this gang member to traffick illegal arms<br><br>" +
|
||||
"Earns money - Increases respect - Increases wanted level",
|
||||
{baseRespect: 0.001, baseWanted: 0.1, baseMoney: 40,
|
||||
{baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 40,
|
||||
hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
|
||||
difficulty: 25}),
|
||||
"Threaten & Blackmail" : new GangMemberTask(
|
||||
@ -474,7 +480,7 @@ GangMemberTasks = {
|
||||
"Terrorism",
|
||||
"Assign this gang member to commit acts of terrorism<br><br>" +
|
||||
"Greatly increases respect - Greatly increases wanted level",
|
||||
{baseRespect: 0.01, baseWanted: 1,
|
||||
{baseRespect: 0.001, baseWanted: 1,
|
||||
hackWeight: 20, strWeight: 20, defWeight: 20,dexWeight: 20, chaWeight: 20,
|
||||
difficulty: 33}),
|
||||
"Vigilante Justice" : new GangMemberTask(
|
||||
@ -502,88 +508,90 @@ GangMemberTasks = {
|
||||
}
|
||||
|
||||
|
||||
function GangMemberUpgrade(name, desc) {
|
||||
function GangMemberUpgrade(name="", desc="", cost=0, type="-") {
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
this.cost = cost;
|
||||
this.type = type; //w, a, v, r
|
||||
}
|
||||
|
||||
//Passes in a GangMember object
|
||||
GangMemberUpgrade.prototype.apply = function(member) {
|
||||
GangMemberUpgrade.prototype.apply = function(member, unapply=false) {
|
||||
switch(this.name) {
|
||||
case "Baseball Bat":
|
||||
member.str *= 1.1;
|
||||
member.def *= 1.1;
|
||||
unapply ? member.str /= 1.1 : member.str *= 1.1;
|
||||
unapply ? member.def /= 1.1 : member.def *= 1.1;
|
||||
break;
|
||||
case "Katana":
|
||||
member.str *= 1.15;
|
||||
member.def *= 1.15;
|
||||
member.dex *= 1.15;
|
||||
unapply ? member.str /= 1.15 : member.str *= 1.15;
|
||||
unapply ? member.def /= 1.15 : member.def *= 1.15;
|
||||
unapply ? member.dex /= 1.15 : member.dex *= 1.15;
|
||||
break;
|
||||
case "Glock 18C":
|
||||
member.str *= 1.2;
|
||||
member.def *= 1.2;
|
||||
member.dex *= 1.2;
|
||||
member.agi *= 1.2;
|
||||
unapply ? member.str /= 1.2 : member.str *= 1.2;
|
||||
unapply ? member.def /= 1.2 : member.def *= 1.2;
|
||||
unapply ? member.dex /= 1.2 : member.dex *= 1.2;
|
||||
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
|
||||
break;
|
||||
case "P90":
|
||||
member.str *= 1.4;
|
||||
member.def *= 1.4;
|
||||
member.agi *= 1.2;
|
||||
unapply ? member.str /= 1.4 : member.str *= 1.4;
|
||||
unapply ? member.def /= 1.4 : member.def *= 1.4;
|
||||
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
|
||||
break;
|
||||
case "Steyr AUG":
|
||||
member.str *= 1.6;
|
||||
member.def *= 1.6;
|
||||
unapply ? member.str /= 1.6 : member.str *= 1.6;
|
||||
unapply ? member.def /= 1.6 : member.def *= 1.6;
|
||||
break;
|
||||
case "AK-47":
|
||||
member.str *= 1.8;
|
||||
member.def *= 1.8;
|
||||
unapply ? member.str /= 1.8 : member.str *= 1.8;
|
||||
unapply ? member.def /= 1.8 : member.def *= 1.8;
|
||||
break;
|
||||
case "M15A10 Assault Rifle":
|
||||
member.str *= 1.9;
|
||||
member.def *= 1.9;
|
||||
unapply ? member.str /= 1.9 : member.str *= 1.9;
|
||||
unapply ? member.def /= 1.9 : member.def *= 1.9;
|
||||
break;
|
||||
case "AWM Sniper Rifle":
|
||||
member.str *= 1.8;
|
||||
member.dex *= 1.8;
|
||||
member.agi *= 1.8;
|
||||
unapply ? member.str /= 1.8 : member.str *= 1.8;
|
||||
unapply ? member.dex /= 1.8 : member.dex *= 1.8;
|
||||
unapply ? member.agi /= 1.8 : member.agi *= 1.8;
|
||||
break;
|
||||
case "Bulletproof Vest":
|
||||
member.def *= 1.15;
|
||||
unapply ? member.def /= 1.15 : member.def *= 1.15;
|
||||
break;
|
||||
case "Full Body Armor":
|
||||
member.def *= 1.3;
|
||||
unapply ? member.def /= 1.3 : member.def *= 1.3;
|
||||
break;
|
||||
case "Liquid Body Armor":
|
||||
member.def *= 1.5;
|
||||
member.agi *= 1.5;
|
||||
unapply ? member.def /= 1.5 : member.def *= 1.5;
|
||||
unapply ? member.agi /= 1.5 : member.agi *= 1.5;
|
||||
break;
|
||||
case "Graphene Plating Armor":
|
||||
member.def *= 2;
|
||||
unapply ? member.def /= 2 : member.def *= 2;
|
||||
break;
|
||||
case "Ford Flex V20":
|
||||
member.agi *= 1.2;
|
||||
member.cha *= 1.2;
|
||||
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
|
||||
unapply ? member.cha /= 1.2 : member.cha *= 1.2;
|
||||
break;
|
||||
case "ATX1070 Superbike":
|
||||
member.agi *= 1.4;
|
||||
member.cha *+ 1.4;
|
||||
unapply ? member.agi /= 1.4 : member.agi *= 1.4;
|
||||
unapply ? member.cha /= 1.4 : member.cha *= 1.4;
|
||||
break;
|
||||
case "Mercedes-Benz S9001":
|
||||
member.agi *= 1.6;
|
||||
member.cha *= 1.6;
|
||||
unapply ? member.agi /= 1.6 : member.agi *= 1.6;
|
||||
unapply ? member.cha /= 1.6 : member.cha *= 1.6;
|
||||
break;
|
||||
case "White Ferrari":
|
||||
member.agi *= 1.8;
|
||||
member.cha *= 1.8;
|
||||
unapply ? member.agi /= 1.8 : member.agi *= 1.8;
|
||||
unapply ? member.cha /= 1.8 : member.cha *= 1.8;
|
||||
break;
|
||||
case "NUKE Rootkit":
|
||||
member.hack *= 1.2;
|
||||
unapply ? member.hack /= 1.2 : member.hack *= 1.2;
|
||||
break;
|
||||
case "Soulstealer Rootkit":
|
||||
member.hack *= 1.3;
|
||||
unapply ? member.hack /= 1.3 : member.hack *= 1.3;
|
||||
break;
|
||||
case "Demon Rootkit":
|
||||
member.hack *= 1.3;
|
||||
unapply ? member.hack /= 1.5 : member.hack *= 1.5;
|
||||
break;
|
||||
default:
|
||||
console.log("ERROR: Could not find this upgrade: " + this.name);
|
||||
@ -591,45 +599,198 @@ GangMemberUpgrade.prototype.apply = function(member) {
|
||||
}
|
||||
}
|
||||
|
||||
//Purchases for given member
|
||||
GangMemberUpgrade.prototype.purchase = function(memberObj) {
|
||||
if (Player.money.lt(this.cost)) {
|
||||
dialogBoxCreate("You do not have enough money to purchase this upgrade");
|
||||
return;
|
||||
}
|
||||
Player.loseMoney(this.cost);
|
||||
switch (this.type) {
|
||||
case "w":
|
||||
if (memberObj.weaponUpgrade instanceof GangMemberUpgrade) {
|
||||
memberObj.weaponUpgrade.apply(memberObj, true); //Unapply old upgrade
|
||||
}
|
||||
this.apply(memberObj, false);
|
||||
memberObj.weaponUpgrade = this;
|
||||
break;
|
||||
case "a":
|
||||
if (memberObj.armorUpgrade instanceof GangMemberUpgrade) {
|
||||
memberObj.armorUpgrade.apply(memberObj, true); //Unapply old upgrade
|
||||
}
|
||||
this.apply(memberObj, false);
|
||||
memberObj.armorUpgrade = this;
|
||||
break;
|
||||
case "v":
|
||||
if (memberObj.vehicleUpgrade instanceof GangMemberUpgrade) {
|
||||
memberObj.vehicleUpgrade.apply(memberObj, true); //Unapply old upgrade
|
||||
}
|
||||
this.apply(memberObj, false);
|
||||
memberObj.vehicleUpgrade = this;
|
||||
break;
|
||||
case "r":
|
||||
if (memberObj.hackingUpgrade instanceof GangMemberUpgrade) {
|
||||
memberObj.hackingUpgrade.apply(memberObj, true); //Unapply old upgrade
|
||||
}
|
||||
this.apply(memberObj, false);
|
||||
memberObj.hackingUpgrade = this;
|
||||
break;
|
||||
default:
|
||||
console.log("ERROR: GangMemberUpgrade has invalid type: " + this.type);
|
||||
break;
|
||||
}
|
||||
createGangMemberUpgradeBox(memberObj);
|
||||
}
|
||||
|
||||
GangMemberUpgrade.prototype.toJSON = function() {
|
||||
return Generic_toJSON("GangMemberUpgrade", this);
|
||||
}
|
||||
|
||||
GangMemberUpgrade.fromJSON = function(value) {
|
||||
return Generic_fromJSON(GangMemberUpgrade, value.data);
|
||||
}
|
||||
|
||||
Reviver.constructors.GangMemberUpgrade = GangMemberUpgrade;
|
||||
|
||||
GangMemberUpgrades = {
|
||||
"Baseball Bat" : new GangMemberUpgrade("Baseball Bat",
|
||||
"Increases strength and defense by 10%"),
|
||||
"Increases strength and defense by 10%", 1000000, "w"),
|
||||
"Katana" : new GangMemberUpgrade("Katana",
|
||||
"Increases strength, defense, and dexterity by 15%"),
|
||||
"Increases strength, defense, and dexterity by 15%", 12000000, "w"),
|
||||
"Glock 18C" : new GangMemberUpgrade("Glock 18C",
|
||||
"Increases strength, defense, dexterity, and agility by 20%"),
|
||||
"Increases strength, defense, dexterity, and agility by 20%", 25000000, "w"),
|
||||
"P90" : new GangMemberUpgrade("P90C",
|
||||
"Increases strength and defense by 40%. Increases agility by 20%"),
|
||||
"Increases strength and defense by 40%. Increases agility by 20%", 50000000, "w"),
|
||||
"Steyr AUG" : new GangMemberUpgrade("Steyr AUG",
|
||||
"Increases strength and defense by 60%"),
|
||||
"Increases strength and defense by 60%", 60000000, "w"),
|
||||
"AK-47" : new GangMemberUpgrade("AK-47",
|
||||
"Increases strength and defense by 80%"),
|
||||
"Increases strength and defense by 80%", 100000000, "w"),
|
||||
"M15A10 Assault Rifle" : new GangMemberUpgrade("M15A10 Assault Rifle",
|
||||
"Increases strength and defense by 90%"),
|
||||
"Increases strength and defense by 90%", 150000000, "w"),
|
||||
"AWM Sniper Rifle" : new GangMemberUpgrade("AWM Sniper Rifle",
|
||||
"Increases strength, dexterity, and agility by 80%"),
|
||||
"Increases strength, dexterity, and agility by 80%", 225000000, "w"),
|
||||
"Bulletproof Vest" : new GangMemberUpgrade("Bulletproof Vest",
|
||||
"Increases defense by 15%"),
|
||||
"Increases defense by 15%", 2000000, "a"),
|
||||
"Full Body Armor" : new GangMemberUpgrade("Full Body Armor",
|
||||
"Increases defense by 30%"),
|
||||
"Increases defense by 30%", 5000000, "a"),
|
||||
"Liquid Body Armor" : new GangMemberUpgrade("Liquid Body Armor",
|
||||
"Increases defense and agility by 50%"),
|
||||
"Increases defense and agility by 50%", 25000000, "a"),
|
||||
"Graphene Plating Armor" : new GangMemberUpgrade("Graphene Plating Armor",
|
||||
"Increases defense by 100%"),
|
||||
"Increases defense by 100%", 40000000, "a"),
|
||||
"Ford Flex V20" : new GangMemberUpgrade("Ford Flex V20",
|
||||
"Increases agility and charisma by 20%"),
|
||||
"Increases agility and charisma by 20%", 3000000, "v"),
|
||||
"ATX1070 Superbike" : new GangMemberUpgrade("ATX1070 Superbike",
|
||||
"Increases agility and charisma by 40%"),
|
||||
"Increases agility and charisma by 40%", 9000000, "v"),
|
||||
"Mercedes-Benz S9001" : new GangMemberUpgrade("Mercedes-Benz S9001",
|
||||
"Increases agility and charisma by 60%"),
|
||||
"Increases agility and charisma by 60%", 18000000, "v"),
|
||||
"White Ferrari" : new GangMemberUpgrade("White Ferrari",
|
||||
"Increases agility and charisma by 80%"),
|
||||
"Increases agility and charisma by 80%", 30000000, "v"),
|
||||
"NUKE Rootkit" : new GangMemberUpgrade("NUKE Rootkit",
|
||||
"Increases hacking by 20%"),
|
||||
"Increases hacking by 20%", 5000000, "r"),
|
||||
"Soulstealer Rootkit" : new GangMemberUpgrade("Soulstealer Rootkit",
|
||||
"Increases hacking by 30%"),
|
||||
"Increases hacking by 30%", 15000000, "r"),
|
||||
"Demon Rootkit" : new GangMemberUpgrade("Demon Rootkit",
|
||||
"Increases hacking by 50%"),
|
||||
"Increases hacking by 50%", 50000000, "r"),
|
||||
}
|
||||
|
||||
//Create a pop-up box that lets player purchase upgrades
|
||||
function createGangMemberUpgradeBox(memberObj) {
|
||||
var container = document.getElementById("gang-purchase-upgrade-container");
|
||||
if (container) {
|
||||
while (container.firstChild) {
|
||||
container.removeChild(container.firstChild);
|
||||
}
|
||||
} else {
|
||||
var container = document.createElement("div");
|
||||
container.setAttribute("id", "gang-purchase-upgrade-container");
|
||||
document.getElementById("entire-game-container").appendChild(container);
|
||||
container.setAttribute("class", "popup-box-container");
|
||||
}
|
||||
|
||||
var content = document.createElement("div");
|
||||
content.setAttribute("class", "popup-box-content");
|
||||
container.appendChild(content);
|
||||
|
||||
var intro = document.createElement("p");
|
||||
content.appendChild(intro);
|
||||
intro.innerHTML =
|
||||
memberObj.name + "<br><br>" +
|
||||
"A gang member can be upgraded with a weapon, armor, a vehicle, and a hacking rootkit. " +
|
||||
"For each of these pieces of equipment, a gang member can only have one at a time (i.e " +
|
||||
"a member cannot have two weapons or two vehicles). Purchasing an upgrade will automatically " +
|
||||
"replace the member's existing upgrade, if he/she is equipped with one. The existing upgrade " +
|
||||
"will be lost and will have to be re-purchased if you want to switch back.";
|
||||
|
||||
//Weapons
|
||||
var weaponTxt = document.createElement("p");
|
||||
content.appendChild(weaponTxt);
|
||||
if (memberObj.weaponUpgrade instanceof GangMemberUpgrade) {
|
||||
weaponTxt.innerHTML = "Weapons (Current Equip: " + memberObj.weaponUpgrade.name + ")";
|
||||
} else {
|
||||
weaponTxt.innerHTML = "Weapons (Current Equip: NONE)";
|
||||
}
|
||||
var weaponNames = ["Baseball Bat", "Katana", "Glock 18C", "P90", "Steyr AUG",
|
||||
"AK-47", "M15A10 Assault Rifle", "AWM Sniper Rifle"];
|
||||
createGangMemberUpgradeButtons(memberObj, weaponNames, memberObj.weaponUpgrade, content);
|
||||
|
||||
var armorTxt = document.createElement("p");
|
||||
content.appendChild(armorTxt);
|
||||
if (memberObj.armorUpgrade instanceof GangMemberUpgrade) {
|
||||
armorTxt.innerHTML = "Armor (Current Equip: " + memberObj.armorUpgrade.name + ")";
|
||||
} else {
|
||||
armorTxt.innerHTML = "Armor (Current Equip: NONE)";
|
||||
}
|
||||
var armorNames = ["Bulletproof Vest", "Full Body Armor", "Liquid Body Armor",
|
||||
"Graphene Plating Armor"];
|
||||
createGangMemberUpgradeButtons(memberObj, armorNames, memberObj.armorUpgrade, content);
|
||||
|
||||
var vehicleTxt = document.createElement("p");
|
||||
content.appendChild(vehicleTxt);
|
||||
if (memberObj.vehicleUpgrade instanceof GangMemberUpgrade) {
|
||||
vehicleTxt.innerHTML = "Vehicles (Current Equip: " + memberObj.vehicleUpgrade.name + ")";
|
||||
} else {
|
||||
vehicleTxt.innerHTML = "Vehicles (Current Equip: NONE)";
|
||||
}
|
||||
var vehicleNames = ["Ford Flex V20", "ATX1070 Superbike", "Mercedes-Benz S9001",
|
||||
"White Ferrari"];
|
||||
createGangMemberUpgradeButtons(memberObj, vehicleNames, memberObj.vehicleUpgrade, content);
|
||||
|
||||
var rootkitTxt = document.createElement("p");
|
||||
content.appendChild(rootkitTxt);
|
||||
if (memberObj.hackingUpgrade instanceof GangMemberUpgrade) {
|
||||
rootkitTxt.innerHTML = "Rootkits (Current Equip: " + memberObj.hackingUpgrade.name + ")";
|
||||
} else {
|
||||
rootkitTxt.innerHTML = "Rootkits (Current Equip: NONE)";
|
||||
}
|
||||
var rootkitNames = ["NUKE Rootkit", "Soulstealer Rootkit", "Demon Rootkit"];
|
||||
createGangMemberUpgradeButtons(memberObj, rootkitNames, memberObj.hackingUpgrade, content);
|
||||
}
|
||||
|
||||
function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, content) {
|
||||
for (var i = 0; i < upgNames.length; ++i) {
|
||||
(function() {
|
||||
var upgrade = GangMemberUpgrades[upgNames[i]];
|
||||
if (upgrade == null) {
|
||||
console.log("ERROR: Could not find GangMemberUpgrade object for" + upgNames[i]);
|
||||
continue;
|
||||
}
|
||||
//Skip the currently owned upgrade
|
||||
if (memberUpgrade instanceof GangMemberUpgrade &&
|
||||
memberUpgrade.name == upgrade.name) {continue;}
|
||||
|
||||
var btn = document.createElement("a");
|
||||
btn.innerHTML = upgrade.name + " - $" + numeral(upgrade.cost).format('(0.00a)');
|
||||
if (Player.money.gte(upgrade.cost)) {
|
||||
btn.setAttribute("class", "a-link-button");
|
||||
} else {
|
||||
btn.setAttribute("class", "a-link-button-inactive");
|
||||
}
|
||||
content.appendChild(btn);
|
||||
btn.addEventListener("click", function() {
|
||||
upgrade.purchase(memberObj);
|
||||
});
|
||||
}()); // Immediate invocation
|
||||
}
|
||||
}
|
||||
|
||||
var gangContentCreated = false;
|
||||
@ -1004,12 +1165,12 @@ function updateGangMemberDisplayElement(memberObj) {
|
||||
var stats = document.getElementById(name + "gang-member-stats-text");
|
||||
if (stats) {
|
||||
stats.innerHTML =
|
||||
"Hacking: " + formatNumber(memberObj.hack, 0) + " (" + formatNumber(memberObj.hack_exp, 3) + " exp)<br>" +
|
||||
"Strength: " + formatNumber(memberObj.str, 0) + " (" + formatNumber(memberObj.str_exp, 3) + " exp)<br>" +
|
||||
"Defense: " + formatNumber(memberObj.def, 0) + " (" + formatNumber(memberObj.def_exp, 3) + " exp)<br>" +
|
||||
"Dexterity: " + formatNumber(memberObj.dex, 0) + " (" + formatNumber(memberObj.dex_exp, 3) + " exp)<br>" +
|
||||
"Agility: " + formatNumber(memberObj.agi, 0) + " (" + formatNumber(memberObj.agi_exp, 3) + " exp)<br>" +
|
||||
"Charisma: " + formatNumber(memberObj.cha, 0) + " (" + formatNumber(memberObj.cha_exp, 3) + " exp)<br>";
|
||||
"Hacking: " + formatNumber(memberObj.hack, 0) + " (" + numeral(memberObj.hack_exp).format('(0.00a)') + " exp)<br>" +
|
||||
"Strength: " + formatNumber(memberObj.str, 0) + " (" + numeral(memberObj.str_exp).format('(0.00a)') + " exp)<br>" +
|
||||
"Defense: " + formatNumber(memberObj.def, 0) + " (" + numeral(memberObj.def_exp).format('(0.00a)') + " exp)<br>" +
|
||||
"Dexterity: " + formatNumber(memberObj.dex, 0) + " (" + numeral(memberObj.dex_exp).format('(0.00a)') + " exp)<br>" +
|
||||
"Agility: " + formatNumber(memberObj.agi, 0) + " (" + numeral(memberObj.agi_exp).format('(0.00a)') + " exp)<br>" +
|
||||
"Charisma: " + formatNumber(memberObj.cha, 0) + " (" + numeral(memberObj.cha_exp).format('(0.00a)') + " exp)<br>";
|
||||
}
|
||||
|
||||
var gainInfo = document.getElementById(name + "gang-member-gain-info");
|
||||
|
@ -108,9 +108,15 @@ HelpTexts = {
|
||||
"Note that after the 'kill' command is issued for a script, it may take a while for the script to actually stop running. " +
|
||||
"This will happen if the script is in the middle of a command such as grow() or weaken() that takes time to execute. " +
|
||||
"The script will not be stopped/killed until after that time has elapsed.",
|
||||
ls: "ls<br>" +
|
||||
"Prints all files on the current server to the Terminal screen. This includes all scripts, programs, and message files. " +
|
||||
"The files will be displayed in alphabetical order.",
|
||||
ls: "ls [| grep pattern]<br>" +
|
||||
"The ls command, with no arguments, prints all files on the current server to the Terminal screen. " +
|
||||
"This includes all scripts, programs, and message files. " +
|
||||
"The files will be displayed in alphabetical order. <br><br>" +
|
||||
"The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern. " +
|
||||
"For example, if you wanted to only display files with the .script extension, you could use: <br><br>" +
|
||||
"ls | grep .script<br><br>" +
|
||||
"Alternatively, if you wanted to display all files with the word purchase in the filename, you could use: <br><br>" +
|
||||
"ls | grep purchase",
|
||||
mem: "mem [script name] [-t] [num threads]<br>" +
|
||||
"Displays the amount of RAM needed to run the specified script with a single thread. The command can also be used to print " +
|
||||
"the amount of RAM needed to run a script with multiple threads using the '-t' flag. If the '-t' flag is specified, then " +
|
||||
|
@ -12,7 +12,7 @@ iTutorialSteps = {
|
||||
TerminalScanAnalyze2: "Use the scan-analyze command with a depth of 3",
|
||||
TerminalConnect: "Using the telnet/connect command to connect to another server",
|
||||
TerminalAnalyze: "Use the analyze command to display details about this server",
|
||||
TerminalNuke: "Use the NUKE Program to gain root access to a server",
|
||||
TerminalNuke: "Use the NUKE Program to gain root access to a server",
|
||||
TerminalManualHack: "Use the hack command to manually hack a server",
|
||||
TerminalHackingMechanics: "Briefly explain hacking mechanics",
|
||||
TerminalCreateScript: "Create a script using nano",
|
||||
@ -23,7 +23,7 @@ iTutorialSteps = {
|
||||
ActiveScriptsPage: "Introduction to the Active Scripts Page",
|
||||
ActiveScriptsToTerminal: "Go from Active Scripts Page Back to Terminal",
|
||||
TerminalTailScript: "Use the tail command to show a script's logs",
|
||||
GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
|
||||
GoToHacknetNodesPage: "Go to the Hacknet Nodes page",
|
||||
HacknetNodesIntroduction: "Introduction to Hacknet Nodesm and have user purchase one",
|
||||
HacknetNodesGoToWorldPage: "Go to the world page",
|
||||
WorldDescription: "Tell the user to explore..theres a lot of different stuff to do out there",
|
||||
@ -40,18 +40,18 @@ function iTutorialStart() {
|
||||
console.log("Interactive Tutorial started");
|
||||
currITutorialStep = iTutorialSteps.Start;
|
||||
iTutorialIsRunning = true;
|
||||
|
||||
|
||||
document.getElementById("interactive-tutorial-container").style.display = "block";
|
||||
|
||||
|
||||
iTutorialEvaluateStep();
|
||||
|
||||
|
||||
//Exit tutorial button
|
||||
var exitButton = clearEventListeners("interactive-tutorial-exit");
|
||||
exitButton.addEventListener("click", function() {
|
||||
iTutorialEnd();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//Back button
|
||||
var backButton = clearEventListeners("interactive-tutorial-back");
|
||||
backButton.style.display = "none";
|
||||
@ -66,10 +66,10 @@ function iTutorialEvaluateStep() {
|
||||
switch(currITutorialStep) {
|
||||
case iTutorialSteps.Start:
|
||||
Engine.loadTerminalContent();
|
||||
|
||||
|
||||
iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " +
|
||||
"The game takes place in a dark, dystopian future...The year is 2077...<br><br>" +
|
||||
"This tutorial will show you the basics of the game to help you get started. " +
|
||||
"The game takes place in a dark, dystopian future...The year is 2077...<br><br>" +
|
||||
"This tutorial will show you the basics of the game to help you get started. " +
|
||||
"You may skip the tutorial at any time.");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
@ -79,16 +79,16 @@ function iTutorialEvaluateStep() {
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.GoToCharacterPage:
|
||||
iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
|
||||
iTutorialSetText("Let's start by heading to the Stats page. Click the 'Stats' tab on " +
|
||||
"the main navigation menu (left-hand side of the screen)");
|
||||
|
||||
|
||||
//No next button
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "none";
|
||||
|
||||
|
||||
//Flash Character tab
|
||||
document.getElementById("stats-menu-link").setAttribute("class", "flashing-button");
|
||||
|
||||
|
||||
//Initialize everything necessary to open the "Character" page
|
||||
var charaterMainMenuButton = document.getElementById("stats-menu-link");
|
||||
charaterMainMenuButton.addEventListener("click", function() {
|
||||
@ -99,7 +99,7 @@ function iTutorialEvaluateStep() {
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.CharacterPage:
|
||||
iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
|
||||
iTutorialSetText("The Stats page shows a lot of important information about your progress, " +
|
||||
"such as your skills, money, and bonuses/multipliers. ")
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
@ -114,9 +114,9 @@ function iTutorialEvaluateStep() {
|
||||
//No next button
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "none";
|
||||
|
||||
|
||||
document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
|
||||
|
||||
|
||||
//Initialize everything necessary to open the 'Terminal' Page
|
||||
var terminalMainMenuButton = document.getElementById("terminal-menu-link");
|
||||
terminalMainMenuButton.addEventListener("click", function() {
|
||||
@ -128,7 +128,7 @@ function iTutorialEvaluateStep() {
|
||||
break;
|
||||
case iTutorialSteps.TerminalIntro:
|
||||
iTutorialSetText("The Terminal is used to interface with your home computer as well as " +
|
||||
"all of the other machines around the world. A lot of content in the game is " +
|
||||
"all of the other machines around the world. A lot of content in the game is " +
|
||||
"accessible only through the Terminal, and is necessary for progressing. ");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
@ -138,37 +138,37 @@ function iTutorialEvaluateStep() {
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.TerminalHelp:
|
||||
iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
|
||||
iTutorialSetText("Let's try it out. Start by entering the 'help' command into the Terminal " +
|
||||
"(Don't forget to press Enter after typing the command)");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "none";
|
||||
next.style.display = "none";
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalLs:
|
||||
iTutorialSetText("The 'help' command displays a list of all available commands, how to use them, " +
|
||||
iTutorialSetText("The 'help' command displays a list of all available commands, how to use them, " +
|
||||
"and a description of what they do. <br><br>Let's try another command. Enter the 'ls' command");
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScan:
|
||||
iTutorialSetText("'ls' is a basic command that shows all of the contents (programs/scripts) " +
|
||||
"on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
|
||||
"We'll get to what this does later. <br><br> Through your home computer's terminal, you can connect " +
|
||||
"to other machines throughout the world. Let's do that now by first entering " +
|
||||
"on the computer. Right now, it shows that you have a program called 'NUKE.exe' on your computer. " +
|
||||
"We'll get to what this does later. <br><br> Through your home computer's terminal, you can connect " +
|
||||
"to other machines throughout the world. Let's do that now by first entering " +
|
||||
"the 'scan' command. ");
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScanAnalyze1:
|
||||
iTutorialSetText("The 'scan' command shows all available network connections. In other words, " +
|
||||
"it displays a list of all servers that can be connected to from your " +
|
||||
"it displays a list of all servers that can be connected to from your " +
|
||||
"current machine. A server is identified by either its IP or its hostname. <br><br> " +
|
||||
"That's great and all, but there's so many servers. Which one should you go to? " +
|
||||
"The 'scan-analyze' command gives some more detailed information about servers on the " +
|
||||
"That's great and all, but there's so many servers. Which one should you go to? " +
|
||||
"The 'scan-analyze' command gives some more detailed information about servers on the " +
|
||||
"network. Try it now");
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalScanAnalyze2:
|
||||
iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
|
||||
"information about each server that you can connect to (servers that are a distance of " +
|
||||
iTutorialSetText("You just ran 'scan-analyze' with a depth of one. This command shows more detailed " +
|
||||
"information about each server that you can connect to (servers that are a distance of " +
|
||||
"one node away). <br><br> It is also possible to run 'scan-analyze' with " +
|
||||
"a higher depth. Let's try a depth of two with the following command: 'scan-analyze 2'.")
|
||||
//next step triggered by terminal command
|
||||
@ -176,101 +176,101 @@ function iTutorialEvaluateStep() {
|
||||
case iTutorialSteps.TerminalConnect:
|
||||
iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " +
|
||||
"as figure out how to navigate to those servers through the network. You can only connect to " +
|
||||
"a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
|
||||
"the ip or the hostname, but dont use both.<br><br>" +
|
||||
"a server that is one node away. To connect to a machine, use the 'connect [ip/hostname]' command. You can type in " +
|
||||
"the ip or the hostname, but dont use both.<br><br>" +
|
||||
"From the results of the 'scan-analyze' command, we can see that the 'foodnstuff' server is " +
|
||||
"only one node away. Let's connect so it now using: 'connect foodnstuff'");
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalAnalyze:
|
||||
iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!<br><br> In the year 2077, currency has " +
|
||||
"become digital and decentralized. People and corporations store their money " +
|
||||
"on servers and computers. Using your hacking abilities, you can hack servers " +
|
||||
"to steal money and gain experience. <br><br> " +
|
||||
iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!<br><br> In the year 2077, currency has " +
|
||||
"become digital and decentralized. People and corporations store their money " +
|
||||
"on servers and computers. Using your hacking abilities, you can hack servers " +
|
||||
"to steal money and gain experience. <br><br> " +
|
||||
"Before you try to hack a server, you should run diagnostics using the 'analyze' command");
|
||||
//next step triggered by terminal command
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalNuke:
|
||||
iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
|
||||
iTutorialSetText("When the 'analyze' command finishes running it will show useful information " +
|
||||
"about hacking the server. <br><br> For this server, the required hacking skill is only 1, " +
|
||||
"which means you are able to hack it right now. However, in order to hack a server " +
|
||||
"which means you are able to hack it right now. However, in order to hack a server " +
|
||||
"you must first gain root access. The 'NUKE.exe' program that we saw earlier on your " +
|
||||
"home computer is a virus that will grant you root access to a machine if there are enough " +
|
||||
"open ports.<br><br> The 'analyze' results shows that there do not need to be any open ports " +
|
||||
"on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
|
||||
"open ports.<br><br> The 'analyze' results shows that there do not need to be any open ports " +
|
||||
"on this machine for the NUKE virus to work, so go ahead and run the virus using the " +
|
||||
"'run NUKE.exe' command.");
|
||||
//next step triggered by terminal command
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalManualHack:
|
||||
iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
|
||||
iTutorialSetText("You now have root access! You can hack the server using the 'hack' command. " +
|
||||
"Try doing that now. ");
|
||||
//next step triggered by terminal command
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalHackingMechanics:
|
||||
iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
|
||||
"only has a certain percentage chance " +
|
||||
"of success. This time and success chance is determined by a variety of factors, including " +
|
||||
"your hacking skill and the server's security level. <br><br>" +
|
||||
iTutorialSetText("You are now attempting to hack the server. Note that performing a hack takes time and " +
|
||||
"only has a certain percentage chance " +
|
||||
"of success. This time and success chance is determined by a variety of factors, including " +
|
||||
"your hacking skill and the server's security level. <br><br>" +
|
||||
"If your attempt to hack the server is successful, you will steal a certain percentage " +
|
||||
"of the server's total money. This percentage is affected by your hacking skill and " +
|
||||
"the server's security level. <br><br> The amount of money on a server is not limitless. So, if " +
|
||||
"you constantly hack a server and deplete its money, then you will encounter " +
|
||||
"the server's security level. <br><br> The amount of money on a server is not limitless. So, if " +
|
||||
"you constantly hack a server and deplete its money, then you will encounter " +
|
||||
"diminishing returns in your hacking.<br>");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
next.addEventListener("click", function() {
|
||||
iTutorialNextStep();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.TerminalCreateScript:
|
||||
iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
|
||||
"you don't want to be hacking manually the entire time. You can automate your hacking " +
|
||||
"by writing scripts! <br><br>To create a new script or edit an existing one, you can use the 'nano' " +
|
||||
iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " +
|
||||
"you don't want to be hacking manually the entire time. You can automate your hacking " +
|
||||
"by writing scripts! <br><br>To create a new script or edit an existing one, you can use the 'nano' " +
|
||||
"command. Scripts must end with the '.script' extension. Let's make a script now by " +
|
||||
"entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
|
||||
"entering 'nano foodnstuff.script' after the hack command finishes running (Sidenote: Pressing ctrl + c" +
|
||||
" will end a command like hack early)");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "none";
|
||||
//next step triggered by terminal command
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalTypeScript:
|
||||
iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
|
||||
"written in the Netscript language, a programming language created for " +
|
||||
iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " +
|
||||
"written in the Netscript language, a programming language created for " +
|
||||
"this game. <strong style='background-color:#444;'>There are details about the Netscript language in the documentation, which " +
|
||||
"can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
|
||||
"it out after this tutorial. </strong> For now, just copy " +
|
||||
"can be accessed in the 'Tutorial' tab on the main navigation menu. I highly suggest you check " +
|
||||
"it out after this tutorial. </strong> For now, just copy " +
|
||||
"and paste the following code into the script editor: <br><br>" +
|
||||
"while(true) { <br>" +
|
||||
" hack('foodnstuff'); <br>" +
|
||||
"while(true) { <br>" +
|
||||
" hack('foodnstuff'); <br>" +
|
||||
"}<br><br> " +
|
||||
"For anyone with basic programming experience, this code should be straightforward. " +
|
||||
"This script will continuously hack the 'foodnstuff' server. <br><br>" +
|
||||
"This script will continuously hack the 'foodnstuff' server. <br><br>" +
|
||||
"To save and close the script editor, press the button in the bottom left, or press ctrl + b.");
|
||||
//next step triggered in saveAndCloseScriptEditor() (Script.js)
|
||||
break;
|
||||
case iTutorialSteps.TerminalFree:
|
||||
iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
|
||||
"run on any machine which you have root access to. Different servers have different " +
|
||||
iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " +
|
||||
"run on any machine which you have root access to. Different servers have different " +
|
||||
"amounts of RAM. You can also purchase more RAM for your home server. <br><br> To check how much " +
|
||||
"RAM is available on this machine, enter the 'free' command.");
|
||||
//next step triggered by terminal commmand
|
||||
break;
|
||||
case iTutorialSteps.TerminalRunScript:
|
||||
iTutorialSetText("We have 4GB of free RAM on this machine, which is enough to run our " +
|
||||
iTutorialSetText("We have 4GB of free RAM on this machine, which is enough to run our " +
|
||||
"script. Let's run our script using 'run foodnstuff.script'.");
|
||||
//next step triggered by terminal commmand
|
||||
break;
|
||||
case iTutorialSteps.TerminalGoToActiveScriptsPage:
|
||||
iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
|
||||
"Your scripts will continuously run in the background and will automatically stop if " +
|
||||
"the code ever completes (the 'foodnstuff.script' will never complete because it " +
|
||||
"runs an infinite loop). <br><br>These scripts can passively earn you income and hacking experience. " +
|
||||
iTutorialSetText("Your script is now running! The script might take a few seconds to 'fully start up'. " +
|
||||
"Your scripts will continuously run in the background and will automatically stop if " +
|
||||
"the code ever completes (the 'foodnstuff.script' will never complete because it " +
|
||||
"runs an infinite loop). <br><br>These scripts can passively earn you income and hacking experience. " +
|
||||
"Your scripts will also earn money and experience while you are offline, although at a " +
|
||||
"much slower rate. <br><br> " +
|
||||
"Let's check out some statistics of our active, running scripts by clicking the " +
|
||||
"much slower rate. <br><br> " +
|
||||
"Let's check out some statistics of our active, running scripts by clicking the " +
|
||||
"'Active Scripts' link in the main navigation menu. ");
|
||||
document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
|
||||
document.getElementById("active-scripts-menu-link").setAttribute("class", "flashing-button");
|
||||
var activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
|
||||
activeScriptsMainMenuButton.addEventListener("click", function() {
|
||||
Engine.loadActiveScriptsContent();
|
||||
@ -281,8 +281,8 @@ function iTutorialEvaluateStep() {
|
||||
break;
|
||||
case iTutorialSteps.ActiveScriptsPage:
|
||||
iTutorialSetText("This page displays stats/information about all of your scripts that are " +
|
||||
"running across every existing server. You can use this to gauge how well " +
|
||||
"your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
|
||||
"running across every existing server. You can use this to gauge how well " +
|
||||
"your scripts are doing. Let's go back to the Terminal now using the 'Terminal'" +
|
||||
"link.");
|
||||
document.getElementById("terminal-menu-link").setAttribute("class", "flashing-button");
|
||||
//Initialize everything necessary to open the 'Terminal' Page
|
||||
@ -295,17 +295,17 @@ function iTutorialEvaluateStep() {
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.ActiveScriptsToTerminal:
|
||||
iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
|
||||
"what it's doing. We can check these logs using the 'tail' command. Do that " +
|
||||
iTutorialSetText("One last thing about scripts, each active script contains logs that detail " +
|
||||
"what it's doing. We can check these logs using the 'tail' command. Do that " +
|
||||
"now for the script we just ran by typing 'tail foodnstuff.script'");
|
||||
//next step triggered by terminal command
|
||||
break;
|
||||
case iTutorialSteps.TerminalTailScript:
|
||||
iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
|
||||
"just started running...but check back again in a few minutes! <br><br>" +
|
||||
"This pretty much covers the basics of hacking. To learn more about writing " +
|
||||
iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " +
|
||||
"just started running...but check back again in a few minutes! <br><br>" +
|
||||
"This pretty much covers the basics of hacking. To learn more about writing " +
|
||||
"scripts using the Netscript language, select the 'Tutorial' link in the " +
|
||||
"main navigation menu to look at the documentation. For now, let's move on " +
|
||||
"main navigation menu to look at the documentation. For now, let's move on " +
|
||||
"to something else!");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
@ -316,7 +316,7 @@ function iTutorialEvaluateStep() {
|
||||
break;
|
||||
case iTutorialSteps.GoToHacknetNodesPage:
|
||||
iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " +
|
||||
"earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
|
||||
"earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " +
|
||||
"the 'Hacknet Nodes' page through the main navigation menu now.");
|
||||
document.getElementById("hacknet-nodes-menu-link").setAttribute("class", "flashing-button");
|
||||
var hacknetNodesButton = clearEventListeners("hacknet-nodes-menu-link");
|
||||
@ -330,15 +330,15 @@ function iTutorialEvaluateStep() {
|
||||
});
|
||||
break;
|
||||
case iTutorialSteps.HacknetNodesIntroduction:
|
||||
iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
|
||||
iTutorialSetText("From this page you can purchase new Hacknet Nodes and upgrade your " +
|
||||
"existing ones. Let's purchase a new one now.");
|
||||
//Next step triggered by purchaseHacknet() (HacknetNode.js)
|
||||
break;
|
||||
case iTutorialSteps.HacknetNodesGoToWorldPage:
|
||||
iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
|
||||
"earn you money over time, both online and offline. When you get enough " +
|
||||
" money, you can upgrade " +
|
||||
"your newly-purchased Hacknet Node below. <br><br>" +
|
||||
iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " +
|
||||
"earn you money over time, both online and offline. When you get enough " +
|
||||
" money, you can upgrade " +
|
||||
"your newly-purchased Hacknet Node below. <br><br>" +
|
||||
"Let's go to the 'City' page through the main navigation menu.");
|
||||
document.getElementById("city-menu-link").setAttribute("class", "flashing-button");
|
||||
var worldButton = clearEventListeners("city-menu-link");
|
||||
@ -351,9 +351,9 @@ function iTutorialEvaluateStep() {
|
||||
break;
|
||||
case iTutorialSteps.WorldDescription:
|
||||
iTutorialSetText("This page lists all of the different locations you can currently " +
|
||||
"travel to. Each location has something that you can do. " +
|
||||
"travel to. Each location has something that you can do. " +
|
||||
"There's a lot of content out in the world, make sure " +
|
||||
"you explore and discover!<br><br>" +
|
||||
"you explore and discover!<br><br>" +
|
||||
"Lastly, click on the 'Tutorial' link in the main navigation menu.");
|
||||
document.getElementById("tutorial-menu-link").setAttribute("class", "flashing-button");
|
||||
var tutorialButton = clearEventListeners("tutorial-menu-link");
|
||||
@ -366,17 +366,17 @@ function iTutorialEvaluateStep() {
|
||||
break;
|
||||
|
||||
case iTutorialSteps.TutorialPageInfo:
|
||||
iTutorialSetText("This page contains a lot of different documentation about the game's " +
|
||||
"content and mechanics. <strong style='background-color:#444;'> I know it's a lot, but I highly suggest you read " +
|
||||
"(or at least skim) through this before you start playing</strong>. That's the end of the tutorial. " +
|
||||
iTutorialSetText("This page contains a lot of different documentation about the game's " +
|
||||
"content and mechanics. <strong style='background-color:#444;'> I know it's a lot, but I highly suggest you read " +
|
||||
"(or at least skim) through this before you start playing</strong>. That's the end of the tutorial. " +
|
||||
"Hope you enjoy the game!");
|
||||
var next = clearEventListeners("interactive-tutorial-next");
|
||||
next.style.display = "inline-block";
|
||||
next.innerHTML = "Finish Tutorial";
|
||||
|
||||
|
||||
var backButton = clearEventListeners("interactive-tutorial-back");
|
||||
backButton.style.display = "none";
|
||||
|
||||
|
||||
next.addEventListener("click", function() {
|
||||
iTutorialNextStep();
|
||||
return false;
|
||||
@ -513,7 +513,7 @@ function iTutorialNextStep() {
|
||||
iTutorialEvaluateStep();
|
||||
break;
|
||||
case iTutorialSteps.End:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid tutorial step");
|
||||
}
|
||||
@ -627,7 +627,7 @@ function iTutorialPrevStep() {
|
||||
iTutorialEvaluateStep();
|
||||
break;
|
||||
case iTutorialSteps.End:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid tutorial step");
|
||||
}
|
||||
@ -648,4 +648,4 @@ function iTutorialSetText(txt) {
|
||||
if (textBox == null) {throw new Error("Could not find text box"); return;}
|
||||
textBox.innerHTML = txt;
|
||||
textBox.parentElement.scrollTop = 0; // this resets scroll position
|
||||
}
|
||||
}
|
||||
|
@ -1990,3 +1990,21 @@ function travelBoxCreate(destCityName, cost) {
|
||||
});
|
||||
yesNoBoxCreate("Would you like to travel to " + destCityName + "? The trip will cost $" + formatNumber(cost, 2) + ".");
|
||||
}
|
||||
|
||||
function purchaseServerBoxCreate(ram, cost) {
|
||||
var yesBtn = yesNoTxtInpBoxGetYesButton();
|
||||
var noBtn = yesNoTxtInpBoxGetNoButton();
|
||||
yesBtn.innerHTML = "Purchase Server";
|
||||
noBtn.innerHTML = "Cancel";
|
||||
yesBtn.addEventListener("click", function() {
|
||||
purchaseServer(ram, cost);
|
||||
yesNoTxtInpBoxClose();
|
||||
});
|
||||
noBtn.addEventListener("click", function() {
|
||||
yesNoTxtInpBoxClose();
|
||||
});
|
||||
|
||||
yesNoTxtInpBoxCreate("Would you like to purchase a new server with " + ram +
|
||||
"GB of RAM for $" + formatNumber(cost, 2) + "?<br><br>" +
|
||||
"Please enter the server hostname below:<br>");
|
||||
}
|
||||
|
@ -185,7 +185,8 @@ function evaluate(exp, workerScript) {
|
||||
reject(makeRuntimeRejectMsg(workerScript, "Not implemented ReturnStatement"));
|
||||
break;
|
||||
case "BreakStatement":
|
||||
reject(makeRuntimeRejectMsg(workerScript, "Not implemented BreakStatement"));
|
||||
reject("BREAKSTATEMENT");
|
||||
//reject(makeRuntimeRejectMsg(workerScript, "Not implemented BreakStatement"));
|
||||
break;
|
||||
case "IfStatement":
|
||||
evaluateIf(exp, workerScript).then(function(forLoopRes) {
|
||||
@ -201,7 +202,12 @@ function evaluate(exp, workerScript) {
|
||||
evaluateWhile(exp, workerScript).then(function(forLoopRes) {
|
||||
resolve("forLoopDone");
|
||||
}).catch(function(e) {
|
||||
reject(e);
|
||||
if (e == "BREAKSTATEMENT" ||
|
||||
(e instanceof WorkerScript && e.errorMessage == "BREAKSTATEMENT")) {
|
||||
return resolve("whileLoopBroken");
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "ForStatement":
|
||||
@ -210,7 +216,12 @@ function evaluate(exp, workerScript) {
|
||||
}).then(function(forLoopRes) {
|
||||
resolve("forLoopDone");
|
||||
}).catch(function(e) {
|
||||
reject(e);
|
||||
if (e == "BREAKSTATEMENT" ||
|
||||
(e instanceof WorkerScript && e.errorMessage == "BREAKSTATEMENT")) {
|
||||
return resolve("forLoopBroken");
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@ -445,7 +456,7 @@ function evaluateFor(exp, workerScript) {
|
||||
resolve("endForLoop"); //Doesn't need to resolve to any particular value
|
||||
}
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -476,7 +487,7 @@ function evaluateWhile(exp, workerScript) {
|
||||
evaluatePromise.then(function(resCode) {
|
||||
resolve(resCode);
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
reject(e);
|
||||
});
|
||||
}, CONSTANTS.CodeInstructionRunTime);
|
||||
});
|
||||
@ -493,7 +504,7 @@ function evaluateWhile(exp, workerScript) {
|
||||
reject(e);
|
||||
});
|
||||
} else {
|
||||
resolve("endWhileLoop"); //Doesn't need to resolve to any particular value
|
||||
resolve("endWhileLoop"); //Doesn't need to resolve to any particular value
|
||||
}
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
|
@ -373,6 +373,13 @@ function prestigeSourceFile() {
|
||||
Terminal.finishAction(true);
|
||||
}
|
||||
|
||||
//Delete all Augmentations
|
||||
for (var name in Augmentations) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
delete Augmentations[name];
|
||||
}
|
||||
}
|
||||
|
||||
//Re-initialize things - This will update any changes
|
||||
initFactions(); //Factions must be initialized before augmentations
|
||||
initAugmentations(); //Calls reapplyAllAugmentations() and resets Player multipliers
|
||||
|
@ -121,7 +121,7 @@ loadGame = function(saveObj) {
|
||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||
try {
|
||||
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||
if (ver == "0.27.0") {
|
||||
if (ver == "0.27.0" || ver == "0.27.1") {
|
||||
if (Player.bitNodeN == null || Player.bitNodeN == 0) {
|
||||
Player.bitNodeN = 1;
|
||||
}
|
||||
@ -217,7 +217,7 @@ loadImportedGame = function(saveObj, saveString) {
|
||||
if (tempSaveObj.hasOwnProperty("VersionSave")) {
|
||||
try {
|
||||
var ver = JSON.parse(tempSaveObj.VersionSave, Reviver);
|
||||
if (ver == "0.27.0") {
|
||||
if (ver == "0.27.0" || ver == "0.27.1") {
|
||||
if (tempPlayer.bitNodeN == null || tempPlayer.bitNodeN == 0) {
|
||||
tempPlayer.bitNodeN = 1;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ purchaseServer = function(ram, cost) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Maximum of 30 servers
|
||||
//Maximum server limit
|
||||
if (Player.purchasedServers.length >= CONSTANTS.PurchasedServerLimit) {
|
||||
dialogBoxCreate("You have reached the maximum limit of " + CONSTANTS.PurchasedServerLimit + " servers. " +
|
||||
"You cannot purchase any more. You can " +
|
||||
@ -17,9 +17,7 @@ purchaseServer = function(ram, cost) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var hostname = document.getElementById("purchase-server-box-input").value;
|
||||
hostname = hostname.replace(/\s\s+/g, '');
|
||||
var hostname = yesNoTxtInpBoxGetInput();
|
||||
if (hostname == "") {
|
||||
dialogBoxCreate("You must enter a hostname for your new server!");
|
||||
return;
|
||||
|
@ -1152,8 +1152,22 @@ var Terminal = {
|
||||
},
|
||||
|
||||
executeListCommand: function(commandArray) {
|
||||
if (commandArray.length != 1) {
|
||||
post("Incorrect usage of ls command. Usage: ls"); return;
|
||||
if (commandArray.length != 1 && commandArray.length != 2) {
|
||||
post("Incorrect usage of ls command. Usage: ls [| grep pattern]"); return;
|
||||
}
|
||||
|
||||
|
||||
//grep
|
||||
var filter = null;
|
||||
if (commandArray.length == 2) {
|
||||
if (commandArray[1].startsWith("| grep ")) {
|
||||
var pattern = commandArray[1].replace("| grep ", "");
|
||||
if (pattern != " ") {
|
||||
filter = pattern;
|
||||
}
|
||||
} else {
|
||||
post("Incorrect usage of ls command. Usage: ls [| grep pattern]"); return;
|
||||
}
|
||||
}
|
||||
|
||||
//Display all programs and scripts
|
||||
@ -1162,13 +1176,32 @@ var Terminal = {
|
||||
//Get all of the programs and scripts on the machine into one temporary array
|
||||
var s = Player.getCurrentServer();
|
||||
for (var i = 0; i < s.programs.length; i++) {
|
||||
allFiles.push(s.programs[i]);
|
||||
if (filter) {
|
||||
if (s.programs[i].includes(filter)) {
|
||||
allFiles.push(s.programs[i]);
|
||||
}
|
||||
} else {
|
||||
allFiles.push(s.programs[i]);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < s.scripts.length; i++) {
|
||||
allFiles.push(s.scripts[i].filename);
|
||||
if (filter) {
|
||||
if (s.scripts[i].filename.includes(filter)) {
|
||||
allFiles.push(s.scripts[i].filename);
|
||||
}
|
||||
} else {
|
||||
allFiles.push(s.scripts[i].filename);
|
||||
}
|
||||
|
||||
}
|
||||
for (var i = 0; i < s.messages.length; i++) {
|
||||
allFiles.push(s.messages[i].filename);
|
||||
if (filter) {
|
||||
if (s.messages[i].filename.includes(filter)) {
|
||||
allFiles.push(s.messages[i].filename);
|
||||
}
|
||||
} else {
|
||||
allFiles.push(s.messages[i].filename);
|
||||
}
|
||||
}
|
||||
|
||||
//Sort the files alphabetically then print each
|
||||
|
@ -383,7 +383,8 @@ var Engine = {
|
||||
if (Player.hp == null) {Player.hp = Player.max_hp;}
|
||||
document.getElementById("character-overview-text").innerHTML =
|
||||
("Hp: " + Player.hp + " / " + Player.max_hp + "<br>" +
|
||||
"Money: $" + formatNumber(Player.money.toNumber(), 2) + "<br>" +
|
||||
//"Money: $" + formatNumber(Player.money.toNumber(), 2) + "<br>" +
|
||||
"Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + "<br>" +
|
||||
"Hack: " + (Player.hacking_skill).toLocaleString() + "<br>" +
|
||||
"Str: " + (Player.strength).toLocaleString() + "<br>" +
|
||||
"Def: " + (Player.defense).toLocaleString() + "<br>" +
|
||||
@ -407,17 +408,17 @@ var Engine = {
|
||||
'Money: $' + formatNumber(Player.money.toNumber(), 2)+ '<br><br><br>' +
|
||||
'<b>Stats</b><br><br>' +
|
||||
'Hacking Level: ' + (Player.hacking_skill).toLocaleString() +
|
||||
" (" + formatNumber(Player.hacking_exp, 4) + ' experience)<br>' +
|
||||
" (" + numeral(Player.hacking_exp).format('(0.000a)') + ' experience)<br>' +
|
||||
'Strength: ' + (Player.strength).toLocaleString() +
|
||||
" (" + formatNumber(Player.strength_exp, 4) + ' experience)<br>' +
|
||||
" (" + numeral(Player.strength_exp).format('(0.000a)') + ' experience)<br>' +
|
||||
'Defense: ' + (Player.defense).toLocaleString() +
|
||||
" (" + formatNumber(Player.defense_exp, 4) + ' experience)<br>' +
|
||||
" (" + numeral(Player.defense_exp).format('(0.000a)')+ ' experience)<br>' +
|
||||
'Dexterity: ' + (Player.dexterity).toLocaleString() +
|
||||
" (" + formatNumber(Player.dexterity_exp, 4) + ' experience)<br>' +
|
||||
" (" + numeral(Player.dexterity_exp).format('(0.000a)') + ' experience)<br>' +
|
||||
'Agility: ' + (Player.agility).toLocaleString() +
|
||||
" (" + formatNumber(Player.agility_exp, 4) + ' experience)<br>' +
|
||||
" (" + numeral(Player.agility_exp).format('(0.000a)') + ' experience)<br>' +
|
||||
'Charisma: ' + (Player.charisma).toLocaleString() +
|
||||
" (" + formatNumber(Player.charisma_exp, 4) + ' experience)<br><br><br>' +
|
||||
" (" + numeral(Player.charisma_exp).format('(0.000a)') + ' experience)<br><br><br>' +
|
||||
'<b>Multipliers</b><br><br>' +
|
||||
'Hacking Chance multiplier: ' + formatNumber(Player.hacking_chance_mult * 100, 2) + '%<br>' +
|
||||
'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%<br>' +
|
||||
|
@ -1,144 +0,0 @@
|
||||
/* Pop up Purchase Augmentation Box */
|
||||
function purchaseAugmentationBoxInit() {
|
||||
var cancelButton = document.getElementById("purchase-augmentation-box-cancel");
|
||||
|
||||
//Close Dialog box
|
||||
cancelButton.addEventListener("click", function() {
|
||||
purchaseAugmentationBoxClose();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener("DOMContentLoaded", purchaseAugmentationBoxInit, false);
|
||||
|
||||
purchaseAugmentationBoxClose = function() {
|
||||
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
|
||||
purchaseAugmentationBox.style.display = "none";
|
||||
}
|
||||
|
||||
purchaseAugmentationBoxOpen = function() {
|
||||
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
|
||||
purchaseAugmentationBox.style.display = "block";
|
||||
}
|
||||
|
||||
purchaseAugmentationBoxSetText = function(txt) {
|
||||
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-text");
|
||||
purchaseAugmentationBox.innerHTML = txt;
|
||||
}
|
||||
|
||||
//ram argument is in GB
|
||||
purchaseAugmentationBoxCreate = function(aug, fac) {
|
||||
document.getElementById("purchase-augmentation-box-aug-name").innerHTML = aug.name;
|
||||
document.getElementById("purchase-augmentation-box-aug-info").innerHTML = aug.info;
|
||||
purchaseAugmentationBoxSetText("<br>Would you like to purchase the " + aug.name + " Augmentation for $" +
|
||||
formatNumber(aug.baseCost * fac.augmentationPriceMult, 2) + "?");
|
||||
|
||||
//Clear old event listeners from Confirm button
|
||||
var newConfirmButton = clearEventListeners("purchase-augmentation-box-confirm");
|
||||
|
||||
newConfirmButton.addEventListener("click", function() {
|
||||
|
||||
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
|
||||
if (aug.name == AugmentationNames.Targeting2 &&
|
||||
Augmentations[AugmentationNames.Targeting1].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
|
||||
} else if (aug.name == AugmentationNames.Targeting3 &&
|
||||
Augmentations[AugmentationNames.Targeting2].owned == false) {
|
||||
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
|
||||
} else if (aug.name == AugmentationNames.CombatRib2 &&
|
||||
Augmentations[AugmentationNames.CombatRib1].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
|
||||
} else if (aug.name == AugmentationNames.CombatRib3 &&
|
||||
Augmentations[AugmentationNames.CombatRib2].owned == false) {
|
||||
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicSpine &&
|
||||
Augmentations[AugmentationNames.BionicSpine].owned == false) {
|
||||
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicLegs &&
|
||||
Augmentations[AugmentationNames.BionicLegs].owned == false) {
|
||||
dialogBoxCreate("You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV2 &&
|
||||
Augmentations[AugmentationNames.ENMCore].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
|
||||
} else if (aug.name == AugmentationNames.ENMCoreV3 &&
|
||||
Augmentations[AugmentationNames.ENMCoreV2].owned == false) {
|
||||
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
|
||||
} else if ((aug.name == AugmentationNames.ENMCore ||
|
||||
aug.name == AugmentationNames.ENMAnalyzeEngine ||
|
||||
aug.name == AugmentationNames.ENMDMA) &&
|
||||
Augmentations[AugmentationNames.ENM].owned == false) {
|
||||
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
|
||||
} else if ((aug.name == AugmentationNames.PCDNIOptimizer ||
|
||||
aug.name == AugmentationNames.PCDNINeuralNetwork) &&
|
||||
Augmentations[AugmentationNames.PCDNI].owned == false) {
|
||||
dialogBoxCreate("You must first install the Pc Direct-Neural Interface before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBrachiBlades &&
|
||||
Augmentations[AugmentationNames.BrachiBlades].owned == false) {
|
||||
dialogBoxCreate("You must first install the Brachi Blades augmentation before installing this upgrade");
|
||||
} else if (aug.name == AugmentationNames.GrapheneBionicArms &&
|
||||
Augmentations[AugmentationNames.BionicArms].owned == false) {
|
||||
dialogBoxCreate("You must first install the Bionic Arms augmentation before installing this upgrade");
|
||||
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
|
||||
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
queuedAugmentation.level = getNextNeurofluxLevel();
|
||||
}
|
||||
Player.queuedAugmentations.push(queuedAugmentation);
|
||||
|
||||
Player.loseMoney((aug.baseCost * fac.augmentationPriceMult));
|
||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.");
|
||||
|
||||
//If you just purchased Neuroflux Governor, recalculate the cost
|
||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||
var nextLevel = getNextNeurofluxLevel();
|
||||
--nextLevel;
|
||||
var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
|
||||
aug.setRequirements(500 * mult, 750000 * mult);
|
||||
|
||||
for (var i = 0; i < Player.queuedAugmentations.length-1; ++i) {
|
||||
aug.baseCost *= CONSTANTS.MultipleAugMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
for (var name in Augmentations) {
|
||||
if (Augmentations.hasOwnProperty(name)) {
|
||||
Augmentations[name].baseCost *= CONSTANTS.MultipleAugMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
displayFactionAugmentations(fac.name);
|
||||
} else {
|
||||
dialogBoxCreate("You don't have enough money to purchase this Augmentation!");
|
||||
}
|
||||
purchaseAugmentationBoxClose();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
purchaseAugmentationBoxOpen();
|
||||
}
|
||||
|
||||
function getNextNeurofluxLevel() {
|
||||
var aug = Augmentations[AugmentationNames.NeuroFluxGovernor];
|
||||
if (aug == null) {
|
||||
for (var i = 0; i < Player.augmentations.length; ++i) {
|
||||
if (Player.augmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
aug = Player.augmentations[i];
|
||||
}
|
||||
}
|
||||
if (aug == null) {
|
||||
console.log("ERROR, Could not find NeuroFlux Governor aug");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
var nextLevel = aug.level + 1;
|
||||
for (var i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||
if (Player.queuedAugmentations[i].name == AugmentationNames.NeuroFluxGovernor) {
|
||||
++nextLevel;
|
||||
}
|
||||
}
|
||||
return nextLevel;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* Pop up Purchase Server Box */
|
||||
function purchaseServerBoxInit() {
|
||||
var cancelButton = document.getElementById("purchase-server-box-cancel");
|
||||
|
||||
//Close Dialog box
|
||||
cancelButton.addEventListener("click", function() {
|
||||
purchaseServerBoxClose();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener("DOMContentLoaded", purchaseServerBoxInit, false);
|
||||
|
||||
purchaseServerBoxClose = function() {
|
||||
var purchaseServerBox = document.getElementById("purchase-server-box-container");
|
||||
purchaseServerBox.style.display = "none";
|
||||
}
|
||||
|
||||
purchaseServerBoxOpen = function() {
|
||||
var purchaseServerBox = document.getElementById("purchase-server-box-container");
|
||||
purchaseServerBox.style.display = "block";
|
||||
}
|
||||
|
||||
purchaseServerBoxSetText = function(txt) {
|
||||
var purchaseServerBox = document.getElementById("purchase-server-box-text");
|
||||
purchaseServerBox.innerHTML = txt;
|
||||
}
|
||||
|
||||
//ram argument is in GB
|
||||
purchaseServerBoxCreate = function(ram, cost) {
|
||||
purchaseServerBoxSetText("Would you like to purchase a new server with " + ram + "GB of RAM for $" + cost + "?" );
|
||||
|
||||
//Clear old event listeners from Confirm button
|
||||
var newConfirmButton = clearEventListeners("purchase-server-box-confirm");
|
||||
newConfirmButton.addEventListener("click", function() {
|
||||
purchaseServerBoxClose();
|
||||
purchaseServer(ram, cost);
|
||||
return false;
|
||||
});
|
||||
|
||||
purchaseServerBoxOpen();
|
||||
}
|
8
utils/numeral.min.js
vendored
Normal file
8
utils/numeral.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user