Skip to content

Commit

Permalink
feat: add support for anomalies (in traditional Hearthstone)
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Aug 22, 2024
1 parent f1202d1 commit 62b18b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/twitch-hdt.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export interface BoardStateData {
*/
opponent?: BoardStatePlayer;

/**
* The dbfId of the anomaly in traditional Hearthstone.
*/
traditional_anomaly?: number;

/**
* The dbfId of the Battleground anomaly.
*/
Expand Down
22 changes: 20 additions & 2 deletions src/viewer/overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ const Trinket = styled(OverlayElement)`
clip-path: circle(50% at 50% 50%);
`;

const TraditionalAnomaly = styled(OverlayElement)`
top: ${(props) => props.top || "unset"};
left: ${(props) => props.left || "unset"};
height: 6.5vh;
width: 6.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 @@ -341,7 +350,12 @@ class Overlay extends React.Component<Props & TwitchExtProps, State> {
const opponent =
boardState && boardState.opponent ? boardState.opponent : {};

const anomaly =
const traditionalAnomaly =
boardState && boardState.traditional_anomaly
? boardState.traditional_anomaly
: null;

const battlegroundsAnomaly =
boardState && boardState.battlegrounds_anomaly
? boardState.battlegrounds_anomaly
: null;
Expand Down Expand Up @@ -600,6 +614,10 @@ class Overlay extends React.Component<Props & TwitchExtProps, State> {
</Weapon>
)}

<TraditionalAnomaly left={"26.5vh"} top={"27vh"}>
<Entity dbfId={traditionalAnomaly || null} />
</TraditionalAnomaly>

{!ignoreDeck ? (
<>
<Deck top={"24vh"} right={"24vh"}>
Expand Down Expand Up @@ -635,7 +653,7 @@ class Overlay extends React.Component<Props & TwitchExtProps, State> {
</>
) : null}
<BattlegroundsAnomaly right={"24vh"} top={"34.5vh"}>
<Entity dbfId={anomaly || null} />
<Entity dbfId={battlegroundsAnomaly || null} />
</BattlegroundsAnomaly>
</Offset>
)}
Expand Down

0 comments on commit 62b18b9

Please sign in to comment.