mirror of
https://github.com/lexogrine/dota2-react-hud.git
synced 2026-05-04 04:23:10 +02:00
Updated for facets
This commit is contained in:
@@ -5,6 +5,7 @@ import DireBorder from './direBorder.png';
|
||||
import "./scoreboard.scss";
|
||||
import { Match } from '../../api/interfaces';
|
||||
import { apiUrl, getAssetURL } from '../../api/api';
|
||||
import { heroFacets } from '../../api/heroFacets';
|
||||
export function stringToClock(time: string | number, pad = true) {
|
||||
if (typeof time === "string") {
|
||||
time = parseFloat(time);
|
||||
@@ -19,6 +20,15 @@ export function stringToClock(time: string | number, pad = true) {
|
||||
}
|
||||
const ScoreboardPlayer = ({ player }: { player: Player }) => {
|
||||
const neutralItem = player.items.find(item => item.type === 'neutral');
|
||||
|
||||
const facetIndex = player.hero?.facetIndex;
|
||||
const facets = heroFacets[(player.hero?.name || "")] ?? [];
|
||||
const facet = facetIndex ? facets[facetIndex] : null;
|
||||
|
||||
if(facet){
|
||||
const _facetUrl = getAssetURL(facet.icon, "facets")
|
||||
}
|
||||
|
||||
return <div className={`player_scoreboard`}>
|
||||
<div className="main_panel">
|
||||
<div className="player_name shadowed-text">
|
||||
|
||||
@@ -19,6 +19,7 @@ export const getAssetURL = (
|
||||
| "items"
|
||||
| "abilities"
|
||||
| "runes"
|
||||
| "facets"
|
||||
) => {
|
||||
if (!asset) return "";
|
||||
if (assetType === "heroes_animated") {
|
||||
@@ -39,6 +40,9 @@ export const getAssetURL = (
|
||||
""
|
||||
)}.webp`;
|
||||
}
|
||||
if(assetType === "facets"){
|
||||
return `${apiUrl}static/dota2/${assetType}/${asset}.png`;
|
||||
}
|
||||
return `${apiUrl}static/dota2/${assetType}/${asset}.webp`;
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user