From 8729b54a9cd672c492626c2c07b59520af628406 Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 19:42:30 +0000 Subject: [PATCH 01/40] Make 3.3 unlock all corp APIs --- .../Player/PlayerObjectCorporationMethods.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts index c00380606..a1bd6ca93 100644 --- a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts @@ -1,4 +1,5 @@ import { Corporation } from "../../Corporation/Corporation"; +import { CorporationUnlockUpgrades } from "../../Corporation/data/CorporationUnlockUpgrades"; import { SourceFileFlags } from "../../SourceFile/SourceFileFlags"; import { IPlayer } from "../IPlayer"; @@ -18,5 +19,13 @@ export function startCorporation(this: IPlayer, corpName: string, additionalShar name: corpName, }); + if (SourceFileFlags[3] === 3) { + const warehouseApi = CorporationUnlockUpgrades["7"][0]; + const OfficeApi = CorporationUnlockUpgrades["8"][0]; + + this.corporation.unlockUpgrades[warehouseApi] = 1; + this.corporation.unlockUpgrades[OfficeApi] = 1; + } + this.corporation.totalShares += additionalShares; } From bea6b0e0b1fa3bcb0dbe2c4ba7469073b5c39bd9 Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 19:42:51 +0000 Subject: [PATCH 02/40] Fix create corp text --- src/Corporation/ui/CreateCorporationModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Corporation/ui/CreateCorporationModal.tsx b/src/Corporation/ui/CreateCorporationModal.tsx index 43c6b9257..0b79c3611 100644 --- a/src/Corporation/ui/CreateCorporationModal.tsx +++ b/src/Corporation/ui/CreateCorporationModal.tsx @@ -56,9 +56,9 @@ export function CreateCorporationModal(props: IProps): React.ReactElement { return ( - Would you like to start a corporation? This will require $150b for registration and initial funding. This $150b + Would you like to start a corporation? This will require $150b for registration and initial funding. {player.bitNodeN === 3 && (`This $150b can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million - shares + shares`)}

If you would like to start one, please enter a name for your corporation below: From e2bb76ae6d3dbdf2ac22d09820ae1b15f7e757d1 Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 19:43:29 +0000 Subject: [PATCH 03/40] Add createCorp --- src/NetscriptFunctions/Corporation.ts | 19 +++++++++++++++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 67bb16e76..5e2cee8ce 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -59,6 +59,21 @@ export function NetscriptCorporation( workerScript: WorkerScript, helper: INetscriptHelper, ): NSCorporation { + function createCorporation(corporationName: string, selfFund = true): boolean { + if (!player.canAccessCorporation() || player.hasCorporation()) return false; + if (!corporationName) return false; + + if (selfFund) { + if (!player.canAfford(150e9)) return false; + + player.startCorporation(corporationName); + player.loseMoney(150e9, "corporation"); + } else { + player.startCorporation(corporationName, 500e6); + } + return true; + } + function getCorporation(): ICorporation { const corporation = player.corporation; if (corporation === null) throw new Error("cannot be called without a corporation"); @@ -482,6 +497,10 @@ export function NetscriptCorporation( cities: cities, }; }, + createCorporation: function (corporationName: string, selfFund = true): boolean { + checkAccess("createCorporation"); + return createCorporation(corporationName, selfFund); + }, getCorporation: function (): CorporationInfo { checkAccess("getCorporation"); const corporation = getCorporation(); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 8fc99aaaf..8603d6c99 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6314,6 +6314,12 @@ export interface WarehouseAPI { * @public */ export interface Corporation extends WarehouseAPI, OfficeAPI { + /** + * Create a Corporation + * @param divisionName - Name of the division + * @returns true if created and false if not + */ + createCorporation(corporationName: string, selfFund: boolean): boolean; /** * Get corporation data * @returns Corporation data From 2cfa589da61f77f6cecdca919b1ee2b0fc7f945d Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 19:53:53 +0000 Subject: [PATCH 04/40] Prevent seed money outside of 3 --- src/NetscriptFunctions/Corporation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 5e2cee8ce..9e8f9cf9d 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -62,6 +62,7 @@ export function NetscriptCorporation( function createCorporation(corporationName: string, selfFund = true): boolean { if (!player.canAccessCorporation() || player.hasCorporation()) return false; if (!corporationName) return false; + if (player.bitNodeN !== 3 && !selfFund) throw new Error("cannot use seed funds outside of BitNode 3"); if (selfFund) { if (!player.canAfford(150e9)) return false; @@ -498,7 +499,6 @@ export function NetscriptCorporation( }; }, createCorporation: function (corporationName: string, selfFund = true): boolean { - checkAccess("createCorporation"); return createCorporation(corporationName, selfFund); }, getCorporation: function (): CorporationInfo { From 360b8d8d16de2f27b7212f9e708c0cdd7390da0c Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 20:08:14 +0000 Subject: [PATCH 05/40] Add has corp to the api player object --- src/NetscriptFunctions.ts | 1 + src/ScriptEditor/NetscriptDefinitions.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index fc56a9b28..79e6b484f 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -2248,6 +2248,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { jobs: {}, factions: Player.factions.slice(), tor: Player.hasTorRouter(), + hasCorporation: Player.hasCorporation(), }; Object.assign(data.jobs, Player.jobs); return data; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 8603d6c99..7e84763c6 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -93,6 +93,7 @@ interface Player { jobs: any; factions: string[]; tor: boolean; + hasCorporation: boolean; } /** From 74019bc2be6f649669a6d867d7171f845b3babba Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 20:25:23 +0000 Subject: [PATCH 06/40] Make list of divisions accessable on the corp --- src/NetscriptFunctions/Corporation.ts | 44 ++++++++++++---------- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 + 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 9e8f9cf9d..6ab6b8da4 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -53,6 +53,7 @@ import { CorporationUnlockUpgrades } from "../Corporation/data/CorporationUnlock import { CorporationUpgrades } from "../Corporation/data/CorporationUpgrades"; import { EmployeePositions } from "../Corporation/EmployeePositions"; import { calculateIntelligenceBonus } from "../PersonObjects/formulas/intelligence"; +import { Industry } from "../Corporation/Industry"; export function NetscriptCorporation( player: IPlayer, @@ -133,6 +134,28 @@ export function NetscriptCorporation( throw helper.makeRuntimeErrorMsg(`corporation.${func}`, "You do not have access to this API."); } + function getSafeDivision(division: Industry): NSDivision { + const cities: string[] = []; + for (const office of Object.values(division.offices)) { + if (office === 0) continue; + cities.push(office.loc); + } + return { + name: division.name, + type: division.type, + awareness: division.awareness, + popularity: division.popularity, + prodMult: division.prodMult, + research: division.sciResearch.qty, + lastCycleRevenue: division.lastCycleRevenue, + lastCycleExpenses: division.lastCycleExpenses, + thisCycleRevenue: division.thisCycleRevenue, + thisCycleExpenses: division.thisCycleExpenses, + upgrades: division.upgrades, + cities: cities, + }; + } + const warehouseAPI: WarehouseAPI = { getWarehouse: function (adivisionName: any, acityName: any): NSWarehouse { checkAccess("getWarehouse", 7); @@ -478,25 +501,7 @@ export function NetscriptCorporation( checkAccess("getDivision"); const divisionName = helper.string("getDivision", "divisionName", adivisionName); const division = getDivision(divisionName); - const cities: string[] = []; - for (const office of Object.values(division.offices)) { - if (office === 0) continue; - cities.push(office.loc); - } - return { - name: division.name, - type: division.type, - awareness: division.awareness, - popularity: division.popularity, - prodMult: division.prodMult, - research: division.sciResearch.qty, - lastCycleRevenue: division.lastCycleRevenue, - lastCycleExpenses: division.lastCycleExpenses, - thisCycleRevenue: division.thisCycleRevenue, - thisCycleExpenses: division.thisCycleExpenses, - upgrades: division.upgrades, - cities: cities, - }; + return getSafeDivision(division); }, createCorporation: function (corporationName: string, selfFund = true): boolean { return createCorporation(corporationName, selfFund); @@ -516,6 +521,7 @@ export function NetscriptCorporation( issuedShares: corporation.issuedShares, sharePrice: corporation.sharePrice, state: corporation.state.getState(), + divisions: corporation.divisions.map((division): NSDivision => getSafeDivision(division)), }; }, }; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 7e84763c6..0a1e935a4 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6388,6 +6388,8 @@ interface CorporationInfo { sharePrice: number; /** State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT. */ state: string; + /** Array of all divisions */ + divisions: Division[]; } /** From 42d767b443d93147e50484762a1d09a0f8f0659d Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 23:46:25 +0000 Subject: [PATCH 07/40] Fix Bug with smart supply leftovers --- src/Corporation/ui/SmartSupplyModal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Corporation/ui/SmartSupplyModal.tsx b/src/Corporation/ui/SmartSupplyModal.tsx index d853ec2f7..b4c031d99 100644 --- a/src/Corporation/ui/SmartSupplyModal.tsx +++ b/src/Corporation/ui/SmartSupplyModal.tsx @@ -20,7 +20,8 @@ function Leftover(props: ILeftoverProps): React.ReactElement { function onChange(event: React.ChangeEvent): void { try { - const material = props.warehouse.materials[props.matName]; + const matName = props.matName.replace(/ /g, ""); + const material = props.warehouse.materials[matName]; SetSmartSupplyUseLeftovers(props.warehouse, material, event.target.checked); } catch (err) { dialogBoxCreate(err + ""); From 1b8c715a5e441a6a468370fcbb10e2bdc679b267 Mon Sep 17 00:00:00 2001 From: pigalot Date: Tue, 11 Jan 2022 23:47:04 +0000 Subject: [PATCH 08/40] Add costs and count function for ads --- src/NetscriptFunctions/Corporation.ts | 117 ++++++++++++++++++++- src/ScriptEditor/NetscriptDefinitions.d.ts | 66 +++++++++++- 2 files changed, 178 insertions(+), 5 deletions(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 6ab6b8da4..0e47455b0 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -54,6 +54,9 @@ import { CorporationUpgrades } from "../Corporation/data/CorporationUpgrades"; import { EmployeePositions } from "../Corporation/EmployeePositions"; import { calculateIntelligenceBonus } from "../PersonObjects/formulas/intelligence"; import { Industry } from "../Corporation/Industry"; +import { IndustryStartingCosts } from "../Corporation/IndustryData"; +import { CorporationConstants } from "../Corporation/data/Constants"; +import { IndustryUpgrades } from "../Corporation/IndustryUpgrades"; export function NetscriptCorporation( player: IPlayer, @@ -76,6 +79,53 @@ export function NetscriptCorporation( return true; } + function hasUnlockUpgrade(upgradeName: string): boolean { + const corporation = getCorporation(); + const upgrade = Object.values(CorporationUnlockUpgrades).find((upgrade) => upgrade[2] === upgradeName); + if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); + const upgN = upgrade[0]; + return corporation.unlockUpgrades[upgN] === 1; + } + + function getUnlockUpgradeCost(upgradeName: string): number { + const upgrade = Object.values(CorporationUnlockUpgrades).find((upgrade) => upgrade[2] === upgradeName); + if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); + return upgrade[1]; + } + + function getUpgradeLevel(aupgradeName: string): number { + const upgradeName = helper.string("levelUpgrade", "upgradeName", aupgradeName); + const corporation = getCorporation(); + const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName); + if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); + const upgN = upgrade[0]; + return corporation.upgrades[upgN]; + } + + function getUpgradeLevelCost(aupgradeName: string): number { + const upgradeName = helper.string("levelUpgrade", "upgradeName", aupgradeName); + const corporation = getCorporation(); + const upgrade = Object.values(CorporationUpgrades).find((upgrade) => upgrade[4] === upgradeName); + if (upgrade === undefined) throw new Error(`No upgrade named '${upgradeName}'`); + const upgN = upgrade[0]; + const baseCost = upgrade[1]; + const priceMult = upgrade[2]; + const level = corporation.upgrades[upgN]; + return baseCost * Math.pow(priceMult, level); + } + + function getExpandIndustryCost(industryName: string): number { + const cost = IndustryStartingCosts[industryName]; + if (cost === undefined) { + throw new Error(`Invalid industry: '${industryName}'`); + } + return cost; + } + + function getExpandCityCost(): number { + return CorporationConstants.OfficeInitialCost; + } + function getCorporation(): ICorporation { const corporation = player.corporation; if (corporation === null) throw new Error("cannot be called without a corporation"); @@ -107,7 +157,8 @@ export function NetscriptCorporation( function getMaterial(divisionName: any, cityName: any, materialName: any): Material { const warehouse = getWarehouse(divisionName, cityName); - const material = warehouse.materials[materialName]; + const matName = (materialName as string).replace(/ /g, ""); + const material = warehouse.materials[matName]; if (material === undefined) throw new Error(`Invalid material name: '${materialName}'`); return material; } @@ -157,6 +208,26 @@ export function NetscriptCorporation( } const warehouseAPI: WarehouseAPI = { + getPurchaseWarehouseCost: function (): number { + checkAccess("getPurchaseWarehouseCost", 7); + return CorporationConstants.WarehouseInitialCost; + }, + getUpgradeWarehouseCost: function (adivisionName: any, acityName: any): number { + checkAccess("upgradeWarehouse", 7); + const divisionName = helper.string("getUpgradeWarehouseCost", "divisionName", adivisionName); + const cityName = helper.string("getUpgradeWarehouseCost", "cityName", acityName); + const warehouse = getWarehouse(divisionName, cityName); + return CorporationConstants.WarehouseUpgradeBaseCost * Math.pow(1.07, warehouse.level + 1); + }, + hasWarehouse: function (adivisionName: any, acityName: any): boolean { + checkAccess("hasWarehouse", 7); + const divisionName = helper.string("getWarehouse", "divisionName", adivisionName); + const cityName = helper.string("getWarehouse", "cityName", acityName); + const division = getDivision(divisionName); + if (!(cityName in division.warehouses)) throw new Error(`Invalid city name '${cityName}'`); + const warehouse = division.warehouses[cityName]; + return warehouse !== 0; + }, getWarehouse: function (adivisionName: any, acityName: any): NSWarehouse { checkAccess("getWarehouse", 7); const divisionName = helper.string("getWarehouse", "divisionName", adivisionName); @@ -167,6 +238,7 @@ export function NetscriptCorporation( loc: warehouse.loc, size: warehouse.size, sizeUsed: warehouse.sizeUsed, + smartSupplyEnabled: warehouse.smartSupplyEnabled }; }, getMaterial: function (adivisionName: any, acityName: any, amaterialName: any): NSMaterial { @@ -342,6 +414,19 @@ export function NetscriptCorporation( }; const officeAPI: OfficeAPI = { + getHireAdVertCost: function (adivisionName: string): number { + checkAccess("hireAdVert", 8); + const divisionName = helper.string("hireAdVert", "divisionName", adivisionName); + const division = getDivision(divisionName); + const upgrade = IndustryUpgrades[1]; + return upgrade[1] * Math.pow(upgrade[2], division.upgrades[1]); + }, + getHireAdVertCount: function (adivisionName: string): number { + checkAccess("hireAdVert", 8); + const divisionName = helper.string("hireAdVert", "divisionName", adivisionName); + const division = getDivision(divisionName); + return division.upgrades[1] + }, assignJob: function (adivisionName: any, acityName: any, aemployeeName: any, ajob: any): Promise { checkAccess("assignJob", 8); const divisionName = helper.string("assignJob", "divisionName", adivisionName); @@ -503,9 +588,6 @@ export function NetscriptCorporation( const division = getDivision(divisionName); return getSafeDivision(division); }, - createCorporation: function (corporationName: string, selfFund = true): boolean { - return createCorporation(corporationName, selfFund); - }, getCorporation: function (): CorporationInfo { checkAccess("getCorporation"); const corporation = getCorporation(); @@ -524,5 +606,32 @@ export function NetscriptCorporation( divisions: corporation.divisions.map((division): NSDivision => getSafeDivision(division)), }; }, + createCorporation: function (corporationName: string, selfFund = true): boolean { + return createCorporation(corporationName, selfFund); + }, + hasUnlockUpgrade: function (upgradeName: string): boolean { + checkAccess("hasUnlockUpgrade"); + return hasUnlockUpgrade(upgradeName); + }, + getUnlockUpgradeCost: function (upgradeName: string): number { + checkAccess("getUnlockUpgradeCost"); + return getUnlockUpgradeCost(upgradeName); + }, + getUpgradeLevel: function (upgradeName: string): number { + checkAccess("hasUnlockUpgrade"); + return getUpgradeLevel(upgradeName); + }, + getUpgradeLevelCost: function (upgradeName: string): number { + checkAccess("getUpgradeLevelCost"); + return getUpgradeLevelCost(upgradeName); + }, + getExpandIndustryCost: function (industryName: string): number { + checkAccess("getExpandIndustryCost"); + return getExpandIndustryCost(industryName); + }, + getExpandCityCost: function(): number { + checkAccess("getExpandCityCost"); + return getExpandCityCost(); + } }; } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 0a1e935a4..bec7986cb 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6140,6 +6140,18 @@ export interface OfficeAPI { * @returns Employee data */ getEmployee(divisionName: string, cityName: string, employeeName: string): Employee; + /** + * Get the cost to Hire AdVert + * @param divisionName - Name of the division + * @returns Cost + */ + getHireAdVertCost(adivisionName: string): number; + /** + * Get the number of times you have Hired AdVert + * @param divisionName - Name of the division + * @returns Number of times you have Hired AdVert + */ + getHireAdVertCount(adivisionName: string): number; } /** @@ -6308,6 +6320,21 @@ export interface WarehouseAPI { designInvest: number, marketingInvest: number, ): void; + /** + * Gets the cost to purchase a warehouse + * @returns cost + */ + getPurchaseWarehouseCost(): number; + /** + * Gets the cost to upgrade a warehouse to the next level + * @returns cost to upgrade + */ + getUpgradeWarehouseCost(adivisionName: any, acityName: any): number; + /** + * Check if you have a warehouse in city + * @returns true if warehouse is present, false if not + */ + hasWarehouse(adivisionName: any, acityName: any): boolean; } /** @@ -6320,7 +6347,42 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * @param divisionName - Name of the division * @returns true if created and false if not */ - createCorporation(corporationName: string, selfFund: boolean): boolean; + createCorporation(corporationName: string, selfFund: boolean): boolean; + /** + * Check if you have a one time unlockable upgrade + * @param upgradeName - Name of the upgrade + * @returns true if unlocked and false if not + */ + hasUnlockUpgrade(upgradeName: string): boolean; + /** + * Gets the cost to unlock a one time unlockable upgrade + * @param upgradeName - Name of the upgrade + * @returns cost of the upgrade + */ + getUnlockUpgradeCost(upgradeName: string): number; + /** + * Get the level of a levelable upgrade + * @param upgradeName - Name of the upgrade + * @returns the level of the upgrade + */ + getUpgradeLevel(upgradeName: string): number; + /** + * Gets the cost to unlock the next level of a levelable upgrade + * @param upgradeName - Name of the upgrade + * @returns cost of the upgrade + */ + getUpgradeLevelCost(upgradeName: string): number; + /** + * Gets the cost to expand into a new industry + * @param industryName - Name of the industry + * @returns cost + */ + getExpandIndustryCost(industryName: string): number; + /** + * Gets the cost to expand into a new city + * @returns cost + */ + getExpandCityCost(): number; /** * Get corporation data * @returns Corporation data @@ -6461,6 +6523,8 @@ interface Warehouse { size: number; /** Used space in the warehouse */ sizeUsed: number; + /** Smart Supply status in the warehouse */ + smartSupplyEnabled: boolean; } /** From 2269f79b15bab4aa1a91171cb0136942df768c97 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 11:42:23 +0000 Subject: [PATCH 09/40] Add investments to the api --- src/Corporation/data/Constants.ts | 14 +++++++ src/Corporation/ui/FindInvestorsModal.tsx | 35 ++++------------- src/NetscriptFunctions/Corporation.ts | 45 +++++++++++++++++++++- src/ScriptEditor/NetscriptDefinitions.d.ts | 25 ++++++++++++ 4 files changed, 91 insertions(+), 28 deletions(-) diff --git a/src/Corporation/data/Constants.ts b/src/Corporation/data/Constants.ts index 9139762c1..b20b03de7 100644 --- a/src/Corporation/data/Constants.ts +++ b/src/Corporation/data/Constants.ts @@ -25,6 +25,8 @@ export const CorporationConstants: { BaseMaxProducts: number; AllCorporationStates: string[]; AllMaterials: string[]; + FundingRoundShares: number[]; + FundingRoundMultiplier: number[]; } = { INITIALSHARES: 1e9, //Total number of shares you have at your company SHARESPERPRICEUPDATE: 1e6, //When selling large number of shares, price is dynamically updated for every batch of this amount @@ -71,4 +73,16 @@ export const CorporationConstants: { "AI Cores", "Real Estate", ], + FundingRoundShares: [ + 0.1, + 0.35, + 0.25, + 0.2 + ], + FundingRoundMultiplier: [ + 4, + 3, + 3, + 2.5 + ], }; diff --git a/src/Corporation/ui/FindInvestorsModal.tsx b/src/Corporation/ui/FindInvestorsModal.tsx index 62bf50831..e24b1520b 100644 --- a/src/Corporation/ui/FindInvestorsModal.tsx +++ b/src/Corporation/ui/FindInvestorsModal.tsx @@ -15,37 +15,18 @@ interface IProps { // Create a popup that lets the player manage exports export function FindInvestorsModal(props: IProps): React.ReactElement { - const corp = useCorporation(); - const val = corp.determineValuation(); - let percShares = 0; - let roundMultiplier = 4; - switch (corp.fundingRound) { - case 0: //Seed - percShares = 0.1; - roundMultiplier = 4; - break; - case 1: //Series A - percShares = 0.35; - roundMultiplier = 3; - break; - case 2: //Series B - percShares = 0.25; - roundMultiplier = 3; - break; - case 3: //Series C - percShares = 0.2; - roundMultiplier = 2.5; - break; - default: - return <>; - } + const corporation = useCorporation(); + const val = corporation.determineValuation(); + if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) return <>; + const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; + const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; const funding = val * percShares * roundMultiplier; const investShares = Math.floor(CorporationConstants.INITIALSHARES * percShares); function findInvestors(): void { - corp.fundingRound++; - corp.addFunds(funding); - corp.numShares -= investShares; + corporation.fundingRound++; + corporation.addFunds(funding); + corporation.numShares -= investShares; props.rerender(); props.onClose(); } diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 0e47455b0..469e1157d 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -21,6 +21,7 @@ import { Division as NSDivision, WarehouseAPI, OfficeAPI, + InvestmentOffer } from "../ScriptEditor/NetscriptDefinitions"; import { @@ -126,6 +127,40 @@ export function NetscriptCorporation( return CorporationConstants.OfficeInitialCost; } + function getInvestmentOffer(): InvestmentOffer { + const corporation = getCorporation(); + if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) + return { + funds: 0, + shares: 0, + round: corporation.fundingRound + 1 // Make more readable + }; // Don't throw an error here, no reason to have a second function to check if you can get investment. + const val = corporation.determineValuation(); + const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; + const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; + const funding = val * percShares * roundMultiplier; + const investShares = Math.floor(CorporationConstants.INITIALSHARES * percShares); + return { + funds: funding, + shares: investShares, + round: corporation.fundingRound + 1 // Make more readable + }; + } + + function acceptInvestmentOffer(): boolean { + const corporation = getCorporation(); + if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) return false; + const val = corporation.determineValuation(); + const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; + const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; + const funding = val * percShares * roundMultiplier; + const investShares = Math.floor(CorporationConstants.INITIALSHARES * percShares); + corporation.fundingRound++; + corporation.addFunds(funding); + corporation.numShares -= investShares; + return true; + } + function getCorporation(): ICorporation { const corporation = player.corporation; if (corporation === null) throw new Error("cannot be called without a corporation"); @@ -632,6 +667,14 @@ export function NetscriptCorporation( getExpandCityCost: function(): number { checkAccess("getExpandCityCost"); return getExpandCityCost(); - } + }, + getInvestmentOffer: function(): InvestmentOffer { + checkAccess("getInvestmentOffer"); + return getInvestmentOffer(); + }, + acceptInvestmentOffer: function(): boolean { + checkAccess("acceptInvestmentOffer"); + return acceptInvestmentOffer(); + }, }; } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index bec7986cb..14b88ea97 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6383,6 +6383,18 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * @returns cost */ getExpandCityCost(): number; + /** + * Get an offer for investment based on you companies current valuation + * @returns An offer of investment + */ + getInvestmentOffer(): InvestmentOffer; + /** + * Accept investment based on you companies current valuation + * @remarks + * Is based on current valuation and will not honer a specific Offer + * @returns An offer of investment + */ + acceptInvestmentOffer(): boolean; /** * Get corporation data * @returns Corporation data @@ -6597,6 +6609,19 @@ interface Division { cities: string[]; } +/** + * Corporation investment offer + * @public + */ +interface InvestmentOffer { + /** Amount of funds you will get from this investment */ + funds: number; + /** Amount of share you will give in exchange for this investment */ + shares: number; + /** Current round of funding (max 4) */ + round: number; +} + /** * Interface Theme * @internal From 98e8910c3aed719003730acd785d7aa9f1d118b7 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 17:47:11 +0000 Subject: [PATCH 10/40] Research func, gopublic function, and validation --- src/Corporation/Actions.ts | 14 +-- src/Corporation/ui/PurchaseMaterialModal.tsx | 4 +- src/NetscriptFunctions/Corporation.ts | 91 ++++++++++++++++---- src/ScriptEditor/NetscriptDefinitions.d.ts | 34 +++++++- 4 files changed, 118 insertions(+), 25 deletions(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index a548c8735..d044867e8 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -94,7 +94,7 @@ export function SellMaterial(mat: Material, amt: string, price: string): void { throw new Error("Invalid value or expression for sell price field: " + e); } - if (temp == null || isNaN(parseFloat(temp))) { + if (temp == null || isNaN(parseFloat(temp)) || parseFloat(temp) < 0) { throw new Error("Invalid value or expression for sell price field"); } @@ -117,13 +117,13 @@ export function SellMaterial(mat: Material, amt: string, price: string): void { throw new Error("Invalid value or expression for sell price field: " + e); } - if (tempQty == null || isNaN(parseFloat(tempQty))) { + if (tempQty == null || isNaN(parseFloat(tempQty)) || parseFloat(tempQty) < 0) { throw new Error("Invalid value or expression for sell price field"); } mat.sllman[0] = true; mat.sllman[1] = q; //Use sanitized input - } else if (isNaN(parseFloat(amt))) { + } else if (isNaN(parseFloat(amt)) || parseFloat(amt) < 0) { throw new Error("Invalid value for sell quantity field! Must be numeric or 'MAX'"); } else { let q = parseFloat(amt); @@ -153,7 +153,7 @@ export function SellProduct(product: Product, city: string, amt: string, price: } catch (e) { throw new Error("Invalid value or expression for sell quantity field: " + e); } - if (temp == null || isNaN(parseFloat(temp))) { + if (temp == null || isNaN(parseFloat(temp)) || parseFloat(temp) < 0) { throw new Error("Invalid value or expression for sell quantity field."); } product.sCost = price; //Use sanitized price @@ -182,7 +182,7 @@ export function SellProduct(product: Product, city: string, amt: string, price: throw new Error("Invalid value or expression for sell price field: " + e); } - if (temp == null || isNaN(parseFloat(temp))) { + if (temp == null || isNaN(parseFloat(temp)) || parseFloat(temp) < 0) { throw new Error("Invalid value or expression for sell price field"); } if (all) { @@ -195,7 +195,7 @@ export function SellProduct(product: Product, city: string, amt: string, price: product.sllman[city][0] = true; product.sllman[city][1] = qty; //Use sanitized input } - } else if (isNaN(parseFloat(amt))) { + } else if (isNaN(parseFloat(amt)) || parseFloat(amt) < 0) { throw new Error("Invalid value for sell quantity field! Must be numeric"); } else { let qty = parseFloat(amt); @@ -239,7 +239,7 @@ export function SetSmartSupplyUseLeftovers(warehouse: Warehouse, material: Mater } export function BuyMaterial(material: Material, amt: number): void { - if (isNaN(amt)) { + if (isNaN(amt) || amt < 0) { throw new Error(`Invalid amount '${amt}' to buy material '${material.name}'`); } material.buy = amt; diff --git a/src/Corporation/ui/PurchaseMaterialModal.tsx b/src/Corporation/ui/PurchaseMaterialModal.tsx index 28d1482a0..114e53940 100644 --- a/src/Corporation/ui/PurchaseMaterialModal.tsx +++ b/src/Corporation/ui/PurchaseMaterialModal.tsx @@ -30,7 +30,7 @@ function BulkPurchaseText(props: IBulkPurchaseTextProps): React.ReactElement { Not enough warehouse space to purchase this amount ); - } else if (isNaN(cost)) { + } else if (isNaN(cost) || parsedAmt < 0) { return ( <> Invalid put for Bulk Purchase amount @@ -68,7 +68,7 @@ function BulkPurchase(props: IBPProps): React.ReactElement { return; } - if (isNaN(amount)) { + if (isNaN(amount) || amount < 0) { dialogBoxCreate("Invalid input amount"); } else { const cost = amount * props.mat.bCost; diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 469e1157d..9bf06d1fd 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -55,9 +55,10 @@ import { CorporationUpgrades } from "../Corporation/data/CorporationUpgrades"; import { EmployeePositions } from "../Corporation/EmployeePositions"; import { calculateIntelligenceBonus } from "../PersonObjects/formulas/intelligence"; import { Industry } from "../Corporation/Industry"; -import { IndustryStartingCosts } from "../Corporation/IndustryData"; +import { IndustryResearchTrees, IndustryStartingCosts } from "../Corporation/IndustryData"; import { CorporationConstants } from "../Corporation/data/Constants"; import { IndustryUpgrades } from "../Corporation/IndustryUpgrades"; +import { ResearchMap } from "../Corporation/ResearchMap"; export function NetscriptCorporation( player: IPlayer, @@ -129,7 +130,7 @@ export function NetscriptCorporation( function getInvestmentOffer(): InvestmentOffer { const corporation = getCorporation(); - if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) + if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || corporation.public) return { funds: 0, shares: 0, @@ -149,7 +150,7 @@ export function NetscriptCorporation( function acceptInvestmentOffer(): boolean { const corporation = getCorporation(); - if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length) return false; + if (corporation.fundingRound >= CorporationConstants.FundingRoundShares.length || corporation.fundingRound >= CorporationConstants.FundingRoundMultiplier.length || corporation.public) return false; const val = corporation.determineValuation(); const percShares = CorporationConstants.FundingRoundShares[corporation.fundingRound]; const roundMultiplier = CorporationConstants.FundingRoundMultiplier[corporation.fundingRound]; @@ -161,6 +162,33 @@ export function NetscriptCorporation( return true; } + function goPublic(numShares: number): boolean { + const corporation = getCorporation(); + const initialSharePrice = corporation.determineValuation() / corporation.totalShares; + if (isNaN(numShares)) throw new Error("Invalid value for number of issued shares"); + if (numShares < 0) throw new Error("Invalid value for number of issued shares"); + if (numShares > corporation.numShares) throw new Error("You don't have that many shares to issue!"); + corporation.public = true; + corporation.sharePrice = initialSharePrice; + corporation.issuedShares = numShares; + corporation.numShares -= numShares; + corporation.addFunds(numShares * initialSharePrice); + return true; + } + + function getResearchCost(division: IIndustry, researchName: string): number { + const researchTree = IndustryResearchTrees[division.type]; + if (researchTree === undefined) throw new Error(`No research tree for industry '${division.type}'`); + const allResearch = researchTree.getAllNodes(); + if (!allResearch.includes(researchName)) throw new Error(`No research named '${researchName}'`); + const research = ResearchMap[researchName]; + return research.cost; + } + + function hasResearched(division: IIndustry, researchName: string): boolean { + return division.researched[researchName] === undefined ? false : division.researched[researchName] as boolean; + } + function getCorporation(): ICorporation { const corporation = player.corporation; if (corporation === null) throw new Error("cannot be called without a corporation"); @@ -239,6 +267,7 @@ export function NetscriptCorporation( thisCycleExpenses: division.thisCycleExpenses, upgrades: division.upgrades, cities: cities, + products: division.products === undefined ? [] : Object.keys(division.products), }; } @@ -286,6 +315,8 @@ export function NetscriptCorporation( name: material.name, qty: material.qty, qlt: material.qlt, + prod: material.prd, + sell: material.sll, }; }, getProduct: function (adivisionName: any, aproductName: any): NSProduct { @@ -299,6 +330,8 @@ export function NetscriptCorporation( cmp: product.cmp, pCost: product.pCost, sCost: product.sCost, + cityData: product.data, + developmentProgress: product.prog, }; }, purchaseWarehouse: function (adivisionName: any, acityName: any): void { @@ -363,6 +396,7 @@ export function NetscriptCorporation( const cityName = helper.string("buyMaterial", "cityName", acityName); const materialName = helper.string("buyMaterial", "materialName", amaterialName); const amt = helper.number("buyMaterial", "amt", aamt); + if (amt < 0) throw new Error("Invalid value for ammount field! Must be numeric and grater than 0"); const material = getMaterial(divisionName, cityName, materialName); BuyMaterial(material, amt); }, @@ -449,19 +483,31 @@ export function NetscriptCorporation( }; const officeAPI: OfficeAPI = { - getHireAdVertCost: function (adivisionName: string): number { - checkAccess("hireAdVert", 8); - const divisionName = helper.string("hireAdVert", "divisionName", adivisionName); + getHireAdVertCost: function (adivisionName: any): number { + checkAccess("getHireAdVertCost", 8); + const divisionName = helper.string("getHireAdVertCost", "divisionName", adivisionName); const division = getDivision(divisionName); const upgrade = IndustryUpgrades[1]; return upgrade[1] * Math.pow(upgrade[2], division.upgrades[1]); }, - getHireAdVertCount: function (adivisionName: string): number { - checkAccess("hireAdVert", 8); - const divisionName = helper.string("hireAdVert", "divisionName", adivisionName); + getHireAdVertCount: function (adivisionName: any): number { + checkAccess("getHireAdVertCount", 8); + const divisionName = helper.string("getHireAdVertCount", "divisionName", adivisionName); const division = getDivision(divisionName); return division.upgrades[1] }, + getResearchCost: function (adivisionName: any, aresearchName: any): number { + checkAccess("getResearchCost", 8); + const divisionName = helper.string("getResearchCost", "divisionName", adivisionName); + const researchName = helper.string("getResearchCost", "researchName", aresearchName); + return getResearchCost(getDivision(divisionName), researchName); + }, + hasResearched: function (adivisionName: any, aresearchName: any): boolean { + checkAccess("hasResearched", 8); + const divisionName = helper.string("hasResearched", "divisionName", adivisionName); + const researchName = helper.string("hasResearched", "researchName", aresearchName); + return hasResearched(getDivision(divisionName), researchName); + }, assignJob: function (adivisionName: any, acityName: any, aemployeeName: any, ajob: any): Promise { checkAccess("assignJob", 8); const divisionName = helper.string("assignJob", "divisionName", adivisionName); @@ -485,6 +531,7 @@ export function NetscriptCorporation( const divisionName = helper.string("upgradeOfficeSize", "divisionName", adivisionName); const cityName = helper.string("upgradeOfficeSize", "cityName", acityName); const size = helper.number("upgradeOfficeSize", "size", asize); + if (size < 0) throw new Error("Invalid value for size field! Must be numeric and grater than 0"); const office = getOffice(divisionName, cityName); const corporation = getCorporation(); UpgradeOfficeSize(corporation, office, size); @@ -494,6 +541,7 @@ export function NetscriptCorporation( const divisionName = helper.string("throwParty", "divisionName", adivisionName); const cityName = helper.string("throwParty", "cityName", acityName); const costPerEmployee = helper.number("throwParty", "costPerEmployee", acostPerEmployee); + if (costPerEmployee < 0) throw new Error("Invalid value for Cost Per Employee field! Must be numeric and grater than 0"); const office = getOffice(divisionName, cityName); const corporation = getCorporation(); return netscriptDelay( @@ -588,6 +636,7 @@ export function NetscriptCorporation( checkAccess("expandCity"); const divisionName = helper.string("expandCity", "divisionName", adivisionName); const cityName = helper.string("expandCity", "cityName", acityName); + if (!CorporationConstants.Cities.includes(cityName)) throw new Error("Invalid city name"); const corporation = getCorporation(); const division = getDivision(divisionName); NewCity(corporation, division, cityName); @@ -611,6 +660,7 @@ export function NetscriptCorporation( issueDividends: function (apercent: any): void { checkAccess("issueDividends"); const percent = helper.number("issueDividends", "percent", apercent); + if (percent < 0 || percent > 100) throw new Error("Invalid value for Cost Per Employee field! Must be numeric, grater than 0, and less than 100"); const corporation = getCorporation(); IssueDividends(corporation, percent); }, @@ -641,27 +691,33 @@ export function NetscriptCorporation( divisions: corporation.divisions.map((division): NSDivision => getSafeDivision(division)), }; }, - createCorporation: function (corporationName: string, selfFund = true): boolean { + createCorporation: function (acorporationName: string, selfFund = true): boolean { + const corporationName = helper.string("createCorporation", "corporationName", acorporationName); return createCorporation(corporationName, selfFund); }, - hasUnlockUpgrade: function (upgradeName: string): boolean { + hasUnlockUpgrade: function (aupgradeName: any): boolean { checkAccess("hasUnlockUpgrade"); + const upgradeName = helper.string("hasUnlockUpgrade", "upgradeName", aupgradeName); return hasUnlockUpgrade(upgradeName); }, - getUnlockUpgradeCost: function (upgradeName: string): number { + getUnlockUpgradeCost: function (aupgradeName: any): number { checkAccess("getUnlockUpgradeCost"); + const upgradeName = helper.string("getUnlockUpgradeCost", "upgradeName", aupgradeName); return getUnlockUpgradeCost(upgradeName); }, - getUpgradeLevel: function (upgradeName: string): number { + getUpgradeLevel: function (aupgradeName: any): number { checkAccess("hasUnlockUpgrade"); + const upgradeName = helper.string("getUpgradeLevel", "upgradeName", aupgradeName); return getUpgradeLevel(upgradeName); }, - getUpgradeLevelCost: function (upgradeName: string): number { + getUpgradeLevelCost: function (aupgradeName: any): number { checkAccess("getUpgradeLevelCost"); + const upgradeName = helper.string("getUpgradeLevelCost", "upgradeName", aupgradeName); return getUpgradeLevelCost(upgradeName); }, - getExpandIndustryCost: function (industryName: string): number { + getExpandIndustryCost: function (aindustryName: any): number { checkAccess("getExpandIndustryCost"); + const industryName = helper.string("getExpandIndustryCost", "industryName", aindustryName); return getExpandIndustryCost(industryName); }, getExpandCityCost: function(): number { @@ -676,5 +732,10 @@ export function NetscriptCorporation( checkAccess("acceptInvestmentOffer"); return acceptInvestmentOffer(); }, + goPublic(anumShares: any): boolean { + checkAccess("acceptInvestmentOffer"); + const numShares = helper.number("goPublic", "numShares", anumShares); + return goPublic(numShares); + }, }; } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 14b88ea97..f0750bae8 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6145,13 +6145,27 @@ export interface OfficeAPI { * @param divisionName - Name of the division * @returns Cost */ - getHireAdVertCost(adivisionName: string): number; + getHireAdVertCost(divisionName: string): number; /** * Get the number of times you have Hired AdVert * @param divisionName - Name of the division * @returns Number of times you have Hired AdVert */ getHireAdVertCount(adivisionName: string): number; + /** + * Get the cost to unlock research + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @returns cost + */ + getResearchCost(divisionName: string, researchName: string): number; + /** + * Gets if you have unlocked a research + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @returns true is unlocked, false if not + */ + hasResearched(divisionName: string, researchName: string): boolean; } /** @@ -6395,6 +6409,12 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * @returns An offer of investment */ acceptInvestmentOffer(): boolean; + /** + * Go public + * @param numShares number of shares you would like to issue for your IPO + * @returns true if you successfully go public, false if not + */ + goPublic(numShares: number): boolean; /** * Get corporation data * @returns Corporation data @@ -6507,6 +6527,12 @@ interface Product { pCost: number; /** Sell cost, can be "MP+5" */ sCost: string | number; + /** Data refers to the production, sale, and quantity of the products + * These values are specific to a city + * For each city, the data is [qty, prod, sell] */ + cityData: {[key: string]:number[]}; + /** Creation progress - A number betwee 0-100 representing percentage */ + developmentProgress: number; } /** @@ -6520,6 +6546,10 @@ interface Material { qty: number; /** Quality of the material */ qlt: number; + /** Amount of material produced */ + prod: number; + /** Amount of material sold */ + sell: number; } /** @@ -6607,6 +6637,8 @@ interface Division { upgrades: number[]; /** Cities in which this division has expanded */ cities: string[]; + /** Products developed by this division */ + products: string[]; } /** From e245cc471aa9ce9d4286d34c354db74ca1986653 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 17:47:55 +0000 Subject: [PATCH 11/40] Prevent awareness and pop going over max --- src/Corporation/Industry.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts index beb69374f..2c271b9c7 100644 --- a/src/Corporation/Industry.ts +++ b/src/Corporation/Industry.ts @@ -1279,10 +1279,31 @@ export class Industry implements IIndustry { case 1: { //AdVert.Inc, const advMult = corporation.getAdvertisingMultiplier() * this.getAdvertisingMultiplier(); - this.awareness += 3 * advMult; - this.popularity += 1 * advMult; - this.awareness *= 1.01 * advMult; - this.popularity *= (1 + getRandomInt(1, 3) / 100) * advMult; + if (this.awareness === Number.MAX_VALUE || this.awareness + (3 * advMult) > Number.MAX_VALUE) { + this.awareness == Number.MAX_VALUE; + } else { + this.awareness += 3 * advMult; + } + + if (this.awareness === Number.MAX_VALUE || this.awareness * (1.01 * advMult) > Number.MAX_VALUE) { + this.awareness == Number.MAX_VALUE; + } else { + this.awareness *= 1.01 * advMult; + } + + if (this.popularity === Number.MAX_VALUE || this.popularity + (1 * advMult) > Number.MAX_VALUE) { + this.popularity == Number.MAX_VALUE; + } else { + this.popularity += 1 * advMult; + } + + const rand = (1 + getRandomInt(1, 3) / 100); + if (this.popularity === Number.MAX_VALUE || this.popularity * (rand * advMult) > Number.MAX_VALUE) { + this.popularity == Number.MAX_VALUE; + } else { + this.popularity *= rand * advMult; + } + break; } default: { From abdc786403d9486316d93259f108992bee5507ac Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 17:55:56 +0000 Subject: [PATCH 12/40] prevent DreamSense from pushing over max --- src/Corporation/Industry.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts index 2c271b9c7..09dbd03b3 100644 --- a/src/Corporation/Industry.ts +++ b/src/Corporation/Industry.ts @@ -435,8 +435,17 @@ export class Industry implements IIndustry { const popularityGain = corporation.getDreamSenseGain(), awarenessGain = popularityGain * 4; if (popularityGain > 0) { - this.popularity += popularityGain * marketCycles; - this.awareness += awarenessGain * marketCycles; + if (this.awareness === Number.MAX_VALUE || this.awareness + (awarenessGain * marketCycles) > Number.MAX_VALUE) { + this.awareness == Number.MAX_VALUE; + } else { + this.awareness += awarenessGain * marketCycles; + } + + if (this.popularity === Number.MAX_VALUE || this.popularity + (popularityGain * marketCycles) > Number.MAX_VALUE) { + this.popularity == Number.MAX_VALUE; + } else { + this.popularity += popularityGain * marketCycles; + } } return; From 1384b8681011c29cbb56991492fd7f0595e0fce2 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 18:47:54 +0000 Subject: [PATCH 13/40] Added better job assignment function, and fix docs --- src/Corporation/OfficeSpace.ts | 34 ++++++++++++++++++++++ src/NetscriptFunctions/Corporation.ts | 15 ++++++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 19 ++++++++---- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts index 87a835864..1476a1a28 100644 --- a/src/Corporation/OfficeSpace.ts +++ b/src/Corporation/OfficeSpace.ts @@ -173,6 +173,40 @@ export class OfficeSpace { return false; } + setEmployeeToJob(job: string, amount: number): boolean { + let unassignedCount = 0; + let jobCount = 0; + for (let i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === EmployeePositions.Unassigned) { + unassignedCount++; + } else if (this.employees[i].pos === job) { + jobCount++; + } + } + + if ((jobCount + unassignedCount) < amount) return false; + + for (let i = 0; i < this.employees.length; ++i) { + if (this.employees[i].pos === EmployeePositions.Unassigned) { + if (jobCount <= amount) { + this.employees[i].pos = job; + jobCount++; + unassignedCount--; + } + if (jobCount === amount) break; + } else if (this.employees[i].pos === job) { + if (jobCount >= amount) { + this.employees[i].pos = EmployeePositions.Unassigned; + jobCount--; + unassignedCount++; + } + if (jobCount === amount) break; + } + } + if (jobCount !== amount) return false; + return true; + } + toJSON(): any { return Generic_toJSON("OfficeSpace", this); } diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 9bf06d1fd..9d23dbef0 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -508,6 +508,21 @@ export function NetscriptCorporation( const researchName = helper.string("hasResearched", "researchName", aresearchName); return hasResearched(getDivision(divisionName), researchName); }, + setAutoJobAssignment: function (adivisionName: any, acityName: any, ajob: any, aamount: any): Promise { + checkAccess("setAutoJobAssignment", 8); + const divisionName = helper.string("setAutoJobAssignment", "divisionName", adivisionName); + const cityName = helper.string("setAutoJobAssignment", "cityName", acityName); + const amount = helper.number("setAutoJobAssignment", "amount", aamount); + const job = helper.string("setAutoJobAssignment", "job", ajob); + const office = getOffice(divisionName, cityName); + if (!Object.values(EmployeePositions).includes(job)) throw new Error(`'${job}' is not a valid job.`); + return netscriptDelay(1000, workerScript).then(function () { + if (workerScript.env.stopFlag) { + return Promise.reject(workerScript); + } + return Promise.resolve(office.setEmployeeToJob(job, amount)); + }); + }, assignJob: function (adivisionName: any, acityName: any, aemployeeName: any, ajob: any): Promise { checkAccess("assignJob", 8); const divisionName = helper.string("assignJob", "divisionName", adivisionName); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index f0750bae8..97e39a074 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6086,7 +6086,7 @@ export interface OfficeAPI { */ assignJob(divisionName: string, cityName: string, employeeName: string, job: string): Promise; /** - * Assign an employee to a job. + * Hire an employee. * @param divisionName - Name of the division * @param cityName - Name of the city * @returns The newly hired employee, if any @@ -6100,7 +6100,7 @@ export interface OfficeAPI { */ upgradeOfficeSize(divisionName: string, cityName: string, size: number): void; /** - * Assign an employee to a job. + * Throw a party for your employees * @param divisionName - Name of the division * @param cityName - Name of the city * @param costPerEmployee - Amount to spend per employee. @@ -6120,7 +6120,7 @@ export interface OfficeAPI { */ hireAdVert(divisionName: string): void; /** - * Hire AdVert. + * purchace a research * @param divisionName - Name of the division * @param researchName - Name of the research */ @@ -6166,6 +6166,15 @@ export interface OfficeAPI { * @returns true is unlocked, false if not */ hasResearched(divisionName: string, researchName: string): boolean; + /** + * Set the auto job assignment for a job + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @param job - Name of the job + * @param amount - Number of employees to assign to that job + * @returns A promise that is fulfilled when the assignment is complete. + */ + setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): Promise; } /** @@ -6411,7 +6420,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { acceptInvestmentOffer(): boolean; /** * Go public - * @param numShares number of shares you would like to issue for your IPO + * @param numShares - number of shares you would like to issue for your IPO * @returns true if you successfully go public, false if not */ goPublic(numShares: number): boolean; @@ -6439,7 +6448,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { */ expandCity(divisionName: string, cityName: string): void; /** - * Unlock an upgrade. + * Unlock an upgrade.npm run doc * @param upgradeName - Name of the upgrade */ unlockUpgrade(upgradeName: string): void; From 19ecda160728466ae409095fb50bee3b5f6aa1cc Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 18:59:47 +0000 Subject: [PATCH 14/40] Fix doc bug --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 97e39a074..f1ba3da19 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6448,7 +6448,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { */ expandCity(divisionName: string, cityName: string): void; /** - * Unlock an upgrade.npm run doc + * Unlock an upgrade * @param upgradeName - Name of the upgrade */ unlockUpgrade(upgradeName: string): void; From 6533913b3ba0c3f4011a554c2e212e8800038aa5 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 19:03:11 +0000 Subject: [PATCH 15/40] add docs for create corp self fund --- src/ScriptEditor/NetscriptDefinitions.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index f1ba3da19..23d181f9b 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6368,6 +6368,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { /** * Create a Corporation * @param divisionName - Name of the division + * @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3 * @returns true if created and false if not */ createCorporation(corporationName: string, selfFund: boolean): boolean; From 1b1dc20c16b15432b20939508aa27998a49bad18 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 19:17:13 +0000 Subject: [PATCH 16/40] fix error message --- src/NetscriptFunctions/Corporation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 9d23dbef0..fda72e7be 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -675,7 +675,7 @@ export function NetscriptCorporation( issueDividends: function (apercent: any): void { checkAccess("issueDividends"); const percent = helper.number("issueDividends", "percent", apercent); - if (percent < 0 || percent > 100) throw new Error("Invalid value for Cost Per Employee field! Must be numeric, grater than 0, and less than 100"); + if (percent < 0 || percent > 100) throw new Error("Invalid value for percent field! Must be numeric, grater than 0, and less than 100"); const corporation = getCorporation(); IssueDividends(corporation, percent); }, From ea88f5f150ef369387187c8608e18fd150c58bbd Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 19:33:59 +0000 Subject: [PATCH 17/40] spelling mistake --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 23d181f9b..5e134e0a3 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6120,7 +6120,7 @@ export interface OfficeAPI { */ hireAdVert(divisionName: string): void; /** - * purchace a research + * Purchase a research * @param divisionName - Name of the division * @param researchName - Name of the research */ From 62f40b3dc1490f18429be13cc27a2c19d0281a31 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 21:05:06 +0000 Subject: [PATCH 18/40] Add bribe --- src/NetscriptFunctions/Corporation.ts | 31 ++++++++++++++++++++-- src/ScriptEditor/NetscriptDefinitions.d.ts | 8 ++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index fda72e7be..52fe44a43 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -59,6 +59,7 @@ import { IndustryResearchTrees, IndustryStartingCosts } from "../Corporation/Ind import { CorporationConstants } from "../Corporation/data/Constants"; import { IndustryUpgrades } from "../Corporation/IndustryUpgrades"; import { ResearchMap } from "../Corporation/ResearchMap"; +import { Factions } from "../Faction/Factions"; export function NetscriptCorporation( player: IPlayer, @@ -189,6 +190,25 @@ export function NetscriptCorporation( return division.researched[researchName] === undefined ? false : division.researched[researchName] as boolean; } + function bribe(factionName: string, amountCash: number, amountShares: number): boolean { + if (!player.factions.includes(factionName)) throw new Error("Invalid faction name"); + if (isNaN(amountCash) || amountCash < 0 || isNaN(amountShares) || amountShares < 0) throw new Error("Invalid value for amount field! Must be numeric, grater than 0."); + const corporation = getCorporation(); + if (corporation.funds < amountCash) return false; + if (corporation.numShares < amountShares) return false; + const faction = Factions[factionName] + const info = faction.getInfo(); + if (!info.offersWork()) return false; + if (player.hasGangWith(factionName)) return false; + + const repGain = (amountCash + amountShares * corporation.sharePrice) / CorporationConstants.BribeToRepRatio; + faction.playerReputation += repGain; + corporation.funds = corporation.funds - amountCash; + corporation.numShares -= amountShares; + + return true; + } + function getCorporation(): ICorporation { const corporation = player.corporation; if (corporation === null) throw new Error("cannot be called without a corporation"); @@ -396,7 +416,7 @@ export function NetscriptCorporation( const cityName = helper.string("buyMaterial", "cityName", acityName); const materialName = helper.string("buyMaterial", "materialName", amaterialName); const amt = helper.number("buyMaterial", "amt", aamt); - if (amt < 0) throw new Error("Invalid value for ammount field! Must be numeric and grater than 0"); + if (amt < 0) throw new Error("Invalid value for amount field! Must be numeric and grater than 0"); const material = getMaterial(divisionName, cityName, materialName); BuyMaterial(material, amt); }, @@ -747,10 +767,17 @@ export function NetscriptCorporation( checkAccess("acceptInvestmentOffer"); return acceptInvestmentOffer(); }, - goPublic(anumShares: any): boolean { + goPublic: function(anumShares: any): boolean { checkAccess("acceptInvestmentOffer"); const numShares = helper.number("goPublic", "numShares", anumShares); return goPublic(numShares); }, + bribe: function(afactionName: string, aamountCash: any, aamountShares: any): boolean { + checkAccess("bribe"); + const factionName = helper.string("bribe", "factionName", afactionName); + const amountCash = helper.number("bribe", "amountCash", aamountCash); + const amountShares = helper.number("bribe", "amountShares", aamountShares); + return bribe(factionName, amountCash, amountShares); + }, }; } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 5e134e0a3..0979aac4e 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6425,6 +6425,14 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * @returns true if you successfully go public, false if not */ goPublic(numShares: number): boolean; + /** + * Bribe a faction + * @param factionName - Faction name + * @param amountCash - Amount of money to bribe + * @param amountShares - Amount of shares to bribe + * @return True if successful, false if not + */ + bribe(factionName: string, amountCash: number, amountShares: number): boolean; /** * Get corporation data * @returns Corporation data From 4562102448eefa493d11a020a54a18ccd3ae7175 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 21:07:08 +0000 Subject: [PATCH 19/40] Fix for js docs --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 0979aac4e..16c469a55 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6430,7 +6430,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * @param factionName - Faction name * @param amountCash - Amount of money to bribe * @param amountShares - Amount of shares to bribe - * @return True if successful, false if not + * @returns True if successful, false if not */ bribe(factionName: string, amountCash: number, amountShares: number): boolean; /** From 3476fc821887a94b99881e217a9253033e26890d Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 18:48:54 +0000 Subject: [PATCH 20/40] Update Docs --- ...urner.corporation.acceptinvestmentoffer.md | 23 +++++++++++++++ ...bitburner.corporation.createcorporation.md | 27 +++++++++++++++++ ...bitburner.corporation.getexpandcitycost.md | 19 ++++++++++++ ...urner.corporation.getexpandindustrycost.md | 26 +++++++++++++++++ ...itburner.corporation.getinvestmentoffer.md | 19 ++++++++++++ ...burner.corporation.getunlockupgradecost.md | 26 +++++++++++++++++ .../bitburner.corporation.getupgradelevel.md | 26 +++++++++++++++++ ...tburner.corporation.getupgradelevelcost.md | 26 +++++++++++++++++ markdown/bitburner.corporation.gopublic.md | 26 +++++++++++++++++ .../bitburner.corporation.hasunlockupgrade.md | 26 +++++++++++++++++ markdown/bitburner.corporation.md | 12 +++++++- .../bitburner.corporation.unlockupgrade.md | 2 +- .../bitburner.corporationinfo.divisions.md | 13 +++++++++ markdown/bitburner.corporationinfo.md | 1 + markdown/bitburner.division.md | 1 + markdown/bitburner.division.products.md | 13 +++++++++ markdown/bitburner.investmentoffer.funds.md | 13 +++++++++ markdown/bitburner.investmentoffer.md | 22 ++++++++++++++ markdown/bitburner.investmentoffer.round.md | 13 +++++++++ markdown/bitburner.investmentoffer.shares.md | 13 +++++++++ markdown/bitburner.iport.clear.md | 13 +++++++++ markdown/bitburner.iport.empty.md | 13 +++++++++ markdown/bitburner.iport.full.md | 13 +++++++++ markdown/bitburner.iport.md | 26 +++++++++++++++++ markdown/bitburner.iport.peek.md | 13 +++++++++ markdown/bitburner.iport.read.md | 13 +++++++++ markdown/bitburner.iport.trywrite.md | 13 +++++++++ markdown/bitburner.iport.write.md | 13 +++++++++ markdown/bitburner.material.md | 2 ++ markdown/bitburner.material.prod.md | 13 +++++++++ markdown/bitburner.material.sell.md | 13 +++++++++ markdown/bitburner.md | 2 ++ .../bitburner.officeapi.gethireadvertcost.md | 26 +++++++++++++++++ .../bitburner.officeapi.gethireadvertcount.md | 26 +++++++++++++++++ .../bitburner.officeapi.getresearchcost.md | 27 +++++++++++++++++ markdown/bitburner.officeapi.hasresearched.md | 27 +++++++++++++++++ markdown/bitburner.officeapi.hireemployee.md | 2 +- markdown/bitburner.officeapi.md | 11 +++++-- markdown/bitburner.officeapi.research.md | 2 +- ...itburner.officeapi.setautojobassignment.md | 29 +++++++++++++++++++ markdown/bitburner.officeapi.throwparty.md | 2 +- markdown/bitburner.player.hascorporation.md | 11 +++++++ markdown/bitburner.player.md | 1 + markdown/bitburner.product.citydata.md | 13 +++++++++ .../bitburner.product.developmentprogress.md | 13 +++++++++ markdown/bitburner.product.md | 2 ++ markdown/bitburner.warehouse.md | 1 + .../bitburner.warehouse.smartsupplyenabled.md | 13 +++++++++ ...r.warehouseapi.getpurchasewarehousecost.md | 19 ++++++++++++ ...er.warehouseapi.getupgradewarehousecost.md | 27 +++++++++++++++++ .../bitburner.warehouseapi.haswarehouse.md | 27 +++++++++++++++++ markdown/bitburner.warehouseapi.md | 3 ++ 52 files changed, 768 insertions(+), 8 deletions(-) create mode 100644 markdown/bitburner.corporation.acceptinvestmentoffer.md create mode 100644 markdown/bitburner.corporation.createcorporation.md create mode 100644 markdown/bitburner.corporation.getexpandcitycost.md create mode 100644 markdown/bitburner.corporation.getexpandindustrycost.md create mode 100644 markdown/bitburner.corporation.getinvestmentoffer.md create mode 100644 markdown/bitburner.corporation.getunlockupgradecost.md create mode 100644 markdown/bitburner.corporation.getupgradelevel.md create mode 100644 markdown/bitburner.corporation.getupgradelevelcost.md create mode 100644 markdown/bitburner.corporation.gopublic.md create mode 100644 markdown/bitburner.corporation.hasunlockupgrade.md create mode 100644 markdown/bitburner.corporationinfo.divisions.md create mode 100644 markdown/bitburner.division.products.md create mode 100644 markdown/bitburner.investmentoffer.funds.md create mode 100644 markdown/bitburner.investmentoffer.md create mode 100644 markdown/bitburner.investmentoffer.round.md create mode 100644 markdown/bitburner.investmentoffer.shares.md create mode 100644 markdown/bitburner.iport.clear.md create mode 100644 markdown/bitburner.iport.empty.md create mode 100644 markdown/bitburner.iport.full.md create mode 100644 markdown/bitburner.iport.md create mode 100644 markdown/bitburner.iport.peek.md create mode 100644 markdown/bitburner.iport.read.md create mode 100644 markdown/bitburner.iport.trywrite.md create mode 100644 markdown/bitburner.iport.write.md create mode 100644 markdown/bitburner.material.prod.md create mode 100644 markdown/bitburner.material.sell.md create mode 100644 markdown/bitburner.officeapi.gethireadvertcost.md create mode 100644 markdown/bitburner.officeapi.gethireadvertcount.md create mode 100644 markdown/bitburner.officeapi.getresearchcost.md create mode 100644 markdown/bitburner.officeapi.hasresearched.md create mode 100644 markdown/bitburner.officeapi.setautojobassignment.md create mode 100644 markdown/bitburner.player.hascorporation.md create mode 100644 markdown/bitburner.product.citydata.md create mode 100644 markdown/bitburner.product.developmentprogress.md create mode 100644 markdown/bitburner.warehouse.smartsupplyenabled.md create mode 100644 markdown/bitburner.warehouseapi.getpurchasewarehousecost.md create mode 100644 markdown/bitburner.warehouseapi.getupgradewarehousecost.md create mode 100644 markdown/bitburner.warehouseapi.haswarehouse.md diff --git a/markdown/bitburner.corporation.acceptinvestmentoffer.md b/markdown/bitburner.corporation.acceptinvestmentoffer.md new file mode 100644 index 000000000..84ade55ce --- /dev/null +++ b/markdown/bitburner.corporation.acceptinvestmentoffer.md @@ -0,0 +1,23 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [acceptInvestmentOffer](./bitburner.corporation.acceptinvestmentoffer.md) + +## Corporation.acceptInvestmentOffer() method + +Accept investment based on you companies current valuation + +Signature: + +```typescript +acceptInvestmentOffer(): boolean; +``` +Returns: + +boolean + +An offer of investment + +## Remarks + +Is based on current valuation and will not honer a specific Offer + diff --git a/markdown/bitburner.corporation.createcorporation.md b/markdown/bitburner.corporation.createcorporation.md new file mode 100644 index 000000000..4129c04bb --- /dev/null +++ b/markdown/bitburner.corporation.createcorporation.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [createCorporation](./bitburner.corporation.createcorporation.md) + +## Corporation.createCorporation() method + +Create a Corporation + +Signature: + +```typescript +createCorporation(corporationName: string, selfFund: boolean): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| corporationName | string | | +| selfFund | boolean | | + +Returns: + +boolean + +true if created and false if not + diff --git a/markdown/bitburner.corporation.getexpandcitycost.md b/markdown/bitburner.corporation.getexpandcitycost.md new file mode 100644 index 000000000..99726fc89 --- /dev/null +++ b/markdown/bitburner.corporation.getexpandcitycost.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getExpandCityCost](./bitburner.corporation.getexpandcitycost.md) + +## Corporation.getExpandCityCost() method + +Gets the cost to expand into a new city + +Signature: + +```typescript +getExpandCityCost(): number; +``` +Returns: + +number + +cost + diff --git a/markdown/bitburner.corporation.getexpandindustrycost.md b/markdown/bitburner.corporation.getexpandindustrycost.md new file mode 100644 index 000000000..335e99775 --- /dev/null +++ b/markdown/bitburner.corporation.getexpandindustrycost.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getExpandIndustryCost](./bitburner.corporation.getexpandindustrycost.md) + +## Corporation.getExpandIndustryCost() method + +Gets the cost to expand into a new industry + +Signature: + +```typescript +getExpandIndustryCost(industryName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| industryName | string | Name of the industry | + +Returns: + +number + +cost + diff --git a/markdown/bitburner.corporation.getinvestmentoffer.md b/markdown/bitburner.corporation.getinvestmentoffer.md new file mode 100644 index 000000000..a1bce820e --- /dev/null +++ b/markdown/bitburner.corporation.getinvestmentoffer.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getInvestmentOffer](./bitburner.corporation.getinvestmentoffer.md) + +## Corporation.getInvestmentOffer() method + +Get an offer for investment based on you companies current valuation + +Signature: + +```typescript +getInvestmentOffer(): InvestmentOffer; +``` +Returns: + +[InvestmentOffer](./bitburner.investmentoffer.md) + +An offer of investment + diff --git a/markdown/bitburner.corporation.getunlockupgradecost.md b/markdown/bitburner.corporation.getunlockupgradecost.md new file mode 100644 index 000000000..328ba6239 --- /dev/null +++ b/markdown/bitburner.corporation.getunlockupgradecost.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getUnlockUpgradeCost](./bitburner.corporation.getunlockupgradecost.md) + +## Corporation.getUnlockUpgradeCost() method + +Gets the cost to unlock a one time unlockable upgrade + +Signature: + +```typescript +getUnlockUpgradeCost(upgradeName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| upgradeName | string | Name of the upgrade | + +Returns: + +number + +cost of the upgrade + diff --git a/markdown/bitburner.corporation.getupgradelevel.md b/markdown/bitburner.corporation.getupgradelevel.md new file mode 100644 index 000000000..e2e74b60a --- /dev/null +++ b/markdown/bitburner.corporation.getupgradelevel.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getUpgradeLevel](./bitburner.corporation.getupgradelevel.md) + +## Corporation.getUpgradeLevel() method + +Get the level of a levelable upgrade + +Signature: + +```typescript +getUpgradeLevel(upgradeName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| upgradeName | string | Name of the upgrade | + +Returns: + +number + +the level of the upgrade + diff --git a/markdown/bitburner.corporation.getupgradelevelcost.md b/markdown/bitburner.corporation.getupgradelevelcost.md new file mode 100644 index 000000000..fb26cd29a --- /dev/null +++ b/markdown/bitburner.corporation.getupgradelevelcost.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [getUpgradeLevelCost](./bitburner.corporation.getupgradelevelcost.md) + +## Corporation.getUpgradeLevelCost() method + +Gets the cost to unlock the next level of a levelable upgrade + +Signature: + +```typescript +getUpgradeLevelCost(upgradeName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| upgradeName | string | Name of the upgrade | + +Returns: + +number + +cost of the upgrade + diff --git a/markdown/bitburner.corporation.gopublic.md b/markdown/bitburner.corporation.gopublic.md new file mode 100644 index 000000000..e5f370e3b --- /dev/null +++ b/markdown/bitburner.corporation.gopublic.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [goPublic](./bitburner.corporation.gopublic.md) + +## Corporation.goPublic() method + +Go public + +Signature: + +```typescript +goPublic(numShares: number): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| numShares | number | number of shares you would like to issue for your IPO | + +Returns: + +boolean + +true if you successfully go public, false if not + diff --git a/markdown/bitburner.corporation.hasunlockupgrade.md b/markdown/bitburner.corporation.hasunlockupgrade.md new file mode 100644 index 000000000..869a78456 --- /dev/null +++ b/markdown/bitburner.corporation.hasunlockupgrade.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [hasUnlockUpgrade](./bitburner.corporation.hasunlockupgrade.md) + +## Corporation.hasUnlockUpgrade() method + +Check if you have a one time unlockable upgrade + +Signature: + +```typescript +hasUnlockUpgrade(upgradeName: string): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| upgradeName | string | Name of the upgrade | + +Returns: + +boolean + +true if unlocked and false if not + diff --git a/markdown/bitburner.corporation.md b/markdown/bitburner.corporation.md index 92f6a7816..393d22e9a 100644 --- a/markdown/bitburner.corporation.md +++ b/markdown/bitburner.corporation.md @@ -17,11 +17,21 @@ export interface Corporation extends WarehouseAPI, OfficeAPI | Method | Description | | --- | --- | +| [acceptInvestmentOffer()](./bitburner.corporation.acceptinvestmentoffer.md) | Accept investment based on you companies current valuation | +| [createCorporation(corporationName, selfFund)](./bitburner.corporation.createcorporation.md) | Create a Corporation | | [expandCity(divisionName, cityName)](./bitburner.corporation.expandcity.md) | Expand to a new city | | [expandIndustry(industryType, divisionName)](./bitburner.corporation.expandindustry.md) | Expand to a new industry | | [getCorporation()](./bitburner.corporation.getcorporation.md) | Get corporation data | | [getDivision(divisionName)](./bitburner.corporation.getdivision.md) | Get division data | +| [getExpandCityCost()](./bitburner.corporation.getexpandcitycost.md) | Gets the cost to expand into a new city | +| [getExpandIndustryCost(industryName)](./bitburner.corporation.getexpandindustrycost.md) | Gets the cost to expand into a new industry | +| [getInvestmentOffer()](./bitburner.corporation.getinvestmentoffer.md) | Get an offer for investment based on you companies current valuation | +| [getUnlockUpgradeCost(upgradeName)](./bitburner.corporation.getunlockupgradecost.md) | Gets the cost to unlock a one time unlockable upgrade | +| [getUpgradeLevel(upgradeName)](./bitburner.corporation.getupgradelevel.md) | Get the level of a levelable upgrade | +| [getUpgradeLevelCost(upgradeName)](./bitburner.corporation.getupgradelevelcost.md) | Gets the cost to unlock the next level of a levelable upgrade | +| [goPublic(numShares)](./bitburner.corporation.gopublic.md) | Go public | +| [hasUnlockUpgrade(upgradeName)](./bitburner.corporation.hasunlockupgrade.md) | Check if you have a one time unlockable upgrade | | [issueDividends(percent)](./bitburner.corporation.issuedividends.md) | Issue dividends | | [levelUpgrade(upgradeName)](./bitburner.corporation.levelupgrade.md) | Level an upgrade. | -| [unlockUpgrade(upgradeName)](./bitburner.corporation.unlockupgrade.md) | Unlock an upgrade. | +| [unlockUpgrade(upgradeName)](./bitburner.corporation.unlockupgrade.md) | Unlock an upgrade.npm run doc | diff --git a/markdown/bitburner.corporation.unlockupgrade.md b/markdown/bitburner.corporation.unlockupgrade.md index a7fec5c0e..758b9cbed 100644 --- a/markdown/bitburner.corporation.unlockupgrade.md +++ b/markdown/bitburner.corporation.unlockupgrade.md @@ -4,7 +4,7 @@ ## Corporation.unlockUpgrade() method -Unlock an upgrade. +Unlock an upgrade.npm run doc Signature: diff --git a/markdown/bitburner.corporationinfo.divisions.md b/markdown/bitburner.corporationinfo.divisions.md new file mode 100644 index 000000000..eb58a0f87 --- /dev/null +++ b/markdown/bitburner.corporationinfo.divisions.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CorporationInfo](./bitburner.corporationinfo.md) > [divisions](./bitburner.corporationinfo.divisions.md) + +## CorporationInfo.divisions property + +Array of all divisions + +Signature: + +```typescript +divisions: Division[]; +``` diff --git a/markdown/bitburner.corporationinfo.md b/markdown/bitburner.corporationinfo.md index 18237d89e..e82e977c3 100644 --- a/markdown/bitburner.corporationinfo.md +++ b/markdown/bitburner.corporationinfo.md @@ -16,6 +16,7 @@ interface CorporationInfo | Property | Type | Description | | --- | --- | --- | +| [divisions](./bitburner.corporationinfo.divisions.md) | [Division](./bitburner.division.md)\[\] | Array of all divisions | | [expenses](./bitburner.corporationinfo.expenses.md) | number | Expenses per second this cycle | | [funds](./bitburner.corporationinfo.funds.md) | number | Funds available | | [issuedShares](./bitburner.corporationinfo.issuedshares.md) | number | Amount of shares issued | diff --git a/markdown/bitburner.division.md b/markdown/bitburner.division.md index 071aa40a1..dafc74bbe 100644 --- a/markdown/bitburner.division.md +++ b/markdown/bitburner.division.md @@ -23,6 +23,7 @@ interface Division | [name](./bitburner.division.name.md) | string | Name of the division | | [popularity](./bitburner.division.popularity.md) | number | Popularity of the division | | [prodMult](./bitburner.division.prodmult.md) | number | Production multiplier | +| [products](./bitburner.division.products.md) | string\[\] | Products developed by this division | | [research](./bitburner.division.research.md) | number | Amount of research in that division | | [thisCycleExpenses](./bitburner.division.thiscycleexpenses.md) | number | Expenses this cycle | | [thisCycleRevenue](./bitburner.division.thiscyclerevenue.md) | number | Revenue this cycle | diff --git a/markdown/bitburner.division.products.md b/markdown/bitburner.division.products.md new file mode 100644 index 000000000..182c8e1f4 --- /dev/null +++ b/markdown/bitburner.division.products.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Division](./bitburner.division.md) > [products](./bitburner.division.products.md) + +## Division.products property + +Products developed by this division + +Signature: + +```typescript +products: string[]; +``` diff --git a/markdown/bitburner.investmentoffer.funds.md b/markdown/bitburner.investmentoffer.funds.md new file mode 100644 index 000000000..77822d27f --- /dev/null +++ b/markdown/bitburner.investmentoffer.funds.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [InvestmentOffer](./bitburner.investmentoffer.md) > [funds](./bitburner.investmentoffer.funds.md) + +## InvestmentOffer.funds property + +Amount of funds you will get from this investment + +Signature: + +```typescript +funds: number; +``` diff --git a/markdown/bitburner.investmentoffer.md b/markdown/bitburner.investmentoffer.md new file mode 100644 index 000000000..4768cc622 --- /dev/null +++ b/markdown/bitburner.investmentoffer.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [InvestmentOffer](./bitburner.investmentoffer.md) + +## InvestmentOffer interface + +Corporation investment offer + +Signature: + +```typescript +interface InvestmentOffer +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [funds](./bitburner.investmentoffer.funds.md) | number | Amount of funds you will get from this investment | +| [round](./bitburner.investmentoffer.round.md) | number | Current round of funding (max 4) | +| [shares](./bitburner.investmentoffer.shares.md) | number | Amount of share you will give in exchange for this investment | + diff --git a/markdown/bitburner.investmentoffer.round.md b/markdown/bitburner.investmentoffer.round.md new file mode 100644 index 000000000..05095029c --- /dev/null +++ b/markdown/bitburner.investmentoffer.round.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [InvestmentOffer](./bitburner.investmentoffer.md) > [round](./bitburner.investmentoffer.round.md) + +## InvestmentOffer.round property + +Current round of funding (max 4) + +Signature: + +```typescript +round: number; +``` diff --git a/markdown/bitburner.investmentoffer.shares.md b/markdown/bitburner.investmentoffer.shares.md new file mode 100644 index 000000000..7c3a2e0a1 --- /dev/null +++ b/markdown/bitburner.investmentoffer.shares.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [InvestmentOffer](./bitburner.investmentoffer.md) > [shares](./bitburner.investmentoffer.shares.md) + +## InvestmentOffer.shares property + +Amount of share you will give in exchange for this investment + +Signature: + +```typescript +shares: number; +``` diff --git a/markdown/bitburner.iport.clear.md b/markdown/bitburner.iport.clear.md new file mode 100644 index 000000000..94b81b098 --- /dev/null +++ b/markdown/bitburner.iport.clear.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [clear](./bitburner.iport.clear.md) + +## IPort.clear property + +removes all data from port + +Signature: + +```typescript +clear: () => void; +``` diff --git a/markdown/bitburner.iport.empty.md b/markdown/bitburner.iport.empty.md new file mode 100644 index 000000000..28e84e351 --- /dev/null +++ b/markdown/bitburner.iport.empty.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [empty](./bitburner.iport.empty.md) + +## IPort.empty property + +check if port is empty + +Signature: + +```typescript +empty: () => boolean; +``` diff --git a/markdown/bitburner.iport.full.md b/markdown/bitburner.iport.full.md new file mode 100644 index 000000000..dde575071 --- /dev/null +++ b/markdown/bitburner.iport.full.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [full](./bitburner.iport.full.md) + +## IPort.full property + +check if port is full + +Signature: + +```typescript +full: () => boolean; +``` diff --git a/markdown/bitburner.iport.md b/markdown/bitburner.iport.md new file mode 100644 index 000000000..6eb648526 --- /dev/null +++ b/markdown/bitburner.iport.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) + +## IPort interface + +Interface of a netscript port + +Signature: + +```typescript +export interface IPort +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [clear](./bitburner.iport.clear.md) | () => void | removes all data from port | +| [empty](./bitburner.iport.empty.md) | () => boolean | check if port is empty | +| [full](./bitburner.iport.full.md) | () => boolean | check if port is full | +| [peek](./bitburner.iport.peek.md) | () => any | reads first element without removing it from port if no data in port returns "NULL PORT DATA" | +| [read](./bitburner.iport.read.md) | () => any | reads and removes first element from port if no data in port returns "NULL PORT DATA" | +| [tryWrite](./bitburner.iport.trywrite.md) | (value: any) => boolean | add data to port if not full. | +| [write](./bitburner.iport.write.md) | (value: any) => any | write data to the port and removes and returns first element if full | + diff --git a/markdown/bitburner.iport.peek.md b/markdown/bitburner.iport.peek.md new file mode 100644 index 000000000..bb3f76344 --- /dev/null +++ b/markdown/bitburner.iport.peek.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [peek](./bitburner.iport.peek.md) + +## IPort.peek property + +reads first element without removing it from port if no data in port returns "NULL PORT DATA" + +Signature: + +```typescript +peek: () => any; +``` diff --git a/markdown/bitburner.iport.read.md b/markdown/bitburner.iport.read.md new file mode 100644 index 000000000..2c1f64bfa --- /dev/null +++ b/markdown/bitburner.iport.read.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [read](./bitburner.iport.read.md) + +## IPort.read property + +reads and removes first element from port if no data in port returns "NULL PORT DATA" + +Signature: + +```typescript +read: () => any; +``` diff --git a/markdown/bitburner.iport.trywrite.md b/markdown/bitburner.iport.trywrite.md new file mode 100644 index 000000000..84a814822 --- /dev/null +++ b/markdown/bitburner.iport.trywrite.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [tryWrite](./bitburner.iport.trywrite.md) + +## IPort.tryWrite property + +add data to port if not full. + +Signature: + +```typescript +tryWrite: (value: any) => boolean; +``` diff --git a/markdown/bitburner.iport.write.md b/markdown/bitburner.iport.write.md new file mode 100644 index 000000000..e88c227fb --- /dev/null +++ b/markdown/bitburner.iport.write.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [write](./bitburner.iport.write.md) + +## IPort.write property + +write data to the port and removes and returns first element if full + +Signature: + +```typescript +write: (value: any) => any; +``` diff --git a/markdown/bitburner.material.md b/markdown/bitburner.material.md index 6a6352e82..a850ce0d9 100644 --- a/markdown/bitburner.material.md +++ b/markdown/bitburner.material.md @@ -17,6 +17,8 @@ interface Material | Property | Type | Description | | --- | --- | --- | | [name](./bitburner.material.name.md) | string | Name of the material | +| [prod](./bitburner.material.prod.md) | number | Amount of material produced | | [qlt](./bitburner.material.qlt.md) | number | Quality of the material | | [qty](./bitburner.material.qty.md) | number | Amount of material | +| [sell](./bitburner.material.sell.md) | number | Amount of material sold | diff --git a/markdown/bitburner.material.prod.md b/markdown/bitburner.material.prod.md new file mode 100644 index 000000000..e45e4f946 --- /dev/null +++ b/markdown/bitburner.material.prod.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Material](./bitburner.material.md) > [prod](./bitburner.material.prod.md) + +## Material.prod property + +Amount of material produced + +Signature: + +```typescript +prod: number; +``` diff --git a/markdown/bitburner.material.sell.md b/markdown/bitburner.material.sell.md new file mode 100644 index 000000000..bde611e26 --- /dev/null +++ b/markdown/bitburner.material.sell.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Material](./bitburner.material.md) > [sell](./bitburner.material.sell.md) + +## Material.sell property + +Amount of material sold + +Signature: + +```typescript +sell: number; +``` diff --git a/markdown/bitburner.md b/markdown/bitburner.md index 4837f78bc..875fc15fa 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -52,6 +52,8 @@ | [HacknetNodesFormulas](./bitburner.hacknetnodesformulas.md) | Hacknet Node formulas | | [HacknetServerConstants](./bitburner.hacknetserverconstants.md) | Hacknet server related constants | | [HacknetServersFormulas](./bitburner.hacknetserversformulas.md) | Hacknet Server formulas | +| [InvestmentOffer](./bitburner.investmentoffer.md) | Corporation investment offer | +| [IPort](./bitburner.iport.md) | Interface of a netscript port | | [Material](./bitburner.material.md) | Material in a warehouse | | [NetscriptPort](./bitburner.netscriptport.md) | Object representing a port. A port is a serialized queue. | | [NodeStats](./bitburner.nodestats.md) | Object representing all the values related to a hacknet node. | diff --git a/markdown/bitburner.officeapi.gethireadvertcost.md b/markdown/bitburner.officeapi.gethireadvertcost.md new file mode 100644 index 000000000..3be571d6b --- /dev/null +++ b/markdown/bitburner.officeapi.gethireadvertcost.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [getHireAdVertCost](./bitburner.officeapi.gethireadvertcost.md) + +## OfficeAPI.getHireAdVertCost() method + +Get the cost to Hire AdVert + +Signature: + +```typescript +getHireAdVertCost(divisionName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| divisionName | string | Name of the division | + +Returns: + +number + +Cost + diff --git a/markdown/bitburner.officeapi.gethireadvertcount.md b/markdown/bitburner.officeapi.gethireadvertcount.md new file mode 100644 index 000000000..6fade9cf7 --- /dev/null +++ b/markdown/bitburner.officeapi.gethireadvertcount.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [getHireAdVertCount](./bitburner.officeapi.gethireadvertcount.md) + +## OfficeAPI.getHireAdVertCount() method + +Get the number of times you have Hired AdVert + +Signature: + +```typescript +getHireAdVertCount(adivisionName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| adivisionName | string | | + +Returns: + +number + +Number of times you have Hired AdVert + diff --git a/markdown/bitburner.officeapi.getresearchcost.md b/markdown/bitburner.officeapi.getresearchcost.md new file mode 100644 index 000000000..9d7ff7539 --- /dev/null +++ b/markdown/bitburner.officeapi.getresearchcost.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [getResearchCost](./bitburner.officeapi.getresearchcost.md) + +## OfficeAPI.getResearchCost() method + +Get the cost to unlock research + +Signature: + +```typescript +getResearchCost(divisionName: string, researchName: string): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| divisionName | string | Name of the division | +| researchName | string | | + +Returns: + +number + +cost + diff --git a/markdown/bitburner.officeapi.hasresearched.md b/markdown/bitburner.officeapi.hasresearched.md new file mode 100644 index 000000000..a996971fc --- /dev/null +++ b/markdown/bitburner.officeapi.hasresearched.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [hasResearched](./bitburner.officeapi.hasresearched.md) + +## OfficeAPI.hasResearched() method + +Gets if you have unlocked a research + +Signature: + +```typescript +hasResearched(divisionName: string, researchName: string): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| divisionName | string | Name of the division | +| researchName | string | | + +Returns: + +boolean + +true is unlocked, false if not + diff --git a/markdown/bitburner.officeapi.hireemployee.md b/markdown/bitburner.officeapi.hireemployee.md index 737528caf..d72ec4407 100644 --- a/markdown/bitburner.officeapi.hireemployee.md +++ b/markdown/bitburner.officeapi.hireemployee.md @@ -4,7 +4,7 @@ ## OfficeAPI.hireEmployee() method -Assign an employee to a job. +Hire an employee. Signature: diff --git a/markdown/bitburner.officeapi.md b/markdown/bitburner.officeapi.md index 39db79ab7..e8b8eb751 100644 --- a/markdown/bitburner.officeapi.md +++ b/markdown/bitburner.officeapi.md @@ -23,10 +23,15 @@ Requires the Office API upgrade from your corporation. | [assignJob(divisionName, cityName, employeeName, job)](./bitburner.officeapi.assignjob.md) | Assign an employee to a job. | | [buyCoffee(divisionName, cityName)](./bitburner.officeapi.buycoffee.md) | Buy coffee for your employees | | [getEmployee(divisionName, cityName, employeeName)](./bitburner.officeapi.getemployee.md) | Get data about an employee | +| [getHireAdVertCost(divisionName)](./bitburner.officeapi.gethireadvertcost.md) | Get the cost to Hire AdVert | +| [getHireAdVertCount(adivisionName)](./bitburner.officeapi.gethireadvertcount.md) | Get the number of times you have Hired AdVert | | [getOffice(divisionName, cityName)](./bitburner.officeapi.getoffice.md) | Get data about an office | +| [getResearchCost(divisionName, researchName)](./bitburner.officeapi.getresearchcost.md) | Get the cost to unlock research | +| [hasResearched(divisionName, researchName)](./bitburner.officeapi.hasresearched.md) | Gets if you have unlocked a research | | [hireAdVert(divisionName)](./bitburner.officeapi.hireadvert.md) | Hire AdVert. | -| [hireEmployee(divisionName, cityName)](./bitburner.officeapi.hireemployee.md) | Assign an employee to a job. | -| [research(divisionName, researchName)](./bitburner.officeapi.research.md) | Hire AdVert. | -| [throwParty(divisionName, cityName, costPerEmployee)](./bitburner.officeapi.throwparty.md) | Assign an employee to a job. | +| [hireEmployee(divisionName, cityName)](./bitburner.officeapi.hireemployee.md) | Hire an employee. | +| [research(divisionName, researchName)](./bitburner.officeapi.research.md) | purchace a research | +| [setAutoJobAssignment(divisionName, cityName, job, amount)](./bitburner.officeapi.setautojobassignment.md) | Set the auto job assignment for a job | +| [throwParty(divisionName, cityName, costPerEmployee)](./bitburner.officeapi.throwparty.md) | Throw a party for your employees | | [upgradeOfficeSize(divisionName, cityName, size)](./bitburner.officeapi.upgradeofficesize.md) | Upgrade office size. | diff --git a/markdown/bitburner.officeapi.research.md b/markdown/bitburner.officeapi.research.md index 56752336e..d3f6c8df2 100644 --- a/markdown/bitburner.officeapi.research.md +++ b/markdown/bitburner.officeapi.research.md @@ -4,7 +4,7 @@ ## OfficeAPI.research() method -Hire AdVert. +purchace a research Signature: diff --git a/markdown/bitburner.officeapi.setautojobassignment.md b/markdown/bitburner.officeapi.setautojobassignment.md new file mode 100644 index 000000000..8a7747f3f --- /dev/null +++ b/markdown/bitburner.officeapi.setautojobassignment.md @@ -0,0 +1,29 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [setAutoJobAssignment](./bitburner.officeapi.setautojobassignment.md) + +## OfficeAPI.setAutoJobAssignment() method + +Set the auto job assignment for a job + +Signature: + +```typescript +setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| divisionName | string | Name of the division | +| cityName | string | Name of the city | +| job | string | Name of the job | +| amount | number | Number of employees to assign to that job | + +Returns: + +Promise<boolean> + +A promise that is fulfilled when the assignment is complete. + diff --git a/markdown/bitburner.officeapi.throwparty.md b/markdown/bitburner.officeapi.throwparty.md index 63a9f4679..d5d9f96d4 100644 --- a/markdown/bitburner.officeapi.throwparty.md +++ b/markdown/bitburner.officeapi.throwparty.md @@ -4,7 +4,7 @@ ## OfficeAPI.throwParty() method -Assign an employee to a job. +Throw a party for your employees Signature: diff --git a/markdown/bitburner.player.hascorporation.md b/markdown/bitburner.player.hascorporation.md new file mode 100644 index 000000000..3f9d9e6b2 --- /dev/null +++ b/markdown/bitburner.player.hascorporation.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Player](./bitburner.player.md) > [hasCorporation](./bitburner.player.hascorporation.md) + +## Player.hasCorporation property + +Signature: + +```typescript +hasCorporation: boolean; +``` diff --git a/markdown/bitburner.player.md b/markdown/bitburner.player.md index 9d29525b3..3059f567f 100644 --- a/markdown/bitburner.player.md +++ b/markdown/bitburner.player.md @@ -64,6 +64,7 @@ interface Player | [hacknet\_node\_ram\_cost\_mult](./bitburner.player.hacknet_node_ram_cost_mult.md) | number | | | [has4SData](./bitburner.player.has4sdata.md) | boolean | | | [has4SDataTixApi](./bitburner.player.has4sdatatixapi.md) | boolean | | +| [hasCorporation](./bitburner.player.hascorporation.md) | boolean | | | [hasTixApiAccess](./bitburner.player.hastixapiaccess.md) | boolean | | | [hasWseAccount](./bitburner.player.haswseaccount.md) | boolean | | | [hp](./bitburner.player.hp.md) | number | | diff --git a/markdown/bitburner.product.citydata.md b/markdown/bitburner.product.citydata.md new file mode 100644 index 000000000..117697514 --- /dev/null +++ b/markdown/bitburner.product.citydata.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Product](./bitburner.product.md) > [cityData](./bitburner.product.citydata.md) + +## Product.cityData property + +Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is \[qty, prod, sell\] + +Signature: + +```typescript +cityData: {[key: string]:number[]}; +``` diff --git a/markdown/bitburner.product.developmentprogress.md b/markdown/bitburner.product.developmentprogress.md new file mode 100644 index 000000000..cb9fa7c29 --- /dev/null +++ b/markdown/bitburner.product.developmentprogress.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Product](./bitburner.product.md) > [developmentProgress](./bitburner.product.developmentprogress.md) + +## Product.developmentProgress property + +Creation progress - A number betwee 0-100 representing percentage + +Signature: + +```typescript +developmentProgress: number; +``` diff --git a/markdown/bitburner.product.md b/markdown/bitburner.product.md index 7fac94ff4..5e5491a8f 100644 --- a/markdown/bitburner.product.md +++ b/markdown/bitburner.product.md @@ -16,7 +16,9 @@ interface Product | Property | Type | Description | | --- | --- | --- | +| [cityData](./bitburner.product.citydata.md) | {\[key: string\]:number\[\]} | Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is \[qty, prod, sell\] | | [cmp](./bitburner.product.cmp.md) | number | Competition for the product | +| [developmentProgress](./bitburner.product.developmentprogress.md) | number | Creation progress - A number betwee 0-100 representing percentage | | [dmd](./bitburner.product.dmd.md) | number | Demand for the product | | [name](./bitburner.product.name.md) | string | Name of the product | | [pCost](./bitburner.product.pcost.md) | number | Production cost | diff --git a/markdown/bitburner.warehouse.md b/markdown/bitburner.warehouse.md index 888d7f5b2..f2248aa39 100644 --- a/markdown/bitburner.warehouse.md +++ b/markdown/bitburner.warehouse.md @@ -20,4 +20,5 @@ interface Warehouse | [loc](./bitburner.warehouse.loc.md) | string | City in which the warehouse is located | | [size](./bitburner.warehouse.size.md) | number | Total space in the warehouse | | [sizeUsed](./bitburner.warehouse.sizeused.md) | number | Used space in the warehouse | +| [smartSupplyEnabled](./bitburner.warehouse.smartsupplyenabled.md) | boolean | Smart Supply status in the warehouse | diff --git a/markdown/bitburner.warehouse.smartsupplyenabled.md b/markdown/bitburner.warehouse.smartsupplyenabled.md new file mode 100644 index 000000000..e95f75388 --- /dev/null +++ b/markdown/bitburner.warehouse.smartsupplyenabled.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Warehouse](./bitburner.warehouse.md) > [smartSupplyEnabled](./bitburner.warehouse.smartsupplyenabled.md) + +## Warehouse.smartSupplyEnabled property + +Smart Supply status in the warehouse + +Signature: + +```typescript +smartSupplyEnabled: boolean; +``` diff --git a/markdown/bitburner.warehouseapi.getpurchasewarehousecost.md b/markdown/bitburner.warehouseapi.getpurchasewarehousecost.md new file mode 100644 index 000000000..e8fbc61d0 --- /dev/null +++ b/markdown/bitburner.warehouseapi.getpurchasewarehousecost.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [WarehouseAPI](./bitburner.warehouseapi.md) > [getPurchaseWarehouseCost](./bitburner.warehouseapi.getpurchasewarehousecost.md) + +## WarehouseAPI.getPurchaseWarehouseCost() method + +Gets the cost to purchase a warehouse + +Signature: + +```typescript +getPurchaseWarehouseCost(): number; +``` +Returns: + +number + +cost + diff --git a/markdown/bitburner.warehouseapi.getupgradewarehousecost.md b/markdown/bitburner.warehouseapi.getupgradewarehousecost.md new file mode 100644 index 000000000..af801a472 --- /dev/null +++ b/markdown/bitburner.warehouseapi.getupgradewarehousecost.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [WarehouseAPI](./bitburner.warehouseapi.md) > [getUpgradeWarehouseCost](./bitburner.warehouseapi.getupgradewarehousecost.md) + +## WarehouseAPI.getUpgradeWarehouseCost() method + +Gets the cost to upgrade a warehouse to the next level + +Signature: + +```typescript +getUpgradeWarehouseCost(adivisionName: any, acityName: any): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| adivisionName | any | | +| acityName | any | | + +Returns: + +number + +cost to upgrade + diff --git a/markdown/bitburner.warehouseapi.haswarehouse.md b/markdown/bitburner.warehouseapi.haswarehouse.md new file mode 100644 index 000000000..636b6274a --- /dev/null +++ b/markdown/bitburner.warehouseapi.haswarehouse.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [WarehouseAPI](./bitburner.warehouseapi.md) > [hasWarehouse](./bitburner.warehouseapi.haswarehouse.md) + +## WarehouseAPI.hasWarehouse() method + +Check if you have a warehouse in city + +Signature: + +```typescript +hasWarehouse(adivisionName: any, acityName: any): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| adivisionName | any | | +| acityName | any | | + +Returns: + +boolean + +true if warehouse is present, false if not + diff --git a/markdown/bitburner.warehouseapi.md b/markdown/bitburner.warehouseapi.md index a3405017d..24a132042 100644 --- a/markdown/bitburner.warehouseapi.md +++ b/markdown/bitburner.warehouseapi.md @@ -26,7 +26,10 @@ Requires the Warehouse API upgrade from your corporation. | [exportMaterial(sourceDivision, sourceCity, targetDivision, targetCity, materialName, amt)](./bitburner.warehouseapi.exportmaterial.md) | Set material export data | | [getMaterial(divisionName, cityName, materialName)](./bitburner.warehouseapi.getmaterial.md) | Get material data | | [getProduct(divisionName, productName)](./bitburner.warehouseapi.getproduct.md) | Get product data | +| [getPurchaseWarehouseCost()](./bitburner.warehouseapi.getpurchasewarehousecost.md) | Gets the cost to purchase a warehouse | +| [getUpgradeWarehouseCost(adivisionName, acityName)](./bitburner.warehouseapi.getupgradewarehousecost.md) | Gets the cost to upgrade a warehouse to the next level | | [getWarehouse(divisionName, cityName)](./bitburner.warehouseapi.getwarehouse.md) | Get warehouse data | +| [hasWarehouse(adivisionName, acityName)](./bitburner.warehouseapi.haswarehouse.md) | Check if you have a warehouse in city | | [makeProduct(divisionName, cityName, productName, designInvest, marketingInvest)](./bitburner.warehouseapi.makeproduct.md) | Create a new product | | [purchaseWarehouse(divisionName, cityName)](./bitburner.warehouseapi.purchasewarehouse.md) | Purchase warehouse for a new city | | [sellMaterial(divisionName, cityName, materialName, amt, price)](./bitburner.warehouseapi.sellmaterial.md) | Set material sell data. | From dc5e9f5269c00a41801c6bcfa400ff6105cc10ef Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 19:04:18 +0000 Subject: [PATCH 21/40] More changes to docs --- markdown/bitburner.corporation.createcorporation.md | 2 +- markdown/bitburner.corporation.md | 2 +- markdown/bitburner.corporation.unlockupgrade.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/markdown/bitburner.corporation.createcorporation.md b/markdown/bitburner.corporation.createcorporation.md index 4129c04bb..9e9cdb585 100644 --- a/markdown/bitburner.corporation.createcorporation.md +++ b/markdown/bitburner.corporation.createcorporation.md @@ -17,7 +17,7 @@ createCorporation(corporationName: string, selfFund: boolean): boolean; | Parameter | Type | Description | | --- | --- | --- | | corporationName | string | | -| selfFund | boolean | | +| selfFund | boolean | If you should self fund, defaults to true, false will only work on Bitnode 3 | Returns: diff --git a/markdown/bitburner.corporation.md b/markdown/bitburner.corporation.md index 393d22e9a..87f76e4ba 100644 --- a/markdown/bitburner.corporation.md +++ b/markdown/bitburner.corporation.md @@ -33,5 +33,5 @@ export interface Corporation extends WarehouseAPI, OfficeAPI | [hasUnlockUpgrade(upgradeName)](./bitburner.corporation.hasunlockupgrade.md) | Check if you have a one time unlockable upgrade | | [issueDividends(percent)](./bitburner.corporation.issuedividends.md) | Issue dividends | | [levelUpgrade(upgradeName)](./bitburner.corporation.levelupgrade.md) | Level an upgrade. | -| [unlockUpgrade(upgradeName)](./bitburner.corporation.unlockupgrade.md) | Unlock an upgrade.npm run doc | +| [unlockUpgrade(upgradeName)](./bitburner.corporation.unlockupgrade.md) | Unlock an upgrade | diff --git a/markdown/bitburner.corporation.unlockupgrade.md b/markdown/bitburner.corporation.unlockupgrade.md index 758b9cbed..581d1bfb2 100644 --- a/markdown/bitburner.corporation.unlockupgrade.md +++ b/markdown/bitburner.corporation.unlockupgrade.md @@ -4,7 +4,7 @@ ## Corporation.unlockUpgrade() method -Unlock an upgrade.npm run doc +Unlock an upgrade Signature: From 6ee291e0b3a1600eb06993418f30956e24b46920 Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 21:08:01 +0000 Subject: [PATCH 22/40] Update md docs --- markdown/bitburner.corporation.bribe.md | 28 ++++++++++++++++++++++++ markdown/bitburner.corporation.md | 1 + markdown/bitburner.officeapi.md | 2 +- markdown/bitburner.officeapi.research.md | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 markdown/bitburner.corporation.bribe.md diff --git a/markdown/bitburner.corporation.bribe.md b/markdown/bitburner.corporation.bribe.md new file mode 100644 index 000000000..7aed27b39 --- /dev/null +++ b/markdown/bitburner.corporation.bribe.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [Corporation](./bitburner.corporation.md) > [bribe](./bitburner.corporation.bribe.md) + +## Corporation.bribe() method + +Bribe a faction + +Signature: + +```typescript +bribe(factionName: string, amountCash: number, amountShares: number): boolean; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| factionName | string | Faction name | +| amountCash | number | Amount of money to bribe | +| amountShares | number | Amount of shares to bribe | + +Returns: + +boolean + +True if successful, false if not + diff --git a/markdown/bitburner.corporation.md b/markdown/bitburner.corporation.md index 87f76e4ba..68d553b6f 100644 --- a/markdown/bitburner.corporation.md +++ b/markdown/bitburner.corporation.md @@ -18,6 +18,7 @@ export interface Corporation extends WarehouseAPI, OfficeAPI | Method | Description | | --- | --- | | [acceptInvestmentOffer()](./bitburner.corporation.acceptinvestmentoffer.md) | Accept investment based on you companies current valuation | +| [bribe(factionName, amountCash, amountShares)](./bitburner.corporation.bribe.md) | Bribe a faction | | [createCorporation(corporationName, selfFund)](./bitburner.corporation.createcorporation.md) | Create a Corporation | | [expandCity(divisionName, cityName)](./bitburner.corporation.expandcity.md) | Expand to a new city | | [expandIndustry(industryType, divisionName)](./bitburner.corporation.expandindustry.md) | Expand to a new industry | diff --git a/markdown/bitburner.officeapi.md b/markdown/bitburner.officeapi.md index e8b8eb751..ad66b2683 100644 --- a/markdown/bitburner.officeapi.md +++ b/markdown/bitburner.officeapi.md @@ -30,7 +30,7 @@ Requires the Office API upgrade from your corporation. | [hasResearched(divisionName, researchName)](./bitburner.officeapi.hasresearched.md) | Gets if you have unlocked a research | | [hireAdVert(divisionName)](./bitburner.officeapi.hireadvert.md) | Hire AdVert. | | [hireEmployee(divisionName, cityName)](./bitburner.officeapi.hireemployee.md) | Hire an employee. | -| [research(divisionName, researchName)](./bitburner.officeapi.research.md) | purchace a research | +| [research(divisionName, researchName)](./bitburner.officeapi.research.md) | Purchase a research | | [setAutoJobAssignment(divisionName, cityName, job, amount)](./bitburner.officeapi.setautojobassignment.md) | Set the auto job assignment for a job | | [throwParty(divisionName, cityName, costPerEmployee)](./bitburner.officeapi.throwparty.md) | Throw a party for your employees | | [upgradeOfficeSize(divisionName, cityName, size)](./bitburner.officeapi.upgradeofficesize.md) | Upgrade office size. | diff --git a/markdown/bitburner.officeapi.research.md b/markdown/bitburner.officeapi.research.md index d3f6c8df2..112f48f38 100644 --- a/markdown/bitburner.officeapi.research.md +++ b/markdown/bitburner.officeapi.research.md @@ -4,7 +4,7 @@ ## OfficeAPI.research() method -purchace a research +Purchase a research Signature: From bd20f16a2d5a70ad83af4a2f2c3870cc967a198a Mon Sep 17 00:00:00 2001 From: pigalot Date: Thu, 13 Jan 2022 22:21:05 +0000 Subject: [PATCH 23/40] Fix for AI Cores in smart supply --- src/Corporation/Actions.ts | 4 ++-- src/Corporation/ui/SmartSupplyModal.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index d044867e8..e69d5bd72 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -233,9 +233,9 @@ export function SetSmartSupply(warehouse: Warehouse, smartSupply: boolean): void } export function SetSmartSupplyUseLeftovers(warehouse: Warehouse, material: Material, useLeftover: boolean): void { - if (!Object.keys(warehouse.smartSupplyUseLeftovers).includes(material.name)) + if (!Object.keys(warehouse.smartSupplyUseLeftovers).includes(material.name.replace(/ /g, ""))) throw new Error(`Invalid material '${material.name}'`); - warehouse.smartSupplyUseLeftovers[material.name] = useLeftover; + warehouse.smartSupplyUseLeftovers[material.name.replace(/ /g, "")] = useLeftover; } export function BuyMaterial(material: Material, amt: number): void { diff --git a/src/Corporation/ui/SmartSupplyModal.tsx b/src/Corporation/ui/SmartSupplyModal.tsx index b4c031d99..083fb8ed5 100644 --- a/src/Corporation/ui/SmartSupplyModal.tsx +++ b/src/Corporation/ui/SmartSupplyModal.tsx @@ -16,7 +16,7 @@ interface ILeftoverProps { } function Leftover(props: ILeftoverProps): React.ReactElement { - const [checked, setChecked] = useState(!!props.warehouse.smartSupplyUseLeftovers[props.matName]); + const [checked, setChecked] = useState(!!props.warehouse.smartSupplyUseLeftovers[props.matName.replace(/ /g, "")]); function onChange(event: React.ChangeEvent): void { try { @@ -33,7 +33,7 @@ function Leftover(props: ILeftoverProps): React.ReactElement { <> } - label={{props.warehouse.materials[props.matName].name}} + label={{props.warehouse.materials[props.matName.replace(/ /g, "")].name}} />
From 4f391682b76e99cda2166e6870824c27f74a5a35 Mon Sep 17 00:00:00 2001 From: pigalot Date: Fri, 14 Jan 2022 09:38:49 +0000 Subject: [PATCH 24/40] Fix for unneeded extra = --- src/Corporation/Industry.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts index 09dbd03b3..6287859b2 100644 --- a/src/Corporation/Industry.ts +++ b/src/Corporation/Industry.ts @@ -436,13 +436,13 @@ export class Industry implements IIndustry { awarenessGain = popularityGain * 4; if (popularityGain > 0) { if (this.awareness === Number.MAX_VALUE || this.awareness + (awarenessGain * marketCycles) > Number.MAX_VALUE) { - this.awareness == Number.MAX_VALUE; + this.awareness = Number.MAX_VALUE; } else { this.awareness += awarenessGain * marketCycles; } if (this.popularity === Number.MAX_VALUE || this.popularity + (popularityGain * marketCycles) > Number.MAX_VALUE) { - this.popularity == Number.MAX_VALUE; + this.popularity = Number.MAX_VALUE; } else { this.popularity += popularityGain * marketCycles; } @@ -1289,26 +1289,26 @@ export class Industry implements IIndustry { //AdVert.Inc, const advMult = corporation.getAdvertisingMultiplier() * this.getAdvertisingMultiplier(); if (this.awareness === Number.MAX_VALUE || this.awareness + (3 * advMult) > Number.MAX_VALUE) { - this.awareness == Number.MAX_VALUE; + this.awareness = Number.MAX_VALUE; } else { this.awareness += 3 * advMult; } if (this.awareness === Number.MAX_VALUE || this.awareness * (1.01 * advMult) > Number.MAX_VALUE) { - this.awareness == Number.MAX_VALUE; + this.awareness = Number.MAX_VALUE; } else { this.awareness *= 1.01 * advMult; } if (this.popularity === Number.MAX_VALUE || this.popularity + (1 * advMult) > Number.MAX_VALUE) { - this.popularity == Number.MAX_VALUE; + this.popularity = Number.MAX_VALUE; } else { this.popularity += 1 * advMult; } const rand = (1 + getRandomInt(1, 3) / 100); if (this.popularity === Number.MAX_VALUE || this.popularity * (rand * advMult) > Number.MAX_VALUE) { - this.popularity == Number.MAX_VALUE; + this.popularity = Number.MAX_VALUE; } else { this.popularity *= rand * advMult; } From 416c4ad6198d7f20abf544cc22948bcecc87cfc3 Mon Sep 17 00:00:00 2001 From: pigalot Date: Fri, 14 Jan 2022 10:05:00 +0000 Subject: [PATCH 25/40] swap if for Math.min --- src/Corporation/Industry.ts | 44 ++++++++----------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts index 6287859b2..a72d7ec0c 100644 --- a/src/Corporation/Industry.ts +++ b/src/Corporation/Industry.ts @@ -435,17 +435,11 @@ export class Industry implements IIndustry { const popularityGain = corporation.getDreamSenseGain(), awarenessGain = popularityGain * 4; if (popularityGain > 0) { - if (this.awareness === Number.MAX_VALUE || this.awareness + (awarenessGain * marketCycles) > Number.MAX_VALUE) { - this.awareness = Number.MAX_VALUE; - } else { - this.awareness += awarenessGain * marketCycles; - } - - if (this.popularity === Number.MAX_VALUE || this.popularity + (popularityGain * marketCycles) > Number.MAX_VALUE) { - this.popularity = Number.MAX_VALUE; - } else { - this.popularity += popularityGain * marketCycles; - } + const awareness = this.awareness + (awarenessGain * marketCycles); + this.awareness = Math.min(awareness, Number.MAX_VALUE); + + const popularity = this.popularity + (popularityGain * marketCycles); + this.popularity = Math.min(popularity, Number.MAX_VALUE); } return; @@ -1288,31 +1282,11 @@ export class Industry implements IIndustry { case 1: { //AdVert.Inc, const advMult = corporation.getAdvertisingMultiplier() * this.getAdvertisingMultiplier(); - if (this.awareness === Number.MAX_VALUE || this.awareness + (3 * advMult) > Number.MAX_VALUE) { - this.awareness = Number.MAX_VALUE; - } else { - this.awareness += 3 * advMult; - } + const awareness = (this.awareness + (3 * advMult)) * (1.01 * advMult); + this.awareness = Math.min(awareness, Number.MAX_VALUE); - if (this.awareness === Number.MAX_VALUE || this.awareness * (1.01 * advMult) > Number.MAX_VALUE) { - this.awareness = Number.MAX_VALUE; - } else { - this.awareness *= 1.01 * advMult; - } - - if (this.popularity === Number.MAX_VALUE || this.popularity + (1 * advMult) > Number.MAX_VALUE) { - this.popularity = Number.MAX_VALUE; - } else { - this.popularity += 1 * advMult; - } - - const rand = (1 + getRandomInt(1, 3) / 100); - if (this.popularity === Number.MAX_VALUE || this.popularity * (rand * advMult) > Number.MAX_VALUE) { - this.popularity = Number.MAX_VALUE; - } else { - this.popularity *= rand * advMult; - } - + const popularity = (this.popularity + (1 * advMult)) * ((1 + getRandomInt(1, 3) / 100) * advMult); + this.popularity = Math.min(popularity, Number.MAX_VALUE); break; } default: { From 9ad41932701973d43b62d57122d8890ae0ec8e02 Mon Sep 17 00:00:00 2001 From: pigalot Date: Sat, 15 Jan 2022 14:08:24 +0000 Subject: [PATCH 26/40] Update markdown/bitburner.product.developmentprogress.md Co-authored-by: Jack --- markdown/bitburner.product.developmentprogress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/bitburner.product.developmentprogress.md b/markdown/bitburner.product.developmentprogress.md index cb9fa7c29..0949fb793 100644 --- a/markdown/bitburner.product.developmentprogress.md +++ b/markdown/bitburner.product.developmentprogress.md @@ -4,7 +4,7 @@ ## Product.developmentProgress property -Creation progress - A number betwee 0-100 representing percentage +Creation progress - A number between 0-100 representing percentage Signature: From 4e099a935e47bbd2d5e4fe27b7d5cba3da368e15 Mon Sep 17 00:00:00 2001 From: pigalot Date: Sat, 15 Jan 2022 14:08:29 +0000 Subject: [PATCH 27/40] Update markdown/bitburner.product.md Co-authored-by: Jack --- markdown/bitburner.product.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/bitburner.product.md b/markdown/bitburner.product.md index 5e5491a8f..495d7f788 100644 --- a/markdown/bitburner.product.md +++ b/markdown/bitburner.product.md @@ -18,7 +18,7 @@ interface Product | --- | --- | --- | | [cityData](./bitburner.product.citydata.md) | {\[key: string\]:number\[\]} | Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is \[qty, prod, sell\] | | [cmp](./bitburner.product.cmp.md) | number | Competition for the product | -| [developmentProgress](./bitburner.product.developmentprogress.md) | number | Creation progress - A number betwee 0-100 representing percentage | +| [developmentProgress](./bitburner.product.developmentprogress.md) | number | Creation progress - A number between 0-100 representing percentage | | [dmd](./bitburner.product.dmd.md) | number | Demand for the product | | [name](./bitburner.product.name.md) | string | Name of the product | | [pCost](./bitburner.product.pcost.md) | number | Production cost | From 2246dd7fe64452a0503580b89b0716788abfb490 Mon Sep 17 00:00:00 2001 From: pigalot Date: Sat, 15 Jan 2022 14:08:34 +0000 Subject: [PATCH 28/40] Update src/ScriptEditor/NetscriptDefinitions.d.ts Co-authored-by: Jack --- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 16c469a55..040e6d82f 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6549,7 +6549,7 @@ interface Product { * These values are specific to a city * For each city, the data is [qty, prod, sell] */ cityData: {[key: string]:number[]}; - /** Creation progress - A number betwee 0-100 representing percentage */ + /** Creation progress - A number between 0-100 representing percentage */ developmentProgress: number; } From d34d720ab92ac69071797faf19abaf779daa8754 Mon Sep 17 00:00:00 2001 From: pigalot Date: Sat, 15 Jan 2022 14:24:01 +0000 Subject: [PATCH 29/40] Office Size Upgrade Cost --- ...rner.officeapi.getofficesizeupgradecost.md | 28 +++++++++++++++++++ markdown/bitburner.officeapi.md | 1 + src/NetscriptFunctions/Corporation.ts | 15 ++++++++++ src/ScriptEditor/NetscriptDefinitions.d.ts | 8 ++++++ 4 files changed, 52 insertions(+) create mode 100644 markdown/bitburner.officeapi.getofficesizeupgradecost.md diff --git a/markdown/bitburner.officeapi.getofficesizeupgradecost.md b/markdown/bitburner.officeapi.getofficesizeupgradecost.md new file mode 100644 index 000000000..1488a0d85 --- /dev/null +++ b/markdown/bitburner.officeapi.getofficesizeupgradecost.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [OfficeAPI](./bitburner.officeapi.md) > [getOfficeSizeUpgradeCost](./bitburner.officeapi.getofficesizeupgradecost.md) + +## OfficeAPI.getOfficeSizeUpgradeCost() method + +Cost to Upgrade office size. + +Signature: + +```typescript +getOfficeSizeUpgradeCost(divisionName: string, cityName: string, asize: number): number; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| divisionName | string | Name of the division | +| cityName | string | Name of the city | +| asize | number | | + +Returns: + +number + +Cost of upgrading the office + diff --git a/markdown/bitburner.officeapi.md b/markdown/bitburner.officeapi.md index ad66b2683..a3fcca6d9 100644 --- a/markdown/bitburner.officeapi.md +++ b/markdown/bitburner.officeapi.md @@ -26,6 +26,7 @@ Requires the Office API upgrade from your corporation. | [getHireAdVertCost(divisionName)](./bitburner.officeapi.gethireadvertcost.md) | Get the cost to Hire AdVert | | [getHireAdVertCount(adivisionName)](./bitburner.officeapi.gethireadvertcount.md) | Get the number of times you have Hired AdVert | | [getOffice(divisionName, cityName)](./bitburner.officeapi.getoffice.md) | Get data about an office | +| [getOfficeSizeUpgradeCost(divisionName, cityName, asize)](./bitburner.officeapi.getofficesizeupgradecost.md) | Cost to Upgrade office size. | | [getResearchCost(divisionName, researchName)](./bitburner.officeapi.getresearchcost.md) | Get the cost to unlock research | | [hasResearched(divisionName, researchName)](./bitburner.officeapi.hasresearched.md) | Gets if you have unlocked a research | | [hireAdVert(divisionName)](./bitburner.officeapi.hireadvert.md) | Hire AdVert. | diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 52fe44a43..05845801c 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -543,6 +543,21 @@ export function NetscriptCorporation( return Promise.resolve(office.setEmployeeToJob(job, amount)); }); }, + getOfficeSizeUpgradeCost: function (adivisionName: any, acityName: any, asize: any): number { + checkAccess("getOfficeSizeUpgradeCost", 8); + const divisionName = helper.string("getOfficeSizeUpgradeCost", "divisionName", adivisionName); + const cityName = helper.string("getOfficeSizeUpgradeCost", "cityName", acityName); + const size = helper.number("getOfficeSizeUpgradeCost", "size", asize); + if (size < 0) throw new Error("Invalid value for size field! Must be numeric and grater than 0"); + const office = getOffice(divisionName, cityName); + const initialPriceMult = Math.round(office.size / CorporationConstants.OfficeInitialSize); + const costMultiplier = 1.09; + let mult = 0; + for (let i = 0; i < size / CorporationConstants.OfficeInitialSize; ++i) { + mult += Math.pow(costMultiplier, initialPriceMult + i); + } + return CorporationConstants.OfficeInitialCost * mult; + }, assignJob: function (adivisionName: any, acityName: any, aemployeeName: any, ajob: any): Promise { checkAccess("assignJob", 8); const divisionName = helper.string("assignJob", "divisionName", adivisionName); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 040e6d82f..d99fa5558 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6175,6 +6175,14 @@ export interface OfficeAPI { * @returns A promise that is fulfilled when the assignment is complete. */ setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): Promise; + /** + * Cost to Upgrade office size. + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @param size - Amount of positions to open + * @returns Cost of upgrading the office + */ + getOfficeSizeUpgradeCost(divisionName: string, cityName: string, asize: number): number; } /** From 8b526071132719edeeae7bfd2d3b2e702e3b9ea7 Mon Sep 17 00:00:00 2001 From: pigalot Date: Sun, 16 Jan 2022 16:13:45 +0000 Subject: [PATCH 30/40] Update docs after rebase --- dist/bitburner.d.ts | 164 +++- input/bitburner.api.json | 1317 +++++++++++++++++++++++++- markdown/bitburner.iport.clear.md | 13 - markdown/bitburner.iport.empty.md | 13 - markdown/bitburner.iport.full.md | 13 - markdown/bitburner.iport.md | 26 - markdown/bitburner.iport.peek.md | 13 - markdown/bitburner.iport.read.md | 13 - markdown/bitburner.iport.trywrite.md | 13 - markdown/bitburner.iport.write.md | 13 - markdown/bitburner.md | 1 - 11 files changed, 1473 insertions(+), 126 deletions(-) delete mode 100644 markdown/bitburner.iport.clear.md delete mode 100644 markdown/bitburner.iport.empty.md delete mode 100644 markdown/bitburner.iport.full.md delete mode 100644 markdown/bitburner.iport.md delete mode 100644 markdown/bitburner.iport.peek.md delete mode 100644 markdown/bitburner.iport.read.md delete mode 100644 markdown/bitburner.iport.trywrite.md delete mode 100644 markdown/bitburner.iport.write.md diff --git a/dist/bitburner.d.ts b/dist/bitburner.d.ts index 4dc51389c..9b6fe3938 100644 --- a/dist/bitburner.d.ts +++ b/dist/bitburner.d.ts @@ -852,6 +852,74 @@ export declare interface CodingContract { * @public */ export declare interface Corporation extends WarehouseAPI, OfficeAPI { + /** + * Create a Corporation + * @param divisionName - Name of the division + * @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3 + * @returns true if created and false if not + */ + createCorporation(corporationName: string, selfFund: boolean): boolean; + /** + * Check if you have a one time unlockable upgrade + * @param upgradeName - Name of the upgrade + * @returns true if unlocked and false if not + */ + hasUnlockUpgrade(upgradeName: string): boolean; + /** + * Gets the cost to unlock a one time unlockable upgrade + * @param upgradeName - Name of the upgrade + * @returns cost of the upgrade + */ + getUnlockUpgradeCost(upgradeName: string): number; + /** + * Get the level of a levelable upgrade + * @param upgradeName - Name of the upgrade + * @returns the level of the upgrade + */ + getUpgradeLevel(upgradeName: string): number; + /** + * Gets the cost to unlock the next level of a levelable upgrade + * @param upgradeName - Name of the upgrade + * @returns cost of the upgrade + */ + getUpgradeLevelCost(upgradeName: string): number; + /** + * Gets the cost to expand into a new industry + * @param industryName - Name of the industry + * @returns cost + */ + getExpandIndustryCost(industryName: string): number; + /** + * Gets the cost to expand into a new city + * @returns cost + */ + getExpandCityCost(): number; + /** + * Get an offer for investment based on you companies current valuation + * @returns An offer of investment + */ + getInvestmentOffer(): InvestmentOffer; + /** + * Accept investment based on you companies current valuation + * @remarks + * Is based on current valuation and will not honer a specific Offer + * @returns An offer of investment + */ + acceptInvestmentOffer(): boolean; + /** + * Go public + * @param numShares - number of shares you would like to issue for your IPO + * @returns true if you successfully go public, false if not + */ + goPublic(numShares: number): boolean; + /** + * Bribe a faction + * @param factionName - Faction name + * @param amountCash - Amount of money to bribe + * @param amountShares - Amount of shares to bribe + * @returns True if successful, false if not + */ + bribe(factionName: string, amountCash: number, amountShares: number): boolean; /** * Get corporation data * @returns Corporation data @@ -876,7 +944,7 @@ export declare interface Corporation extends WarehouseAPI, OfficeAPI { */ expandCity(divisionName: string, cityName: string): void; /** - * Unlock an upgrade. + * Unlock an upgrade * @param upgradeName - Name of the upgrade */ unlockUpgrade(upgradeName: string): void; @@ -919,6 +987,8 @@ export declare interface CorporationInfo { sharePrice: number; /** State of the corporation. Possible states are START, PURCHASE, PRODUCTION, SALE, EXPORT. */ state: string; + /** Array of all divisions */ + divisions: Division[]; } /** @@ -997,6 +1067,8 @@ export declare interface Division { upgrades: number[]; /** Cities in which this division has expanded */ cities: string[]; + /** Products developed by this division */ + products: string[]; } /** @@ -2213,6 +2285,19 @@ export declare interface HacknetServersFormulas { constants(): HacknetServerConstants; } +/** + * Corporation investment offer + * @public + */ +export declare interface InvestmentOffer { + /** Amount of funds you will get from this investment */ + funds: number; + /** Amount of share you will give in exchange for this investment */ + shares: number; + /** Current round of funding (max 4) */ + round: number; +} + /** * Interface Styles * @internal @@ -2233,6 +2318,10 @@ export declare interface Material { qty: number; /** Quality of the material */ qlt: number; + /** Amount of material produced */ + prod: number; + /** Amount of material sold */ + sell: number; } /** @@ -4377,7 +4466,7 @@ export declare interface OfficeAPI { */ assignJob(divisionName: string, cityName: string, employeeName: string, job: string): Promise; /** - * Assign an employee to a job. + * Hire an employee. * @param divisionName - Name of the division * @param cityName - Name of the city * @returns The newly hired employee, if any @@ -4391,7 +4480,7 @@ export declare interface OfficeAPI { */ upgradeOfficeSize(divisionName: string, cityName: string, size: number): void; /** - * Assign an employee to a job. + * Throw a party for your employees * @param divisionName - Name of the division * @param cityName - Name of the city * @param costPerEmployee - Amount to spend per employee. @@ -4411,7 +4500,7 @@ export declare interface OfficeAPI { */ hireAdVert(divisionName: string): void; /** - * Hire AdVert. + * Purchase a research * @param divisionName - Name of the division * @param researchName - Name of the research */ @@ -4431,6 +4520,49 @@ export declare interface OfficeAPI { * @returns Employee data */ getEmployee(divisionName: string, cityName: string, employeeName: string): Employee; + /** + * Get the cost to Hire AdVert + * @param divisionName - Name of the division + * @returns Cost + */ + getHireAdVertCost(divisionName: string): number; + /** + * Get the number of times you have Hired AdVert + * @param divisionName - Name of the division + * @returns Number of times you have Hired AdVert + */ + getHireAdVertCount(adivisionName: string): number; + /** + * Get the cost to unlock research + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @returns cost + */ + getResearchCost(divisionName: string, researchName: string): number; + /** + * Gets if you have unlocked a research + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @returns true is unlocked, false if not + */ + hasResearched(divisionName: string, researchName: string): boolean; + /** + * Set the auto job assignment for a job + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @param job - Name of the job + * @param amount - Number of employees to assign to that job + * @returns A promise that is fulfilled when the assignment is complete. + */ + setAutoJobAssignment(divisionName: string, cityName: string, job: string, amount: number): Promise; + /** + * Cost to Upgrade office size. + * @param divisionName - Name of the division + * @param cityName - Name of the city + * @param size - Amount of positions to open + * @returns Cost of upgrading the office + */ + getOfficeSizeUpgradeCost(divisionName: string, cityName: string, asize: number): number; } /** @@ -4533,6 +4665,7 @@ export declare interface Player { jobs: any; factions: string[]; tor: boolean; + hasCorporation: boolean; } /** @@ -4594,6 +4727,12 @@ export declare interface Product { pCost: number; /** Sell cost, can be "MP+5" */ sCost: string | number; + /** Data refers to the production, sale, and quantity of the products + * These values are specific to a city + * For each city, the data is [qty, prod, sell] */ + cityData: {[key: string]:number[]}; + /** Creation progress - A number between 0-100 representing percentage */ + developmentProgress: number; } /** @@ -6404,6 +6543,8 @@ export declare interface Warehouse { size: number; /** Used space in the warehouse */ sizeUsed: number; + /** Smart Supply status in the warehouse */ + smartSupplyEnabled: boolean; } /** @@ -6572,6 +6713,21 @@ export declare interface WarehouseAPI { designInvest: number, marketingInvest: number, ): void; + /** + * Gets the cost to purchase a warehouse + * @returns cost + */ + getPurchaseWarehouseCost(): number; + /** + * Gets the cost to upgrade a warehouse to the next level + * @returns cost to upgrade + */ + getUpgradeWarehouseCost(adivisionName: any, acityName: any): number; + /** + * Check if you have a warehouse in city + * @returns true if warehouse is present, false if not + */ + hasWarehouse(adivisionName: any, acityName: any): boolean; } export { } diff --git a/input/bitburner.api.json b/input/bitburner.api.json index 478af67a9..0d49c5fb9 100644 --- a/input/bitburner.api.json +++ b/input/bitburner.api.json @@ -5362,6 +5362,167 @@ "releaseTag": "Public", "name": "Corporation", "members": [ + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#acceptInvestmentOffer:member(1)", + "docComment": "/**\n * Accept investment based on you companies current valuation\n *\n * @remarks\n *\n * Is based on current valuation and will not honer a specific Offer\n *\n * @returns An offer of investment\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "acceptInvestmentOffer(): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [], + "name": "acceptInvestmentOffer" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#bribe:member(1)", + "docComment": "/**\n * Bribe a faction\n *\n * @param factionName - Faction name\n *\n * @param amountCash - Amount of money to bribe\n *\n * @param amountShares - Amount of shares to bribe\n *\n * @returns True if successful, false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "bribe(factionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", amountCash: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ", amountShares: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 7, + "endIndex": 8 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "factionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "amountCash", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + }, + { + "parameterName": "amountShares", + "parameterTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + } + } + ], + "name": "bribe" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#createCorporation:member(1)", + "docComment": "/**\n * Create a Corporation\n *\n * @param divisionName - Name of the division\n *\n * @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3\n *\n * @returns true if created and false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "createCorporation(corporationName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", selfFund: " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "corporationName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "selfFund", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], + "name": "createCorporation" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!Corporation#expandCity:member(1)", @@ -5554,6 +5715,327 @@ ], "name": "getDivision" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getExpandCityCost:member(1)", + "docComment": "/**\n * Gets the cost to expand into a new city\n *\n * @returns cost\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getExpandCityCost(): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [], + "name": "getExpandCityCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getExpandIndustryCost:member(1)", + "docComment": "/**\n * Gets the cost to expand into a new industry\n *\n * @param industryName - Name of the industry\n *\n * @returns cost\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getExpandIndustryCost(industryName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "industryName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getExpandIndustryCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getInvestmentOffer:member(1)", + "docComment": "/**\n * Get an offer for investment based on you companies current valuation\n *\n * @returns An offer of investment\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getInvestmentOffer(): " + }, + { + "kind": "Reference", + "text": "InvestmentOffer", + "canonicalReference": "bitburner!InvestmentOffer:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [], + "name": "getInvestmentOffer" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getUnlockUpgradeCost:member(1)", + "docComment": "/**\n * Gets the cost to unlock a one time unlockable upgrade\n *\n * @param upgradeName - Name of the upgrade\n *\n * @returns cost of the upgrade\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getUnlockUpgradeCost(upgradeName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "upgradeName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getUnlockUpgradeCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getUpgradeLevel:member(1)", + "docComment": "/**\n * Get the level of a levelable upgrade\n *\n * @param upgradeName - Name of the upgrade\n *\n * @returns the level of the upgrade\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getUpgradeLevel(upgradeName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "upgradeName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getUpgradeLevel" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#getUpgradeLevelCost:member(1)", + "docComment": "/**\n * Gets the cost to unlock the next level of a levelable upgrade\n *\n * @param upgradeName - Name of the upgrade\n *\n * @returns cost of the upgrade\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getUpgradeLevelCost(upgradeName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "upgradeName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getUpgradeLevelCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#goPublic:member(1)", + "docComment": "/**\n * Go public\n *\n * @param numShares - number of shares you would like to issue for your IPO\n *\n * @returns true if you successfully go public, false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "goPublic(numShares: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "numShares", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "goPublic" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!Corporation#hasUnlockUpgrade:member(1)", + "docComment": "/**\n * Check if you have a one time unlockable upgrade\n *\n * @param upgradeName - Name of the upgrade\n *\n * @returns true if unlocked and false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "hasUnlockUpgrade(upgradeName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "upgradeName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "hasUnlockUpgrade" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!Corporation#issueDividends:member(1)", @@ -5645,7 +6127,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!Corporation#unlockUpgrade:member(1)", - "docComment": "/**\n * Unlock an upgrade.\n *\n * @param upgradeName - Name of the upgrade\n */\n", + "docComment": "/**\n * Unlock an upgrade\n *\n * @param upgradeName - Name of the upgrade\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5711,6 +6193,37 @@ "releaseTag": "Public", "name": "CorporationInfo", "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!CorporationInfo#divisions:member", + "docComment": "/**\n * Array of all divisions\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "divisions: " + }, + { + "kind": "Reference", + "text": "Division", + "canonicalReference": "bitburner!Division:interface" + }, + { + "kind": "Content", + "text": "[]" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "divisions", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 3 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!CorporationInfo#expenses:member", @@ -6731,6 +7244,32 @@ "endIndex": 2 } }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Division#products:member", + "docComment": "/**\n * Products developed by this division\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "products: " + }, + { + "kind": "Content", + "text": "string[]" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "products", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!Division#research:member", @@ -14793,6 +15332,100 @@ ], "extendsTokenRanges": [] }, + { + "kind": "Interface", + "canonicalReference": "bitburner!InvestmentOffer:interface", + "docComment": "/**\n * Corporation investment offer\n *\n * @public\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "interface InvestmentOffer " + } + ], + "releaseTag": "Public", + "name": "InvestmentOffer", + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!InvestmentOffer#funds:member", + "docComment": "/**\n * Amount of funds you will get from this investment\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "funds: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "funds", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!InvestmentOffer#round:member", + "docComment": "/**\n * Current round of funding (max 4)\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "round: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "round", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!InvestmentOffer#shares:member", + "docComment": "/**\n * Amount of share you will give in exchange for this investment\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "shares: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "shares", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "extendsTokenRanges": [] + }, { "kind": "Interface", "canonicalReference": "bitburner!Material:interface", @@ -14832,6 +15465,32 @@ "endIndex": 2 } }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Material#prod:member", + "docComment": "/**\n * Amount of material produced\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "prod: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "prod", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!Material#qlt:member", @@ -14883,6 +15542,32 @@ "startIndex": 1, "endIndex": 2 } + }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Material#sell:member", + "docComment": "/**\n * Amount of material sold\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "sell: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "sell", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } } ], "extendsTokenRanges": [] @@ -21378,6 +22063,94 @@ ], "name": "getEmployee" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#getHireAdVertCost:member(1)", + "docComment": "/**\n * Get the cost to Hire AdVert\n *\n * @param divisionName - Name of the division\n *\n * @returns Cost\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getHireAdVertCost(divisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "divisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getHireAdVertCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#getHireAdVertCount:member(1)", + "docComment": "/**\n * Get the number of times you have Hired AdVert\n *\n * @param divisionName - Name of the division\n *\n * @returns Number of times you have Hired AdVert\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getHireAdVertCount(adivisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "adivisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "name": "getHireAdVertCount" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!OfficeAPI#getOffice:member(1)", @@ -21438,6 +22211,198 @@ ], "name": "getOffice" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#getOfficeSizeUpgradeCost:member(1)", + "docComment": "/**\n * Cost to Upgrade office size.\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @param size - Amount of positions to open\n *\n * @returns Cost of upgrading the office\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getOfficeSizeUpgradeCost(divisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", cityName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", asize: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 7, + "endIndex": 8 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "divisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "cityName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + }, + { + "parameterName": "asize", + "parameterTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + } + } + ], + "name": "getOfficeSizeUpgradeCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#getResearchCost:member(1)", + "docComment": "/**\n * Get the cost to unlock research\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @returns cost\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getResearchCost(divisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", researchName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "divisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "researchName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], + "name": "getResearchCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#hasResearched:member(1)", + "docComment": "/**\n * Gets if you have unlocked a research\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @returns true is unlocked, false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "hasResearched(divisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", researchName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "divisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "researchName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], + "name": "hasResearched" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!OfficeAPI#hireAdVert:member(1)", @@ -21485,7 +22450,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!OfficeAPI#hireEmployee:member(1)", - "docComment": "/**\n * Assign an employee to a job.\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @returns The newly hired employee, if any\n */\n", + "docComment": "/**\n * Hire an employee.\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @returns The newly hired employee, if any\n */\n", "excerptTokens": [ { "kind": "Content", @@ -21549,7 +22514,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!OfficeAPI#research:member(1)", - "docComment": "/**\n * Hire AdVert.\n *\n * @param divisionName - Name of the division\n *\n * @param researchName - Name of the research\n */\n", + "docComment": "/**\n * Purchase a research\n *\n * @param divisionName - Name of the division\n *\n * @param researchName - Name of the research\n */\n", "excerptTokens": [ { "kind": "Content", @@ -21605,10 +22570,104 @@ ], "name": "research" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!OfficeAPI#setAutoJobAssignment:member(1)", + "docComment": "/**\n * Set the auto job assignment for a job\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @param job - Name of the job\n *\n * @param amount - Number of employees to assign to that job\n *\n * @returns A promise that is fulfilled when the assignment is complete.\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "setAutoJobAssignment(divisionName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", cityName: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", job: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ", amount: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Reference", + "text": "Promise", + "canonicalReference": "!Promise:interface" + }, + { + "kind": "Content", + "text": "" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 9, + "endIndex": 11 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "divisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "cityName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + }, + { + "parameterName": "job", + "parameterTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + } + }, + { + "parameterName": "amount", + "parameterTypeTokenRange": { + "startIndex": 7, + "endIndex": 8 + } + } + ], + "name": "setAutoJobAssignment" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!OfficeAPI#throwParty:member(1)", - "docComment": "/**\n * Assign an employee to a job.\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @param costPerEmployee - Amount to spend per employee.\n *\n * @returns Amount of happiness increased.\n */\n", + "docComment": "/**\n * Throw a party for your employees\n *\n * @param divisionName - Name of the division\n *\n * @param cityName - Name of the city\n *\n * @param costPerEmployee - Amount to spend per employee.\n *\n * @returns Amount of happiness increased.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -23147,6 +24206,32 @@ "endIndex": 2 } }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Player#hasCorporation:member", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "hasCorporation: " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "hasCorporation", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!Player#hasTixApiAccess:member", @@ -24500,6 +25585,32 @@ "releaseTag": "Public", "name": "Product", "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Product#cityData:member", + "docComment": "/**\n * Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is [qty, prod, sell]\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "cityData: " + }, + { + "kind": "Content", + "text": "{[key: string]:number[]}" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "cityData", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!Product#cmp:member", @@ -24526,6 +25637,32 @@ "endIndex": 2 } }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Product#developmentProgress:member", + "docComment": "/**\n * Creation progress - A number between 0-100 representing percentage\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "developmentProgress: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "developmentProgress", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, { "kind": "PropertySignature", "canonicalReference": "bitburner!Product#dmd:member", @@ -31651,6 +32788,32 @@ "startIndex": 1, "endIndex": 2 } + }, + { + "kind": "PropertySignature", + "canonicalReference": "bitburner!Warehouse#smartSupplyEnabled:member", + "docComment": "/**\n * Smart Supply status in the warehouse\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "smartSupplyEnabled: " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "releaseTag": "Public", + "name": "smartSupplyEnabled", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } } ], "extendsTokenRanges": [] @@ -32189,6 +33352,93 @@ ], "name": "getProduct" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!WarehouseAPI#getPurchaseWarehouseCost:member(1)", + "docComment": "/**\n * Gets the cost to purchase a warehouse\n *\n * @returns cost\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getPurchaseWarehouseCost(): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [], + "name": "getPurchaseWarehouseCost" + }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!WarehouseAPI#getUpgradeWarehouseCost:member(1)", + "docComment": "/**\n * Gets the cost to upgrade a warehouse to the next level\n *\n * @returns cost to upgrade\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "getUpgradeWarehouseCost(adivisionName: " + }, + { + "kind": "Content", + "text": "any" + }, + { + "kind": "Content", + "text": ", acityName: " + }, + { + "kind": "Content", + "text": "any" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "adivisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "acityName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], + "name": "getUpgradeWarehouseCost" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!WarehouseAPI#getWarehouse:member(1)", @@ -32249,6 +33499,65 @@ ], "name": "getWarehouse" }, + { + "kind": "MethodSignature", + "canonicalReference": "bitburner!WarehouseAPI#hasWarehouse:member(1)", + "docComment": "/**\n * Check if you have a warehouse in city\n *\n * @returns true if warehouse is present, false if not\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "hasWarehouse(adivisionName: " + }, + { + "kind": "Content", + "text": "any" + }, + { + "kind": "Content", + "text": ", acityName: " + }, + { + "kind": "Content", + "text": "any" + }, + { + "kind": "Content", + "text": "): " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isOptional": false, + "returnTypeTokenRange": { + "startIndex": 5, + "endIndex": 6 + }, + "releaseTag": "Public", + "overloadIndex": 1, + "parameters": [ + { + "parameterName": "adivisionName", + "parameterTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "parameterName": "acityName", + "parameterTypeTokenRange": { + "startIndex": 3, + "endIndex": 4 + } + } + ], + "name": "hasWarehouse" + }, { "kind": "MethodSignature", "canonicalReference": "bitburner!WarehouseAPI#makeProduct:member(1)", diff --git a/markdown/bitburner.iport.clear.md b/markdown/bitburner.iport.clear.md deleted file mode 100644 index 94b81b098..000000000 --- a/markdown/bitburner.iport.clear.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [clear](./bitburner.iport.clear.md) - -## IPort.clear property - -removes all data from port - -Signature: - -```typescript -clear: () => void; -``` diff --git a/markdown/bitburner.iport.empty.md b/markdown/bitburner.iport.empty.md deleted file mode 100644 index 28e84e351..000000000 --- a/markdown/bitburner.iport.empty.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [empty](./bitburner.iport.empty.md) - -## IPort.empty property - -check if port is empty - -Signature: - -```typescript -empty: () => boolean; -``` diff --git a/markdown/bitburner.iport.full.md b/markdown/bitburner.iport.full.md deleted file mode 100644 index dde575071..000000000 --- a/markdown/bitburner.iport.full.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [full](./bitburner.iport.full.md) - -## IPort.full property - -check if port is full - -Signature: - -```typescript -full: () => boolean; -``` diff --git a/markdown/bitburner.iport.md b/markdown/bitburner.iport.md deleted file mode 100644 index 6eb648526..000000000 --- a/markdown/bitburner.iport.md +++ /dev/null @@ -1,26 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) - -## IPort interface - -Interface of a netscript port - -Signature: - -```typescript -export interface IPort -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [clear](./bitburner.iport.clear.md) | () => void | removes all data from port | -| [empty](./bitburner.iport.empty.md) | () => boolean | check if port is empty | -| [full](./bitburner.iport.full.md) | () => boolean | check if port is full | -| [peek](./bitburner.iport.peek.md) | () => any | reads first element without removing it from port if no data in port returns "NULL PORT DATA" | -| [read](./bitburner.iport.read.md) | () => any | reads and removes first element from port if no data in port returns "NULL PORT DATA" | -| [tryWrite](./bitburner.iport.trywrite.md) | (value: any) => boolean | add data to port if not full. | -| [write](./bitburner.iport.write.md) | (value: any) => any | write data to the port and removes and returns first element if full | - diff --git a/markdown/bitburner.iport.peek.md b/markdown/bitburner.iport.peek.md deleted file mode 100644 index bb3f76344..000000000 --- a/markdown/bitburner.iport.peek.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [peek](./bitburner.iport.peek.md) - -## IPort.peek property - -reads first element without removing it from port if no data in port returns "NULL PORT DATA" - -Signature: - -```typescript -peek: () => any; -``` diff --git a/markdown/bitburner.iport.read.md b/markdown/bitburner.iport.read.md deleted file mode 100644 index 2c1f64bfa..000000000 --- a/markdown/bitburner.iport.read.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [read](./bitburner.iport.read.md) - -## IPort.read property - -reads and removes first element from port if no data in port returns "NULL PORT DATA" - -Signature: - -```typescript -read: () => any; -``` diff --git a/markdown/bitburner.iport.trywrite.md b/markdown/bitburner.iport.trywrite.md deleted file mode 100644 index 84a814822..000000000 --- a/markdown/bitburner.iport.trywrite.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [tryWrite](./bitburner.iport.trywrite.md) - -## IPort.tryWrite property - -add data to port if not full. - -Signature: - -```typescript -tryWrite: (value: any) => boolean; -``` diff --git a/markdown/bitburner.iport.write.md b/markdown/bitburner.iport.write.md deleted file mode 100644 index e88c227fb..000000000 --- a/markdown/bitburner.iport.write.md +++ /dev/null @@ -1,13 +0,0 @@ - - -[Home](./index.md) > [bitburner](./bitburner.md) > [IPort](./bitburner.iport.md) > [write](./bitburner.iport.write.md) - -## IPort.write property - -write data to the port and removes and returns first element if full - -Signature: - -```typescript -write: (value: any) => any; -``` diff --git a/markdown/bitburner.md b/markdown/bitburner.md index 875fc15fa..98fb4585d 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -53,7 +53,6 @@ | [HacknetServerConstants](./bitburner.hacknetserverconstants.md) | Hacknet server related constants | | [HacknetServersFormulas](./bitburner.hacknetserversformulas.md) | Hacknet Server formulas | | [InvestmentOffer](./bitburner.investmentoffer.md) | Corporation investment offer | -| [IPort](./bitburner.iport.md) | Interface of a netscript port | | [Material](./bitburner.material.md) | Material in a warehouse | | [NetscriptPort](./bitburner.netscriptport.md) | Object representing a port. A port is a serialized queue. | | [NodeStats](./bitburner.nodestats.md) | Object representing all the values related to a hacknet node. | From c1b777733fd0d986e070dfff0a831376672d93fa Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 17 Jan 2022 14:22:04 -0600 Subject: [PATCH 31/40] Improve clarity of editor tabs --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 33 ++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index b27b1a2e5..95e0657dd 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -198,7 +198,7 @@ export function Root(props: IProps): React.ReactElement { }); editor.focus(); }); - } catch {} + } catch { } } else if (!options.vim) { // Whem vim mode is disabled vimEditor?.dispose(); @@ -432,7 +432,7 @@ export function Root(props: IProps): React.ReactElement { } try { infLoop(newCode); - } catch (err) {} + } catch (err) { } } function saveScript(scriptToSave: OpenScript): void { @@ -714,7 +714,9 @@ export function Root(props: IProps): React.ReactElement { ref={provided.innerRef} {...provided.droppableProps} style={{ - backgroundColor: snapshot.isDraggingOver ? "#1F2022" : Settings.theme.backgroundprimary, + backgroundColor: snapshot.isDraggingOver + ? Settings.theme.backgroundsecondary + : Settings.theme.backgroundprimary, overflowX: "scroll", }} > @@ -738,12 +740,14 @@ export function Root(props: IProps): React.ReactElement { > @@ -752,10 +756,13 @@ export function Root(props: IProps): React.ReactElement { style={{ maxWidth: "20px", minWidth: "20px", - background: - currentScript?.fileName === openScripts[index].fileName - ? Settings.theme.secondarydark - : "", + ...(currentScript?.fileName === openScripts[index].fileName ? { + background: Settings.theme.button, + color: Settings.theme.primary + } : { + background: Settings.theme.backgroundsecondary, + color: Settings.theme.secondary + }) }} > x From c41cd68a8d0ba301cd92440fab1b4593b558210c Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 17 Jan 2022 16:32:45 -0600 Subject: [PATCH 32/40] Add modal to editor with RAM details --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 45 +++++++++++++++++++----- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 95e0657dd..f74486f94 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -34,7 +34,12 @@ import Link from "@mui/material/Link"; import Box from "@mui/material/Box"; import IconButton from "@mui/material/IconButton"; import SettingsIcon from "@mui/icons-material/Settings"; +import Table from "@mui/material/Table"; +import TableCell from "@mui/material/TableCell"; +import TableRow from "@mui/material/TableRow"; +import TableBody from "@mui/material/TableBody"; import { PromptEvent } from "../../ui/React/PromptManager"; +import { Modal } from "../../ui/React/Modal"; import libSource from "!!raw-loader!../NetscriptDefinitions.d.ts"; @@ -109,6 +114,7 @@ export function Root(props: IProps): React.ReactElement { const [editor, setEditor] = useState(null); const [ram, setRAM] = useState("RAM: ???"); + const [ramEntries, setRamEntries] = useState([["???", ""]]); const [updatingRam, setUpdatingRam] = useState(false); const [decorations, setDecorations] = useState([]); @@ -121,6 +127,8 @@ export function Root(props: IProps): React.ReactElement { vim: props.vim || Settings.MonacoVim, }); + const [ramInfoOpen, setRamInfoOpen] = useState(false); + // Prevent Crash if script is open on deleted server openScripts = openScripts.filter((script) => { return GetServer(script.hostname) !== null; @@ -222,8 +230,9 @@ export function Root(props: IProps): React.ReactElement { const debouncedSetRAM = useMemo( () => - debounce((s) => { + debounce((s, e) => { setRAM(s); + setRamEntries(e); setUpdatingRam(false); }, 300), [], @@ -231,28 +240,34 @@ export function Root(props: IProps): React.ReactElement { async function updateRAM(newCode: string): Promise { if (currentScript != null && currentScript.fileName.endsWith(".txt")) { - debouncedSetRAM(""); + debouncedSetRAM("", []); return; } setUpdatingRam(true); const codeCopy = newCode + ""; const ramUsage = await calculateRamUsage(props.player, codeCopy, props.player.getCurrentServer().scripts); if (ramUsage.cost > 0) { - debouncedSetRAM("RAM: " + numeralWrapper.formatRAM(ramUsage.cost)); + const entries = ramUsage.entries?.sort((a, b) => b.cost - a.cost) ?? []; + const entriesDisp = []; + for (const entry of entries) { + entriesDisp.push([`${entry.name} (${entry.type})`, numeralWrapper.formatRAM(entry.cost)]); + } + + debouncedSetRAM("RAM: " + numeralWrapper.formatRAM(ramUsage.cost), entriesDisp); return; } switch (ramUsage.cost) { case RamCalculationErrorCode.ImportError: { - debouncedSetRAM("RAM: Import Error"); + debouncedSetRAM("RAM: Import Error", [["Import Error", ""]]); break; } case RamCalculationErrorCode.URLImportError: { - debouncedSetRAM("RAM: HTTP Import Error"); + debouncedSetRAM("RAM: HTTP Import Error", [["HTTP Import Error", ""]]); break; } case RamCalculationErrorCode.SyntaxError: default: { - debouncedSetRAM("RAM: Syntax Error"); + debouncedSetRAM("RAM: Syntax Error", [["Syntax Error", ""]]); break; } } @@ -800,9 +815,23 @@ export function Root(props: IProps): React.ReactElement { - + + setRamInfoOpen(false)}> + + + {ramEntries.map(([n, r]) => ( + + + {n} + {r} + + + ))} + +
+
From a9314f244716934ab532fe86afdd66998e74aea2 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 17 Jan 2022 16:44:55 -0600 Subject: [PATCH 33/40] Show N/A when editing a txt file --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index f74486f94..276613a18 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -240,7 +240,7 @@ export function Root(props: IProps): React.ReactElement { async function updateRAM(newCode: string): Promise { if (currentScript != null && currentScript.fileName.endsWith(".txt")) { - debouncedSetRAM("", []); + debouncedSetRAM("N/A", [["N/A", ""]]); return; } setUpdatingRam(true); From 258a1b262e0bc69630567b937fdea3ee8829f9a5 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 17 Jan 2022 17:20:38 -0600 Subject: [PATCH 34/40] Update options button --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 36 ++++++++++-------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 276613a18..c21681b4c 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -32,7 +32,6 @@ import Button from "@mui/material/Button"; import Typography from "@mui/material/Typography"; import Link from "@mui/material/Link"; import Box from "@mui/material/Box"; -import IconButton from "@mui/material/IconButton"; import SettingsIcon from "@mui/icons-material/Settings"; import Table from "@mui/material/Table"; import TableCell from "@mui/material/TableCell"; @@ -814,24 +813,11 @@ export function Root(props: IProps): React.ReactElement { >
+ - setRamInfoOpen(false)}> - - - {ramEntries.map(([n, r]) => ( - - - {n} - {r} - - - ))} - -
-
@@ -845,12 +831,6 @@ export function Root(props: IProps): React.ReactElement { Full - setOptionsOpen(true)}> - <> - - options - -
+ setRamInfoOpen(false)}> + + + {ramEntries.map(([n, r]) => ( + + + {n} + {r} + + + ))} + +
+
Date: Tue, 18 Jan 2022 08:20:58 -0600 Subject: [PATCH 35/40] Fix ns.setFocus --- src/NetscriptFunctions/Singularity.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index c2c5c60aa..0032cdb71 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -653,7 +653,9 @@ export function NetscriptSingularity( !( player.workType == CONSTANTS.WorkTypeFaction || player.workType == CONSTANTS.WorkTypeCompany || - player.workType == CONSTANTS.WorkTypeCompanyPartTime + player.workType == CONSTANTS.WorkTypeCompanyPartTime || + player.workType == CONSTANTS.WorkTypeCreateProgram || + player.workType == CONSTANTS.WorkTypeStudyClass ) ) { throw helper.makeRuntimeErrorMsg("setFocus", "Cannot change focus for current job"); From 2d38ce8f72e0757f59bb3051d446d5e56ae8305b Mon Sep 17 00:00:00 2001 From: nickofolas Date: Tue, 18 Jan 2022 08:49:06 -0600 Subject: [PATCH 36/40] Fix focus arg for sing functions --- src/Locations/ui/GymLocation.tsx | 4 +++- src/Locations/ui/UniversityLocation.tsx | 4 +++- src/NetscriptFunctions/Singularity.ts | 12 ++++++------ src/PersonObjects/IPlayer.ts | 4 ++-- src/PersonObjects/Player/PlayerObject.ts | 4 ++-- .../Player/PlayerObjectGeneralMethods.tsx | 7 +------ src/Programs/ui/ProgramsRoot.tsx | 4 +++- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Locations/ui/GymLocation.tsx b/src/Locations/ui/GymLocation.tsx index c735c2b69..f6aa54158 100644 --- a/src/Locations/ui/GymLocation.tsx +++ b/src/Locations/ui/GymLocation.tsx @@ -35,7 +35,9 @@ export function GymLocation(props: IProps): React.ReactElement { function train(stat: string): void { const loc = props.loc; - props.p.startClass(props.router, calculateCost(), loc.expMult, stat); + props.p.startClass(calculateCost(), loc.expMult, stat); + props.p.startFocusing(); + props.router.toWork(); } function trainStrength(): void { diff --git a/src/Locations/ui/UniversityLocation.tsx b/src/Locations/ui/UniversityLocation.tsx index fd65fa62c..f9ed00738 100644 --- a/src/Locations/ui/UniversityLocation.tsx +++ b/src/Locations/ui/UniversityLocation.tsx @@ -34,7 +34,9 @@ export function UniversityLocation(props: IProps): React.ReactElement { function take(stat: string): void { const loc = props.loc; - player.startClass(router, calculateCost(), loc.expMult, stat); + player.startClass(calculateCost(), loc.expMult, stat); + player.startFocusing(); + router.toWork(); } function study(): void { diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 0032cdb71..e3834f66c 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -343,7 +343,7 @@ export function NetscriptSingularity( workerScript.log("universityCourse", () => `Invalid class name: ${className}.`); return false; } - player.startClass(Router, costMult, expMult, task); + player.startClass(costMult, expMult, task); if (focus) { player.startFocusing(); Router.toWork(); @@ -433,19 +433,19 @@ export function NetscriptSingularity( switch (stat.toLowerCase()) { case "strength".toLowerCase(): case "str".toLowerCase(): - player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymStrength); + player.startClass(costMult, expMult, CONSTANTS.ClassGymStrength); break; case "defense".toLowerCase(): case "def".toLowerCase(): - player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDefense); + player.startClass(costMult, expMult, CONSTANTS.ClassGymDefense); break; case "dexterity".toLowerCase(): case "dex".toLowerCase(): - player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymDexterity); + player.startClass(costMult, expMult, CONSTANTS.ClassGymDexterity); break; case "agility".toLowerCase(): case "agi".toLowerCase(): - player.startClass(Router, costMult, expMult, CONSTANTS.ClassGymAgility); + player.startClass(costMult, expMult, CONSTANTS.ClassGymAgility); break; default: workerScript.log("gymWorkout", () => `Invalid stat: ${stat}.`); @@ -1271,7 +1271,7 @@ export function NetscriptSingularity( return false; } - player.startCreateProgramWork(Router, p.name, create.time, create.level); + player.startCreateProgramWork(p.name, create.time, create.level); if (focus) { player.startFocusing(); Router.toWork(); diff --git a/src/PersonObjects/IPlayer.ts b/src/PersonObjects/IPlayer.ts index e6aa717c5..3138e5c9d 100644 --- a/src/PersonObjects/IPlayer.ts +++ b/src/PersonObjects/IPlayer.ts @@ -215,7 +215,7 @@ export interface IPlayer { singularityStopWork(): string; startBladeburner(p: any): void; startFactionWork(faction: Faction): void; - startClass(router: IRouter, costMult: number, expMult: number, className: string): void; + startClass(costMult: number, expMult: number, className: string): void; startCorporation(corpName: string, additionalShares?: number): void; startCrime( router: IRouter, @@ -247,7 +247,7 @@ export interface IPlayer { quitJob(company: string): void; hasJob(): boolean; createHacknetServer(): HacknetServer; - startCreateProgramWork(router: IRouter, programName: string, time: number, reqLevel: number): void; + startCreateProgramWork(programName: string, time: number, reqLevel: number): void; queueAugmentation(augmentationName: string): void; receiveInvite(factionName: string): void; updateSkillLevels(): void; diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts index 07d5bacef..b2b859eaa 100644 --- a/src/PersonObjects/Player/PlayerObject.ts +++ b/src/PersonObjects/Player/PlayerObject.ts @@ -220,7 +220,7 @@ export class PlayerObject implements IPlayer { singularityStopWork: () => string; startBladeburner: (p: any) => void; startFactionWork: (faction: Faction) => void; - startClass: (router: IRouter, costMult: number, expMult: number, className: string) => void; + startClass: (costMult: number, expMult: number, className: string) => void; startCorporation: (corpName: string, additionalShares?: number) => void; startCrime: ( router: IRouter, @@ -253,7 +253,7 @@ export class PlayerObject implements IPlayer { hasJob: () => boolean; process: (router: IRouter, numCycles?: number) => void; createHacknetServer: () => HacknetServer; - startCreateProgramWork: (router: IRouter, programName: string, time: number, reqLevel: number) => void; + startCreateProgramWork: (programName: string, time: number, reqLevel: number) => void; queueAugmentation: (augmentationName: string) => void; receiveInvite: (factionName: string) => void; updateSkillLevels: () => void; diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 266ae828e..365634cf7 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -1253,14 +1253,12 @@ export function getWorkRepGain(this: IPlayer): number { /* Creating a Program */ export function startCreateProgramWork( this: IPlayer, - router: IRouter, programName: string, time: number, reqLevel: number, ): void { this.resetWorkStatus(); this.isWorking = true; - this.focus = true; this.workType = CONSTANTS.WorkTypeCreateProgram; //Time needed to complete work affected by hacking skill (linearly based on @@ -1289,7 +1287,6 @@ export function startCreateProgramWork( } this.createProgramName = programName; - router.toWork(); } export function createProgramWork(this: IPlayer, numCycles: number): boolean { @@ -1337,10 +1334,9 @@ export function finishCreateProgramWork(this: IPlayer, cancelled: boolean): stri return "You've finished creating " + programName + "! The new program can be found on your home computer."; } /* Studying/Taking Classes */ -export function startClass(this: IPlayer, router: IRouter, costMult: number, expMult: number, className: string): void { +export function startClass(this: IPlayer, costMult: number, expMult: number, className: string): void { this.resetWorkStatus(); this.isWorking = true; - this.focus = true; this.workType = CONSTANTS.WorkTypeStudyClass; this.workCostMult = costMult; this.workExpMult = expMult; @@ -1353,7 +1349,6 @@ export function startClass(this: IPlayer, router: IRouter, costMult: number, exp this.workDexExpGainRate = earnings.workDexExpGainRate; this.workAgiExpGainRate = earnings.workAgiExpGainRate; this.workChaExpGainRate = earnings.workChaExpGainRate; - router.toWork(); } export function takeClass(this: IPlayer, numCycles: number): boolean { diff --git a/src/Programs/ui/ProgramsRoot.tsx b/src/Programs/ui/ProgramsRoot.tsx index df846da22..7c23b3183 100644 --- a/src/Programs/ui/ProgramsRoot.tsx +++ b/src/Programs/ui/ProgramsRoot.tsx @@ -50,7 +50,9 @@ export function ProgramsRoot(): React.ReactElement { sx={{ my: 1 }} onClick={(event) => { if (!event.isTrusted) return; - player.startCreateProgramWork(router, program.name, create.time, create.level); + player.startCreateProgramWork(program.name, create.time, create.level); + player.startFocusing(); + router.toWork(); }} > {program.name} From e5d951ed05db2ea18909aefc298d97257ff3b4bf Mon Sep 17 00:00:00 2001 From: Martin Fournier Date: Tue, 18 Jan 2022 15:40:36 -0500 Subject: [PATCH 37/40] Add script to generate a markdown changelog --- tools/README.md | 10 ++++++++++ tools/changelog.sh | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tools/changelog.sh diff --git a/tools/README.md b/tools/README.md index 0f2e5f759..e9cb7e57b 100644 --- a/tools/README.md +++ b/tools/README.md @@ -20,3 +20,13 @@ Used to synchronize the achievements info in steamworks to the game's data.json # Get your key here: https://steamcommunity.com/dev/apikey node fetch-steam-achievements-data.js DEVKEYDEVKEYDEVKEYDEVKEY ``` + +## Changelog script + +Used to generate a basic git commit log (in markdown) between commit A & commit B + +**Usage** +```sh +# Will default to HEAD if second is not specified. +./tools/changelog.sh 9a0062b 05cbc25 +``` diff --git a/tools/changelog.sh b/tools/changelog.sh new file mode 100644 index 000000000..11d59b7fa --- /dev/null +++ b/tools/changelog.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +version=${2:-HEAD} +cat >> temp_changelog.md << EOF +# v1.X.X ($version) + +Description Here. + +Compare Commits [on github](https://github.com/danielyxie/bitburner/compare/$1...$version). + +--- + +### Commits +EOF + +git log $1...${version} \ + --pretty=format:'* [`%h`]([https://github.com/danielyxie/bitburner/commit/%H): %s (by %aN on %ad) %n' \ + --date=short \ + --no-merges >> temp_changelog.md + # --reverse >> temp_changelog.md + +rm -f changelog_$1_${version}.md +mv temp_changelog.md changelog_$1_${version}.md From eb7a0ebace7cea89e8a8a2a7df1bd76f24e56d30 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Tue, 18 Jan 2022 16:15:36 -0600 Subject: [PATCH 38/40] Use background primary before #000000 for body --- src/ui/React/Theme.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/React/Theme.tsx b/src/ui/React/Theme.tsx index fa28f6793..7f82bcebe 100644 --- a/src/ui/React/Theme.tsx +++ b/src/ui/React/Theme.tsx @@ -362,7 +362,7 @@ export function refreshTheme(): void { }, }); - document.body.style.backgroundColor = theme.colors.black?.toString() ?? "black"; + document.body.style.backgroundColor = theme.colors.backgroundprimary?.toString() ?? "black"; } refreshTheme(); From d0a44a60884236216b7bde020fe68e7fd0152d6f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Tue, 18 Jan 2022 18:57:43 -0500 Subject: [PATCH 39/40] change asleep --- src/NetscriptFunctions.ts | 6 ++---- src/NetscriptWorker.ts | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index ec22166f6..e7bbb3696 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -577,9 +577,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { throw makeRuntimeErrorMsg("asleep", "Takes 1 argument."); } workerScript.log("asleep", () => `Sleeping for ${time} milliseconds`); - return netscriptDelay(time, workerScript).then(function () { - return Promise.resolve(true); - }); + return new Promise((resolve) => setTimeout(resolve, time)); }, grow: function (hostname: any, { threads: requestedThreads, stock }: any = {}): any { updateDynamicRam("grow", getRamCost(Player, "grow")); @@ -715,7 +713,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { end(); }); }, - getSharePower: function(): number { + getSharePower: function (): number { return CalculateShareMult(); }, print: function (...args: any[]): void { diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts index 3819c5c20..a3935f76d 100644 --- a/src/NetscriptWorker.ts +++ b/src/NetscriptWorker.ts @@ -178,7 +178,7 @@ function startNetscript1Script(workerScript: WorkerScript): Promise Date: Tue, 18 Jan 2022 19:12:52 -0500 Subject: [PATCH 40/40] doc --- dist/bitburner.d.ts | 17 ++++++++++------- input/bitburner.api.json | 6 +++--- markdown/bitburner.ns.getsharepower.md | 2 +- markdown/bitburner.ns.md | 4 ++-- markdown/bitburner.ns.share.md | 4 +++- markdown/bitburner.product.citydata.md | 2 +- markdown/bitburner.product.md | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 17 ++++++++++------- 8 files changed, 31 insertions(+), 23 deletions(-) diff --git a/dist/bitburner.d.ts b/dist/bitburner.d.ts index 201a77868..06c6e1445 100644 --- a/dist/bitburner.d.ts +++ b/dist/bitburner.d.ts @@ -856,13 +856,13 @@ export declare interface Corporation extends WarehouseAPI, OfficeAPI { * Create a Corporation * @param divisionName - Name of the division * @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3 - * @returns true if created and false if not + * @returns true if created and false if not */ createCorporation(corporationName: string, selfFund: boolean): boolean; /** * Check if you have a one time unlockable upgrade * @param upgradeName - Name of the upgrade - * @returns true if unlocked and false if not + * @returns true if unlocked and false if not */ hasUnlockUpgrade(upgradeName: string): boolean; /** @@ -4434,14 +4434,17 @@ export declare interface NS extends Singularity { flags(schema: [string, string | number | boolean | string[]][]): any; /** - * Share your computer with your factions. Increasing your rep gain for a short duration. + * Share your computer with your factions. * @remarks * RAM cost: 2.4 GB + * + * Increases your rep gain of hacking contracts while share is called. + * Scales with thread count. */ share(): Promise; /** - * Calculate your share power. + * Calculate your share power. Based on all the active share calls. * @remarks * RAM cost: 0.2 GB */ @@ -4751,10 +4754,10 @@ export declare interface Product { pCost: number; /** Sell cost, can be "MP+5" */ sCost: string | number; - /** Data refers to the production, sale, and quantity of the products - * These values are specific to a city + /** Data refers to the production, sale, and quantity of the products + * These values are specific to a city * For each city, the data is [qty, prod, sell] */ - cityData: {[key: string]:number[]}; + cityData: { [key: string]: number[] }; /** Creation progress - A number between 0-100 representing percentage */ developmentProgress: number; } diff --git a/input/bitburner.api.json b/input/bitburner.api.json index 4205889fa..30922f80e 100644 --- a/input/bitburner.api.json +++ b/input/bitburner.api.json @@ -18440,7 +18440,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#getSharePower:member(1)", - "docComment": "/**\n * Calculate your share power.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n */\n", + "docComment": "/**\n * Calculate your share power. Based on all the active share calls.\n *\n * @remarks\n *\n * RAM cost: 0.2 GB\n */\n", "excerptTokens": [ { "kind": "Content", @@ -20475,7 +20475,7 @@ { "kind": "MethodSignature", "canonicalReference": "bitburner!NS#share:member(1)", - "docComment": "/**\n * Share your computer with your factions. Increasing your rep gain for a short duration.\n *\n * @remarks\n *\n * RAM cost: 2.4 GB\n */\n", + "docComment": "/**\n * Share your computer with your factions.\n *\n * @remarks\n *\n * RAM cost: 2.4 GB\n *\n * Increases your rep gain of hacking contracts while share is called. Scales with thread count.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -25657,7 +25657,7 @@ }, { "kind": "Content", - "text": "{[key: string]:number[]}" + "text": "{ [key: string]: number[] }" }, { "kind": "Content", diff --git a/markdown/bitburner.ns.getsharepower.md b/markdown/bitburner.ns.getsharepower.md index b588899f2..d615c728f 100644 --- a/markdown/bitburner.ns.getsharepower.md +++ b/markdown/bitburner.ns.getsharepower.md @@ -4,7 +4,7 @@ ## NS.getSharePower() method -Calculate your share power. +Calculate your share power. Based on all the active share calls. Signature: diff --git a/markdown/bitburner.ns.md b/markdown/bitburner.ns.md index 25ced3b46..81ad55bf0 100644 --- a/markdown/bitburner.ns.md +++ b/markdown/bitburner.ns.md @@ -107,7 +107,7 @@ export async function main(ns) { | [getServerRequiredHackingLevel(host)](./bitburner.ns.getserverrequiredhackinglevel.md) | Returns the required hacking level of the target server. | | [getServerSecurityLevel(host)](./bitburner.ns.getserversecuritylevel.md) | Get server security level. | | [getServerUsedRam(host)](./bitburner.ns.getserverusedram.md) | Get the used RAM on a server. | -| [getSharePower()](./bitburner.ns.getsharepower.md) | Calculate your share power. | +| [getSharePower()](./bitburner.ns.getsharepower.md) | Calculate your share power. Based on all the active share calls. | | [getTimeSinceLastAug()](./bitburner.ns.gettimesincelastaug.md) | Returns the amount of time in milliseconds that have passed since you last installed Augmentations. | | [getWeakenTime(host)](./bitburner.ns.getweakentime.md) | Get the execution time of a weaken() call. | | [grow(host, opts)](./bitburner.ns.grow.md) | Spoof money in a servers bank account, increasing the amount available. | @@ -145,7 +145,7 @@ export async function main(ns) { | [scriptKill(script, host)](./bitburner.ns.scriptkill.md) | Kill all scripts with a filename. | | [scriptRunning(script, host)](./bitburner.ns.scriptrunning.md) | Check if any script with a filename is running. | | [serverExists(host)](./bitburner.ns.serverexists.md) | Returns a boolean denoting whether or not the specified server exists. | -| [share()](./bitburner.ns.share.md) | Share your computer with your factions. Increasing your rep gain for a short duration. | +| [share()](./bitburner.ns.share.md) | Share your computer with your factions. | | [sleep(millis)](./bitburner.ns.sleep.md) | Suspends the script for n milliseconds. | | [spawn(script, numThreads, args)](./bitburner.ns.spawn.md) | Terminate current script and start another in 10s. | | [sprintf(format, args)](./bitburner.ns.sprintf.md) | Format a string. | diff --git a/markdown/bitburner.ns.share.md b/markdown/bitburner.ns.share.md index a46323f23..421e3e032 100644 --- a/markdown/bitburner.ns.share.md +++ b/markdown/bitburner.ns.share.md @@ -4,7 +4,7 @@ ## NS.share() method -Share your computer with your factions. Increasing your rep gain for a short duration. +Share your computer with your factions. Signature: @@ -19,3 +19,5 @@ Promise<void> RAM cost: 2.4 GB +Increases your rep gain of hacking contracts while share is called. Scales with thread count. + diff --git a/markdown/bitburner.product.citydata.md b/markdown/bitburner.product.citydata.md index 117697514..aad8ca9c2 100644 --- a/markdown/bitburner.product.citydata.md +++ b/markdown/bitburner.product.citydata.md @@ -9,5 +9,5 @@ Data refers to the production, sale, and quantity of the products These values a Signature: ```typescript -cityData: {[key: string]:number[]}; +cityData: { [key: string]: number[] }; ``` diff --git a/markdown/bitburner.product.md b/markdown/bitburner.product.md index 495d7f788..e0562b85b 100644 --- a/markdown/bitburner.product.md +++ b/markdown/bitburner.product.md @@ -16,7 +16,7 @@ interface Product | Property | Type | Description | | --- | --- | --- | -| [cityData](./bitburner.product.citydata.md) | {\[key: string\]:number\[\]} | Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is \[qty, prod, sell\] | +| [cityData](./bitburner.product.citydata.md) | { \[key: string\]: number\[\] } | Data refers to the production, sale, and quantity of the products These values are specific to a city For each city, the data is \[qty, prod, sell\] | | [cmp](./bitburner.product.cmp.md) | number | Competition for the product | | [developmentProgress](./bitburner.product.developmentprogress.md) | number | Creation progress - A number between 0-100 representing percentage | | [dmd](./bitburner.product.dmd.md) | number | Demand for the product | diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index a6a62b629..6021a88ef 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -6076,14 +6076,17 @@ export interface NS extends Singularity { flags(schema: [string, string | number | boolean | string[]][]): any; /** - * Share your computer with your factions. Increasing your rep gain for a short duration. + * Share your computer with your factions. * @remarks * RAM cost: 2.4 GB + * + * Increases your rep gain of hacking contracts while share is called. + * Scales with thread count. */ share(): Promise; /** - * Calculate your share power. + * Calculate your share power. Based on all the active share calls. * @remarks * RAM cost: 0.2 GB */ @@ -6398,13 +6401,13 @@ export interface Corporation extends WarehouseAPI, OfficeAPI { * Create a Corporation * @param divisionName - Name of the division * @param selfFund - If you should self fund, defaults to true, false will only work on Bitnode 3 - * @returns true if created and false if not + * @returns true if created and false if not */ createCorporation(corporationName: string, selfFund: boolean): boolean; /** * Check if you have a one time unlockable upgrade * @param upgradeName - Name of the upgrade - * @returns true if unlocked and false if not + * @returns true if unlocked and false if not */ hasUnlockUpgrade(upgradeName: string): boolean; /** @@ -6574,10 +6577,10 @@ interface Product { pCost: number; /** Sell cost, can be "MP+5" */ sCost: string | number; - /** Data refers to the production, sale, and quantity of the products - * These values are specific to a city + /** Data refers to the production, sale, and quantity of the products + * These values are specific to a city * For each city, the data is [qty, prod, sell] */ - cityData: {[key: string]:number[]}; + cityData: { [key: string]: number[] }; /** Creation progress - A number between 0-100 representing percentage */ developmentProgress: number; }