Skip to content

Commit

Permalink
Merge pull request #108 from danielyxie/dev
Browse files Browse the repository at this point in the history
Dev v0.27.1
  • Loading branch information
danielyxie authored Aug 15, 2017
2 parents a5facac + 6975b46 commit 1d255fa
Show file tree
Hide file tree
Showing 16 changed files with 575 additions and 419 deletions.
25 changes: 1 addition & 24 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -741,17 +741,6 @@ <h1 id="location-name"></h1>
</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">
Expand All @@ -771,17 +760,6 @@ <h1 id="location-name"></h1>
</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">
Expand Down Expand Up @@ -980,14 +958,13 @@ <h1> Game Options </h1>
<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>
Expand Down
10 changes: 8 additions & 2 deletions src/Constants.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 " +
Expand All @@ -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 changes: 120 additions & 4 deletions src/Faction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 1d255fa

Please sign in to comment.