fix: live tab game now works for custom tournament games

This commit is contained in:
Valentin Kaelin 2020-02-29 15:11:23 +01:00
parent 85bbf7faf9
commit 493195e0dc
3 changed files with 29 additions and 9 deletions

View file

@ -126,8 +126,8 @@
class="absolute ban-order w-4 h-4 flex items-center justify-center text-xs font-bold rounded-full" class="absolute ban-order w-4 h-4 flex items-center justify-center text-xs font-bold rounded-full"
>{{ banChamp(index, player.teamId).pickTurn }}</div> >{{ banChamp(index, player.teamId).pickTurn }}</div>
</div> </div>
<div v-else class="w-5 h-5"> <div v-else class="w-5 h-5 text-left">
<div class="-mt-1 text-blue-300 text-2xl">-</div> <div class="text-blue-300 text-2xl">-</div>
</div> </div>
</div> </div>
</td> </td>
@ -185,10 +185,26 @@ export default {
ally: { ally: {
type: Boolean, type: Boolean,
default: true, default: true,
},
gamemode: {
type: String,
default: '',
}
},
data() {
return {
customGameBanOrder: {
100: [1, 3, 5, 2, 4],
200: [2, 4, 6, 1, 3]
}
} }
}, },
computed: { computed: {
isCustom() {
return this.gamemode === 'Custom Game'
},
...mapState({ ...mapState({
account: state => state.summoner.basic.account, account: state => state.summoner.basic.account,
live: state => state.summoner.live.match, live: state => state.summoner.live.match,
@ -198,12 +214,12 @@ export default {
methods: { methods: {
banChamp(index, teamId) { banChamp(index, teamId) {
index++ if (teamId === 200 && !this.isCustom) {
if (teamId === 200) {
index += 5 index += 5
} }
return this.live.bannedChampions.find(b => b.pickTurn === index)
const toFind = this.isCustom ? this.customGameBanOrder[teamId][index] : index + 1
return this.live.bannedChampions.find(b => b.pickTurn === toFind && b.teamId === teamId)
}, },
borderChampion(id) { borderChampion(id) {
if (id === this.account.id) { if (id === this.account.id) {

View file

@ -22,7 +22,11 @@ export const liveGame = {
return this.current && this.current.participants ? this.current.participants.filter(p => p.teamId !== this.teamColor) : [] return this.current && this.current.participants ? this.current.participants.filter(p => p.teamId !== this.teamColor) : []
}, },
gamemode() { gamemode() {
return gameModes[this.current.gameQueueConfigId] if (this.current.participants) {
return this.current.gameType === 'CUSTOM_GAME' ? { type: '', name: 'Custom Game' } : gameModes[this.current.gameQueueConfigId]
} else {
return { type: '', name: '' }
}
}, },
gameStartTime() { gameStartTime() {
return this.current ? this.current.gameStartTime : 0 return this.current ? this.current.gameStartTime : 0

View file

@ -12,8 +12,8 @@
</div> </div>
<div v-else class="h-4"></div> <div v-else class="h-4"></div>
<LiveTeam :team="allyTeam" :ally="true" /> <LiveTeam :team="allyTeam" :ally="true" :gamemode="gamemode.name" />
<LiveTeam :team="enemyTeam" :ally="false" class="mt-4" /> <LiveTeam :team="enemyTeam" :ally="false" :gamemode="gamemode.name" class="mt-4" />
</div> </div>
<div v-else> <div v-else>
<div class="mt-16 flex justify-center"> <div class="mt-16 flex justify-center">