mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 15:12:27 +01:00
Formatted/linted (There are some errors, but they aren't mine afaik)
This commit is contained in:
parent
8b026f606b
commit
f8f3c099e0
@ -1577,7 +1577,8 @@ export class Bladeburner implements IBladeburner {
|
||||
this.stamina = Math.min(this.maxStamina, this.stamina + staminaGain);
|
||||
if (this.logging.general) {
|
||||
this.log(
|
||||
`${person.whoAmI()}: Rested in Hyperbolic Regeneration Chamber. Restored ${BladeburnerConstants.HrcHpGain
|
||||
`${person.whoAmI()}: Rested in Hyperbolic Regeneration Chamber. Restored ${
|
||||
BladeburnerConstants.HrcHpGain
|
||||
} HP and gained ${numeralWrapper.formatStamina(staminaGain)} stamina`,
|
||||
);
|
||||
}
|
||||
|
@ -136,20 +136,19 @@ export class Skill {
|
||||
calculateCost(currentLevel: number, count = 1): number {
|
||||
if (count == 1) {
|
||||
return Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);
|
||||
}
|
||||
else if (count < 0 || isNaN(count)) {
|
||||
} else if (count < 0 || isNaN(count)) {
|
||||
throw new Error(`Attempted to find cost of ${count} BB upgrades`);
|
||||
}
|
||||
else if (count < 100) {
|
||||
const thisUpgrade = Math.floor((this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost);
|
||||
} else if (count < 100) {
|
||||
const thisUpgrade = Math.floor(
|
||||
(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost,
|
||||
);
|
||||
return this.calculateCost(currentLevel + 1, count - 1) + thisUpgrade;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//unFloored is roughly equivalent to
|
||||
//(this.baseCost + currentLevel * this.costInc) * BitNodeMultipliers.BladeburnerSkillCost
|
||||
//being repeated for increasing currentLevel
|
||||
const preMult = count * ((2 * this.baseCost) + this.costInc * (2 * currentLevel + count + 1)) / 2;
|
||||
const unFloored = (preMult * BitNodeMultipliers.BladeburnerSkillCost) - count / 2;
|
||||
const preMult = (count * (2 * this.baseCost + this.costInc * (2 * currentLevel + count + 1))) / 2;
|
||||
const unFloored = preMult * BitNodeMultipliers.BladeburnerSkillCost - count / 2;
|
||||
return Math.floor(unFloored);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ export function GeneralActionElem(props: IProps): React.ReactElement {
|
||||
<CopyableText value={props.action.name} />
|
||||
<StartButton
|
||||
bladeburner={props.bladeburner}
|
||||
type={ActionTypes[props.action.name ]}
|
||||
type={ActionTypes[props.action.name]}
|
||||
name={props.action.name}
|
||||
rerender={rerender}
|
||||
/>
|
||||
|
@ -22,7 +22,7 @@ export function Augmentations(props: IProps): React.ReactElement {
|
||||
const [augmentation, setAugmentation] = useState("Augmented Targeting I");
|
||||
|
||||
function setAugmentationDropdown(event: SelectChangeEvent<string>): void {
|
||||
setAugmentation(event.target.value );
|
||||
setAugmentation(event.target.value);
|
||||
}
|
||||
function queueAug(): void {
|
||||
props.player.queueAugmentation(augmentation);
|
||||
|
@ -15,7 +15,7 @@ import { CodingContractTypes } from "../../CodingContracts";
|
||||
export function CodingContracts(): React.ReactElement {
|
||||
const [codingcontract, setCodingcontract] = useState("Find Largest Prime Factor");
|
||||
function setCodingcontractDropdown(event: SelectChangeEvent<string>): void {
|
||||
setCodingcontract(event.target.value );
|
||||
setCodingcontract(event.target.value);
|
||||
}
|
||||
|
||||
function specificContract(): void {
|
||||
|
@ -18,7 +18,7 @@ const bigNumber = 1e12;
|
||||
export function Companies(): React.ReactElement {
|
||||
const [company, setCompany] = useState(FactionNames.ECorp as string);
|
||||
function setCompanyDropdown(event: SelectChangeEvent<string>): void {
|
||||
setCompany(event.target.value );
|
||||
setCompany(event.target.value);
|
||||
}
|
||||
function resetCompanyRep(): void {
|
||||
AllCompanies[company].playerReputation = 0;
|
||||
|
@ -29,7 +29,7 @@ export function Factions(props: IProps): React.ReactElement {
|
||||
const [faction, setFaction] = useState(FactionNames.Illuminati as string);
|
||||
|
||||
function setFactionDropdown(event: SelectChangeEvent<string>): void {
|
||||
setFaction(event.target.value );
|
||||
setFaction(event.target.value);
|
||||
}
|
||||
|
||||
function receiveInvite(): void {
|
||||
|
@ -19,7 +19,7 @@ interface IProps {
|
||||
export function Programs(props: IProps): React.ReactElement {
|
||||
const [program, setProgram] = useState("NUKE.exe");
|
||||
function setProgramDropdown(event: SelectChangeEvent<string>): void {
|
||||
setProgram(event.target.value );
|
||||
setProgram(event.target.value);
|
||||
}
|
||||
function addProgram(): void {
|
||||
if (!props.player.hasProgram(program)) {
|
||||
|
@ -15,7 +15,7 @@ import MenuItem from "@mui/material/MenuItem";
|
||||
export function Servers(): React.ReactElement {
|
||||
const [server, setServer] = useState("home");
|
||||
function setServerDropdown(event: SelectChangeEvent<string>): void {
|
||||
setServer(event.target.value );
|
||||
setServer(event.target.value);
|
||||
}
|
||||
function rootServer(): void {
|
||||
const s = GetServer(server);
|
||||
|
@ -8,8 +8,8 @@ export function Unclickable(): React.ReactElement {
|
||||
|
||||
function unclickable(event: React.MouseEvent<HTMLDivElement>): void {
|
||||
if (!event.target || !(event.target instanceof Element)) return;
|
||||
const display = getComputedStyle(event.target ).display;
|
||||
const visibility = getComputedStyle(event.target ).visibility;
|
||||
const display = getComputedStyle(event.target).display;
|
||||
const visibility = getComputedStyle(event.target).visibility;
|
||||
if (display === "none" && visibility === "hidden" && event.isTrusted) player.giveExploit(Exploit.Unclickable);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = getMaxNumberLevelUpgrades(props.player, node, HacknetNodeConstants.MaxLevel);
|
||||
} else {
|
||||
const levelsToMax = HacknetNodeConstants.MaxLevel - node.level;
|
||||
multiplier = Math.min(levelsToMax, purchaseMult );
|
||||
multiplier = Math.min(levelsToMax, purchaseMult);
|
||||
}
|
||||
|
||||
const increase =
|
||||
@ -94,7 +94,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = getMaxNumberRamUpgrades(props.player, node, HacknetNodeConstants.MaxRam);
|
||||
} else {
|
||||
const levelsToMax = Math.round(Math.log2(HacknetNodeConstants.MaxRam / node.ram));
|
||||
multiplier = Math.min(levelsToMax, purchaseMult );
|
||||
multiplier = Math.min(levelsToMax, purchaseMult);
|
||||
}
|
||||
|
||||
const increase =
|
||||
@ -144,7 +144,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
multiplier = getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores);
|
||||
} else {
|
||||
const levelsToMax = HacknetNodeConstants.MaxCores - node.cores;
|
||||
multiplier = Math.min(levelsToMax, purchaseMult );
|
||||
multiplier = Math.min(levelsToMax, purchaseMult);
|
||||
}
|
||||
|
||||
const increase =
|
||||
|
@ -298,10 +298,9 @@ export function NetscriptBladeburner(player: IPlayer, workerScript: WorkerScript
|
||||
const bladeburner = player.bladeburner;
|
||||
if (bladeburner === null) throw new Error("Should not be called without Bladeburner");
|
||||
try {
|
||||
if(bladeburner.upgradeSkillNetscriptFn(skillName, count, workerScript)){
|
||||
if (bladeburner.upgradeSkillNetscriptFn(skillName, count, workerScript)) {
|
||||
return count;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} catch (e: any) {
|
||||
|
@ -257,7 +257,7 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
|
||||
function getMaterial(divisionName: string, cityName: string, materialName: string): Material {
|
||||
const warehouse = getWarehouse(divisionName, cityName);
|
||||
const matName = (materialName ).replace(/ /g, "");
|
||||
const matName = materialName.replace(/ /g, "");
|
||||
const material = warehouse.materials[matName];
|
||||
if (material === undefined) throw new Error(`Invalid material name: '${materialName}'`);
|
||||
return material;
|
||||
@ -725,9 +725,11 @@ export function NetscriptCorporation(player: IPlayer, workerScript: WorkerScript
|
||||
const employeeName = ctx.helper.string("employeeName", _employeeName);
|
||||
const job = ctx.helper.string("job", _job);
|
||||
const employee = getEmployee(divisionName, cityName, employeeName);
|
||||
return netscriptDelay(["Training", "Unassigned"].includes(employee.pos) ? 0 : 1000, workerScript).then(function () {
|
||||
return netscriptDelay(["Training", "Unassigned"].includes(employee.pos) ? 0 : 1000, workerScript).then(
|
||||
function () {
|
||||
return Promise.resolve(AssignJob(employee, job));
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
hireEmployee:
|
||||
(ctx: NetscriptContext) =>
|
||||
|
@ -693,7 +693,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
if (server === null) throw new Error(`Server '${closingScript.hostname}' should not be null, but it is.`);
|
||||
|
||||
const serverScriptIndex = server.scripts.findIndex((script) => script.filename === closingScript.fileName);
|
||||
if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex ].code) {
|
||||
if (serverScriptIndex === -1 || savedScriptCode !== server.scripts[serverScriptIndex].code) {
|
||||
PromptEvent.emit({
|
||||
txt: `Do you want to save changes to ${closingScript.fileName} on ${closingScript.hostname}?`,
|
||||
resolve: (result: boolean | string) => {
|
||||
|
@ -36,7 +36,7 @@ function toNumber(n: number | IMinMaxRange): number {
|
||||
return n;
|
||||
}
|
||||
case "object": {
|
||||
const range = n ;
|
||||
const range = n;
|
||||
value = getRandomInt(range.min, range.max);
|
||||
break;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ export function placeOrder(
|
||||
|
||||
// Process to see if it should be executed immediately
|
||||
const processOrderRefs = {
|
||||
stockMarket: StockMarket ,
|
||||
stockMarket: StockMarket,
|
||||
symbolToStockMap: SymbolToStockMap,
|
||||
};
|
||||
processOrders(stock, order.type, order.pos, processOrderRefs);
|
||||
|
@ -84,7 +84,7 @@ export function mv(
|
||||
|
||||
script.filename = destPath;
|
||||
} else if (srcFile instanceof TextFile) {
|
||||
const textFile = srcFile ;
|
||||
const textFile = srcFile;
|
||||
if (!dest.endsWith(".txt")) {
|
||||
terminal.error(`Source and destination files must have the same type`);
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ export function getTextFile(fn: string, server: BaseServer): TextFile | null {
|
||||
filename = removeLeadingSlash(filename);
|
||||
}
|
||||
|
||||
for (const file of server.textFiles ) {
|
||||
for (const file of server.textFiles) {
|
||||
if (file.fn === filename) {
|
||||
return file;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user