From bd992ad0e54e496c42c7a2f2913bf3e3bf47bdee Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 30 Oct 2023 21:06:27 +0000 Subject: [PATCH] add more hmd names --- src/headsets.ts | 37 +++++++++++-------------------------- src/services/updateData.ts | 3 +-- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/headsets.ts b/src/headsets.ts index 12ebe52..03605ec 100644 --- a/src/headsets.ts +++ b/src/headsets.ts @@ -1,26 +1,11 @@ -export const Headsets = [ - { - id: [-1], - name: "Unknown", - }, - { - id: [64], - name: "Valve Index", - }, - { - id: [32], - name: "Oculus Quest", - }, - { - id: [16], - name: "Rift S", - }, - { - id: [1], - name: "Rift CV1", - }, - { - id: [2], - name: "Vive", - }, -]; +export const Headsets: { [key: number]: string } = { + 0: "Unknown", + 1: "Rift CV1", + 2: "Vive", + 4: "Vive Pro", + 8: "Windows Mixed Reality", + 16: "Rift S", + 32: "Oculus Quest", + 64: "Valve Index", + 128: "Vive Cosmos", +}; diff --git a/src/services/updateData.ts b/src/services/updateData.ts index 08af560..723d9ac 100644 --- a/src/services/updateData.ts +++ b/src/services/updateData.ts @@ -72,8 +72,7 @@ async function connectWebsocket() { } = score; const { maxScore, stars, id: leaderboardId } = leaderboard; - const hmdName = - Headsets.find((h) => h.id.includes(hmd))?.name || "Unknown"; + const hmdName = Headsets[hmd] || "Unknown"; const countryId = normalizedRegionName(player.country) || "Unknown"; totalCountries[countryId] = (totalCountries[countryId] || 0) + 1; totalHeadsets[hmdName] = (totalHeadsets[hmdName] || 0) + 1;