Skip to content

Commit

Permalink
refactor: Simplify setting up Bungie definitions (#2141)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Jul 24, 2024
1 parent 62866fa commit c853db3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
3 changes: 2 additions & 1 deletion native/app/inventory/sections/GuardianDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useGGStore } from "@/app/store/GGStore.ts";
import { StyleSheet, View, Text } from "react-native";
import { Image } from "expo-image";
import { DESTINY_TEXT, POWER_LEVEL, VAULT_CHARACTER_ID } from "@/app/utilities/Constants.ts";
import { POWER_LEVEL, VAULT_CHARACTER_ID } from "@/app/utilities/Constants.ts";
import { getGuardianClassType, getGuardianRaceType } from "@/app/utilities/Helpers.ts";
import { DESTINY_TEXT } from "@/app/store/Definitions.ts";

const styles = StyleSheet.create({
root: {
Expand Down
3 changes: 2 additions & 1 deletion native/app/inventory/sections/SeparatorUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { StyleSheet, View, Text } from "react-native";

import { SEPARATOR_HEIGHT, DEFAULT_MARGIN } from "@/app/utilities/UISize.ts";
import { useGGStore } from "@/app/store/GGStore.ts";
import { BUCKET_SIZES, VAULT_CHARACTER_ID } from "@/app/utilities/Constants.ts";
import { VAULT_CHARACTER_ID } from "@/app/utilities/Constants.ts";
import { BUCKET_SIZES } from "@/app/store/Definitions.ts";
import type { BucketHash, CharacterId } from "@/app/core/GetProfile.ts";
import { vaultItemBuckets } from "@/app/inventory/logic/Helpers.ts";
import { useEffect, useState } from "react";
Expand Down
24 changes: 0 additions & 24 deletions native/app/utilities/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
import { DestinyClass, ItemSubType, SectionBuckets, DamageType } from "@/app/bungie/Enums.ts";
import type { CharacterId } from "@/app/core/GetProfile.ts";
import { DestinyInventoryBucketDefinition, DestinyStatDefinition } from "@/app/store/Definitions.ts";
import type { DestinyItem } from "@/app/inventory/logic/Types.ts";

export function updateBucketSizes() {
BUCKET_SIZES[SectionBuckets.Consumables] =
DestinyInventoryBucketDefinition?.[SectionBuckets.Consumables]?.itemCount ?? 5;
BUCKET_SIZES[SectionBuckets.Mods] = DestinyInventoryBucketDefinition?.[SectionBuckets.Mods]?.itemCount ?? 5;
BUCKET_SIZES[SectionBuckets.LostItem] = DestinyInventoryBucketDefinition?.[SectionBuckets.LostItem]?.itemCount ?? 5;
BUCKET_SIZES[SectionBuckets.Vault] = DestinyInventoryBucketDefinition?.[SectionBuckets.Vault]?.itemCount ?? 5;
}

export function updateDestinyText() {
DESTINY_TEXT.POWER = DestinyStatDefinition?.[1935470627]?.displayProperties.name ?? "";
}

export const VAULT_CHARACTER_ID = "VAULT" as CharacterId;
export const GLOBAL_MODS_CHARACTER_ID = "GLOBAL_MODS_CHARACTER_ID" as CharacterId;
export const GLOBAL_CONSUMABLES_CHARACTER_ID = "GLOBAL_CONSUMABLES_CHARACTER_ID" as CharacterId;
Expand All @@ -26,17 +13,6 @@ export const GLOBAL_INVENTORY_NAMES = [
GLOBAL_LOST_ITEMS_CHARACTER_ID,
];

export const BUCKET_SIZES = {
[SectionBuckets.Consumables]: 50,
[SectionBuckets.Mods]: 50,
[SectionBuckets.LostItem]: 21,
[SectionBuckets.Vault]: 500,
};

export const DESTINY_TEXT = {
POWER: "",
};

export const DEFAULT_OVERLAP_COLOR = "#242429CC";

export const LOGO_DARK = require("../../images/gg-logo-dark.webp");
Expand Down

0 comments on commit c853db3

Please sign in to comment.