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X3HQDB4GSDSTQZAC
QDCUZEYTKURHBOP65DP5VYAPGHNXPTXIF3S3VTDZ3WGBZ3BI3DHQC
CZPLX4O4R7K3TF3NSAL5PT7NO3CUOLDY3OR332GBIYYNKMZTW24AC
GIDOI5BK3WYIDEQL7SZTJPR3Q5TDQ34YHDPDCUFFH6PX4POEDSQQC
DDJJXZKSQLXUXIMLKMKHY75JKC2IRA2A7SEVSUNL5FSCFH77T4IAC
6EXHALB3E5HP3IQVC47M4RVZE2JERJHX37GOOHPYIVAFBWSWUX7QC
HUH4SI4HXIP72KQSJP2I4ELHX5KUQZM7FFGKZZGJ33DF7E3JHMYQC
"@babel/types": "^7.10.4"
}
},
"@babel/helper-builder-react-jsx": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz",
"integrity": "sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg==",
"requires": {
"@babel/helper-annotate-as-pure": "^7.10.4",
"@babel/helper-builder-react-jsx-experimental": {
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.11.tgz",
"integrity": "sha512-4oGVOekPI8dh9JphkPXC68iIuP6qp/RPbaPmorRmEFbRAHZjSqxPjqHudn18GVDPgCuFM/KdFXc63C17Ygfa9w==",
"requires": {
"@babel/helper-annotate-as-pure": "^7.12.10",
"@babel/helper-module-imports": "^7.12.5",
"@babel/types": "^7.12.11"
}
},
"version": "7.12.1",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.1.tgz",
"integrity": "sha512-d+/o30tJxFxrA1lhzJqiUcEJdI6jKlNregCv5bASeGf2Q4MXmnwH7viDo7nhx1/ohf09oaH8j1GVYG/e3Yqk6A==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.12.12.tgz",
"integrity": "sha512-nrz9y0a4xmUrRq51bYkWJIO5SBZyG2ys2qinHsN0zHDHVsUaModrkpyWWWXfGqYQmOL3x9sQIcTNN/pBGpo09A==",
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.11.tgz",
"integrity": "sha512-atR1Rxc3hM+VPg/NvNvfYw0npQEAcHuJ+MGZnFn6h3bo+1U3BWXMdFMlvVRApBTWKQMX7SOwRJZA5FBF/JQbvA==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.12.12.tgz",
"integrity": "sha512-VOEPQ/ExOVqbukuP7BYJtI5ZxxsmegTwzZ04j1aF0dkSypGo9XpDHuOrABsJu+ie+penpSJheDJ11x1BEZNiyQ==",
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.11.tgz",
"integrity": "sha512-5nWOw6mTylaFU72BdZfa0dP1HsGdY3IMExpxn8LBE8dNmkQjB+W+sR+JwIdtbzkPvVuFviT3zyNbSUkuVTVxbw==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.12.tgz",
"integrity": "sha512-JDWGuzGNWscYcq8oJVCtSE61a5+XAOos+V0HrxnDieUus4UMnBEosDnY1VJqU5iZ4pA04QY7l0+JvHL1hZEfsw==",
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.11.tgz",
"integrity": "sha512-5MvsGschXeXJsbzQGR/BH89ATMzCsM7rx95n+R7/852cGoK2JgMbacDw/A9Pmrfex4tArdMab0L5SBV4SB/Nxg==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.12.tgz",
"integrity": "sha512-i1AxnKxHeMxUaWVXQOSIco4tvVvvCxMSfeBMnMM06mpaJt3g+MpxYQQrDfojUQldP1xxraPSJYSMEljoWM/dCg==",
"version": "7.12.10",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.10.tgz",
"integrity": "sha512-6aEtf0IeRgbYWzta29lePeYSk+YAFIC3kyqESeft8o5CkFlYIMX+EQDDWEiAQ9LHOA3d0oHdgrSsID/CKqXJlg==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.12.tgz",
"integrity": "sha512-s88i0X0lPy45RrLM8b9mz8RPH5FqO9G9p7ti59cToE44xFm1Q+Pjh5Gq4SXBbtb88X7Uy7pexeqRIQDDMNkL0w==",
"@babel/code-frame": "^7.10.4",
"@babel/generator": "^7.12.10",
"@babel/helper-function-name": "^7.10.4",
"@babel/helper-split-export-declaration": "^7.11.0",
"@babel/parser": "^7.12.10",
"@babel/types": "^7.12.10",
"@babel/code-frame": "^7.12.11",
"@babel/generator": "^7.12.11",
"@babel/helper-function-name": "^7.12.11",
"@babel/helper-split-export-declaration": "^7.12.11",
"@babel/parser": "^7.12.11",
"@babel/types": "^7.12.12",
},
"dependencies": {
"@babel/code-frame": {
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
"integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
"requires": {
"@babel/highlight": "^7.10.4"
}
}
"version": "7.12.11",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.11.tgz",
"integrity": "sha512-ukA9SQtKThINm++CX1CwmliMrE54J6nIYB5XTwL5f/CLFW9owfls+YSU8tVW15RQ2w+a3fSbPjC6HdQNtWZkiA==",
"version": "7.12.12",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.12.tgz",
"integrity": "sha512-lnIX7piTxOH22xE7fDXDbSHg9MM1/6ORnafpJmov5rs0kX5g4BZxeXNJLXsMRiO0U5Rb8/FvMS6xlTnTHvxonQ==",
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.1.5.tgz",
"integrity": "sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ=="
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.1.6.tgz",
"integrity": "sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA=="
"version": "1.3.632",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.632.tgz",
"integrity": "sha512-LkaEH9HHr9fodmm3txF4nFMyHN3Yr50HcpD/DBHpLCxzM9doV8AV0er6aBWva4IDs2aA9kGguces0rp+WKL7rg=="
"version": "1.3.633",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.633.tgz",
"integrity": "sha512-bsVCsONiVX1abkWdH7KtpuDAhsQ3N3bjPYhROSAXE78roJKet0Y5wznA14JE9pzbwSZmSMAW6KiKYf1RvbTJkA=="
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.4.1.tgz",
"integrity": "sha512-s1Iam6Gwz3JI5Hweaz4GoCD1WUNUIyzePFy5+Js2hjwGVt2Z79wNN+ZKOZ2vB6C+Xs6njyB84Z1IthQg8d9LxA=="
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz",
"integrity": "sha512-p+T744ZyjjiaFlMUZZv6YPC5JrkNj8maRmPaQCWFJFplUAzpIUTRaTcS+7wmZtUoFXHtESJb23ISliaWyz3SHA=="
let tabViews: JSX.Element[] = [];
tabViews[1] = useMemo(() => {
return (
<NodeDetail
selectedPointNode={gameState.playerUI.selectedPointNode}
allocatedPointNodeSet={gameState.playerSave.allocatedPointNodeSet}
worldGen={gameState.worldGen}
availableSp={gameState.playerSave.availableSp}
/>
);
}, [
gameState.playerUI.selectedPointNode,
gameState.playerSave.allocatedPointNodeSet,
gameState.worldGen,
gameState.playerSave.availableSp,
]);
tabViews[0] = useMemo(() => {
return (
<QuestProgress
remainingPoints={gameState.playerSave.availableSp}
createQuestCb={createQuestCb}
activeQuest={gameState.playerSave.activeQuest}
numBatches={gameState.playerSave.batchesSinceQuestStart}
playerResourceAmounts={gameState.computed.playerResourceAmounts}
/>
);
}, [
gameState.playerSave.availableSp,
gameState.playerSave.activeQuest,
createQuestCb,
gameState.playerSave.batchesSinceQuestStart,
gameState.computed.playerResourceAmounts,
]);
tabViews[2] = useMemo(() => {
return (
<DebugTab
selectedPointNode={gameState.playerUI.selectedPointNode}
allocatedPointNodeSet={gameState.playerSave.allocatedPointNodeSet}
worldGen={gameState.worldGen}
availableSp={gameState.playerSave.availableSp}
computed={gameState.computed}
/>
);
}, [
gameState.playerUI.selectedPointNode,
gameState.playerSave.allocatedPointNodeSet,
gameState.worldGen,
gameState.playerSave.availableSp,
gameState.computed,
]);
let tabViews: JSX.Element[] = [];
tabViews = [
<QuestProgress
remainingPoints={gameState.playerSave.availableSp}
createQuestCb={createQuestCb}
activeQuest={gameState.playerSave.activeQuest}
numBatches={gameState.playerSave.batchesSinceQuestStart}
playerResourceAmounts={gameState.computed.playerResourceAmounts}
updaters={updaters.playerSave}
score={gameState.playerSave.score}
/>,
<NodeDetail
selectedPointNode={gameState.playerUI.selectedPointNode}
allocatedPointNodeSet={gameState.playerSave.allocatedPointNodeSet}
worldGen={gameState.worldGen}
availableSp={gameState.playerSave.availableSp}
/>,
<DebugTab
selectedPointNode={gameState.playerUI.selectedPointNode}
allocatedPointNodeSet={gameState.playerSave.allocatedPointNodeSet}
worldGen={gameState.worldGen}
availableSp={gameState.playerSave.availableSp}
computed={gameState.computed}
/>,
];
selectedPointNode?: PointNodeRef
allocatedPointNodeSet: HashSet<PointNodeRef>,
worldGen: WorldGenState,
availableSp: number,
}
export function NodeDetail({
selectedPointNode?: PointNodeRef;
allocatedPointNodeSet: HashSet<PointNodeRef>;
worldGen: WorldGenState;
availableSp: number;
};
export const NodeDetail = React.memo(NodeDetailComponent);
function NodeDetailComponent({
const pointNodeGen = worldGen.zLevels[selectedPointNode.z]!.chunks.get(selectedPointNode.chunkCoord)!.pointNodes.get(selectedPointNode.pointNodeCoord)!
const isAllocated = (allocatedPointNodeSet.contains(selectedPointNode));
const canBeAllocated: string = canAllocate(selectedPointNode, worldGen, allocatedPointNodeSet, availableSp);
const pointNodeGen = worldGen.zLevels[selectedPointNode.z]!.chunks.get(
selectedPointNode.chunkCoord
)!.pointNodes.get(selectedPointNode.pointNodeCoord)!;
const isAllocated = allocatedPointNodeSet.contains(selectedPointNode);
const canBeAllocated: string = canAllocate(
selectedPointNode,
worldGen,
allocatedPointNodeSet,
availableSp
);
remainingPoints: number,
createQuestCb: () => void,
activeQuest: Quest | undefined,
numBatches: number,
playerResourceAmounts?: { [k in ResourceType]: number },
}
export default function QuestProgress({
remainingPoints: number;
createQuestCb: () => void;
activeQuest: Quest | undefined;
numBatches: number;
playerResourceAmounts?: { [k in ResourceType]: number };
updaters: UpdaterGeneratorType2<GameState, GameState>["playerSave"];
score: GameState["playerSave"]["score"];
};
export default React.memo(QuestProgressComponent);
function QuestProgressComponent({
const isQuestComplete = activeQuest && (playerResourceAmounts?.[activeQuest.resourceType] || 0) >= activeQuest.resourceAmount;
const isQuestComplete =
activeQuest &&
(playerResourceAmounts?.[activeQuest.resourceType] || 0) >=
activeQuest.resourceAmount;
window.alert("your score increased by 831!");
// window.alert("your score increased by 831!");
// const questScore = efficiency;
const questScore = 831;
updaters.score.enqueueUpdate((lastScore) => {
console.log({ score, lastScore });
console.log("updating score");
return lastScore + questScore;
});
updaters.activeQuest.enqueueUpdate(() => {
return undefined;
});
{activeQuest === undefined ? (<>
<h2> You have no <br />active quests! </h2>
<br></br>
<br></br>
<button className="button" onClick={() => {
createQuestCb();
}}>Get a quest</button>
<br></br>
<br></br>
<br></br>
</>) : (<>
{<Score score={score} />}
{activeQuest === undefined ? (
<>
<h2>
{" "}
You have no <br />
active quests!{" "}
</h2>
<br></br>
<br></br>
<button
className="button"
onClick={() => {
createQuestCb();
}}
>
Get a quest
</button>
<br></br>
<br></br>
<br></br>
</>
) : (
<>
<div className={classnames({ good: isQuestComplete })}>{playerResourceAmounts?.[activeQuest.resourceType]} {activeQuest.resourceType}</div>
<div className={classnames({ good: isQuestComplete })}>
{playerResourceAmounts?.[activeQuest.resourceType]}{" "}
{activeQuest.resourceType}
</div>
<div>{'SS'}</div>
{ isQuestComplete ? (<>
<br></br>
<button className="button" onClick={() => {
doClaimReward();
}}>
Claim reward
</button>
</>) : (<></>)}
<div>{"SS"}</div>
{isQuestComplete ? (
<>
<br></br>
<button
className="button"
onClick={() => {
doClaimReward();
}}
>
Claim reward
</button>
</>
) : (
<></>
)}
<div>(Hint: You won't run <br />out of skill points, but<br /> they come in batches -<br />
try to use the <br /> fewest you can!)</div>
</>)}
<div>
(Hint: You won't run <br />
out of skill points, but
<br /> they come in batches -<br />
try to use the <br /> fewest you can!)
</div>
</>
)}
function Score({ score }: { score: number }) {
const [lastScore, setLastScore] = useState(0);
const [delta, setDelta] = useState(0);
useEffect(() => {
console.log(`new score received: ${score}`);
setLastScore((lastScore) => {
setDelta(() => score - lastScore);
return score;
});
}, [score]);
return (
<>
{!!delta && <h6>Your score increased by {delta}!</h6>}
{!!score && <h3>Score: {score}</h3>}
</>
);
}