mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Fixed bug with creating gangs
This commit is contained in:
parent
a8e28e3d71
commit
9b96e2537d
1491
dist/bundle.js
vendored
1491
dist/bundle.js
vendored
File diff suppressed because it is too large
Load Diff
@ -134,6 +134,7 @@ function getNumAvailableCreateProgram() {
|
|||||||
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
if (count > 0) {Player.firstProgramAvailable = true;}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@ import {Augmentations, AugmentationNames,
|
|||||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode.js";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants.js";
|
||||||
import {Player} from "./Player.js";
|
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine.js";
|
||||||
import {FactionInfo} from "./FactionInfo.js";
|
import {FactionInfo} from "./FactionInfo.js";
|
||||||
|
import {Locations} from "./Location.js";
|
||||||
|
import {Player} from "./Player.js";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings.js";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||||
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox.js";
|
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox.js";
|
||||||
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
||||||
@ -568,8 +570,8 @@ function displayFactionContent(factionName) {
|
|||||||
noBtn.innerHTML = "Cancel";
|
noBtn.innerHTML = "Cancel";
|
||||||
yesBtn.addEventListener("click", () => {
|
yesBtn.addEventListener("click", () => {
|
||||||
var hacking = false;
|
var hacking = false;
|
||||||
if (factionName == "NiteSec" || factionName == "The Black Hand") {hacking = true;}
|
if (factionName === "NiteSec" || factionName === "The Black Hand") {hacking = true;}
|
||||||
Player.gang = new Gang(factionName, hacking);
|
Player.startGang(factionName, hacking);
|
||||||
Engine.loadGangContent();
|
Engine.loadGangContent();
|
||||||
yesNoBoxClose();
|
yesNoBoxClose();
|
||||||
});
|
});
|
||||||
@ -906,6 +908,8 @@ function purchaseAugmentation(aug, fac, sing=false) {
|
|||||||
var txt = "You must first install the Bionic Arms augmentation before installing this upgrade";
|
var txt = "You must first install the Bionic Arms augmentation before installing this upgrade";
|
||||||
if (sing) {return txt;} else {dialogBoxCreate(txt);}
|
if (sing) {return txt;} else {dialogBoxCreate(txt);}
|
||||||
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
|
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
|
||||||
|
Player.firstAugPurchased = true;
|
||||||
|
|
||||||
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
|
var queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
|
||||||
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
|
||||||
queuedAugmentation.level = getNextNeurofluxLevel();
|
queuedAugmentation.level = getNextNeurofluxLevel();
|
||||||
|
@ -1840,6 +1840,7 @@ function initLocationButtons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function travelToCity(destCityName, cost) {
|
function travelToCity(destCityName, cost) {
|
||||||
|
Player.firstTimeTraveled = true;
|
||||||
if (Player.money.lt(cost)) {
|
if (Player.money.lt(cost)) {
|
||||||
dialogBoxCreate("You cannot afford to travel to " + destCityName);
|
dialogBoxCreate("You cannot afford to travel to " + destCityName);
|
||||||
return;
|
return;
|
||||||
|
@ -105,15 +105,8 @@ function PlayerObject() {
|
|||||||
this.sourceFiles = [];
|
this.sourceFiles = [];
|
||||||
|
|
||||||
//Crime statistics
|
//Crime statistics
|
||||||
this.karma = 0;
|
|
||||||
this.numTimesShoplifted = 0;
|
|
||||||
this.numPeopleMugged = 0;
|
|
||||||
this.numTimesDealtDrugs = 0;
|
|
||||||
this.numTimesTraffickArms = 0;
|
|
||||||
this.numPeopleKilled = 0;
|
this.numPeopleKilled = 0;
|
||||||
this.numTimesGrandTheftAuto = 0;
|
this.karma = 0;
|
||||||
this.numTimesKidnapped = 0;
|
|
||||||
this.numTimesHeist = 0;
|
|
||||||
|
|
||||||
this.crime_money_mult = 1;
|
this.crime_money_mult = 1;
|
||||||
this.crime_success_mult = 1;
|
this.crime_success_mult = 1;
|
||||||
@ -172,11 +165,18 @@ function PlayerObject() {
|
|||||||
this.hasTixApiAccess = false;
|
this.hasTixApiAccess = false;
|
||||||
|
|
||||||
//Gang
|
//Gang
|
||||||
this.gang = null;
|
this.gang = 0;
|
||||||
|
|
||||||
//bitnode
|
//bitnode
|
||||||
this.bitNodeN = 1;
|
this.bitNodeN = 1;
|
||||||
|
|
||||||
|
//Flags for determining whether certain "thresholds" have been achieved
|
||||||
|
this.firstFacInvRecvd = false;
|
||||||
|
this.firstAugPurchased = false;
|
||||||
|
this.firstJobRecvd = false;
|
||||||
|
this.firstTimeTraveled = false;
|
||||||
|
this.firstProgramAvailable = false;
|
||||||
|
|
||||||
//Used to store the last update time.
|
//Used to store the last update time.
|
||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.totalPlaytime = 0;
|
this.totalPlaytime = 0;
|
||||||
@ -207,16 +207,7 @@ PlayerObject.prototype.prestigeAugmentation = function() {
|
|||||||
this.currentServer = homeComp.ip;
|
this.currentServer = homeComp.ip;
|
||||||
this.homeComputer = homeComp.ip;
|
this.homeComputer = homeComp.ip;
|
||||||
|
|
||||||
//Crime statistics
|
|
||||||
this.numTimesShoplifted = 0;
|
|
||||||
this.numPeopleMugged = 0;
|
|
||||||
this.numTimesDealtDrugs = 0;
|
|
||||||
this.numTimesTraffickArms = 0;
|
|
||||||
this.numPeopleKilled = 0;
|
this.numPeopleKilled = 0;
|
||||||
this.numTimesGrandTheftAuto = 0;
|
|
||||||
this.numTimesKidnapped = 0;
|
|
||||||
this.numTimesHeist = 0;
|
|
||||||
|
|
||||||
this.karma = 0;
|
this.karma = 0;
|
||||||
|
|
||||||
//Reset stats
|
//Reset stats
|
||||||
@ -295,15 +286,7 @@ PlayerObject.prototype.prestigeSourceFile = function() {
|
|||||||
this.currentServer = homeComp.ip;
|
this.currentServer = homeComp.ip;
|
||||||
this.homeComputer = homeComp.ip;
|
this.homeComputer = homeComp.ip;
|
||||||
|
|
||||||
this.numTimesShoplifted = 0;
|
|
||||||
this.numPeopleMugged = 0;
|
|
||||||
this.numTimesDealtDrugs = 0;
|
|
||||||
this.numTimesTraffickArms = 0;
|
|
||||||
this.numPeopleKilled = 0;
|
this.numPeopleKilled = 0;
|
||||||
this.numTimesGrandTheftAuto = 0;
|
|
||||||
this.numTimesKidnapped = 0;
|
|
||||||
this.numTimesHeist = 0;
|
|
||||||
|
|
||||||
this.karma = 0;
|
this.karma = 0;
|
||||||
|
|
||||||
//Reset stats
|
//Reset stats
|
||||||
@ -1425,24 +1408,20 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
|
|||||||
switch(this.crimeType) {
|
switch(this.crimeType) {
|
||||||
case CONSTANTS.CrimeShoplift:
|
case CONSTANTS.CrimeShoplift:
|
||||||
this.karma -= 0.1;
|
this.karma -= 0.1;
|
||||||
++this.numTimesShoplifted;
|
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeRobStore:
|
case CONSTANTS.CrimeRobStore:
|
||||||
this.karma -= 0.5;
|
this.karma -= 0.5;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeMug:
|
case CONSTANTS.CrimeMug:
|
||||||
this.karma -= 0.25;
|
this.karma -= 0.25;
|
||||||
++this.numPeopleMugged;
|
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeLarceny:
|
case CONSTANTS.CrimeLarceny:
|
||||||
this.karma -= 1.5;
|
this.karma -= 1.5;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeDrugs:
|
case CONSTANTS.CrimeDrugs:
|
||||||
++this.numTimesDealtDrugs;
|
|
||||||
this.karma -= 0.5;
|
this.karma -= 0.5;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeTraffickArms:
|
case CONSTANTS.CrimeTraffickArms:
|
||||||
++this.numTimesTraffickArms;
|
|
||||||
this.karma -= 1;
|
this.karma -= 1;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeHomicide:
|
case CONSTANTS.CrimeHomicide:
|
||||||
@ -1450,11 +1429,9 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
|
|||||||
this.karma -= 3;
|
this.karma -= 3;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeGrandTheftAuto:
|
case CONSTANTS.CrimeGrandTheftAuto:
|
||||||
++this.numTimesGrandTheftAuto;
|
|
||||||
this.karma -= 5;
|
this.karma -= 5;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeKidnap:
|
case CONSTANTS.CrimeKidnap:
|
||||||
++this.numTimesKidnapped;
|
|
||||||
this.karma -= 6;
|
this.karma -= 6;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeAssassination:
|
case CONSTANTS.CrimeAssassination:
|
||||||
@ -1462,7 +1439,6 @@ PlayerObject.prototype.finishCrime = function(cancelled) {
|
|||||||
this.karma -= 10;
|
this.karma -= 10;
|
||||||
break;
|
break;
|
||||||
case CONSTANTS.CrimeHeist:
|
case CONSTANTS.CrimeHeist:
|
||||||
++this.numTimesHeist;
|
|
||||||
this.karma -= 15;
|
this.karma -= 15;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1638,6 +1614,8 @@ PlayerObject.prototype.applyForJob = function(entryPosType, sing=false) {
|
|||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = pos;
|
this.companyPosition = pos;
|
||||||
|
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
|
|
||||||
if (leaveCompany) {
|
if (leaveCompany) {
|
||||||
if (sing) {return true;}
|
if (sing) {return true;}
|
||||||
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " +
|
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " +
|
||||||
@ -1740,6 +1718,7 @@ PlayerObject.prototype.applyForAgentJob = function(sing=false) {
|
|||||||
PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
|
PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
|
||||||
var company = Companies[this.location]; //Company being applied to
|
var company = Companies[this.location]; //Company being applied to
|
||||||
if (this.isQualified(company, CompanyPositions.Employee)) {
|
if (this.isQualified(company, CompanyPositions.Employee)) {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = CompanyPositions.Employee;
|
this.companyPosition = CompanyPositions.Employee;
|
||||||
if (sing) {return true;}
|
if (sing) {return true;}
|
||||||
@ -1754,6 +1733,7 @@ PlayerObject.prototype.applyForEmployeeJob = function(sing=false) {
|
|||||||
PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
|
PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
|
||||||
var company = Companies[this.location]; //Company being applied to
|
var company = Companies[this.location]; //Company being applied to
|
||||||
if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) {
|
if (this.isQualified(company, CompanyPositions.PartTimeEmployee)) {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = CompanyPositions.PartTimeEmployee;
|
this.companyPosition = CompanyPositions.PartTimeEmployee;
|
||||||
if (sing) {return true;}
|
if (sing) {return true;}
|
||||||
@ -1768,6 +1748,7 @@ PlayerObject.prototype.applyForPartTimeEmployeeJob = function(sing=false) {
|
|||||||
PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
|
PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
|
||||||
var company = Companies[this.location]; //Company being applied to
|
var company = Companies[this.location]; //Company being applied to
|
||||||
if (this.isQualified(company, CompanyPositions.Waiter)) {
|
if (this.isQualified(company, CompanyPositions.Waiter)) {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = CompanyPositions.Waiter;
|
this.companyPosition = CompanyPositions.Waiter;
|
||||||
if (sing) {return true;}
|
if (sing) {return true;}
|
||||||
@ -1782,6 +1763,7 @@ PlayerObject.prototype.applyForWaiterJob = function(sing=false) {
|
|||||||
PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) {
|
PlayerObject.prototype.applyForPartTimeWaiterJob = function(sing=false) {
|
||||||
var company = Companies[this.location]; //Company being applied to
|
var company = Companies[this.location]; //Company being applied to
|
||||||
if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) {
|
if (this.isQualified(company, CompanyPositions.PartTimeWaiter)) {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
this.companyName = company.companyName;
|
this.companyName = company.companyName;
|
||||||
this.companyPosition = CompanyPositions.PartTimeWaiter;
|
this.companyPosition = CompanyPositions.PartTimeWaiter;
|
||||||
if (sing) {return true;}
|
if (sing) {return true;}
|
||||||
@ -2171,6 +2153,10 @@ PlayerObject.prototype.inGang = function() {
|
|||||||
return (this.gang instanceof Gang);
|
return (this.gang instanceof Gang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerObject.prototype.startGang = function(factionName, hacking) {
|
||||||
|
this.gang = new Gang(factionName, hacking);
|
||||||
|
}
|
||||||
|
|
||||||
/************* BitNodes **************/
|
/************* BitNodes **************/
|
||||||
PlayerObject.prototype.setBitNodeNumber = function(n) {
|
PlayerObject.prototype.setBitNodeNumber = function(n) {
|
||||||
this.bitNodeN = n;
|
this.bitNodeN = n;
|
||||||
|
@ -142,10 +142,30 @@ function loadGame(saveObj) {
|
|||||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||||
try {
|
try {
|
||||||
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||||
|
if (Player.bitNodeN === null || Player.bitNodeN === 0) {
|
||||||
|
Player.setBitNodeNumber(1);
|
||||||
|
}
|
||||||
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
|
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
|
||||||
console.log("Evaluating changes needed for version compatibility");
|
console.log("Evaluating changes needed for version compatibility");
|
||||||
if (Player.bitNodeN == null || Player.bitNodeN == 0) {
|
if (Player.augmentations.length > 0 || Player.queuedAugmentations.length > 0 ||
|
||||||
Player.setBitNodeNumber(1);
|
Player.sourceFiles.length > 0) {
|
||||||
|
//If you have already purchased an Aug...you are far enough in the game
|
||||||
|
//that everything should be available
|
||||||
|
Player.firstFacInvRecvd = true;
|
||||||
|
Player.firstAugPurchased = true;
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
|
Player.firstTimeTraveled = true;
|
||||||
|
Player.firstProgramAvailable = true;
|
||||||
|
} else {
|
||||||
|
if (Player.factions.length > 0 || Player.factionInvitations.length > 0) {
|
||||||
|
Player.firstFacInvRecvd = true;
|
||||||
|
}
|
||||||
|
if (Player.companyName !== "" || Player.companyPosition !== "") {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
|
}
|
||||||
|
if (Player.hacking_skill >= 25) {
|
||||||
|
Player.firstScriptAvailable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ver != CONSTANTS.Version) {
|
if (ver != CONSTANTS.Version) {
|
||||||
@ -329,10 +349,31 @@ function loadImportedGame(saveObj, saveString) {
|
|||||||
if (saveObj.hasOwnProperty("VersionSave")) {
|
if (saveObj.hasOwnProperty("VersionSave")) {
|
||||||
try {
|
try {
|
||||||
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
var ver = JSON.parse(saveObj.VersionSave, Reviver);
|
||||||
if (ver.startsWith("0.27.")) {
|
|
||||||
console.log("Evaluating changes needed for version compatibility");
|
|
||||||
if (Player.bitNodeN == null || Player.bitNodeN == 0) {
|
if (Player.bitNodeN == null || Player.bitNodeN == 0) {
|
||||||
Player.setBitNodeNumber(1);
|
Player.setBitNodeNumber(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (ver.startsWith("0.27.") || ver.startsWith("0.28.")) {
|
||||||
|
console.log("Evaluating changes needed for version compatibility");
|
||||||
|
if (Player.augmentations.length > 0 || Player.queuedAugmentations.length > 0 ||
|
||||||
|
Player.sourceFiles.length > 0) {
|
||||||
|
//If you have already purchased an Aug...you are far enough in the game
|
||||||
|
//that everything should be available
|
||||||
|
Player.firstFacInvRecvd = true;
|
||||||
|
Player.firstAugPurchased = true;
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
|
Player.firstTimeTraveled = true;
|
||||||
|
Player.firstProgramAvailable = true;
|
||||||
|
} else {
|
||||||
|
if (Player.factions.length > 0 || Player.factionInvitations.length > 0) {
|
||||||
|
Player.firstFacInvRecvd = true;
|
||||||
|
}
|
||||||
|
if (Player.companyName !== "" || Player.companyPosition !== "") {
|
||||||
|
Player.firstJobRecvd = true;
|
||||||
|
}
|
||||||
|
if (Player.hacking_skill >= 25) {
|
||||||
|
Player.firstScriptAvailable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ver != CONSTANTS.Version) {
|
if (ver != CONSTANTS.Version) {
|
||||||
|
@ -27,14 +27,14 @@ import {Programs, displayCreateProgramContent,
|
|||||||
import {displayFactionContent, joinFaction,
|
import {displayFactionContent, joinFaction,
|
||||||
processPassiveFactionRepGain, Factions,
|
processPassiveFactionRepGain, Factions,
|
||||||
inviteToFaction, initFactions} from "./Faction.js";
|
inviteToFaction, initFactions} from "./Faction.js";
|
||||||
|
import {Locations, displayLocationContent,
|
||||||
|
initLocationButtons} from "./Location.js";
|
||||||
import {displayGangContent, updateGangContent,
|
import {displayGangContent, updateGangContent,
|
||||||
Gang} from "./Gang.js";
|
Gang} from "./Gang.js";
|
||||||
import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
||||||
updateHacknetNodesContent} from "./HacknetNode.js";
|
updateHacknetNodesContent} from "./HacknetNode.js";
|
||||||
import {iTutorialStart} from "./InteractiveTutorial.js";
|
import {iTutorialStart} from "./InteractiveTutorial.js";
|
||||||
import {initLiterature} from "./Literature.js";
|
import {initLiterature} from "./Literature.js";
|
||||||
import {Locations, displayLocationContent,
|
|
||||||
initLocationButtons} from "./Location.js";
|
|
||||||
import {checkForMessagesToSend, initMessages} from "./Message.js";
|
import {checkForMessagesToSend, initMessages} from "./Message.js";
|
||||||
import {initSingularitySFFlags,
|
import {initSingularitySFFlags,
|
||||||
hasSingularitySF} from "./NetscriptFunctions.js";
|
hasSingularitySF} from "./NetscriptFunctions.js";
|
||||||
@ -915,6 +915,7 @@ let Engine = {
|
|||||||
if (Engine.Counters.checkFactionInvitations <= 0) {
|
if (Engine.Counters.checkFactionInvitations <= 0) {
|
||||||
var invitedFactions = Player.checkForFactionInvitations();
|
var invitedFactions = Player.checkForFactionInvitations();
|
||||||
if (invitedFactions.length > 0) {
|
if (invitedFactions.length > 0) {
|
||||||
|
Player.firstFacInvRecvd = true;
|
||||||
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
|
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
|
||||||
inviteToFaction(randFaction);
|
inviteToFaction(randFaction);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user