Skip to content

Commit 3f765eb

Browse files
committed
feat: add double statue drop chance and double golden food drop chance calculations with breakdowns in formulas component
1 parent 23d0879 commit 3f765eb

File tree

2 files changed

+92
-11
lines changed

2 files changed

+92
-11
lines changed

pages/tools/formulas.jsx

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ import { getPrinterMulti } from '@parsers/printer';
2323
import { getBitsMulti } from '@parsers/gaming';
2424
import { getGoldenFoodMulti } from '@parsers/misc';
2525
import { NextSeo } from 'next-seo';
26+
import { getDoubleStatueDrop, getDoubleGoldenFoodDrop } from '@parsers/misc';
27+
import Tooltip from '@components/Tooltip';
28+
import { IconInfoCircleFilled } from '@tabler/icons-react';
29+
import { Breakdown } from '@components/common/styles';
2630

2731
const Formulas = () => {
2832
const { state } = useContext(AppContext);
@@ -38,6 +42,8 @@ const Formulas = () => {
3842
const printerMulti = getPrinterMulti(state?.account, state?.characters);
3943
const bitMulti = getBitsMulti(state?.account, state?.characters);
4044
const goldenFoodMulti = getGoldenFoodMulti(selectedChar, state?.account, state?.characters);
45+
const doubleStatueDropChance = getDoubleStatueDrop(state?.account, selectedChar, state?.characters);
46+
const doubleGoldenFoodDropChance = getDoubleGoldenFoodDrop(state?.account, selectedChar, state?.characters);
4147
return [
4248
{
4349
id: 'crystalChance',
@@ -52,6 +58,7 @@ const Formulas = () => {
5258
name: 'Respawn Rate',
5359
formula: respawnRate?.expression,
5460
value: respawnRate?.respawnRate,
61+
breakdown: respawnRate?.breakdown,
5562
renderValue: (value) => `${notateNumber(value, 'MultiplierInfo')}%`,
5663
description: 'How often a mob is spawned'
5764
},
@@ -60,6 +67,7 @@ const Formulas = () => {
6067
name: 'Cash Multiplier',
6168
formula: cashMulti?.expression,
6269
value: cashMulti?.cashMulti,
70+
breakdown: cashMulti?.breakdown,
6371
renderValue: (value) => `${cashFormatter(value, 2)}x`,
6472
description: 'Coin bonuses from all sources'
6573
},
@@ -68,6 +76,7 @@ const Formulas = () => {
6876
name: 'Exp Multiplier',
6977
formula: expMulti?.expression,
7078
value: expMulti?.value,
79+
breakdown: expMulti?.breakdown,
7180
renderValue: (value) => `${cashFormatter(value, 2)}x`,
7281
description: 'Exp bonuses from all sources'
7382
},
@@ -76,6 +85,7 @@ const Formulas = () => {
7685
name: 'Drop Rate',
7786
formula: dropRate?.expression,
7887
value: dropRate?.dropRate,
88+
breakdown: dropRate?.breakdown,
7989
renderValue: (value) => `${notateNumber(value, 'MultiplierInfo')}x`,
8090
description: 'Drop rate bonuses from all sources'
8191
},
@@ -100,6 +110,7 @@ const Formulas = () => {
100110
name: 'Crop Evolution',
101111
formula: cropEvo?.expression,
102112
value: cropEvo?.value,
113+
breakdown: cropEvo?.breakdown,
103114
renderValue: (value) => `${value}%`,
104115
description: 'Crop evolution chance'
105116
},
@@ -108,6 +119,7 @@ const Formulas = () => {
108119
name: 'Printer Multiplier',
109120
formula: printerMulti?.expression,
110121
value: printerMulti?.value,
122+
breakdown: printerMulti?.breakdown,
111123
renderValue: (value) => `${value.toFixed(2)}%`,
112124
description: 'Printer multi bonuses from all sources'
113125
},
@@ -116,6 +128,7 @@ const Formulas = () => {
116128
name: 'Bit Multiplier',
117129
formula: bitMulti?.expression,
118130
value: bitMulti?.value,
131+
breakdown: bitMulti?.breakdown,
119132
renderValue: (value) => `${notateNumber(value)}%`,
120133
description: 'Bit multi bonuses from all sources'
121134
},
@@ -124,8 +137,27 @@ const Formulas = () => {
124137
name: 'Golden Food Multiplier',
125138
formula: goldenFoodMulti?.expression,
126139
value: goldenFoodMulti?.value,
140+
breakdown: goldenFoodMulti?.breakdown,
127141
renderValue: (value) => `${Math.floor(value * 100) / 100}x`,
128142
description: 'Golden Food multi bonuses from all sources'
143+
},
144+
{
145+
id: 'doubleStatueDropChance',
146+
name: 'Double Item Drop Chance',
147+
formula: doubleStatueDropChance?.expression,
148+
value: doubleStatueDropChance?.value,
149+
breakdown: doubleStatueDropChance?.breakdown,
150+
renderValue: (value) => `${Math.floor(value * 100) / 100}x`,
151+
description: 'Double statue drop chance from all sources'
152+
},
153+
{
154+
id: 'doubleGoldenFoodDropChance',
155+
name: 'Double Golden Food Drop Chance',
156+
formula: doubleGoldenFoodDropChance?.expression,
157+
value: doubleGoldenFoodDropChance?.value,
158+
breakdown: doubleGoldenFoodDropChance?.breakdown,
159+
renderValue: (value) => `${Math.floor(value * 100) / 100}x`,
160+
description: 'Double golden food drop chance from all sources'
129161
}
130162
];
131163
}, [selectedChar]);
@@ -140,7 +172,7 @@ const Formulas = () => {
140172
};
141173

142174
if (!state?.characters) {
143-
return <DataLoadingWrapper/>
175+
return <DataLoadingWrapper />
144176
}
145177

146178
return <>
@@ -156,9 +188,9 @@ const Formulas = () => {
156188
getOptionLabel={(option) => cleanUnderscore(option.toLowerCase().capitalizeAll()) || ''}
157189
value={selectedFormula}
158190
onChange={(_, newValue) => setSelectedFormula(newValue)}
159-
renderInput={(params) => <TextField {...params} label="Formulas" variant="outlined" fullWidth/>}
191+
renderInput={(params) => <TextField {...params} label="Formulas" variant="outlined" fullWidth />}
160192
/>
161-
<Divider orientation={'vertical'} flexItem sx={{ mx: 2, display: { xs: 'none', sm: 'block' } }}/>
193+
<Divider orientation={'vertical'} flexItem sx={{ mx: 2, display: { xs: 'none', sm: 'block' } }} />
162194
<Select
163195
size={'small'}
164196
sx={{ width: 230 }}
@@ -189,7 +221,7 @@ const Formulas = () => {
189221
{filteredFormulas.map((formula) => (
190222
<Accordion key={formula.id}>
191223
<AccordionSummary
192-
expandIcon={<ExpandMoreIcon/>}
224+
expandIcon={<ExpandMoreIcon />}
193225
aria-controls={`${formula.id}-content`}
194226
id={`${formula.id}-header`}
195227
>
@@ -227,9 +259,19 @@ const Formulas = () => {
227259
<Typography variant="subtitle2" color="text.secondary" mt={1}>
228260
Result
229261
</Typography>
230-
<Typography>
231-
{formula.renderValue ? formula.renderValue(formula.value) : formula.value}
232-
</Typography>
262+
<Stack direction="row" alignItems="center" gap={1}>
263+
<Typography>
264+
{formula.renderValue ? formula.renderValue(formula.value) : formula.value}
265+
</Typography>
266+
{formula.breakdown && formula.breakdown.length > 0 ? (
267+
<Tooltip
268+
title={<Breakdown breakdown={formula.breakdown} notation="Big" titleStyle={{ width: 180 }} />}
269+
maxWidth={500}
270+
>
271+
<IconInfoCircleFilled size={18} />
272+
</Tooltip>
273+
) : null}
274+
</Stack>
233275
</Stack>
234276
</AccordionDetails>
235277
</Accordion>

parsers/misc.js

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,45 @@ import { getArmorSetBonus } from '@parsers/misc/armorSmithy';
4141
import { getObolsBonus } from '@parsers/obols';
4242
import { getLegendTalentBonus } from '@parsers/world-7/legendTalents';
4343
import { getCardBonusByEffect } from '@parsers/cards';
44+
import { getTesseractBonus } from '@parsers/tesseract';
45+
import { getPaletteBonus } from '@parsers/gaming';
46+
import { getMinorDivinityBonus } from '@parsers/divinity';
47+
48+
49+
export const getDoubleStatueDrop = (account, character, characters) => {
50+
const tesseractBonus = getTesseractBonus(account, 18);
51+
const paletteBonus = getPaletteBonus(account, 19);
52+
const kattelkrukPlayer = characters?.find(({ linkedDeity }) => linkedDeity === 8); // kattelkruk is limited to only 1 player linked.
53+
const divinityMinorBonus = getMinorDivinityBonus(kattelkrukPlayer, account, 8, characters);
54+
const talentBonus = getTalentBonus(character?.flatStarTalents, 'STATUE_METALLURGY');
55+
56+
return {
57+
value: tesseractBonus + talentBonus + paletteBonus + Math.min(10, divinityMinorBonus),
58+
breakdown: [
59+
{ name: 'Tesseract', value: tesseractBonus },
60+
{ name: 'Talent', value: talentBonus },
61+
{ name: 'Palette', value: paletteBonus },
62+
{ name: 'Divinity', value: Math.min(10, divinityMinorBonus) }
63+
],
64+
expression: `tesseractBonus + talentBonus + paletteBonus + Math.min(10, divinityMinorBonus)`
65+
};
66+
}
67+
68+
export const getDoubleGoldenFoodDrop = (account, character, characters) => {
69+
const tesseractBonus = getTesseractBonus(account, 30);
70+
const paletteBonus = getPaletteBonus(account, 24);
71+
const bigFishBonus = getAdviceFishBonus(account, 5);
72+
73+
return {
74+
value: tesseractBonus + paletteBonus + bigFishBonus,
75+
breakdown: [
76+
{ name: 'Tesseract', value: tesseractBonus },
77+
{ name: 'Palette', value: paletteBonus },
78+
{ name: 'Big Fish', value: bigFishBonus }
79+
],
80+
expression: `tesseractBonus + paletteBonus + bigFishBonus`
81+
};
82+
}
4483

4584
export const getFriendBonusStats = (account = {}) => {
4685
const FRIEND_BONUS_NAMES = [
@@ -1250,18 +1289,18 @@ export const getKillRoy = (idleonData, charactersData, accountData, serverVars)
12501289
const permanentUpgrades = killRoySkullShop?.slice(10)?.map((upgrade, i) => {
12511290
const levelOption = permanentUpgradeLevelMap[i];
12521291
const bonusIndex = permanentUpgradeBonusMap[i];
1253-
1292+
12541293
const level = levelOption !== null ? (accountData?.accountOptions?.[levelOption] ?? 0) : 0;
12551294
const bonus = bonusIndex !== undefined ? getKillRoyShopBonus(accountData, bonusIndex) : 1;
1256-
1295+
12571296
// Special case: Shop 15 (Gallery) changes description when level >= 2
12581297
let description = upgrade?.description;
12591298
let replacementChar = '{';
1260-
1299+
12611300
if (i === 5 && level >= 2) {
12621301
description = `Permanently_boosts_your_Gallery_Multiplier_by_+${(bonus / 100).toFixed(2)}x`;
12631302
}
1264-
1303+
12651304
return {
12661305
...upgrade,
12671306
level,

0 commit comments

Comments
 (0)