diff --git a/src/routes/match/[id]/+layout.svelte b/src/routes/match/[id]/+layout.svelte index 3a41be5..422c928 100644 --- a/src/routes/match/[id]/+layout.svelte +++ b/src/routes/match/[id]/+layout.svelte @@ -19,6 +19,7 @@ { label: 'Overview', href: `/match/${match.match_id}` }, { label: 'Economy', href: `/match/${match.match_id}/economy` }, { label: 'Details', href: `/match/${match.match_id}/details` }, + { label: 'Weapons', href: `/match/${match.match_id}/weapons` }, { label: 'Flashes', href: `/match/${match.match_id}/flashes` }, { label: 'Damage', href: `/match/${match.match_id}/damage` }, { label: 'Chat', href: `/match/${match.match_id}/chat` } diff --git a/src/routes/match/[id]/weapons/+page.svelte b/src/routes/match/[id]/weapons/+page.svelte new file mode 100644 index 0000000..d88def1 --- /dev/null +++ b/src/routes/match/[id]/weapons/+page.svelte @@ -0,0 +1,318 @@ + + + + Match Weapons - CS2.WTF + + +{#if !hasWeaponsData} + +
+ +

No Weapons Data Available

+

Weapon statistics are not available for this match.

+ Weapons data unavailable +
+
+{:else} +
+ +
+ +
+ +

Total Kills

+
+
+ {topWeapons.reduce((sum, w) => sum + w.kills, 0)} +
+
Across all weapons
+
+ + +
+ +

Total Damage

+
+
+ {topWeapons.reduce((sum, w) => sum + w.damage, 0).toLocaleString()} +
+
Across all weapons
+
+ + +
+ +

Total Hits

+
+
+ {topWeapons.reduce((sum, w) => sum + w.hits, 0).toLocaleString()} +
+
Across all weapons
+
+
+ + + +
+

Most Used Weapons

+

Weapons ranked by total kills

+
+ +
+ + + +
+

Hit Location Distribution

+

Where shots landed across all weapons

+
+
+ +
+
+
+ +
+ Head +
+ {hitGroupTotals.head} +
+
+ +
+ Chest +
+ {hitGroupTotals.chest} +
+
+ +
+ Stomach +
+ {hitGroupTotals.stomach} +
+
+ +
+ Arms +
+ {hitGroupTotals.left_arm + hitGroupTotals.right_arm} +
+
+ +
+ Legs +
+ {hitGroupTotals.left_leg + hitGroupTotals.right_leg} +
+
+
+
+
+ + + +
+

Player Weapon Performance

+

Individual player weapon statistics

+
+ + +
+
+{/if} diff --git a/src/routes/match/[id]/weapons/+page.ts b/src/routes/match/[id]/weapons/+page.ts new file mode 100644 index 0000000..cbf1d62 --- /dev/null +++ b/src/routes/match/[id]/weapons/+page.ts @@ -0,0 +1,23 @@ +import type { PageLoad } from './$types'; +import { matchesAPI } from '$lib/api/matches'; + +export const load: PageLoad = async ({ parent, params }) => { + const { match } = await parent(); + + try { + // Fetch weapons statistics for this match + const weapons = await matchesAPI.getMatchWeapons(params.id); + + return { + match, + weapons + }; + } catch (error) { + console.error('Failed to load weapons data:', error); + // Return match without weapons data on error + return { + match, + weapons: { match_id: parseInt(params.id), weapons: [] } + }; + } +};