Skip to content

Commit

Permalink
KillFeed item icons
Browse files Browse the repository at this point in the history
  • Loading branch information
solcloud committed Sep 30, 2023
1 parent df48fbc commit 6e7d626
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 4 deletions.
7 changes: 7 additions & 0 deletions www/assets/css/hud.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@font-face {
font-family: csIcons;
src: url("../../resources/font/csgo_icons.ttf");
}

#hud {
--color-attackers: #ff9145;
--color-defenders: #43b4fd;
Expand Down Expand Up @@ -428,6 +433,7 @@
}

#hud .kill-feed {
font-family: csIcons;
max-height: 220px;
font-size: .9rem;
line-height: 80%;
Expand All @@ -443,6 +449,7 @@
}

#hud .inventory {
font-family: csIcons;
font-size: 80%;
}

Expand Down
22 changes: 22 additions & 0 deletions www/assets/js/Enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export {
InventorySlot,
ItemId,
ItemIdToName,
ItemIdToIcon,
Action,
}

Expand Down Expand Up @@ -189,6 +190,27 @@ const ItemIdToName = {
35: 'Molotov',
36: 'Smoke',
50: 'Bomb',
51: 'Defuse Kit',
}

const ItemIdToIcon = {
0: '\uE000',
1: '\uE03B',
2: '\uE004',
3: '\uE013',
4: '\uE00E',
5: '\uE007',
6: '\uE00E',
7: '\uE009',
30: '\uE02F',
31: '\uE02B',
32: '\uE02C',
33: '\uE030',
34: '\uE064',
35: '\uE02E',
36: '\uE02D',
50: '\uE031',
51: '\uE066',
}

// PlayerAction.js
Expand Down
8 changes: 4 additions & 4 deletions www/assets/js/hud/KillFeed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ItemId} from "../Enums.js";
import {ItemId, ItemIdToIcon} from "../Enums.js";

export class KillFeed {
#element
Expand Down Expand Up @@ -29,7 +29,7 @@ export class KillFeed {
const culprit = document.createElement('span')
const culpritOnMyTeam = (playerCulprit.isAttacker === playerMe.isAttacker)
culprit.classList.add(culpritOnMyTeam ? 'team-me' : 'team-opponent')
culprit.innerText = killedByBomb ? '💣' : this.#scoreBoard.getPlayerName(playerCulprit, playerMe)
culprit.innerText = killedByBomb ? ItemIdToIcon[ItemId.Bomb] : this.#scoreBoard.getPlayerName(playerCulprit, playerMe)

const dead = document.createElement('span')
const deadOnyMyTeam = (playerDead.isAttacker === playerMe.isAttacker)
Expand All @@ -46,9 +46,9 @@ export class KillFeed {
if (shouldHighlight) {
row.classList.add('highlight')
}
let headshot = (wasHeadshot ? ' ' : '')
let headshot = (wasHeadshot ? ' 🗣' : '')
row.append(culprit)
row.append(` killed${headshot} `)
row.append(` ${ItemIdToIcon[killedItemId]}${headshot} `)
row.append(dead)
parentElement.append(row)

Expand Down
12 changes: 12 additions & 0 deletions www/resources/font/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# License

#### csgo_icons.ttf

by **ohmygosh** from https://www.unknowncheats.me/forum/downloads.php?do=file&id=16704


# Acknowledgement

Thanks original authors for providing these awesome images for free!

If you find file here that violence license, please open issue.
Binary file added www/resources/font/csgo_icons.ttf
Binary file not shown.

0 comments on commit 6e7d626

Please sign in to comment.