This commit is contained in:
danielyxie 2019-02-23 20:27:09 -08:00
commit d2762a99b1
2 changed files with 67 additions and 16 deletions

@ -3,6 +3,8 @@ import { CodingContractTypes } from "./CodingContracts";
import { generateContract, import { generateContract,
generateRandomContract, generateRandomContract,
generateRandomContractOnHome } from "./CodingContractGenerator"; generateRandomContractOnHome } from "./CodingContractGenerator";
import { Companies } from "./Company/Companies";
import { Company } from "./Company/Company";
import { Programs } from "./Programs/Programs"; import { Programs } from "./Programs/Programs";
import { Factions } from "./Faction/Factions"; import { Factions } from "./Faction/Factions";
import { Player } from "./Player"; import { Player } from "./Player";
@ -373,6 +375,38 @@ export function createDevMenu() {
innerText: "Connect to server", 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 // Bladeburner
const bladeburnerHeader = createElement("h2", {innerText: "Bladeburner"}); const bladeburnerHeader = createElement("h2", {innerText: "Bladeburner"});
@ -599,6 +633,11 @@ export function createDevMenu() {
devMenuContainer.appendChild(serversMaxMoneyAll); devMenuContainer.appendChild(serversMaxMoneyAll);
devMenuContainer.appendChild(serversConnectToDropdown); devMenuContainer.appendChild(serversConnectToDropdown);
devMenuContainer.appendChild(serversConnectToButton); devMenuContainer.appendChild(serversConnectToButton);
devMenuContainer.appendChild(companiesHeader);
devMenuContainer.appendChild(companiesDropdown);
devMenuContainer.appendChild(createElement("br"));
devMenuContainer.appendChild(companyReputationInput);
devMenuContainer.appendChild(companyReputationButton);
devMenuContainer.appendChild(bladeburnerHeader); devMenuContainer.appendChild(bladeburnerHeader);
devMenuContainer.appendChild(bladeburnerGainRankInput); devMenuContainer.appendChild(bladeburnerGainRankInput);
devMenuContainer.appendChild(bladeburnerGainRankButton); devMenuContainer.appendChild(bladeburnerGainRankButton);

@ -2043,15 +2043,27 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var numAugmentations = this.augmentations.length; 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 allCompanies = Object.keys(this.jobs);
const allPositions = Object.values(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 //Illuminati
var illuminatiFac = Factions["Illuminati"]; var illuminatiFac = Factions["Illuminati"];
if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited && if (!illuminatiFac.isBanned && !illuminatiFac.isMember && !illuminatiFac.alreadyInvited &&
@ -2090,14 +2102,14 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
//ECorp //ECorp
var ecorpFac = Factions["ECorp"]; var ecorpFac = Factions["ECorp"];
if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited && if (!ecorpFac.isBanned && !ecorpFac.isMember && !ecorpFac.alreadyInvited &&
allCompanies.includes(Locations.AevumECorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumECorp)) {
invitedFactions.push(ecorpFac); invitedFactions.push(ecorpFac);
} }
//MegaCorp //MegaCorp
var megacorpFac = Factions["MegaCorp"]; var megacorpFac = Factions["MegaCorp"];
if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited && if (!megacorpFac.isBanned && !megacorpFac.isMember && !megacorpFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12MegaCorp) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12MegaCorp)) {
invitedFactions.push(megacorpFac); invitedFactions.push(megacorpFac);
} }
@ -2105,42 +2117,42 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var bachmanandassociatesFac = Factions["Bachman & Associates"]; var bachmanandassociatesFac = Factions["Bachman & Associates"];
if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember && if (!bachmanandassociatesFac.isBanned && !bachmanandassociatesFac.isMember &&
!bachmanandassociatesFac.alreadyInvited && !bachmanandassociatesFac.alreadyInvited &&
allCompanies.includes(Locations.AevumBachmanAndAssociates) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumBachmanAndAssociates)) {
invitedFactions.push(bachmanandassociatesFac); invitedFactions.push(bachmanandassociatesFac);
} }
//Blade Industries //Blade Industries
var bladeindustriesFac = Factions["Blade Industries"]; var bladeindustriesFac = Factions["Blade Industries"];
if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited && if (!bladeindustriesFac.isBanned && !bladeindustriesFac.isMember && !bladeindustriesFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12BladeIndustries) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12BladeIndustries)) {
invitedFactions.push(bladeindustriesFac); invitedFactions.push(bladeindustriesFac);
} }
//NWO //NWO
var nwoFac = Factions["NWO"]; var nwoFac = Factions["NWO"];
if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited && if (!nwoFac.isBanned && !nwoFac.isMember && !nwoFac.alreadyInvited &&
allCompanies.includes(Locations.VolhavenNWO) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.VolhavenNWO)) {
invitedFactions.push(nwoFac); invitedFactions.push(nwoFac);
} }
//Clarke Incorporated //Clarke Incorporated
var clarkeincorporatedFac = Factions["Clarke Incorporated"]; var clarkeincorporatedFac = Factions["Clarke Incorporated"];
if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited && if (!clarkeincorporatedFac.isBanned && !clarkeincorporatedFac.isMember && !clarkeincorporatedFac.alreadyInvited &&
allCompanies.includes(Locations.AevumClarkeIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.AevumClarkeIncorporated)) {
invitedFactions.push(clarkeincorporatedFac); invitedFactions.push(clarkeincorporatedFac);
} }
//OmniTek Incorporated //OmniTek Incorporated
var omnitekincorporatedFac = Factions["OmniTek Incorporated"]; var omnitekincorporatedFac = Factions["OmniTek Incorporated"];
if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited && if (!omnitekincorporatedFac.isBanned && !omnitekincorporatedFac.isMember && !omnitekincorporatedFac.alreadyInvited &&
allCompanies.includes(Locations.VolhavenOmniTekIncorporated) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.VolhavenOmniTekIncorporated)) {
invitedFactions.push(omnitekincorporatedFac); invitedFactions.push(omnitekincorporatedFac);
} }
//Four Sigma //Four Sigma
var foursigmaFac = Factions["Four Sigma"]; var foursigmaFac = Factions["Four Sigma"];
if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited && if (!foursigmaFac.isBanned && !foursigmaFac.isMember && !foursigmaFac.alreadyInvited &&
allCompanies.includes(Locations.Sector12FourSigma) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.Sector12FourSigma)) {
invitedFactions.push(foursigmaFac); invitedFactions.push(foursigmaFac);
} }
@ -2148,7 +2160,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
var kuaigonginternationalFac = Factions["KuaiGong International"]; var kuaigonginternationalFac = Factions["KuaiGong International"];
if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember && if (!kuaigonginternationalFac.isBanned && !kuaigonginternationalFac.isMember &&
!kuaigonginternationalFac.alreadyInvited && !kuaigonginternationalFac.alreadyInvited &&
allCompanies.includes(Locations.ChongqingKuaiGongInternational) && companyRep >= CONSTANTS.CorpFactionRepRequirement) { checkMegacorpRequirements(Locations.ChongqingKuaiGongInternational)) {
invitedFactions.push(kuaigonginternationalFac); invitedFactions.push(kuaigonginternationalFac);
} }
@ -2161,7 +2173,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember && if (!fulcrumsecrettechonologiesFac.isBanned && !fulcrumsecrettechonologiesFac.isMember &&
!fulcrumsecrettechonologiesFac.alreadyInvited && !fulcrumsecrettechonologiesFac.alreadyInvited &&
fulcrumSecretServer.manuallyHacked && fulcrumSecretServer.manuallyHacked &&
allCompanies.includes(Locations.AevumFulcrumTechnologies) && companyRep >= 250000) { checkMegacorpRequirements(Locations.AevumFulcrumTechnologies, 250e3)) {
invitedFactions.push(fulcrumsecrettechonologiesFac); invitedFactions.push(fulcrumsecrettechonologiesFac);
} }
} }