diff --git a/src/components/HoverCard.tsx b/src/components/HoverCard.tsx index 116eb43..0f13a49 100644 --- a/src/components/HoverCard.tsx +++ b/src/components/HoverCard.tsx @@ -210,8 +210,6 @@ const HoverCard: React.FC = ({ item, children }) => { }); return; } - - console.log('Item not found in any table'); } catch (error) { console.error('Error fetching item data:', error); } diff --git a/src/features/armor-optimization/filter-permutations.ts b/src/features/armor-optimization/filter-permutations.ts index 8b5d593..59cdfad 100644 --- a/src/features/armor-optimization/filter-permutations.ts +++ b/src/features/armor-optimization/filter-permutations.ts @@ -8,6 +8,12 @@ import { FragmentStatModifications, } from '../../types/d2l-types'; +/** + * Finds the stat deficit by considering the total armor in each permutation and the fragment modifications. + * Then, it tries pre-calculated mod combinations to meet the required threshold. + * It returns a sorted, filtered permutation array based on the lowest number of mods used. + */ + interface SelectedThresholds { [key: string]: number; } @@ -99,6 +105,13 @@ function calculateTotalCost(perm: FilteredPermutation): number { return total; } +/** + * The algorithm for the ShareLoadout link to find optimal armor from the receiving user's armor pool. + * It starts with the highest priority stat at its maximum threshold and decrements + * the threshold until a permutation is found. This allows us to find the best or closest + * possible armor from the receiving user's armor pool. + */ + export function filterFromSharedLoadout( decodedLoadout: DecodedLoadoutData, permutations: DestinyArmor[][],