mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 16:52:55 +02:00
CORPORATION: Rename functions in Actions.ts (#1272)
This should be a straight rename, no functionality changes.
This commit is contained in:
@@ -19,37 +19,37 @@ import {
|
||||
} from "@nsdefs";
|
||||
|
||||
import {
|
||||
NewDivision,
|
||||
createDivision,
|
||||
purchaseOffice,
|
||||
IssueDividends,
|
||||
GoPublic,
|
||||
IssueNewShares,
|
||||
AcceptInvestmentOffer,
|
||||
SellMaterial,
|
||||
SellProduct,
|
||||
SetSmartSupply,
|
||||
BuyMaterial,
|
||||
UpgradeOfficeSize,
|
||||
issueDividends,
|
||||
goPublic,
|
||||
issueNewShares,
|
||||
acceptInvestmentOffer,
|
||||
sellMaterial,
|
||||
sellProduct,
|
||||
setSmartSupply,
|
||||
buyMaterial,
|
||||
upgradeOfficeSize,
|
||||
purchaseWarehouse,
|
||||
UpgradeWarehouse,
|
||||
BuyTea,
|
||||
ThrowParty,
|
||||
HireAdVert,
|
||||
MakeProduct,
|
||||
Research,
|
||||
ExportMaterial,
|
||||
CancelExportMaterial,
|
||||
SetMaterialMarketTA1,
|
||||
SetMaterialMarketTA2,
|
||||
SetProductMarketTA1,
|
||||
SetProductMarketTA2,
|
||||
BulkPurchase,
|
||||
SellShares,
|
||||
BuyBackShares,
|
||||
SetSmartSupplyOption,
|
||||
LimitMaterialProduction,
|
||||
LimitProductProduction,
|
||||
UpgradeWarehouseCost,
|
||||
upgradeWarehouse,
|
||||
buyTea,
|
||||
throwParty,
|
||||
hireAdVert,
|
||||
makeProduct,
|
||||
research,
|
||||
exportMaterial,
|
||||
cancelExportMaterial,
|
||||
setMaterialMarketTA1,
|
||||
setMaterialMarketTA2,
|
||||
setProductMarketTA1,
|
||||
setProductMarketTA2,
|
||||
bulkPurchase,
|
||||
sellShares,
|
||||
buyBackShares,
|
||||
setSmartSupplyOption,
|
||||
limitMaterialProduction,
|
||||
limitProductProduction,
|
||||
upgradeWarehouseCost,
|
||||
createCorporation,
|
||||
removeDivision,
|
||||
bribe,
|
||||
@@ -184,7 +184,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
throw helpers.errorMessage(ctx, "You must provide a positive number");
|
||||
}
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
return UpgradeWarehouseCost(warehouse, amt);
|
||||
return upgradeWarehouseCost(warehouse, amt);
|
||||
},
|
||||
hasWarehouse: (ctx) => (_divisionName, _cityName) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -273,7 +273,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
if (amt < 1) {
|
||||
throw helpers.errorMessage(ctx, "You must provide a positive number");
|
||||
}
|
||||
UpgradeWarehouse(corporation, getDivision(divisionName), getWarehouse(divisionName, cityName), amt);
|
||||
upgradeWarehouse(corporation, getDivision(divisionName), getWarehouse(divisionName, cityName), amt);
|
||||
},
|
||||
sellMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt, _price) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -283,7 +283,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const amt = helpers.string(ctx, "amt", _amt);
|
||||
const price = helpers.string(ctx, "price", _price);
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
SellMaterial(material, amt, price);
|
||||
sellMaterial(material, amt, price);
|
||||
},
|
||||
sellProduct:
|
||||
(ctx) =>
|
||||
@@ -296,7 +296,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const price = helpers.string(ctx, "price", _price);
|
||||
const all = !!_all;
|
||||
const product = getProduct(divisionName, productName);
|
||||
SellProduct(product, cityName, amt, price, all);
|
||||
sellProduct(product, cityName, amt, price, all);
|
||||
},
|
||||
discontinueProduct: (ctx) => (_divisionName, _productName) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -312,7 +312,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
if (!hasUnlock(CorpUnlockName.SmartSupply))
|
||||
throw helpers.errorMessage(ctx, `You have not purchased the Smart Supply upgrade!`);
|
||||
SetSmartSupply(warehouse, enabled);
|
||||
setSmartSupply(warehouse, enabled);
|
||||
},
|
||||
setSmartSupplyOption: (ctx) => (_divisionName, _cityName, _materialName, _option) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -324,7 +324,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const option = getEnumHelper("SmartSupplyOption").nsGetMember(ctx, _option);
|
||||
if (!hasUnlock(CorpUnlockName.SmartSupply))
|
||||
throw helpers.errorMessage(ctx, `You have not purchased the Smart Supply upgrade!`);
|
||||
SetSmartSupplyOption(warehouse, material, option);
|
||||
setSmartSupplyOption(warehouse, material, option);
|
||||
},
|
||||
buyMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -337,7 +337,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
if (amt < 0 || !Number.isFinite(amt))
|
||||
throw new Error("Invalid value for amount field! Must be numeric and greater than or equal to 0");
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
BuyMaterial(division, material, amt);
|
||||
buyMaterial(division, material, amt);
|
||||
},
|
||||
bulkPurchase: (ctx) => (_divisionName, _cityName, _materialName, _amt) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -350,7 +350,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const amt = helpers.number(ctx, "amt", _amt);
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
const material = getMaterial(divisionName, cityName, materialName);
|
||||
BulkPurchase(corporation, division, warehouse, material, amt);
|
||||
bulkPurchase(corporation, division, warehouse, material, amt);
|
||||
},
|
||||
makeProduct:
|
||||
(ctx) =>
|
||||
@@ -362,7 +362,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const designInvest = helpers.number(ctx, "designInvest", _designInvest);
|
||||
const marketingInvest = helpers.number(ctx, "marketingInvest", _marketingInvest);
|
||||
const corporation = getCorporation();
|
||||
MakeProduct(corporation, getDivision(divisionName), cityName, productName, designInvest, marketingInvest);
|
||||
makeProduct(corporation, getDivision(divisionName), cityName, productName, designInvest, marketingInvest);
|
||||
},
|
||||
limitProductProduction: (ctx) => (_divisionName, _cityName, _productName, _qty) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -370,7 +370,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
||||
const productName = helpers.string(ctx, "productName", _productName);
|
||||
const qty = helpers.number(ctx, "qty", _qty);
|
||||
LimitProductProduction(getProduct(divisionName, productName), cityName, qty);
|
||||
limitProductProduction(getProduct(divisionName, productName), cityName, qty);
|
||||
},
|
||||
exportMaterial:
|
||||
(ctx) =>
|
||||
@@ -386,7 +386,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
||||
const amt = helpers.string(ctx, "amt", _amt);
|
||||
|
||||
ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt);
|
||||
exportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt);
|
||||
},
|
||||
cancelExportMaterial:
|
||||
(ctx) =>
|
||||
@@ -400,7 +400,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const targetDivision = helpers.string(ctx, "targetDivision", _targetDivision);
|
||||
const targetCity = getEnumHelper("CityName").nsGetMember(ctx, _targetCity, "targetCity");
|
||||
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
||||
CancelExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName));
|
||||
cancelExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName));
|
||||
},
|
||||
limitMaterialProduction: (ctx) => (_divisionName, _cityName, _materialName, _qty) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -408,7 +408,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
||||
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
||||
const qty = helpers.number(ctx, "qty", _qty);
|
||||
LimitMaterialProduction(getMaterial(divisionName, cityName, materialName), qty);
|
||||
limitMaterialProduction(getMaterial(divisionName, cityName, materialName), qty);
|
||||
},
|
||||
setMaterialMarketTA1: (ctx) => (_divisionName, _cityName, _materialName, _on) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -418,7 +418,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const on = !!_on;
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
||||
throw helpers.errorMessage(ctx, `You have not researched MarketTA.I for division: ${divisionName}`);
|
||||
SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on);
|
||||
setMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on);
|
||||
},
|
||||
setMaterialMarketTA2: (ctx) => (_divisionName, _cityName, _materialName, _on) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -428,7 +428,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const on = !!_on;
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
||||
throw helpers.errorMessage(ctx, `You have not researched MarketTA.II for division: ${divisionName}`);
|
||||
SetMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on);
|
||||
setMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on);
|
||||
},
|
||||
setProductMarketTA1: (ctx) => (_divisionName, _productName, _on) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -437,7 +437,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const on = !!_on;
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
||||
throw helpers.errorMessage(ctx, `You have not researched MarketTA.I for division: ${divisionName}`);
|
||||
SetProductMarketTA1(getProduct(divisionName, productName), on);
|
||||
setProductMarketTA1(getProduct(divisionName, productName), on);
|
||||
},
|
||||
setProductMarketTA2: (ctx) => (_divisionName, _productName, _on) => {
|
||||
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
||||
@@ -446,7 +446,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const on = !!_on;
|
||||
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
||||
throw helpers.errorMessage(ctx, `You have not researched MarketTA.II for division: ${divisionName}`);
|
||||
SetProductMarketTA2(getProduct(divisionName, productName), on);
|
||||
setProductMarketTA2(getProduct(divisionName, productName), on);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -526,7 +526,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
|
||||
const office = getOffice(divisionName, cityName);
|
||||
const corporation = getCorporation();
|
||||
UpgradeOfficeSize(corporation, office, size);
|
||||
upgradeOfficeSize(corporation, office, size);
|
||||
},
|
||||
throwParty: (ctx) => (_divisionName, _cityName, _costPerEmployee) => {
|
||||
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
||||
@@ -540,7 +540,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const corporation = getCorporation();
|
||||
const office = getOffice(divisionName, cityName);
|
||||
|
||||
return ThrowParty(corporation, office, costPerEmployee);
|
||||
return throwParty(corporation, office, costPerEmployee);
|
||||
},
|
||||
buyTea: (ctx) => (_divisionName, _cityName) => {
|
||||
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
||||
@@ -549,19 +549,19 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
|
||||
const corporation = getCorporation();
|
||||
const office = getOffice(divisionName, cityName);
|
||||
return BuyTea(corporation, office);
|
||||
return buyTea(corporation, office);
|
||||
},
|
||||
hireAdVert: (ctx) => (_divisionName) => {
|
||||
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
||||
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
||||
const corporation = getCorporation();
|
||||
HireAdVert(corporation, getDivision(divisionName));
|
||||
hireAdVert(corporation, getDivision(divisionName));
|
||||
},
|
||||
research: (ctx) => (_divisionName, _researchName) => {
|
||||
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
||||
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
||||
const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName");
|
||||
Research(getDivision(divisionName), researchName);
|
||||
research(getDivision(divisionName), researchName);
|
||||
},
|
||||
getOffice: (ctx) => (_divisionName, _cityName) => {
|
||||
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
||||
@@ -611,7 +611,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const industryName = getEnumHelper("IndustryType").nsGetMember(ctx, _industryName, "industryName");
|
||||
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
||||
const corporation = getCorporation();
|
||||
NewDivision(corporation, industryName, divisionName);
|
||||
createDivision(corporation, industryName, divisionName);
|
||||
},
|
||||
expandCity: (ctx) => (_divisionName, _cityName) => {
|
||||
checkAccess(ctx);
|
||||
@@ -643,7 +643,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
throw new Error(`Invalid value for rate field! Must be numeric, greater than 0, and less than ${max}`);
|
||||
const corporation = getCorporation();
|
||||
if (!corporation.public) throw helpers.errorMessage(ctx, `Your company has not gone public!`);
|
||||
IssueDividends(corporation, rate);
|
||||
issueDividends(corporation, rate);
|
||||
},
|
||||
issueNewShares: (ctx) => (_amount) => {
|
||||
checkAccess(ctx);
|
||||
@@ -651,7 +651,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const maxNewShares = corporation.calculateMaxNewShares();
|
||||
if (_amount == undefined) _amount = maxNewShares;
|
||||
const amount = helpers.number(ctx, "amount", _amount);
|
||||
const [funds] = IssueNewShares(corporation, amount);
|
||||
const [funds] = issueNewShares(corporation, amount);
|
||||
return funds;
|
||||
},
|
||||
getDivision: (ctx) => (_divisionName) => {
|
||||
@@ -728,7 +728,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
checkAccess(ctx);
|
||||
const corporation = getCorporation();
|
||||
try {
|
||||
AcceptInvestmentOffer(corporation);
|
||||
acceptInvestmentOffer(corporation);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
@@ -739,18 +739,18 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
||||
const corporation = getCorporation();
|
||||
if (corporation.public) throw helpers.errorMessage(ctx, "Corporation is already public");
|
||||
const numShares = helpers.number(ctx, "numShares", _numShares);
|
||||
GoPublic(corporation, numShares);
|
||||
goPublic(corporation, numShares);
|
||||
return true;
|
||||
},
|
||||
sellShares: (ctx) => (_numShares) => {
|
||||
checkAccess(ctx);
|
||||
const numShares = helpers.number(ctx, "numShares", _numShares);
|
||||
return SellShares(getCorporation(), numShares);
|
||||
return sellShares(getCorporation(), numShares);
|
||||
},
|
||||
buyBackShares: (ctx) => (_numShares) => {
|
||||
checkAccess(ctx);
|
||||
const numShares = helpers.number(ctx, "numShares", _numShares);
|
||||
return BuyBackShares(getCorporation(), numShares);
|
||||
return buyBackShares(getCorporation(), numShares);
|
||||
},
|
||||
bribe: (ctx) => (_factionName, _amountCash) => {
|
||||
checkAccess(ctx);
|
||||
|
||||
Reference in New Issue
Block a user