Skip to content

Commit

Permalink
fix: Detect Rocket Assisted Sidearm stats (#2172)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Jul 27, 2024
1 parent 6ad2a19 commit 9059438
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions native/app/stats/StatBars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { DestinyItem } from "@/app/inventory/logic/Types.ts";
import type { ItemStats } from "@/app/stats/Logic.ts";
import { DestinyStatDefinition } from "@/app/store/Definitions.ts";
import RecoilStat from "@/app/stats/RecoilStat.tsx";
import { createSockets } from "@/app/inventory/logic/Sockets.ts";

type UiStatType = "BAR" | "NUMERAL" | "RECOIL" | "SEPARATOR" | "ARMOR-TOTAL";

Expand Down Expand Up @@ -65,6 +66,13 @@ const ExplosiveWeaponStats: UiStatData[] = [
...SharedWeaponStats,
];

const RocketSidearmStats: UiStatData[] = [
{ statType: StatType.BlastRadius, type: "BAR" },
{ statType: StatType.Velocity, type: "BAR" },
{ statType: StatType.Range, type: "BAR" },
...SharedWeaponStats,
];

const FusionWeaponStats: UiStatData[] = [
{ statType: StatType.Impact, type: "BAR" },
{ statType: StatType.Range, type: "BAR" },
Expand Down Expand Up @@ -168,6 +176,14 @@ function BarUi({ statType, value }: BarProps) {
);
}

function isRocketSidearm(destinyItem: DestinyItem): boolean {
const sockets = createSockets(destinyItem);
if (!sockets) {
return false;
}
return sockets.socketEntries?.[0]?.singleInitialItemHash === 2928496916;
}

function getStatsUiData(destinyItem: DestinyItem): UiStatData[] {
if (destinyItem.def.itemType === ItemType.Armor) {
return DefaultArmorStats;
Expand All @@ -186,6 +202,12 @@ function getStatsUiData(destinyItem: DestinyItem): UiStatData[] {
return ExplosiveWeaponStats;
case ItemSubType.Bow:
return BowWeaponStats;
case ItemSubType.Sidearm: {
if (isRocketSidearm(destinyItem)) {
return RocketSidearmStats;
}
return DefaultWeaponStats;
}
default:
return DefaultWeaponStats;
}
Expand Down

0 comments on commit 9059438

Please sign in to comment.