Skip to content

Commit

Permalink
fix: few requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Morta1 committed Feb 21, 2025
1 parent 9b1a76d commit 762d9d6
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 31 deletions.
43 changes: 21 additions & 22 deletions components/characters/Talents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import Tooltip from '../Tooltip';
import { Box, Stack, Tab, Tabs, Typography } from '@mui/material';
import { Breakdown, TalentTooltip } from '../common/styles';
import InfoIcon from '@mui/icons-material/Info';
import { isArtifactAcquired } from '@parsers/sailing';
import { getAtomBonus } from '@parsers/atomCollider';
import { getAchievementStatus } from '@parsers/achievements';
import { getSaltLickBonus } from '@parsers/saltLick';
import { merits, randomList } from '../../data/website-data';


const Talents = ({
Expand Down Expand Up @@ -112,9 +107,13 @@ const Talents = ({
aria-label={`star-sign-tab`}
icon={<TabIcon src={`${prefix}data/ClassIcons0.png`} alt=""/>}/>
</Tabs>
{activeTab === STAR_TAB_INDEX ? <Typography variant={'caption'} mt={2} style={{ opacity: activeTab === 4 ? 1 : 0 }}>Specials {specialsTab + 1}</Typography> :
{activeTab === STAR_TAB_INDEX ? <Typography variant={'caption'} mt={2} style={{
opacity: activeTab === 4
? 1
: 0
}}>Specials {specialsTab + 1}</Typography> :
<Typography variant={'caption'} mt={2}>{cleanUnderscore(talents?.[activeTab]?.name)}</Typography>}
<Typography component={'div'} variant={'caption'}>Total Points Spent: {spentTalentPoints}</Typography>
<Typography component={'div'} variant={'caption'}>Total Points Spent: {spentTalentPoints}</Typography>
<Stack gap={1} direction={'row'} justifyContent={'center'} alignItems={'center'}>
<Typography component={'div'} variant={'caption'}>Added levels: {selectedAddedLevels}</Typography>
<Tooltip title={<Breakdown titleStyle={{ width: 150 }} breakdown={selectedAddedLevelsBreakdown}/>}>
Expand All @@ -123,23 +122,23 @@ const Talents = ({
</Stack>
<div className="talents-wrapper">
{activeTalents?.orderedTalents?.map((talentDetails, index) => {
const { talentId, level, maxLevel, name } = talentDetails;
const { talentId, level, baseLevel, maxLevel, name } = talentDetails;
if (index >= 15) return null;
// if (-1 < this._SkillIconSelected)
const artifact = isArtifactAcquired(account?.sailing?.artifacts, 'Fury_Relic')
const winnerBonus = 0;
const atomBonus = getAtomBonus(account, 'Oxygen_-_Library_Booker');
const achievementBonus = getAchievementStatus(account?.achievements, 145);
const saltLickBonus = getSaltLickBonus(account?.saltLick, 4);
const unavailableLibraryBook = randomList?.[16]?.split(' ').map((num) => Number(num));
const isBookUnavailable = unavailableLibraryBook.includes(talentId);
const maxBookLevel = Math.round(125 + artifact?.bonus
+ winnerBonus
+ 10 * Math.min(atomBonus, 1)
+ (Math.min(5, Math.max(0, 5 * achievementBonus))
+ saltLickBonus + merits?.[2]?.[2]?.bonusPerLevel
* account?.tasks?.[2]?.[2]?.[2]));
const hardMaxed = isBookUnavailable || activeTab === STAR_TAB_INDEX ? true : maxLevel >= maxBookLevel;
// const artifact = isArtifactAcquired(account?.sailing?.artifacts, 'Fury_Relic')
// const winnerBonus = 0;
// const atomBonus = getAtomBonus(account, 'Oxygen_-_Library_Booker');
// const achievementBonus = getAchievementStatus(account?.achievements, 145);
// const saltLickBonus = getSaltLickBonus(account?.saltLick, 4);
// const unavailableLibraryBook = randomList?.[16]?.split(' ').map((num) => Number(num));
// const isBookUnavailable = unavailableLibraryBook.includes(talentId);
// const maxBookLevel = Math.round(125 + artifact?.bonus
// + winnerBonus
// + 10 * Math.min(atomBonus, 1)
// + (Math.min(5, Math.max(0, 5 * achievementBonus))
// + saltLickBonus + merits?.[2]?.[2]?.bonusPerLevel
// * account?.tasks?.[2]?.[2]?.[2]));
const hardMaxed = activeTab === STAR_TAB_INDEX ? true : baseLevel < maxLevel;
const levelText = getLevelAndMaxLevel(level, maxLevel);

return (talentId === 'Blank' || talentId === '84' || talentId === 'arrow') ?
Expand Down
22 changes: 17 additions & 5 deletions pages/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Button from '@mui/material/Button';
import { migrateConfig } from '@utility/migrations';

const baseTrackers = {
version: 9,
version: 10,
account: {
General: {
tasks: {
Expand Down Expand Up @@ -130,7 +130,9 @@ const baseTrackers = {
printer: {
checked: true,
options: [
{ name: 'includeOakAndCopper', category: 'atoms', checked: false },
{ name: 'includeOakTree', category: 'atoms', checked: false },
{ name: 'includeCopper', checked: false },
{ name: 'includeSporeCap', checked: true },
{ name: 'showAlertWhenFull', checked: false }]
},
library: {
Expand Down Expand Up @@ -191,7 +193,13 @@ const baseTrackers = {
{
name: 'ribbons',
type: 'input',
props: { label: 'Ribbons threshold', value: 0, maxValue: 28, minValue: 0, helperText: "Empty ribbon slots" },
props: {
label: 'Ribbons threshold',
value: 0,
maxValue: 28,
minValue: 0,
helperText: 'Empty ribbon slots'
},
checked: true
}
]
Expand Down Expand Up @@ -301,8 +309,12 @@ const baseTrackers = {
options: [
{ name: 'unspentPoints', checked: true },
{ name: 'missingHammers', checked: true },
{ name: 'anvilOverdue', checked: true },
{ name: 'showAlertBeforeFull', checked: true, category: 'anvil overdue' }
{
name: 'anvilOverdue',
type: 'input',
props: { label: 'Minutes', value: 30, minValue: 1, helperText: 'alert X minutes before' },
checked: true
}
]
},
worship: {
Expand Down
1 change: 1 addition & 0 deletions parsers/alchemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ export const getUpgradeableBubbles = (acc) => {
if (moreBubblesFromMerit > 0) {
upgradeableBubblesAmount += moreBubblesFromMerit;
}
upgradeableBubblesAmount = Math.min(10, upgradeableBubblesAmount)
const normal = sorted.slice(0, upgradeableBubblesAmount);
const atomBubbles = getNblbBubbles(acc, 25, upgradeableBubblesAmount);
return {
Expand Down
7 changes: 6 additions & 1 deletion parsers/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ export const getTimeToNextBooks = (bookCount, account, characters, idleonData) =
export const getLooty = (idleonData) => {
const lootyRaw = idleonData?.Cards?.[1] || tryToParse(idleonData?.Cards1);
const allItems = structuredClone((items)); // Deep clone
const forcedNames = {
'Motherlode': 'Motherlode_x1',
'Island0': 'Island0_x1',
}
const slabItems = slab?.map((name) => ({
name: allItems?.[name]?.displayName,
rawName: name,
rawName: forcedNames?.[name] || name,
obtained: lootyRaw?.includes(name),
onRotation: filteredGemShopItems?.[name],
unobtainable: filteredLootyItems?.[name]
Expand All @@ -137,6 +141,7 @@ export const getLooty = (idleonData) => {
rawName,
unobtainable
}) => !obtained && !unobtainable)?.length;

return {
slabItems,
lootyRaw,
Expand Down
9 changes: 7 additions & 2 deletions utility/dashboard/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,14 @@ export const getWorld3Alerts = (account, fields, options) => {
if (!account?.finishedWorlds?.World2) return alerts;
if (fields?.printer?.checked) {
const printer = {};
const { includeOakAndCopper, showAlertWhenFull } = options?.printer || {};
const { includeOakTree, includeCopper, includeSporeCap, showAlertWhenFull } = options?.printer || {};
const totals = calcTotals(account, showAlertWhenFull);
const exclusions = ['atom', ...(!includeOakAndCopper?.checked ? ['Copper', 'OakTree'] : [])].toSimpleObject();
const exclusions = [
'atom',
...(!includeOakTree?.checked ? ['OakTree'] : []),
...(!includeCopper?.checked ? ['Copper'] : []),
...(!includeSporeCap?.checked ? ['Grasslands1'] : []),
].toSimpleObject();
const atoms = Object.entries(totals || {}).filter(([itemName, { atoms }]) => !exclusions?.[itemName] && atoms).map(([name, data]) => ({
name: items?.[name]?.displayName,
rawName: name,
Expand Down
2 changes: 1 addition & 1 deletion utility/dashboard/characters.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const anvilAlerts = (account, characters, character, lastUpdated, options
alerts.anvilOverdue = allProgress?.map(({ date, name, rawName }) => {
const d = new Date(date - 1);
return { diff: differenceInMinutes(d, new Date()), name, rawName };
}).filter(({ diff }) => anvilOption?.showAlertBeforeFull?.checked ? diff <= 60 : diff <= 0);
}).filter(({ diff }) => diff <= anvilOption?.anvilOverdue?.props?.value);
}
return alerts;
}
Expand Down
35 changes: 35 additions & 0 deletions utility/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,38 @@ export const migrateToVersion9 = (config) => {
dashboardConfig.version = 9;
return dashboardConfig
}
export const migrateToVersion10 = (config) => {
let dashboardConfig = { ...config };
if (!dashboardConfig) {
dashboardConfig = {};
}

const anvilOptions = dashboardConfig?.characters?.anvil?.options?.filter(({ name }) => name !== 'anvilOverdue' && name !== 'showAlertBeforeFull');
if (dashboardConfig?.characters?.anvil) {
dashboardConfig.characters.anvil.options = [
...anvilOptions,
{
name: 'anvilOverdue',
type: 'input',
props: { label: 'Minutes', value: 30, minValue: 1, helperText: 'alert X minutes before full' },
checked: true
}
]
}

const printerOptions = dashboardConfig?.characters?.anvil?.options?.filter(({ name }) => name !== 'includeOakAndCopper');
if (dashboardConfig?.account?.['World 3']?.printer?.options?.length === 2) {
dashboardConfig.account['World 3'].printer.options = [
{ name: 'includeOakTree', category: 'atoms', checked: false },
{ name: 'includeCopper', checked: false },
{ name: 'includeSporeCap', checked: true },
...printerOptions
]
}

dashboardConfig.version = 9;
return dashboardConfig
}

export const migrateConfig = (baseTrackers, userConfig) => {
if (baseTrackers?.version === userConfig?.version) return userConfig;
Expand Down Expand Up @@ -189,6 +221,9 @@ export const migrateConfig = (baseTrackers, userConfig) => {
if (migratedConfig?.version === 8) {
migratedConfig = migrateToVersion9(migratedConfig);
}
if (migratedConfig?.version === 9) {
migratedConfig = migrateToVersion10(migratedConfig);
}
}
return migratedConfig;
}

0 comments on commit 762d9d6

Please sign in to comment.