BDMXIXECYJQDF66EF2TSVVHWIJ5CC22LUFOAOO2Y6YTZZPI3GOYQC AKJYQ7DS4ZQBUVXA4QOKL46X6MOZI4HK5HSDT6JZWDZHQ6UMPXFAC EODDZUMP2DADEIM2XGPPN24VOCUUYMLSF6WUH2WDMOUKNKRJZILAC WZRQS7TSQE2CGTO7WKFFFABDT2JQU2CED5LVANUCMGREIRI73W3AC Z5I5KK7NX6RS23QAB7ISLQCM5Z6TMVZK532NPSE7CO4MNXNKVKMAC QTTO6EU2UCXVVPN724D2FUMGKJSEWTG7FXLOFNUB3IL3RVV3AVUAC HXHNGFB2VCXB6YXDND35HJI22GBJC3QTSUR2TK3M3LXGJHVNXVHAC X7IQA5I46B6EHXPBIWTPCMZR4RZQ7PSJN5IMSEHA7H6F2NWQSNSQC SJGRJWVRMIYRCSQUR4LMS2APZNSJ64JAW7647NYTB52REONXVD2QC DPJCZOPIKAKQIS4YRXETBSJA5ZTL2KQESSJE2TEZFLRQARXUVFXQC PZNEDCRDS5IBR7QDPHTW5HZRMQAZFIF7VB3IKWPZDC7IALHZKHWAC 5NOOFT552GDEBDUACQZXG4TOLQSILGZEPGEJRS5BQD34TIJQ6T2QC GIDOI5BK3WYIDEQL7SZTJPR3Q5TDQ34YHDPDCUFFH6PX4POEDSQQC "bindings": {"version": "1.5.0","resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz","integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==","optional": true,"requires": {"file-uri-to-path": "1.0.0"}},
function calculateQuestScoreDetails() {const questScore: { scoreComponents: ScoreComponent[] } = {scoreComponents: [],};questScore.scoreComponents.push({inputAmount: 1,inputTitle: "quest completed",outputScore: 5,outputDescription: "",});questScore.scoreComponents.push({inputAmount: numBatches,inputTitle: "nodes allocated",outputScore: Math.floor(10 / (numBatches + 1)),outputDescription: "efficiency",});const total = questScore.scoreComponents.reduce((subtotal, prev) => subtotal + prev.outputScore,0);console.log(total);return { ...questScore, total };}
function Score({ score }: { score: number }) {const [lastScore, setLastScore] = useState(0);const [delta, setDelta] = useState(0);
function Score({scoreDetails,score,}: {score: number;scoreDetails: QuestScoreDetails;}) {const [viewed, setViewed] = useState(true);
console.log(`new score received: ${score}`);setLastScore((lastScore) => {setDelta(() => score - lastScore);return score;});}, [score]);
console.log({ scoreDetails });if (scoreDetails.total === 0) return;setViewed(false);}, [scoreDetails]);
{!!delta && <h6>Your score increased by {delta}!</h6>}{!!score && <h3>Score: {score}</h3>}
{!viewed && (<><h3>Score: {score}</h3>{!!scoreDetails.total && (<h4>Your score increased by {scoreDetails.total}!</h4>)}{scoreDetails.scoreComponents.map((scoreComponent) => {return (<React.Fragment key={scoreComponent.inputTitle}><h5>{scoreComponent.outputDescription &&scoreComponent.outputDescription + ": "}{formatDelta(scoreComponent.outputScore)} score for{" "}{scoreComponent.inputAmount} {scoreComponent.inputTitle}</h5></React.Fragment>);})}<button onClick={() => setViewed(true)}>OK</button></>)}
return new QuestFactory({}).create();
const r = Math.floor(Math.random() * 3) as 0 | 1 | 2;const resource = Object.values(ResourceNontrivialType)[r];const currentResource =gameState.computed.playerResourceAmounts?.[resource] || 50;const totalAllocatedNodes =gameState.computed.playerResourceNodesAggregated?.size() ?? 0;const scale = 2 + 1 / (totalAllocatedNodes + 1);return new QuestFactory(config).create(resource,Math.round(currentResource * scale));