Skip to content

Commit

Permalink
chore: bump data and dogma-engine to latest (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueBrain authored Aug 6, 2024
1 parent 6b70fe0 commit 5e0a8f7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
"peerDependencies": {
"@eveshipfit/data": "^10",
"@eveshipfit/dogma-engine": "^6",
"@eveshipfit/dogma-engine": "^7",
"react": "^18",
"react-dom": "^18"
},
Expand Down
20 changes: 18 additions & 2 deletions src/providers/DogmaEngineProvider/DogmaEngineProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ declare global {
get_dogma_attribute?: unknown;
get_dogma_effects?: unknown;
get_dogma_effect?: unknown;
get_type_id?: unknown;
get_type?: unknown;
type_name_to_id?: unknown;
attribute_name_to_id?: unknown;
}
}

Expand Down Expand Up @@ -88,9 +90,23 @@ export const DogmaEngineProvider = (props: DogmaEngineProps) => {
window.get_dogma_effect = (effect_id: number): DogmaEffect | undefined => {
return eveData.dogmaEffects[effect_id];
};
window.get_type_id = (type_id: number): Type | undefined => {
window.get_type = (type_id: number): Type | undefined => {
return eveData.types[type_id];
};
window.type_name_to_id = (name: string): number | undefined => {
for (const [id, type] of Object.entries(eveData.types)) {
if (type.name === name) {
return parseInt(id);
}
}
};
window.attribute_name_to_id = (name: string): number | undefined => {
for (const [id, attribute] of Object.entries(eveData.dogmaAttributes)) {
if (attribute.name === name) {
return parseInt(id);
}
}
};
}

const contextValue = React.useMemo(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/StatisticsProvider/StatisticsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const useStatistics = () => {

export const useCurrentStatistics = () => {
const statistics = React.useContext(StatisticsContext);
return statistics === null ? null : statistics.current ?? statistics.statistics;
return statistics === null ? null : (statistics.current ?? statistics.statistics);
};

interface StatisticsProps {
Expand Down

0 comments on commit 5e0a8f7

Please sign in to comment.