Skip to content

Commit

Permalink
fix: meal alert
Browse files Browse the repository at this point in the history
  • Loading branch information
Morta1 committed Mar 4, 2025
1 parent 2a693a1 commit d5b56cd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
14 changes: 1 addition & 13 deletions components/account/Worlds/World4/Meals.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ import { checkCharClass } from '@parsers/talents';

const maxTimeValue = 8.64e15;

let DEFAULT_MEAL_MAX_LEVEL = 30;
const breakpoints = [-1, 0, -2, -3, 11, 30, 40, 50, 60, 70, 80, 90, 100, 110];
const Meals = ({ account, characters, meals, totalMealSpeed, achievements, artifacts, lab, equinoxUpgrades }) => {
const Meals = ({ account, characters, meals, totalMealSpeed, mealMaxLevel, achievements, lab, equinoxUpgrades }) => {
const [filters, setFilters] = useState(() => []);
const [localMeals, setLocalMeals] = useState();
const [bestSpeedMeal, setBestSpeedMeal] = useState([]);
const [mealMaxLevel, setMealMaxLevel] = useState(DEFAULT_MEAL_MAX_LEVEL);
const [mealSpeed, setMealSpeed] = useState(totalMealSpeed);
const [sortBy, setSortBy] = useState(breakpoints[0]);
const [foodLust, setFoodLust] = useState(account?.equinox?.upgrades?.find(({ name }) => name === 'Food_Lust')?.bonus)
Expand Down Expand Up @@ -129,16 +127,6 @@ const Meals = ({ account, characters, meals, totalMealSpeed, achievements, artif
setLocalEquinoxUpgrades(temp);
}, [foodLust])

useEffect(() => {
const causticolumnArtifact = isArtifactAcquired(artifacts, 'Causticolumn');
const firstJadeUnlocked = isJadeBonusUnlocked(account, 'Papa_Blob\'s_Quality_Guarantee');
const secondJadeUnlocked = isJadeBonusUnlocked(account, 'Chef_Geustloaf\'s_Cutting_Edge_Philosophy');
const grimoireBonus = getGrimoireBonus(account?.grimoire?.upgrades, 26);
setMealMaxLevel(DEFAULT_MEAL_MAX_LEVEL + grimoireBonus + (causticolumnArtifact?.bonus ?? 0) + (firstJadeUnlocked
? 10
: 0) + (secondJadeUnlocked ? 10 : 0))
}, [account]);

const handleFilters = (e, newFilters) => {
setFilters(newFilters);
};
Expand Down
2 changes: 2 additions & 0 deletions pages/account/world-4/cooking.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const Cooking = () => {
<FormControl sx={{ width: 170 }}>
<InputLabel id="selected-character">Character</InputLabel>
<Select
size={'small'}
labelId="selected-character"
id="selected-character"
value={selectedCharacter?.playerId}
Expand Down Expand Up @@ -103,6 +104,7 @@ const Cooking = () => {
totalMealSpeed={totalMealSpeed}
account={state?.account}
artifacts={sailing?.artifacts}
mealMaxLevel={state?.account?.cooking?.mealMaxLevel}
equinoxUpgrades={state?.account?.equinox?.upgrades}
/>
</Tabber>
Expand Down
18 changes: 17 additions & 1 deletion parsers/cooking.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { getMonumentBonus } from '@parsers/world-5/caverns/bravery';
import { getBucketBonus } from '@parsers/world-5/caverns/the-well';
import { getLampBonus } from '@parsers/world-5/caverns/the-lamp';
import { getUpgradeVaultBonus } from '@parsers/misc/upgradeVault';
import { getGrimoireBonus } from '@parsers/grimoire';

export const spicesNames = [
'Grasslands',
Expand Down Expand Up @@ -60,9 +61,12 @@ export const getCooking = (idleonData, account) => {
const parseCooking = (mealsRaw, territoryRaw, cookingRaw, account) => {
const meals = getMeals(mealsRaw, account);
const spices = getSpices(mealsRaw, territoryRaw, account);
const mealMaxLevel = getMealMaxLevel(account);

return {
meals,
spices
spices,
mealMaxLevel
}
}

Expand Down Expand Up @@ -442,6 +446,18 @@ export const calcMealTime = (maxLevel, meal, totalMealSpeed, achievements, equin
return calcTimeToNextLevel(amountNeeded, cookReq, totalMealSpeed);
}

export const DEFAULT_MEAL_MAX_LEVEL = 30;
export const getMealMaxLevel = (account) => {
const causticolumnArtifact = isArtifactAcquired(account?.sailing?.artifacts, 'Causticolumn');
const firstJadeUnlocked = isJadeBonusUnlocked(account, 'Papa_Blob\'s_Quality_Guarantee');
const secondJadeUnlocked = isJadeBonusUnlocked(account, 'Chef_Geustloaf\'s_Cutting_Edge_Philosophy');
const grimoireBonus = getGrimoireBonus(account?.grimoire?.upgrades, 26);
return DEFAULT_MEAL_MAX_LEVEL
+ grimoireBonus
+ (causticolumnArtifact?.bonus ?? 0)
+ (firstJadeUnlocked ? 10 : 0)
+ (secondJadeUnlocked ? 10 : 0)
}
export const getMealLevelCost = (level, achievements, account, localEquinoxUpgrades) => {
const foodLustChallenge = account?.equinox?.challenges.find(challenge => challenge.current === -1
&& challenge.reward.includes('\'Food_Lust\'_Equinox_Upg_now_reduces_cost_by_-42%_per_stack')) ? 1 : 0;
Expand Down
2 changes: 1 addition & 1 deletion utility/dashboard/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ export const getWorld4Alerts = (account, fields, options) => {
if (fields?.cooking?.checked) {
const cooking = {};
if (options?.cooking?.meals?.checked) {
const readyMeals = account?.cooking?.meals?.filter(({ levelCost, amount }) => amount >= levelCost);
const readyMeals = account?.cooking?.meals?.filter(({ levelCost, amount, level }) => amount >= levelCost && level < account?.cooking?.mealMaxLevel);
if (readyMeals?.length > 0) {
cooking.meals = readyMeals;
}
Expand Down

0 comments on commit d5b56cd

Please sign in to comment.