From 9059438fe5289ed21d249409707bf6c5913c7391 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Sat, 27 Jul 2024 15:33:57 +0300 Subject: [PATCH] fix: Detect Rocket Assisted Sidearm stats (#2172) --- native/app/stats/StatBars.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/native/app/stats/StatBars.tsx b/native/app/stats/StatBars.tsx index 55fe54eeb..eadb3eea3 100644 --- a/native/app/stats/StatBars.tsx +++ b/native/app/stats/StatBars.tsx @@ -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"; @@ -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" }, @@ -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; @@ -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; }