Skip to content

Commit

Permalink
feat(overlay): add trinkets support
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMCesar authored and beheh committed Aug 22, 2024
1 parent fda7750 commit f1202d1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/twitch-hdt.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ export interface BoardStatePlayer {
*/
weapon?: number;

/**
* The dbfId of the first trinket, if any.
*/
first_trinket?: number;

/**
* The dbfId of the second trinket, if any.
*/
second_trinket?: number;

/**
* The dbfIds of secrets.
*/
Expand Down
47 changes: 41 additions & 6 deletions src/viewer/overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ const Weapon = styled(OverlayElement)`
clip-path: circle(50% at 50% 50%);
`;

const Trinket = styled(OverlayElement)`
top: ${(props) => props.top || "unset"};
left: ${(props) => props.left || "unset"};
bottom: ${(props) => props.bottom || "unset"};
height: 9.5vh;
width: 9.5vh;
clip-path: circle(50% at 50% 50%);
`;

const BattlegroundsAnomaly = styled(OverlayElement)`
top: ${(props) => props.top || "unset"};
right: ${(props) => props.right || "unset"};
Expand Down Expand Up @@ -559,12 +569,37 @@ class Overlay extends React.Component<Props & TwitchExtProps, State> {
<HeroPower bottom={"16.9vh"} right={"65.6vh"}>
<Entity dbfId={player.hero_power || null} />
</HeroPower>
<Weapon top={"15.5vh"} left={"65.8vh"}>
<Entity dbfId={opponent.weapon || null} />
</Weapon>
<Weapon bottom={"16.8vh"} left={"64.25vh"}>
<Entity dbfId={player.weapon || null} />
</Weapon>

{opponent.first_trinket || opponent.second_trinket ? (
<>
<Trinket top={"10.7vh"} left={"72.7vh"}>
<Entity dbfId={opponent.first_trinket || null} />
</Trinket>
<Trinket top={"16.7vh"} left={"65.3vh"}>
<Entity dbfId={opponent.second_trinket || null} />
</Trinket>
</>
) : (
<Weapon top={"15.5vh"} left={"65.8vh"}>
<Entity dbfId={opponent.weapon || null} />
</Weapon>
)}

{player.first_trinket || player.second_trinket ? (
<>
<Trinket bottom={"14.3vh"} left={"71.6vh"}>
<Entity dbfId={player.first_trinket || null} />
</Trinket>
<Trinket bottom={"21vh"} left={"64.6vh"}>
<Entity dbfId={player.second_trinket || null} />
</Trinket>
</>
) : (
<Weapon bottom={"16.8vh"} left={"64.25vh"}>
<Entity dbfId={player.weapon || null} />
</Weapon>
)}

{!ignoreDeck ? (
<>
<Deck top={"24vh"} right={"24vh"}>
Expand Down

0 comments on commit f1202d1

Please sign in to comment.