2021-10-08 09:16:51 +02:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import { staneksGift } from "../../CotMG/Helper";
|
|
|
|
|
|
|
|
import Accordion from "@mui/material/Accordion";
|
|
|
|
import AccordionSummary from "@mui/material/AccordionSummary";
|
|
|
|
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
|
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
|
|
|
|
|
|
import Typography from "@mui/material/Typography";
|
|
|
|
import { Adjuster } from "./Adjuster";
|
|
|
|
|
2023-06-27 04:29:44 +02:00
|
|
|
export function StanekDev(): React.ReactElement {
|
2021-10-08 09:16:51 +02:00
|
|
|
function addCycles(): void {
|
|
|
|
staneksGift.storedCycles = 1e6;
|
|
|
|
}
|
|
|
|
|
|
|
|
function modCycles(modify: number): (x: number) => void {
|
|
|
|
return function (cycles: number): void {
|
|
|
|
staneksGift.storedCycles += cycles * modify;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetCycles(): void {
|
|
|
|
staneksGift.storedCycles = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function addCharge(): void {
|
2021-11-14 04:44:17 +01:00
|
|
|
staneksGift.fragments.forEach((f) => {
|
2022-04-01 21:45:12 +02:00
|
|
|
f.highestCharge = 1e21;
|
2021-11-14 04:44:17 +01:00
|
|
|
f.numCharge = 1e21;
|
|
|
|
});
|
2021-10-08 09:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function modCharge(modify: number): (x: number) => void {
|
|
|
|
return function (cycles: number): void {
|
2022-04-01 21:45:12 +02:00
|
|
|
staneksGift.fragments.forEach((f) => (f.highestCharge += cycles * modify));
|
2021-10-08 09:16:51 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetCharge(): void {
|
2021-11-14 04:44:17 +01:00
|
|
|
staneksGift.fragments.forEach((f) => {
|
2022-04-01 21:45:12 +02:00
|
|
|
f.highestCharge = 0;
|
2021-11-14 04:44:17 +01:00
|
|
|
f.numCharge = 0;
|
|
|
|
});
|
2021-10-08 09:16:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Accordion TransitionProps={{ unmountOnExit: true }}>
|
|
|
|
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
|
|
|
<Typography>Stanek's Gift</Typography>
|
|
|
|
</AccordionSummary>
|
|
|
|
<AccordionDetails>
|
|
|
|
<table>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Adjuster
|
|
|
|
label="cycles"
|
|
|
|
placeholder="amt"
|
|
|
|
tons={addCycles}
|
|
|
|
add={modCycles(1)}
|
|
|
|
subtract={modCycles(-1)}
|
|
|
|
reset={resetCycles}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Adjuster
|
|
|
|
label="all charge"
|
|
|
|
placeholder="amt"
|
|
|
|
tons={addCharge}
|
|
|
|
add={modCharge(1)}
|
|
|
|
subtract={modCharge(-1)}
|
|
|
|
reset={resetCharge}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</AccordionDetails>
|
|
|
|
</Accordion>
|
|
|
|
);
|
|
|
|
}
|