### Install Dependencies and Start Development Server Source: https://github.com/osrs-reldo/os-league-tools/blob/master/README.md Run these commands to install project dependencies and start the local development server. Open http://localhost:3000 to view the application. ```bash npm install npm run dev ``` -------------------------------- ### Example: Get Experience Multiplier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Demonstrates how to obtain the experience multiplier for a given relic tier. This example first determines the tier using `getTier` and then retrieves the multiplier using `getExpMultiplier`, both imported from `./util/getTier`. ```javascript import { getTier, getExpMultiplier } from './util/getTier'; const tier = getTier(10000); const multiplier = getExpMultiplier(tier); console.log(`Experience multiplier: ${multiplier}x`); ``` -------------------------------- ### Development Commands Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Common npm commands for managing the development environment, including installing dependencies, starting the dev server, building for production, and running tests. ```bash # Install dependencies npm install # Start development server (with hot reload) npm run dev # Build production bundle npm run build # Run tests npm run test ``` -------------------------------- ### Breakpoint Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/configuration.md Example of how to use the `useBreakpoint` hook with defined media queries to check if the screen size is smaller than the SM breakpoint. ```javascript const isMobile = useBreakpoint(MEDIA_QUERIES.SM, MODE.LESS); ``` -------------------------------- ### Skill Configuration Examples Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/types.md Illustrates how to access skill configuration objects, such as for 'Attack' and 'Cooking'. ```javascript STATS.Attack // { label: 'Attack', panelOrder: 0, icon: '...', productionProdigyEligible: false } STATS.Cooking // { label: 'Cooking', panelOrder: 11, productionProdigyEligible: true } ``` -------------------------------- ### Persist State to Local Storage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Shows how to update the application's state in local storage using the `updateLocalStorage` function. This example specifically updates the theme setting. ```javascript import { updateLocalStorage, LOCALSTORAGE_KEYS } from './client/localstorage-client'; updateLocalStorage(LOCALSTORAGE_KEYS.SETTINGS, { theme: 'dark' }); ``` -------------------------------- ### Skill Filter Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/task-filters.md An example of how to configure the filter state to show only Fishing and Cooking tasks that the player can currently perform. ```javascript // Only show Fishing and Cooking tasks that the player can currently do const filterState = { skills: ['Fishing', 'Cooking'], showNoRequirements: false, showUnmetRequirements: false, isProductionProdigy: true }; ``` -------------------------------- ### Get Current Tier and Exp Multiplier Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Demonstrates how to determine a player's current tier based on their experience points and retrieve the corresponding experience multiplier. Uses `getTier` and `getExpMultiplier` utilities. ```javascript import { getTier, getExpMultiplier } from './util/getTier'; const tier = getTier(5000); // points → tier const multiplier = getExpMultiplier(tier); // tier → exp multiplier ``` -------------------------------- ### Login Button Usage Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/account-hook.md Example of how to attach the login function to a button click event. ```javascript ``` -------------------------------- ### Fetch Hiscores Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Demonstrates how to fetch player hiscores using the `getHiscores` client function. It logs the hiscores if the fetch is successful. ```javascript import getHiscores from './client/hiscores-client'; getHiscores('player-name', (result) => { if (result.success) { console.log(result.hiscores); } }); ``` -------------------------------- ### Hiscores Client Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/hiscores-client.md Demonstrates how to import and use the getHiscores function to fetch and display player hiscores. ```javascript import getHiscores from './client/hiscores-client'; getHiscores('lynx titan', (result) => { if (result.success) { console.log('Hiscores fetched:', result.hiscores); } else { console.error('Failed to fetch hiscores:', result.message); } }); ``` -------------------------------- ### Example: Convert Experience to Level Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Demonstrates how to use the `experienceToLevel` function to find a skill level from a given experience value. Ensure the `xpAndLevelConversions` utility is imported. ```javascript import { experienceToLevel } from './util/xpAndLevelConversions'; const level = experienceToLevel(1234567); console.log(`Level: ${level}`); // Output: Level: 62 ``` -------------------------------- ### App Component Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/account-hook.md Demonstrates how to use the useAccount hook within a React component to manage authentication state and UI. ```javascript import useAccount from './hooks/useAccount'; export function App() { const { isLoggedIn, isAuthenticating, login, logout } = useAccount({ redirectReturnToUrl: window.location.origin }); if (isAuthenticating) { return
Loading...
; } return ( ); } ``` -------------------------------- ### Add Multiplier Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/multipliers-hook.md Demonstrates how to add a new relic multiplier to the collection using the addMultiplier function. This example boosts experience and output for Smithing activities. ```javascript const multiplier = { multiplier: 1.5, categories: ['Smithing'], actions: [], matchers: null, exceptions: [], appliesTo: { exp: true, inputs: false, outputs: true } }; addMultiplier('relic-exp-boost', multiplier); ``` -------------------------------- ### Filter Tasks Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Provides an example of filtering a list of tasks based on a set of predefined filters. It uses `taskFilters` utility to apply multiple filtering conditions. ```javascript import taskFilters from './util/taskFilters'; const filtered = allTasks.filter(task => taskFilters.every(filter => filter(task, filterState, context)) ); ``` -------------------------------- ### Calculator Experience Values Definition Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/types.md Tracks the starting and target experience for a calculator session. The difference between target and start experience is used for action calculations. ```javascript { start: { xp: number }, // Starting experience target: { xp: number } // Target experience } ``` -------------------------------- ### Example: Convert Level to Experience Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Shows how to use the `levelToExperience` function to calculate the total experience needed to reach a specific level, such as level 99. Import the function from `xpAndLevelConversions`. ```javascript import { levelToExperience } from './util/xpAndLevelConversions'; const xpFor99 = levelToExperience(99); console.log(`XP for level 99: ${xpFor99}`); // 13,034,431 ``` -------------------------------- ### Account Slice Actions and Usage Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md Exports the action to update the account cache. A usage example shows how to dispatch this action with authentication details. ```javascript export const { updateAccountCache } = accountSlice.actions; // Usage: dispatch(updateAccountCache({ isAuthenticated: true, user: auth0User, accessToken: token })); ``` -------------------------------- ### Apply Multipliers to Value Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Shows how to apply various multipliers to a base value using the `useMultipliers` hook. This is useful for calculating adjusted values based on game mechanics. ```javascript const multipliers = useMultipliers(); const finalValue = multipliers.applyMultipliers( 1000, // Base value { id: 'action-1', category: 'Smithing' }, { name: 'Steel bar' }, { exp: true, inputs: false, outputs: false } ); ``` -------------------------------- ### Filters Slice Actions and Usage Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md Exports actions for updating and resetting various filters. Usage examples demonstrate dispatching these actions. ```javascript export const { updateTaskFilter, updateQuestFilter, updateDiariesFilter, updateCalculatorsFilter, resetTasks, resetQuests, resetDiaries, resetCalculators, reset } = filterSlice.actions; // Usage examples: dispatch(updateTaskFilter({ field: 'difficulty', value: ['Hard', 'Elite'] })); dispatch(updateCalculatorsFilter({ field: 'regions', value: ['Misthalin', 'Karamja'] })); dispatch(resetTasks()); // Reset only task filters dispatch(reset()); // Reset all filters ``` -------------------------------- ### useBreakpoint Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/react-hooks.md Illustrates how to use the useBreakpoint hook to conditionally render different navigation components based on screen size. It imports predefined breakpoints and modes for flexible responsive design. ```javascript import useBreakpoint, { MEDIA_QUERIES, MODE } from './hooks/useBreakpoint'; export function ResponsiveNav() { const isSmallScreen = useBreakpoint(MEDIA_QUERIES.SM, MODE.LESS); const isMediumUp = useBreakpoint(MEDIA_QUERIES.MD); return ( ); } ``` -------------------------------- ### Example: Determine Relic Tier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Illustrates how to use the `getTier` function to find the current relic tier for a given number of league points. The `getTier` function should be imported from `./util/getTier`. ```javascript import { getTier } from './util/getTier'; const tier = getTier(5000); console.log(`Current tier: ${tier}`); // Output: 4 ``` -------------------------------- ### Example: Determine Trophy Tier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Demonstrates the usage of the `getTrophyTier` function to determine a trophy tier from a given number of league points. The function should be imported from `./util/getTier`. ```javascript import { getTrophyTier } from './util/getTier'; const trophyTier = getTrophyTier(8000); console.log(`Trophy tier: ${trophyTier}`); ``` -------------------------------- ### Example: Determine Region Tier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Shows how to use the `getRegionTier` function to find the appropriate region tier based on the count of completed tasks. Ensure the function is imported from `./util/getTier`. ```javascript import { getRegionTier } from './util/getTier'; const regionTier = getRegionTier(150); console.log(`Region tier: ${regionTier}`); // Output: 0 ``` -------------------------------- ### Usage Example: SkillCalculator with useMultipliers Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/multipliers-hook.md Demonstrates how to integrate the useMultipliers hook into a React component to manage and apply experience multipliers. It shows adding multipliers based on relic selection and calculating adjusted experience for activities. ```javascript import useMultipliers from './hooks/useMultipliers'; export function SkillCalculator() { const { multipliers, addMultiplier, removeMultiplier, applyMultipliers } = useMultipliers(); const handleRelicSelect = (relic) => { addMultiplier(relic.id, { multiplier: relic.exp.multiplier, categories: ['All'], actions: [], matchers: null, exceptions: [], appliesTo: { exp: true, inputs: false, outputs: false } }); }; const calculateActivity = (activity) => { const finalExp = applyMultipliers(activity.exp, activity, undefined, { exp: true, inputs: false, outputs: false }); return { ...activity, expWithMultipliers: finalExp }; }; return (
{/* Component implementation */}
); } ``` -------------------------------- ### Redux State Shape Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Illustrates the structure of the Redux state, detailing the organization of filters, settings, tasks, unlocks, character, account, and calculator states. ```javascript { filters: { tasks, quests, diaries, calculators }, settings: { theme, ... }, tasks: { tasks, taskStats, tier }, unlocks: { regions, quests, questStats }, character: { characters, activeCharacter, hiscoresState }, account: { accountCache }, calculators: { /* calculator state */ } } ``` -------------------------------- ### Default Regions Configuration Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/configuration.md Specifies the default regions unlocked at the start of a league. Includes Misthalin (id: 0) and Karamja (id: 1). ```javascript export const DEFAULT_REGIONS = [0, 1]; // Misthalin (id: 0) and Karamja (id: 1) ``` -------------------------------- ### Usage Example: Importing Character Data Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/plugin-importer.md Demonstrates how to use the importFromPlugin function within a React component, including Redux hooks for state management and dispatching actions. ```javascript import importFromPlugin from './client/plugin-importer'; import { useDispatch, useSelector } from 'react-redux'; export function ImportCharacterModal() { const dispatch = useDispatch(); const userState = useSelector(state => ({ tasks: state.tasks, regions: state.unlocks.regions })); const characterState = useSelector(state => state.character); const handleImportClick = () => { const pluginData = { displayName: 'MyPlayer123', tasks: { 'task-001': { completed: 1234567890, tracked: 0, ignored: 0 }, 'task-002': { completed: 0, tracked: 5, ignored: 0 } }, quests: { 'quest-1': 'FINISHED' } }; importFromPlugin(pluginData, userState, dispatch, characterState); }; return ; } ``` -------------------------------- ### expValues Structure for useCalculatorData Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/react-hooks.md Illustrates the expected structure for the `expValues` object, which should contain `start` and `target` properties, each with an `xp` number. This is used by the `useCalculatorData` hook. ```javascript { start: { xp: number }, target: { xp: number } } ``` -------------------------------- ### SmithingCalculator Component using useCalculatorData Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/react-hooks.md A React component example demonstrating how to use the `useCalculatorData` hook to fetch and display Smithing calculator data. It shows how to pass necessary parameters and render the processed activity information. ```javascript import useCalculatorData from './hooks/useCalculatorData'; export function SmithingCalculator() { const calculatorData = useCalculatorData( 'Smithing', { start: { xp: 0 }, target: { xp: 1000000 } }, 5, // 5x experience multiplier multipliersState, equilibriumState ); return calculatorData.data.map(activity => (

{activity.name}: {activity.exp} XP per action

Actions needed: {activity.actionsRequired}

)); } ``` -------------------------------- ### Dispatch Async Thunk to Fetch Data Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md Example of dispatching an asynchronous thunk action, such as fetching hiscores data from the backend. The .then() block can be used to handle the data after it's loaded. ```javascript // In character slice dispatch(fetchHiscores(characterState, null, skipDbUpdate)) .then(() => { // Hiscores loaded }); ``` -------------------------------- ### Get User Data By Storage Key (JavaScript) Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/user-data-client.md Retrieves specific user data associated with a given storage key. Requires the user's email, the storage key (e.g., 'tasks', 'settings'), and an Auth0 access token. Returns a promise that resolves to an object indicating success and the requested data. ```javascript export function getUserData(userEmail: string, storageKey: string, accessToken: string): Promise ``` ```javascript import { getUserData } from './client/user-data-client'; const result = await getUserData('user@example.com', 'tasks_DEFAULT', accessToken); if (result.success) { const tasksData = result.value; console.log('Task data:', tasksData); } ``` -------------------------------- ### useQueryString Usage Example Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/react-hooks.md Demonstrates how to use the useQueryString hook in a React component to manage a select dropdown's value, synchronizing it with the URL's query parameter. Setting an undefined or null value removes the parameter from the URL. ```javascript import useQueryString from './hooks/useQueryString'; export function SkillCalculator() { const [skill, setSkill] = useQueryString('skill', 'Smithing'); return ( // URL becomes: /calculators?skill=Cooking ); } ``` -------------------------------- ### League Start and End Dates Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Defines the start and end dates for the league using JavaScript Date objects. These constants are crucial for time-sensitive features. ```javascript LEAGUE_START_DATE = new Date('2024-11-27T12:00:00+00:00') LEAGUE_END_DATE = new Date('2025-01-22T12:00:00+00:00') ``` -------------------------------- ### getExpMultiplier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Gets the passive experience multiplier for a given relic tier. ```APIDOC ## getExpMultiplier ### Description Gets the passive experience multiplier for a given relic tier. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (Function) ### Endpoint None (Function) ### Parameters - **tier** (number) - Required - Relic tier index (0-7) ### Response #### Success Response - **number** - Experience multiplier ### Usage Example ```javascript import { getTier, getExpMultiplier } from './util/getTier'; const tier = getTier(10000); const multiplier = getExpMultiplier(tier); console.log(`Experience multiplier: ${multiplier}x`); ``` ``` -------------------------------- ### getExpMultiplier(tier) Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/remaining-utilities.md Gets the passive experience multiplier associated with a given relic tier. The multiplier is sourced from passive relic data. ```APIDOC ## getExpMultiplier(tier) ### Description Gets passive experience multiplier for a relic tier. ### Method `getExpMultiplier(tier: number): number` ### Parameters #### Path Parameters - **tier** (number) - Required - The tier index (0-7) for which to get the experience multiplier. ### Returns - **multiplier** (number) - The experience multiplier for the specified tier. ### Example ```javascript const tier = getTier(10000); // tier = 5 const multiplier = getExpMultiplier(tier); // multiplier = 8 ``` ``` -------------------------------- ### Project Structure Overview Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/INDEX.md Illustrates the directory layout of the OSRS League Tools project, highlighting key modules such as client APIs, custom hooks, utility functions, data storage, and components. ```plaintext src/ ├── client/ → External API clients (5 modules) ├── hooks/ → Custom React hooks (7 hooks) ├── util/ → Pure functions (11+ utilities) ├── data/ → Constants & static data ├── store/ → Redux slices ├── components/ → React components ├── pages/ → Page routes ├── App.js → Root component ├── store.js → Redux store setup └── index.js → Entry point ``` -------------------------------- ### Settings Slice Initial State Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md The initial state for the settings slice, including user preferences like theme. ```javascript { version: 2, theme: 'sl-dark', // ... other user preferences } ``` -------------------------------- ### Create User If Needed (JavaScript) Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/user-data-client.md Creates a new user account if one does not already exist. Requires user email and an Auth0 access token. Returns a promise that resolves to an object indicating success and optional user data. Errors during fetch or authorization result in a failed promise. ```javascript export function createUserIfNeeded(userEmail: string, accessToken: string): Promise ``` ```javascript import { createUserIfNeeded } from './client/user-data-client'; const result = await createUserIfNeeded('user@example.com', accessToken); if (result.success) { console.log('User created or already exists'); } ``` -------------------------------- ### Get Experience Multiplier by Tier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/remaining-utilities.md Retrieves the passive experience multiplier for a given relic tier (0-7). The multiplier is sourced from PASSIVE_RELICS data. ```javascript export function getExpMultiplier(tier: number): number ``` ```javascript const tier = getTier(10000); // tier = 5 const multiplier = getExpMultiplier(tier); // multiplier = 8 ``` -------------------------------- ### Character Slice Actions and Usage Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md Exports actions for managing characters, including adding, updating, deleting, and fetching hiscores. Usage examples are provided. ```javascript export const { addCharacter, updateActiveCharacter, updateCharacterName, deleteCharacter, fetchHiscores, updateHiscoresState } = characterSlice.actions; // Usage: dispatch(addCharacter({ rsn: 'PlayerName', setActive: true })); dispatch(updateActiveCharacter(0)); // Set first character as active dispatch(deleteCharacter(characterName)); dispatch(fetchHiscores(characterState, null, skipDbUpdate)); ``` -------------------------------- ### durationAsCountdown Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/number-formatters.md Formats a duration in milliseconds into a countdown string representing days, hours, minutes, and seconds. It can optionally take a start date to calculate the difference. ```APIDOC ## durationAsCountdown ### Description Formats milliseconds as a countdown string in days, hours, minutes, and seconds. Returns null if the end date is in the past. ### Signature ```javascript export function durationAsCountdown(endDate: number, startDate: number = Date.now()): string | null ``` ### Parameters #### Path Parameters - **endDate** (number) - Required - Target timestamp in milliseconds (typically from Date.now()) - **startDate** (number) - Optional - Starting timestamp in milliseconds. Defaults to `Date.now()`. ### Return Type string | null - Formatted countdown in format "Xd:Yh:Zm:Ws" or null if endDate is in the past. ### Examples ```javascript import { durationAsCountdown } from './util/numberFormatters'; const leagueEnd = new Date('2025-01-22T12:00:00Z').getTime(); const countdown = durationAsCountdown(leagueEnd); console.log(countdown); // "16d:4h:23m:45s" // Only 5 minutes remaining const countdown2 = durationAsCountdown(Date.now() + 5 * 60 * 1000); console.log(countdown2); // "0d:0h:5m:0s" // Event already passed const countdown3 = durationAsCountdown(Date.now() - 1000); console.log(countdown3); // null ``` ``` -------------------------------- ### levelToExperience Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Converts a skill level (1-126) to the required experience points at that level. ```APIDOC ## levelToExperience ### Description Converts a skill level (1-126) to the required experience points at that level. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Method None (Function) ### Endpoint None (Function) ### Parameters - **level** (number) - Required - Skill level from 1 to 126 ### Response #### Success Response - **number** - Experience required to reach that level ### Formula For each level i, XP is calculated as: ``` sum = 0 for i from 1 to level-1: sum += floor(i + 300 × 2^(i/7)) XP = floor(0.25 × sum) ``` ### Usage Example ```javascript import { levelToExperience } from './util/xpAndLevelConversions'; const xpFor99 = levelToExperience(99); console.log(`XP for level 99: ${xpFor99}`); // 13,034,431 ``` ``` -------------------------------- ### Get Experience Multiplier Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/experience-and-tier-utilities.md Retrieves the passive experience multiplier associated with a specific relic tier (0-7). This is useful for calculating boosted experience gains. ```javascript export function getExpMultiplier(tier: number): number ``` -------------------------------- ### Build Styles Command Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/README.md Command to recompile TailwindCSS. Use this when style changes are not reflected. ```bash # Recompile TailwindCSS npm run build:styles ``` -------------------------------- ### Skill Configuration Object Structure Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/types.md Defines the metadata for each skill, including display name, panel order, and icon paths. Some properties are optional. ```javascript { label: string, // Display name (e.g., 'Attack', 'Cooking') panelOrder: number, // Display order in skill panel (0-22) icon: string, // Path to skill icon image iconMini: string, // Path to small skill icon isPossibleTutorialUnlock?: boolean, productionProdigyEligible?: boolean // Can benefit from Production Prodigy relic } ``` -------------------------------- ### Get Accent Color for Theme Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/remaining-utilities.md Retrieves the accent color RGB value for a specific league theme. Use this to dynamically style elements based on the selected theme. ```javascript export default function getAccentColorForTheme(theme: string): string ``` ```javascript import getAccentColorForTheme from './util/colors'; function ThemeSelector({ currentTheme }) { const accentColor = getAccentColorForTheme(currentTheme); return (
Current theme accent: {accentColor}
); } ``` -------------------------------- ### Get Data from LocalStorage Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/localstorage-client.md Retrieves and parses data from browser storage. Use this to safely access stored values, providing a default if the key is not found or parsing fails. ```javascript import { getFromLocalStorage, LOCALSTORAGE_KEYS } from './client/localstorage-client'; const username = getFromLocalStorage(LOCALSTORAGE_KEYS.USERNAME, 'Unknown Player'); const settings = getFromLocalStorage(LOCALSTORAGE_KEYS.SETTINGS, {}); const tempData = getFromLocalStorage('tempKey', null, true); // From sessionStorage ``` -------------------------------- ### Update Task Filter with useDispatch Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/redux-integration.md Shows how to use the `useDispatch` hook to dispatch actions to update the Redux state. This example dispatches an `updateTaskFilter` action to modify the difficulty filter. ```javascript import { useDispatch } from 'react-redux'; import { updateTaskFilter } from '../store/filters'; function DifficultySelector() { const dispatch = useDispatch(); const handleChange = (newDifficulties) => { dispatch(updateTaskFilter({ field: 'difficulty', value: newDifficulties })); }; return ; } ``` -------------------------------- ### Set Backend API Endpoint (REACT_APP_RELDO_URL) Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/configuration.md Configure the backend API endpoint for user data, hiscores, and feedback. Set this for development (local API) or production (hosted API). ```bash REACT_APP_RELDO_URL=https://osrs-reldo-api.herokuapp.com ``` -------------------------------- ### Feedback Client Configuration Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/feedback-client.md All feedback functions utilize the REACT_APP_RELDO_URL environment variable for the backend base URL. Requests are made with JSON content type. ```javascript { 'Content-type': 'application/json' } ``` -------------------------------- ### createUserIfNeeded Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/user-data-client.md Creates a new user account if one does not already exist. Requires user email and an access token for authorization. ```APIDOC ## createUserIfNeeded ### Description Creates a new user account if one does not already exist. ### Method POST (inferred) ### Endpoint /user ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **userEmail** (string) - Required - User's email address - **accessToken** (string) - Required - Auth0 access token for authorization ### Request Example ```json { "userEmail": "user@example.com", "accessToken": "your_access_token" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **value** (object) - Optional - Additional user data if available. #### Response Example ```json { "success": true, "value": {} } ``` #### Error Handling - Returns `{ success: false }` on fetch or authorization failure. ``` -------------------------------- ### Get All Quest Prerequisites Source: https://github.com/osrs-reldo/os-league-tools/blob/master/_autodocs/api-reference/remaining-utilities.md Recursively retrieves all prerequisite quests for a given list of quest IDs. This function is used to determine the full quest chain required for a specific quest. ```javascript export default function getAllQuestPrereqs(questIds: string[]): string[] ``` ```javascript // If quest '34' requires '31' which requires '11': getAllQuestPrereqs(['34']) // → ['34', '31', '11'] ```