mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 23:22:29 +01:00
Fixed an issue with people getting invited to Megacorporation factions even if they didnt meet the rep requirements
This commit is contained in:
parent
f4bb5f3299
commit
d043ea67cc
@ -3,6 +3,8 @@ import { CodingContractTypes } from "./CodingContracts";
|
||||
import { generateContract,
|
||||
generateRandomContract,
|
||||
generateRandomContractOnHome } from "./CodingContractGenerator";
|
||||
import { Companies } from "./Company/Companies";
|
||||
import { Company } from "./Company/Company";
|
||||
import { Programs } from "./Programs/Programs";
|
||||
import { Factions } from "./Faction/Factions";
|
||||
import { Player } from "./Player";
|
||||
@ -373,6 +375,38 @@ export function createDevMenu() {
|
||||
innerText: "Connect to server",
|
||||
});
|
||||
|
||||
// Companies
|
||||
const companiesHeader = createElement("h2", { innerText: "Companies" });
|
||||
|
||||
const companiesDropdown = createElement("select", {
|
||||
class: "dropdown",
|
||||
margin: "5px",
|
||||
});
|
||||
for (const c in Companies) {
|
||||
companiesDropdown.add(createOptionElement(Companies[c].name));
|
||||
}
|
||||
|
||||
const companyReputationInput = createElement("input", {
|
||||
margin: "5px",
|
||||
placeholder: "Rep to add to company",
|
||||
type: "number",
|
||||
});
|
||||
|
||||
const companyReputationButton = createElement("button", {
|
||||
class: "std-button",
|
||||
innerText: "Add rep to company",
|
||||
clickListener: () => {
|
||||
const compName = getSelectText(companiesDropdown);
|
||||
const company = Companies[compName];
|
||||
const rep = parseFloat(companyReputationInput.value);
|
||||
if (company != null && !isNaN(rep)) {
|
||||
company.playerReputation += rep;
|
||||
} else {
|
||||
console.warn(`Invalid input for Dev Menu Company Rep. Company Name: ${compName}. Rep: ${rep}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Bladeburner
|
||||
const bladeburnerHeader = createElement("h2", {innerText: "Bladeburner"});
|
||||
|
||||
@ -599,6 +633,11 @@ export function createDevMenu() {
|
||||
devMenuContainer.appendChild(serversMaxMoneyAll);
|
||||
devMenuContainer.appendChild(serversConnectToDropdown);
|
||||
devMenuContainer.appendChild(serversConnectToButton);
|
||||
devMenuContainer.appendChild(companiesHeader);
|
||||
devMenuContainer.appendChild(companiesDropdown);
|
||||
devMenuContainer.appendChild(createElement("br"));
|
||||
devMenuContainer.appendChild(companyReputationInput);
|
||||
devMenuContainer.appendChild(companyReputationButton);
|
||||
devMenuContainer.appendChild(bladeburnerHeader);
|
||||
devMenuContainer.appendChild(bladeburnerGainRankInput);
|
||||
devMenuContainer.appendChild(bladeburnerGainRankButton);
|
||||
|
@ -2043,15 +2043,27 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
|
||||
var numAugmentations = this.augmentations.length;
|
||||
|
||||
var company = Companies[this.companyName];
|
||||
var companyRep = 0;
|
||||
if (company != null) {
|
||||
companyRep = company.playerReputation;
|
||||
}
|
||||
|
||||
const allCompanies = Object.keys(this.jobs);
|
||||
const allPositions = Object.values(this.jobs);
|
||||
|
||||
// Given a company name, safely returns the reputation (returns 0 if invalid company is specified)
|
||||
function getCompanyRep(companyName) {
|
||||
const company = Companies[companyName];
|
||||
if (company == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return company.playerReputation;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function that returns a boolean indicating whether the Player meets
|
||||
// the requirements for the specified company. There are two requirements:
|
||||
// 1. High enough reputation
|
||||
// 2. Player is employed at the company
|
||||
function checkMegacorpRequirements(companyName, repNeeded=CONSTANTS.CorpFactionRepRequirement) {
|
||||
return allCompanies.includes(companyName) && (getCompanyRep(companyName) > repNeeded);
|
||||
}
|
||||
|
||||
//Illuminati
|
||||
var illuminatiFac = Factions["Illuminati"];
|
||||
if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited &&
|
||||
@ -2090,14 +2102,14 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
//ECorp
|
||||
var ecorpFac = Factions["ECorp"];
|
||||
if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.AevumECorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.AevumECorp)) {
|
||||
invitedFactions.push(ecorpFac);
|
||||
}
|
||||
|
||||
//MegaCorp
|
||||
var megacorpFac = Factions["MegaCorp"];
|
||||
if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.Sector12MegaCorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.Sector12MegaCorp)) {
|
||||
invitedFactions.push(megacorpFac);
|
||||
}
|
||||
|
||||
@ -2105,42 +2117,42 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
var bachmanandassociatesFac = Factions["Bachman & Associates"];
|
||||
if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember &&
|
||||
!bachmanandassociatesFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.AevumBachmanAndAssociates) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.AevumBachmanAndAssociates)) {
|
||||
invitedFactions.push(bachmanandassociatesFac);
|
||||
}
|
||||
|
||||
//Blade Industries
|
||||
var bladeindustriesFac = Factions["Blade Industries"];
|
||||
if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.Sector12BladeIndustries) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.Sector12BladeIndustries)) {
|
||||
invitedFactions.push(bladeindustriesFac);
|
||||
}
|
||||
|
||||
//NWO
|
||||
var nwoFac = Factions["NWO"];
|
||||
if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.VolhavenNWO) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.VolhavenNWO)) {
|
||||
invitedFactions.push(nwoFac);
|
||||
}
|
||||
|
||||
//Clarke Incorporated
|
||||
var clarkeincorporatedFac = Factions["Clarke Incorporated"];
|
||||
if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.AevumClarkeIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.AevumClarkeIncorporated)) {
|
||||
invitedFactions.push(clarkeincorporatedFac);
|
||||
}
|
||||
|
||||
//OmniTek Incorporated
|
||||
var omnitekincorporatedFac = Factions["OmniTek Incorporated"];
|
||||
if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.VolhavenOmniTekIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.VolhavenOmniTekIncorporated)) {
|
||||
invitedFactions.push(omnitekincorporatedFac);
|
||||
}
|
||||
|
||||
//Four Sigma
|
||||
var foursigmaFac = Factions["Four Sigma"];
|
||||
if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.Sector12FourSigma) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.Sector12FourSigma)) {
|
||||
invitedFactions.push(foursigmaFac);
|
||||
}
|
||||
|
||||
@ -2148,7 +2160,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
var kuaigonginternationalFac = Factions["KuaiGong International"];
|
||||
if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember &&
|
||||
!kuaigonginternationalFac.alreadyInvited &&
|
||||
allCompanies.includes(Locations.ChongqingKuaiGongInternational) && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
|
||||
checkMegacorpRequirements(Locations.ChongqingKuaiGongInternational)) {
|
||||
invitedFactions.push(kuaigonginternationalFac);
|
||||
}
|
||||
|
||||
@ -2161,7 +2173,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
||||
if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&
|
||||
!fulcrumsecrettechonologiesFac.alreadyInvited &&
|
||||
fulcrumSecretServer.manuallyHacked &&
|
||||
allCompanies.includes(Locations.AevumFulcrumTechnologies) && companyRep >= 250000) {
|
||||
checkMegacorpRequirements(Locations.AevumFulcrumTechnologies, 250e3)) {
|
||||
invitedFactions.push(fulcrumsecrettechonologiesFac);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user