Skip to content

Commit 2e8474a

Browse files
committed
Updated dependencies, fixed imports, updated db calls
1 parent 82e6025 commit 2e8474a

File tree

6 files changed

+51
-53
lines changed

6 files changed

+51
-53
lines changed

package-lock.json

Lines changed: 27 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/armor-optimization/StatsTable.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
import ArmorIcon from '../../components/ArmorIcon';
1111
import { STAT_HASH, STATS } from '../../lib/bungie_api/constants';
1212
import { getStatModByCost } from '../../lib/bungie_api/utils';
13+
import { ManifestArmorStatMod } from '../../types/manifest-types';
14+
import { db } from '../../store/db';
1315

1416
interface StatsTableProps {
1517
permutations: FilteredPermutation[];
@@ -249,19 +251,15 @@ const StatsTable: React.FC<StatsTableProps> = ({ permutations, onPermutationClic
249251
onClick={() => {
250252
dispatch(resetLoadoutArmorMods());
251253
dispatch(updateLoadoutArmor(perm.permutation));
252-
let requiredMods: Plug[] = [];
254+
let requiredMods: ManifestArmorStatMod[] = [];
255+
253256
Object.entries(perm.modsArray).forEach(([stat, costs]) => {
254-
costs.forEach((cost: number) => {
255-
requiredMods.push({
256-
plugItemHash: String(
257-
getStatModByCost(
258-
cost,
259-
STAT_HASH[stat.toUpperCase() as keyof typeof STAT_HASH]
260-
)
261-
),
262-
socketArrayType: 0,
263-
socketIndex: 0,
264-
});
257+
costs.forEach(async (cost: number) => {
258+
const mod = await db.manifestArmorStatModDef
259+
.where(stat + 'Mod')
260+
.equals(cost)
261+
.first();
262+
if (mod !== undefined) requiredMods.push(mod);
265263
});
266264
});
267265
dispatch(updateRequiredStatMods(requiredMods));

src/features/armor/components/ArmorConfig.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { useDispatch } from 'react-redux';
44
import ArmorIcon from '../../../components/ArmorIcon';
55
import { updateLoadoutArmorMods } from '../../../store/LoadoutReducer';
66
import { DestinyArmor, Plug } from '../../../types/d2l-types';
7-
import ArmorModSelector from './armor-mod-selector';
7+
import ArmorModSelector from './ArmorModSelector';
88
import { getSelectedModsBySlot, getModsBySlot } from '../util';
9-
import { ManifestArmorMod } from '../../../types/manifest-types';
9+
import { ManifestArmorMod, ManifestArmorStatMod } from '../../../types/manifest-types';
1010

1111
interface ArmorConfigProps {
1212
armor: DestinyArmor;
@@ -33,7 +33,11 @@ const ArmorConfig: React.FC<ArmorConfigProps> = ({ armor, statMods, artificeMods
3333
);
3434
};
3535

36-
const onSelectMod = async (mod: ManifestArmorMod, slot: number, socketIndex: number) => {
36+
const onSelectMod = async (
37+
mod: ManifestArmorMod | ManifestArmorStatMod,
38+
slot: number,
39+
socketIndex: number
40+
) => {
3741
let totalCost = mod.energyCost;
3842

3943
for (const key in selectedMods) {
@@ -57,11 +61,7 @@ const ArmorConfig: React.FC<ArmorConfigProps> = ({ armor, statMods, artificeMods
5761
updateLoadoutArmorMods({
5862
armorType: armor.type,
5963
slot: slot,
60-
plug: {
61-
plugItemHash: String(mod.itemHash),
62-
socketArrayType: 0,
63-
socketIndex: socketIndex,
64-
},
64+
plug: mod,
6565
})
6666
);
6767
setSelectedMods(getSelectedModsBySlot(armor.type));

src/features/armor/components/armor-mod-selector.tsx renamed to src/features/armor/components/ArmorModSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box } from '@mui/system';
2-
import { Plug, ManifestArmorMod } from '../../../types/d2l-types';
2+
import { Plug } from '../../../types/d2l-types';
3+
import { ManifestArmorMod } from '../../../types/manifest-types';
34

45
interface ModSelectorProps {
56
selected: Plug;

src/features/armor/components/LoadoutArmor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ const LoadoutArmor: React.FC = () => {
1616

1717
useEffect(() => {
1818
const gatherMods = async () => {
19-
const dbStatMods = await db.manifestArmorModDef
19+
const dbStatMods = await db.manifestArmorStatModDef
2020
.where('category')
2121
.equals(PLUG_CATEGORY_HASH.ARMOR_MODS.STAT_ARMOR_MODS)
2222
.toArray();
2323

24-
const dbArtificeMods = await db.manifestArmorModDef
24+
const dbArtificeMods = await db.manifestArmorStatModDef
2525
.where('category')
2626
.equals(PLUG_CATEGORY_HASH.ARMOR_MODS.ARTIFICE_ARMOR_MODS)
2727
.toArray();
@@ -50,7 +50,7 @@ const LoadoutArmor: React.FC = () => {
5050
let matches: ManifestArmorMod[] = [];
5151

5252
for (const mod of requiredStatMods) {
53-
const found = allStatMods.find((statMod) => String(statMod.itemHash) === mod.plugItemHash);
53+
const found = allStatMods.find((statMod) => String(statMod.itemHash) === mod.itemHash);
5454
if (found) matches.push(found);
5555
}
5656

src/features/subclass/AbilitiesModification.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import styled from '@emotion/styled';
2-
import { Paper, Button, Typography } from '@mui/material';
1+
import { Paper, Button, Typography, styled } from '@mui/material';
32
import { Box, Container } from '@mui/system';
43
import React, { useCallback, useEffect, useState } from 'react';
54
import { useSelector, useDispatch } from 'react-redux';

0 commit comments

Comments
 (0)