API: Expose gang's discount rate (#2272)

This commit is contained in:
catloversg
2025-08-01 23:32:51 +07:00
committed by GitHub
parent d4cb50fbf1
commit 970368d11d
7 changed files with 24 additions and 1 deletions

View File

@@ -30,3 +30,5 @@ RAM cost: 2 GB
Get the amount of money it takes to purchase a piece of Equipment or an Augmentation. If an invalid Equipment/Augmentation is specified, this function will return Infinity.
This function already takes equipmentCostMult from [GangGenInfo](./bitburner.ganggeninfo.md) into account.

View File

@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GangGenInfo](./bitburner.ganggeninfo.md) &gt; [equipmentCostMult](./bitburner.ganggeninfo.equipmentcostmult.md)
## GangGenInfo.equipmentCostMult property
Gang gives a discount on all equipment. This multiplier is applied to the equipment cost.
**Signature:**
```typescript
equipmentCostMult: number;
```

View File

@@ -16,6 +16,7 @@ interface GangGenInfo
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [equipmentCostMult](./bitburner.ganggeninfo.equipmentcostmult.md) | | number | Gang gives a discount on all equipment. This multiplier is applied to the equipment cost. |
| [faction](./bitburner.ganggeninfo.faction.md) | | string | Name of faction that the gang belongs to ("Slum Snakes", etc.) |
| [isHacking](./bitburner.ganggeninfo.ishacking.md) | | boolean | Indicating whether or not it's a hacking gang |
| [moneyGainRate](./bitburner.ganggeninfo.moneygainrate.md) | | number | Money earned per game cycle |

View File

@@ -519,6 +519,7 @@ import nsDoc_bitburner_gangformulas_moneygain_md from "../../markdown/bitburner.
import nsDoc_bitburner_gangformulas_respectgain_md from "../../markdown/bitburner.gangformulas.respectgain.md?raw";
import nsDoc_bitburner_gangformulas_wantedlevelgain_md from "../../markdown/bitburner.gangformulas.wantedlevelgain.md?raw";
import nsDoc_bitburner_gangformulas_wantedpenalty_md from "../../markdown/bitburner.gangformulas.wantedpenalty.md?raw";
import nsDoc_bitburner_ganggeninfo_equipmentcostmult_md from "../../markdown/bitburner.ganggeninfo.equipmentcostmult.md?raw";
import nsDoc_bitburner_ganggeninfo_faction_md from "../../markdown/bitburner.ganggeninfo.faction.md?raw";
import nsDoc_bitburner_ganggeninfo_ishacking_md from "../../markdown/bitburner.ganggeninfo.ishacking.md?raw";
import nsDoc_bitburner_ganggeninfo_md from "../../markdown/bitburner.ganggeninfo.md?raw";
@@ -2021,6 +2022,7 @@ AllPages["nsDoc/bitburner.gangformulas.moneygain.md"] = nsDoc_bitburner_gangform
AllPages["nsDoc/bitburner.gangformulas.respectgain.md"] = nsDoc_bitburner_gangformulas_respectgain_md;
AllPages["nsDoc/bitburner.gangformulas.wantedlevelgain.md"] = nsDoc_bitburner_gangformulas_wantedlevelgain_md;
AllPages["nsDoc/bitburner.gangformulas.wantedpenalty.md"] = nsDoc_bitburner_gangformulas_wantedpenalty_md;
AllPages["nsDoc/bitburner.ganggeninfo.equipmentcostmult.md"] = nsDoc_bitburner_ganggeninfo_equipmentcostmult_md;
AllPages["nsDoc/bitburner.ganggeninfo.faction.md"] = nsDoc_bitburner_ganggeninfo_faction_md;
AllPages["nsDoc/bitburner.ganggeninfo.ishacking.md"] = nsDoc_bitburner_ganggeninfo_ishacking_md;
AllPages["nsDoc/bitburner.ganggeninfo.md"] = nsDoc_bitburner_ganggeninfo_md;

View File

@@ -231,7 +231,7 @@ export function EquipmentsSubpage(): React.ReactElement {
</Typography>
}
>
<Typography sx={{ m: 1 }}>Discount: -{formatPercent(1 - 1 / gang.getDiscount())}</Typography>
<Typography sx={{ m: 1 }}>Discount: {formatPercent(1 - 1 / gang.getDiscount())}</Typography>
</Tooltip>
<TextField

View File

@@ -113,6 +113,7 @@ export function NetscriptGang(): InternalAPI<IGang> {
wantedLevel: gang.wanted,
wantedLevelGainRate: gang.wantedGainRate,
wantedPenalty: gang.getWantedPenalty(),
equipmentCostMult: 1 / gang.getDiscount(),
};
},
getOtherGangInformation: (ctx) => () => {

View File

@@ -866,6 +866,8 @@ interface GangGenInfo {
territoryWarfareEngaged: boolean;
/** Number indicating the current wanted penalty */
wantedPenalty: number;
/** Gang gives a discount on all equipment. This multiplier is applied to the equipment cost. */
equipmentCostMult: number;
}
/** @public */
@@ -4329,6 +4331,8 @@ export interface Gang {
* Get the amount of money it takes to purchase a piece of Equipment or an Augmentation.
* If an invalid Equipment/Augmentation is specified, this function will return Infinity.
*
* This function already takes equipmentCostMult from {@link GangGenInfo | GangGenInfo} into account.
*
* @param equipName - Name of equipment.
* @returns Cost to purchase the specified Equipment/Augmentation (number). Infinity for invalid arguments
*/