Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Detect Rocket Assisted Sidearm stats #2172

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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