mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
Remove cooldown from "Sell corporation and start over" (#919)
This commit is contained in:
parent
f2baa04f45
commit
34cc0441c2
@ -21,9 +21,10 @@ import { createEnumKeyedRecord, getRecordValues } from "../Types/Record";
|
|||||||
|
|
||||||
export const CorporationResolvers: ((prevState: CorpStateName) => void)[] = [];
|
export const CorporationResolvers: ((prevState: CorpStateName) => void)[] = [];
|
||||||
|
|
||||||
interface IParams {
|
interface ICorporationParams {
|
||||||
name?: string;
|
name?: string;
|
||||||
seedFunded?: boolean;
|
seedFunded?: boolean;
|
||||||
|
shareSaleCooldown?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Corporation {
|
export class Corporation {
|
||||||
@ -70,9 +71,10 @@ export class Corporation {
|
|||||||
|
|
||||||
state = new CorporationState();
|
state = new CorporationState();
|
||||||
|
|
||||||
constructor(params: IParams = {}) {
|
constructor(params: ICorporationParams = {}) {
|
||||||
this.name = params.name || "The Corporation";
|
this.name = params.name || "The Corporation";
|
||||||
this.seedFunded = params.seedFunded ?? false;
|
this.seedFunded = params.seedFunded ?? false;
|
||||||
|
this.shareSaleCooldown = params.shareSaleCooldown ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFunds(amt: number): void {
|
addFunds(amt: number): void {
|
||||||
|
@ -319,22 +319,13 @@ function SellDivisionButton(): React.ReactElement {
|
|||||||
function RestartButton(): React.ReactElement {
|
function RestartButton(): React.ReactElement {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const corp = useCorporation();
|
|
||||||
const sellSharesOnCd = corp.shareSaleCooldown > 0;
|
|
||||||
|
|
||||||
function restart(): void {
|
function restart(): void {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonWithTooltip
|
<ButtonWithTooltip normalTooltip={"Sell corporation and start over"} onClick={restart}>
|
||||||
normalTooltip={"Sell corporation and start over"}
|
|
||||||
disabledTooltip={
|
|
||||||
sellSharesOnCd ? "Sell corporation and start over. Cannot do this while Sell Shares is on cooldown." : ""
|
|
||||||
}
|
|
||||||
onClick={restart}
|
|
||||||
>
|
|
||||||
Sell CEO position
|
Sell CEO position
|
||||||
</ButtonWithTooltip>
|
</ButtonWithTooltip>
|
||||||
<SellCorporationModal open={open} onClose={() => setOpen(false)} />
|
<SellCorporationModal open={open} onClose={() => setOpen(false)} />
|
||||||
|
@ -61,7 +61,7 @@ export function SellSharesModal(props: IProps): React.ReactElement {
|
|||||||
<li>Selling shares will cause stock price to fall due to market forces.</li>
|
<li>Selling shares will cause stock price to fall due to market forces.</li>
|
||||||
<li>The money from selling your shares will go directly to you (NOT your Corporation).</li>
|
<li>The money from selling your shares will go directly to you (NOT your Corporation).</li>
|
||||||
<li>
|
<li>
|
||||||
You will not be able to sell shares again (or dissolve the corporation) for{" "}
|
You will not be able to sell shares again for{" "}
|
||||||
<b>{corp.convertCooldownToString(corpConstants.sellSharesCooldown)}</b>.
|
<b>{corp.convertCooldownToString(corpConstants.sellSharesCooldown)}</b>.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -12,6 +12,7 @@ export function startCorporation(this: PlayerObject, corpName: string, seedFunde
|
|||||||
this.corporation = new Corporation({
|
this.corporation = new Corporation({
|
||||||
name: corpName,
|
name: corpName,
|
||||||
seedFunded: seedFunded,
|
seedFunded: seedFunded,
|
||||||
|
shareSaleCooldown: this.corporation?.shareSaleCooldown,
|
||||||
});
|
});
|
||||||
//reset the research tree in case the corporation was restarted
|
//reset the research tree in case the corporation was restarted
|
||||||
resetIndustryResearchTrees();
|
resetIndustryResearchTrees();
|
||||||
|
Loading…
Reference in New Issue
Block a user