#5 weapons only selectable, if player did damage with them
This commit is contained in:
@@ -15,11 +15,11 @@
|
|||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select v-model="data.selectWeapon" class="form-select">
|
<select v-if="data.selectPlayer !== ''" :key="data.selectPlayer" v-model="data.selectWeapon" class="form-select">
|
||||||
<option disabled value="">Select a Weapon</option>
|
<option disabled value="">Select a Weapon</option>
|
||||||
<option class="select-hr" value="All">All</option>
|
<option class="select-hr" value="All">All</option>
|
||||||
<option disabled>───────────────────────────</option>
|
<option disabled>───────────────────────────</option>
|
||||||
<option v-for="(value, index) in data.eq_map" :key="index" :value="value">
|
<option v-for="(value, index) in processPlayerWeapon()" :key="index" :value="value">
|
||||||
{{ Object.values(value).toString().charAt(0).toUpperCase() + Object.values(value).toString().slice(1) }}
|
{{ Object.values(value).toString().charAt(0).toUpperCase() + Object.values(value).toString().slice(1) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -36,7 +36,7 @@ import * as echarts from 'echarts/core';
|
|||||||
import {GeoComponent, TooltipComponent, VisualMapComponent} from 'echarts/components';
|
import {GeoComponent, TooltipComponent, VisualMapComponent} from 'echarts/components';
|
||||||
import {MapChart} from 'echarts/charts';
|
import {MapChart} from 'echarts/charts';
|
||||||
import {CanvasRenderer} from 'echarts/renderers';
|
import {CanvasRenderer} from 'echarts/renderers';
|
||||||
import {onMounted, onUnmounted, reactive, ref} from "vue";
|
import {onMounted, onUnmounted, reactive, ref, watch} from "vue";
|
||||||
import {useStore} from "vuex";
|
import {useStore} from "vuex";
|
||||||
|
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
@@ -62,18 +62,6 @@ export default {
|
|||||||
eq_map: []
|
eq_map: []
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(store.state.playersArr)
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
for (let i in props.equipment_map) {
|
|
||||||
if (i < 500) {
|
|
||||||
const obj = {}
|
|
||||||
obj[i] = props.equipment_map[i]
|
|
||||||
data.eq_map.push(obj)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 400)
|
|
||||||
|
|
||||||
let myChart1
|
let myChart1
|
||||||
|
|
||||||
const getWindowWidth = () => {
|
const getWindowWidth = () => {
|
||||||
@@ -97,6 +85,73 @@ export default {
|
|||||||
const width = ref(getWindowWidth())
|
const width = ref(getWindowWidth())
|
||||||
const height = ref(setHeight())
|
const height = ref(setHeight())
|
||||||
|
|
||||||
|
const processPlayerWeapon = () => {
|
||||||
|
let arr = []
|
||||||
|
if (data.selectPlayer === 'All') {
|
||||||
|
props.stats.forEach(player => {
|
||||||
|
Object.values(player).forEach(enemies => {
|
||||||
|
Object.values(enemies).forEach(weapons => {
|
||||||
|
Object.values(weapons).forEach(weapon => {
|
||||||
|
arr.push(weapon[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else if (data.selectPlayer === 'Team 1') {
|
||||||
|
props.stats.forEach(player => {
|
||||||
|
store.state.playersArr.forEach(p => {
|
||||||
|
if (p.player.steamid64 === Object.keys(player).toString() && p.team_id === 1)
|
||||||
|
Object.values(player).forEach(enemies => {
|
||||||
|
Object.values(enemies).forEach(weapons => {
|
||||||
|
Object.values(weapons).forEach(weapon => {
|
||||||
|
arr.push(weapon[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else if (data.selectPlayer === 'Team 2') {
|
||||||
|
props.stats.forEach(player => {
|
||||||
|
store.state.playersArr.forEach(p => {
|
||||||
|
if (p.player.steamid64 === Object.keys(player).toString() && p.team_id === 2)
|
||||||
|
Object.values(player).forEach(enemies => {
|
||||||
|
Object.values(enemies).forEach(weapons => {
|
||||||
|
Object.values(weapons).forEach(weapon => {
|
||||||
|
arr.push(weapon[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
props.stats.forEach(player => {
|
||||||
|
if (Object.keys(player).toString() === data.selectPlayer.steamid64) {
|
||||||
|
Object.values(player).forEach(enemies => {
|
||||||
|
Object.values(enemies).forEach(weapons => {
|
||||||
|
Object.values(weapons).forEach(weapon => {
|
||||||
|
arr.push(weapon[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const unique = arr.filter((a, b) => arr.indexOf(a) === b && a < 500)
|
||||||
|
|
||||||
|
let arr2 = []
|
||||||
|
|
||||||
|
unique.forEach(w => {
|
||||||
|
for (let weapon in props.equipment_map) {
|
||||||
|
if (parseInt(w) === parseInt(weapon)) {
|
||||||
|
arr2.push({w: props.equipment_map[weapon]})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return arr2
|
||||||
|
}
|
||||||
|
|
||||||
const processDmg = () => {
|
const processDmg = () => {
|
||||||
let arr = []
|
let arr = []
|
||||||
if (data.selectPlayer && data.selectWeapon) {
|
if (data.selectPlayer && data.selectWeapon) {
|
||||||
@@ -336,7 +391,9 @@ export default {
|
|||||||
buildCharts()
|
buildCharts()
|
||||||
}
|
}
|
||||||
|
|
||||||
return {props, data, store, processDmg}
|
watch(() => data.selectPlayer, processPlayerWeapon)
|
||||||
|
|
||||||
|
return {props, data, store, processDmg, processPlayerWeapon}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user