mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +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 " +
|
||||
|
122
src/Faction.js
122
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
|
||||
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 " +
|
||||
|
@ -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) {
|
||||
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) {
|
||||
if (e == "BREAKSTATEMENT" ||
|
||||
(e instanceof WorkerScript && e.errorMessage == "BREAKSTATEMENT")) {
|
||||
return resolve("forLoopBroken");
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
@ -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,14 +1176,33 @@ 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++) {
|
||||
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++) {
|
||||
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++) {
|
||||
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
|
||||
allFiles.sort();
|
||||
|
@ -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