mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
This reverts commit 7a3c18fcf2.
This commit is contained in:
@@ -18,7 +18,6 @@ interface Division
|
||||
| --- | --- | --- | --- |
|
||||
| [awareness](./bitburner.division.awareness.md) | | number | Awareness of the division |
|
||||
| [cities](./bitburner.division.cities.md) | | [CityName](./bitburner.cityname.md)<!-- -->\[\] | Cities in which this division has expanded |
|
||||
| [industry](./bitburner.division.industry.md) | | [CorpIndustryName](./bitburner.corpindustryname.md) | Type of division, like Agriculture |
|
||||
| [lastCycleExpenses](./bitburner.division.lastcycleexpenses.md) | | number | Expenses last cycle |
|
||||
| [lastCycleRevenue](./bitburner.division.lastcyclerevenue.md) | | number | Revenue last cycle |
|
||||
| [makesProducts](./bitburner.division.makesproducts.md) | | boolean | Whether the industry of this division is capable of developing and producing products |
|
||||
@@ -31,4 +30,5 @@ interface Division
|
||||
| [researchPoints](./bitburner.division.researchpoints.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 |
|
||||
| [type](./bitburner.division.type.md) | | [CorpIndustryName](./bitburner.corpindustryname.md) | Type of division, like Agriculture |
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Division](./bitburner.division.md) > [industry](./bitburner.division.industry.md)
|
||||
[Home](./index.md) > [bitburner](./bitburner.md) > [Division](./bitburner.division.md) > [type](./bitburner.division.type.md)
|
||||
|
||||
## Division.industry property
|
||||
## Division.type property
|
||||
|
||||
Type of division, like Agriculture
|
||||
|
||||
**Signature:**
|
||||
|
||||
```typescript
|
||||
industry: CorpIndustryName;
|
||||
type: CorpIndustryName;
|
||||
```
|
||||
@@ -399,7 +399,7 @@ export const achievements: Record<string, Achievement> = {
|
||||
Condition: () => {
|
||||
if (!Player.corporation) return false;
|
||||
for (const division of Player.corporation.divisions.values()) {
|
||||
if (division.industry === IndustryType.RealEstate) return true;
|
||||
if (division.type === IndustryType.RealEstate) return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -88,7 +88,7 @@ export function createDivision(corporation: Corporation, industry: IndustryType,
|
||||
new Division({
|
||||
corp: corporation,
|
||||
name: name,
|
||||
industry: industry,
|
||||
type: industry,
|
||||
}),
|
||||
);
|
||||
corporation.numberOfOfficesAndWarehouses += 2;
|
||||
@@ -319,7 +319,7 @@ export function setSmartSupplyOption(warehouse: Warehouse, material: Material, u
|
||||
|
||||
export function buyMaterial(division: Division, material: Material, amt: number): void {
|
||||
if (!isRelevantMaterial(material.name, division)) {
|
||||
throw new Error(`${material.name} is not a relevant material for industry ${division.industry}`);
|
||||
throw new Error(`${material.name} is not a relevant material for industry ${division.type}`);
|
||||
}
|
||||
if (!Number.isFinite(amt) || amt < 0) {
|
||||
throw new Error(
|
||||
@@ -337,7 +337,7 @@ export function bulkPurchase(
|
||||
amt: number,
|
||||
): void {
|
||||
if (!isRelevantMaterial(material.name, division)) {
|
||||
throw new Error(`${material.name} is not a relevant material for industry ${division.industry}`);
|
||||
throw new Error(`${material.name} is not a relevant material for industry ${division.type}`);
|
||||
}
|
||||
const matSize = MaterialInfo[material.name].size;
|
||||
const maxAmount = (warehouse.size - warehouse.sizeUsed) / matSize;
|
||||
@@ -501,8 +501,8 @@ export function makeProduct(
|
||||
export function research(researchingDivision: Division, researchName: CorpResearchName): void {
|
||||
const corp = Player.corporation;
|
||||
if (!corp) return;
|
||||
const researchTree = IndustryResearchTrees[researchingDivision.industry];
|
||||
if (researchTree === undefined) throw new Error(`No research tree for industry '${researchingDivision.industry}'`);
|
||||
const researchTree = IndustryResearchTrees[researchingDivision.type];
|
||||
if (researchTree === undefined) throw new Error(`No research tree for industry '${researchingDivision.type}'`);
|
||||
const research = ResearchMap[researchName];
|
||||
const researchNode = researchTree.findNode(researchName);
|
||||
const researchPreReq = researchNode?.parent?.researchName;
|
||||
@@ -524,7 +524,7 @@ export function research(researchingDivision: Division, researchName: CorpResear
|
||||
researchTree.research(researchName);
|
||||
// All divisions of the same type as the researching division get the new research.
|
||||
for (const division of corp.divisions.values()) {
|
||||
if (division.industry !== researchingDivision.industry) continue;
|
||||
if (division.type !== researchingDivision.type) continue;
|
||||
division.researched.add(researchName);
|
||||
// Handle researches that need to have their effects manually applied here.
|
||||
// Warehouse size needs to be updated here because it is not recalculated during normal processing.
|
||||
|
||||
@@ -22,12 +22,12 @@ import { throwIfReachable } from "../utils/helpers/throwIfReachable";
|
||||
interface DivisionParams {
|
||||
name: string;
|
||||
corp: Corporation;
|
||||
industry: IndustryType;
|
||||
type: IndustryType;
|
||||
}
|
||||
|
||||
export class Division {
|
||||
name = "DefaultDivisionName";
|
||||
industry = IndustryType.Agriculture;
|
||||
type = IndustryType.Agriculture;
|
||||
researchPoints = 0;
|
||||
researched = new JSONSet<CorpResearchName>();
|
||||
requiredMaterials: PartialRecord<CorpMaterialName, number> = {};
|
||||
@@ -86,7 +86,7 @@ export class Division {
|
||||
constructor(params: DivisionParams | null = null) {
|
||||
if (!params) return;
|
||||
// Must be initialized inside the constructor because it references the industry
|
||||
this.industry = params.industry;
|
||||
this.type = params.type;
|
||||
this.name = params.name;
|
||||
// Add default starting
|
||||
this.warehouses[CityName.Sector12] = new Warehouse({
|
||||
@@ -100,7 +100,7 @@ export class Division {
|
||||
});
|
||||
|
||||
// Loading data based on this division's industry type
|
||||
const data = IndustriesData[this.industry];
|
||||
const data = IndustriesData[this.type];
|
||||
this.startingCost = data.startingCost;
|
||||
this.makesProducts = data.makesProducts;
|
||||
this.realEstateFactor = data.realEstateFactor ?? 0;
|
||||
@@ -261,9 +261,9 @@ export class Division {
|
||||
if (change === 0) continue;
|
||||
|
||||
if (
|
||||
this.industry === IndustryType.Pharmaceutical ||
|
||||
this.industry === IndustryType.Software ||
|
||||
this.industry === IndustryType.Robotics
|
||||
this.type === IndustryType.Pharmaceutical ||
|
||||
this.type === IndustryType.Software ||
|
||||
this.type === IndustryType.Robotics
|
||||
) {
|
||||
change *= 3;
|
||||
}
|
||||
@@ -1063,7 +1063,7 @@ export class Division {
|
||||
|
||||
updateResearchTree(): void {
|
||||
if (this.treeInitialized) return;
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
// Need to populate the tree in case we are loading a game.
|
||||
for (const research of this.researched) researchTree.research(research);
|
||||
// Also need to load researches from the tree in case we are making a new division.
|
||||
@@ -1073,61 +1073,61 @@ export class Division {
|
||||
|
||||
// Get multipliers from Research
|
||||
getAdvertisingMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getAdvertisingMultiplier();
|
||||
}
|
||||
|
||||
getEmployeeChaMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getEmployeeChaMultiplier();
|
||||
}
|
||||
|
||||
getEmployeeCreMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getEmployeeCreMultiplier();
|
||||
}
|
||||
|
||||
getEmployeeEffMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getEmployeeEffMultiplier();
|
||||
}
|
||||
|
||||
getEmployeeIntMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getEmployeeIntMultiplier();
|
||||
}
|
||||
|
||||
getProductionMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getProductionMultiplier();
|
||||
}
|
||||
|
||||
getProductProductionMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getProductProductionMultiplier();
|
||||
}
|
||||
|
||||
getSalesMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getSalesMultiplier();
|
||||
}
|
||||
|
||||
getScientificResearchMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getScientificResearchMultiplier();
|
||||
}
|
||||
|
||||
getStorageMultiplier(): number {
|
||||
const researchTree = IndustryResearchTrees[this.industry];
|
||||
const researchTree = IndustryResearchTrees[this.type];
|
||||
this.updateResearchTree();
|
||||
return researchTree.getStorageMultiplier();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ export class Product {
|
||||
}
|
||||
|
||||
calculateRating(industry: Division): void {
|
||||
const weights = IndustriesData[industry.industry].product?.ratingWeights;
|
||||
const weights = IndustriesData[industry.type].product?.ratingWeights;
|
||||
if (!weights) {
|
||||
return console.error(`Could not find product rating weights for: ${industry.name}`);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ function MakeProductButton(): React.ReactElement {
|
||||
}
|
||||
|
||||
let createProductButtonText = "";
|
||||
switch (division.industry) {
|
||||
switch (division.type) {
|
||||
case IndustryType.Restaurant:
|
||||
createProductButtonText = "Build Restaurant";
|
||||
break;
|
||||
@@ -122,7 +122,7 @@ export function DivisionOverview(props: DivisionOverviewProps): React.ReactEleme
|
||||
return (
|
||||
<Paper>
|
||||
<Typography>
|
||||
Industry: {division.industry} (Corp Funds: <Money money={corp.funds} />)
|
||||
Industry: {division.type} (Corp Funds: <Money money={corp.funds} />)
|
||||
</Typography>
|
||||
<br />
|
||||
<StatsTable
|
||||
@@ -137,7 +137,7 @@ export function DivisionOverview(props: DivisionOverviewProps): React.ReactEleme
|
||||
<>
|
||||
<Typography>Multiplier for this industry's sales due to its awareness and popularity.</Typography>
|
||||
<br />
|
||||
<MathJax>{`\\(\\text{${division.industry} Industry: }\\alpha = ${division.advertisingFactor}\\)`}</MathJax>
|
||||
<MathJax>{`\\(\\text{${division.type} Industry: }\\alpha = ${division.advertisingFactor}\\)`}</MathJax>
|
||||
<MathJax>{`\\(\\text{multiplier} = \\left((\\text{awareness}+1)^{\\alpha} \\times (\\text{popularity}+1)^{\\alpha} \\times \\frac{\\text{popularity}+0.001}{\\text{awareness}}\\right)^{0.85}\\)`}</MathJax>
|
||||
<br />
|
||||
<StatsTable
|
||||
|
||||
@@ -40,7 +40,7 @@ export function MakeProductModal(props: IProps): React.ReactElement {
|
||||
const [name, setName] = useState("");
|
||||
const [design, setDesign] = useState<number>(NaN);
|
||||
const [marketing, setMarketing] = useState<number>(NaN);
|
||||
const data = IndustriesData[division.industry];
|
||||
const data = IndustriesData[division.type];
|
||||
if (division.hasMaximumNumberProducts() || !data.product) return <></>;
|
||||
|
||||
function makeProduct(): void {
|
||||
@@ -87,7 +87,7 @@ export function MakeProductModal(props: IProps): React.ReactElement {
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<TextField onChange={onProductNameChange} placeholder={productPlaceholder(division.industry)} />
|
||||
<TextField onChange={onProductNameChange} placeholder={productPlaceholder(division.type)} />
|
||||
<br />
|
||||
<NumberInput onChange={setDesign} autoFocus={true} placeholder={"Design investment"} />
|
||||
<NumberInput onChange={setMarketing} onKeyDown={onKeyDown} placeholder={"Marketing investment"} />
|
||||
|
||||
@@ -137,7 +137,7 @@ interface IProps {
|
||||
|
||||
// Create the Research Tree UI for this Industry
|
||||
export function ResearchModal(props: IProps): React.ReactElement {
|
||||
const researchTree = IndustryResearchTrees[props.industry.industry];
|
||||
const researchTree = IndustryResearchTrees[props.industry.type];
|
||||
if (researchTree === undefined) return <></>;
|
||||
|
||||
return (
|
||||
|
||||
@@ -94,8 +94,8 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
}
|
||||
|
||||
function getResearchCost(division: Division, researchName: CorpResearchName): number {
|
||||
const researchTree = IndustryResearchTrees[division.industry];
|
||||
if (researchTree === undefined) throw new Error(`No research tree for industry '${division.industry}'`);
|
||||
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];
|
||||
@@ -157,9 +157,9 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
function getSafeDivision(division: Division): NSDivision {
|
||||
const cities = getRecordKeys(division.offices);
|
||||
|
||||
const data = {
|
||||
return {
|
||||
name: division.name,
|
||||
industry: division.industry,
|
||||
type: division.type,
|
||||
awareness: division.awareness,
|
||||
popularity: division.popularity,
|
||||
productionMult: division.productionMult,
|
||||
@@ -174,14 +174,6 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
makesProducts: division.makesProducts,
|
||||
maxProducts: division.maxProducts,
|
||||
};
|
||||
setDeprecatedProperties(data, {
|
||||
type: {
|
||||
identifier: "ns.corporation.getDivision().type",
|
||||
message: "Use ns.corporation.getDivision().industry instead.",
|
||||
value: data.industry,
|
||||
},
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
const warehouseAPI: InternalAPI<WarehouseAPI> = {
|
||||
|
||||
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@@ -10109,7 +10109,7 @@ interface Division {
|
||||
/** Name of the division */
|
||||
name: string;
|
||||
/** Type of division, like Agriculture */
|
||||
industry: CorpIndustryName;
|
||||
type: CorpIndustryName;
|
||||
/** Awareness of the division */
|
||||
awareness: number;
|
||||
/** Popularity of the division */
|
||||
|
||||
Reference in New Issue
Block a user