From 66c18ffe0281870ca51a69f48b08a566113d87d6 Mon Sep 17 00:00:00 2001
From: cnachtigall1991 <40701475+cnachtigall1991@users.noreply.github.com>
Date: Wed, 13 Oct 2021 18:19:05 +0200
Subject: [PATCH] refactored to match api-changes + added multi-kill-chart
---
src/components/DamageChart.vue | 12 +-
src/components/MultiKillsChart.vue | 186 +++++++++++++++++++++++++++
src/components/ScoreTeam.vue | 16 +--
src/components/UtilityChartTotal.vue | 2 +-
src/router/index.js | 4 +-
src/views/Match.vue | 54 +++++---
src/views/Player.vue | 62 ++++-----
7 files changed, 270 insertions(+), 66 deletions(-)
create mode 100644 src/components/MultiKillsChart.vue
diff --git a/src/components/DamageChart.vue b/src/components/DamageChart.vue
index 4810a51..d5ed4c0 100644
--- a/src/components/DamageChart.vue
+++ b/src/components/DamageChart.vue
@@ -71,11 +71,11 @@ export default {
let arr = []
if (team === 1) {
for (let i = 0; i < 5; i++) {
- arr.push(-checkStatEmpty(stats[i].extended.dmg.team))
+ arr.push(-checkStatEmpty(stats[i].dmg.team))
}
} else {
for (let i = 5; i < stats.length; i++) {
- arr.push(-checkStatEmpty(stats[i].extended.dmg.team))
+ arr.push(-checkStatEmpty(stats[i].dmg.team))
}
}
arr.reverse()
@@ -87,18 +87,18 @@ export default {
if (team === 1) {
for (let i = 0; i < 5; i++) {
arr.push({
- value: checkStatEmpty(stats[i].extended.dmg.enemy),
+ value: checkStatEmpty(stats[i].dmg.enemy),
itemStyle: {
- color: getComputedStyle(document.documentElement).getPropertyValue(`--csgo-${stats[i].extended.color}`)
+ color: getComputedStyle(document.documentElement).getPropertyValue(`--csgo-${stats[i].color}`)
}
})
}
} else {
for (let i = 5; i < stats.length; i++) {
arr.push({
- value: checkStatEmpty(stats[i].extended.dmg.enemy),
+ value: checkStatEmpty(stats[i].dmg.enemy),
itemStyle: {
- color: getComputedStyle(document.documentElement).getPropertyValue(`--csgo-${stats[i].extended.color}`)
+ color: getComputedStyle(document.documentElement).getPropertyValue(`--csgo-${stats[i].color}`)
}
})
}
diff --git a/src/components/MultiKillsChart.vue b/src/components/MultiKillsChart.vue
new file mode 100644
index 0000000..feceee6
--- /dev/null
+++ b/src/components/MultiKillsChart.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
diff --git a/src/components/ScoreTeam.vue b/src/components/ScoreTeam.vue
index 662fe23..5de8e8d 100644
--- a/src/components/ScoreTeam.vue
+++ b/src/components/ScoreTeam.vue
@@ -27,20 +27,20 @@
:assists="player.assists"
:avatar="player.player.avatar"
:deaths="player.deaths"
- :dmg="player.extended?.dmg?.enemy"
+ :dmg="player.dmg?.enemy"
:hs="player.headshot"
:kdiff="player.kills - player.deaths"
:kills="player.kills"
- :mk_duo="player.extended?.multi_kills?.duo"
- :mk_pent="player.extended?.multi_kills?.pent"
- :mk_quad="player.extended?.multi_kills?.quad"
- :mk_triple="player.extended?.multi_kills?.triple"
+ :mk_duo="player.multi_kills?.duo"
+ :mk_pent="player.multi_kills?.pent"
+ :mk_quad="player.multi_kills?.quad"
+ :mk_triple="player.multi_kills?.triple"
:mvp="player.mvp"
:name="player.player.name"
:player_score="player.score"
- :rank="player.extended?.rank?.old"
+ :rank="player.rank?.old"
:rounds_played="props.rounds_played"
- :color="player.extended?.color"
+ :color="player.color"
:tracked="player.player.tracked"
:parsed="props.parsed"
/>
@@ -131,4 +131,4 @@ table {
cursor: help;
}
}
-
\ No newline at end of file
+
diff --git a/src/components/UtilityChartTotal.vue b/src/components/UtilityChartTotal.vue
index 5a4d6b1..a7306b9 100644
--- a/src/components/UtilityChartTotal.vue
+++ b/src/components/UtilityChartTotal.vue
@@ -34,7 +34,7 @@ export default {
const seriesArr = (stats) => {
let arr = []
for (let i = 0; i < stats.length; i++) {
- const sum = checkStatEmpty(stats[i].extended.dmg.ud.flames) + checkStatEmpty(stats[i].extended.dmg.ud.flash) + checkStatEmpty(stats[i].extended.dmg.ud.he) + checkStatEmpty(stats[i].extended.dmg.ud.smoke)
+ const sum = checkStatEmpty(stats[i].dmg.ud.flames) + checkStatEmpty(stats[i].dmg.ud.flash) + checkStatEmpty(stats[i].dmg.ud.he) + checkStatEmpty(stats[i].dmg.ud.smoke)
if (sum !== 0) {
arr.push({
diff --git a/src/router/index.js b/src/router/index.js
index 96d4703..2acc769 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,4 +1,4 @@
-import { createRouter, createWebHistory } from 'vue-router'
+import {createRouter, createWebHistory} from 'vue-router'
function lazyLoad(view) {
return () => import(`@/views/${view}.vue`)
@@ -21,7 +21,7 @@ const routes = [
name: 'Match',
component: lazyLoad('Match'),
props: true,
- alias: ['/match/:match_id/flashes', '/match/:match_id/utility', '/match/:match_id/damage']
+ alias: ['/match/:match_id/flashes', '/match/:match_id/utility', '/match/:match_id/damage', '/match/:match_id/details']
},
{
path: '/explore',
diff --git a/src/views/Match.vue b/src/views/Match.vue
index 2ad36eb..b6c6755 100644
--- a/src/views/Match.vue
+++ b/src/views/Match.vue
@@ -36,14 +36,21 @@
- Scoreboard
- - Flashes
+
- Details
- - Utility
+
- Flashes
- - Damage
+
- Utility
+
+ - Damage
@@ -51,24 +58,24 @@
+ :score="data.score[0]" :stats="data.stats" :team_id="1"/>
+ :score="data.score[1]" :stats="data.stats" :team_id="2"/>
@@ -78,12 +85,16 @@
:key="player.player.steamid64"
:avatar="player.player.avatar"
:name="player.player.name"
- :ud="player.extended.dmg.ud"
+ :ud="player.dmg.ud"
/>
-
+
+
+
+
+
@@ -99,6 +110,7 @@ const FlashChart = defineAsyncComponent(() => import('../components/FlashChart')
const UtilityChart = defineAsyncComponent(() => import('../components/UtilityChart'))
const UtilityChartTotal = defineAsyncComponent(() => import('../components/UtilityChartTotal'))
const DamageChart = defineAsyncComponent(() => import('../components/DamageChart'))
+const MultiKillsChart = defineAsyncComponent(() => import('../components/MultiKillsChart'))
export default {
name: 'Match',
@@ -108,7 +120,8 @@ export default {
FlashChart,
UtilityChart,
UtilityChartTotal,
- DamageChart
+ DamageChart,
+ MultiKillsChart
},
setup(props) {
// Refs
@@ -144,8 +157,8 @@ export default {
let fullRank = 0
data.stats?.map(player => {
- if (player.extended?.rank?.old) {
- fullRank += player.extended?.rank?.old
+ if (player.rank?.old) {
+ fullRank += player.rank?.old
count += 1
}
})
@@ -168,7 +181,7 @@ export default {
newNavItem.classList.add('active')
newItem.classList.add('active')
- if (id === 'flashes' || id === 'utility' || id === 'damage') {
+ if (['flashes', 'utility', 'damage', 'details'].indexOf(id) > -1) {
history.replaceState({}, null, `/match/${data.matchDetails.match_id}/${id}`)
} else if (id === 'scoreboard') {
history.replaceState({}, null, `/match/${data.matchDetails.match_id}`)
@@ -240,7 +253,7 @@ export default {
rgba(0, 0, 0, .6) 100%
);
- #scoreboard, #flashes, #utility, #damage {
+ #scoreboard, #flashes, #utility, #damage, #details {
display: none;
flex-direction: column;
align-items: center;
@@ -249,7 +262,8 @@ export default {
#scoreboard.active,
#flashes.active,
#utility.active,
- #damage.active {
+ #damage.active,
+ #details.active {
display: flex;
}
}
diff --git a/src/views/Player.vue b/src/views/Player.vue
index ad97bf6..281f4c0 100644
--- a/src/views/Player.vue
+++ b/src/views/Player.vue
@@ -122,7 +122,7 @@
@@ -135,9 +135,9 @@
|
|
@@ -145,43 +145,43 @@
title="Long match">
|
-
{{ match.score[0] }} - {{ match.score[1] }}
|
- {{ match.stats[0].kills ? match.stats[0].kills : "0" }}
+ {{ match.stats.kills ? match.stats.kills : "0" }}
|
- {{ match.stats[0].assists ? match.stats[0].assists : "0" }}
+ {{ match.stats.assists ? match.stats.assists : "0" }}
|
- {{ match.stats[0].deaths ? match.stats[0].deaths : "0" }}
+ {{ match.stats.deaths ? match.stats.deaths : "0" }}
|
-
{{
- (match.stats[0].kills ? match.stats[0].kills : 0) - (match.stats[0].deaths ? match.stats[0].deaths : 0)
+ (match.stats.kills ? match.stats.kills : 0) - (match.stats.deaths ? match.stats.deaths : 0)
}}
|
= 1 ? 'text-success' : 'text-warning'"
class="td-hltv text-center fw-bold">
{{
GetHLTV_1(
- match.stats[0].kills,
+ match.stats.kills,
match.score[0] + match.score[1],
- match.stats[0].deaths,
- match.stats[0].extended?.multi_kills?.duo,
- match.stats[0].extended?.multi_kills?.triple,
- match.stats[0].extended?.multi_kills?.quad,
- match.stats[0].extended?.multi_kills?.pent)
+ match.stats.deaths,
+ match.stats.multi_kills?.duo,
+ match.stats.multi_kills?.triple,
+ match.stats.multi_kills?.quad,
+ match.stats.multi_kills?.pent)
}}
|
@@ -270,6 +270,8 @@ export default {
document.title = `${data.playerDetails.name} | csgoWTF`
console.log(data.playerDetails)
+ } else {
+ GoToLink('/')
}
} else {
GoToLink('/')
@@ -279,13 +281,15 @@ export default {
const TrackPlayer = async () => {
[data.statusErrorCode, data.statusError] = await TrackMe(data.playerDetails.steamid64, data.userData.authcode, data.userData.sharecode)
- // setTimeout(() => {
- if (data.statusErrorCode === 202) {
- data.statusErrorCode = 0
- data.statusError = ''
- data.tracked = true
- }
- // }, 2000)
+ setTimeout(() => {
+ if (data.statusErrorCode === 202) {
+ data.statusErrorCode = 0
+ data.statusError = ''
+ data.tracked = true
+ }
+
+ window.location.reload()
+ }, 2000)
}
onMounted(() => {
|