summaryrefslogtreecommitdiff
path: root/src/App.vue
blob: a994a01f204f79b727bc923174f9a0ee70d78c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<template>
  <div class="container">
    <section class="hero">
      <div class="hero-body">
        <div class="container">
          <h1 class="title">Vainglory Broken Talents Fun Statistics</h1>
          <h2 class="subtitle">Tilting Brawlers since May 2017</h2>
        </div>
      </div>
    </section>

    <b-tabs v-model="activeTab">
      <b-tab-item label="Blitz">
        <div class="tile is-ancestor">
          <div class="tile is-parent">
            <talent-box class="tile is-child is-warning notification"
                        title="Overpowered!"
                        :entry="topWins.blitz_pvp_ranked">
              {{ Math.round(100 * topWins.blitz_pvp_ranked.Winner) }}% Win Rate
            </talent-box>
          </div>

          <div class="tile is-parent">
            <talent-box class="tile is-child is-success notification"
                        title="Trending"
                        :entry="topPicks.blitz_pvp_ranked">
              {{ (100 * 6 * topPicks.blitz_pvp_ranked.Count / totalPicks.blitz_pvp_ranked).toFixed(2) }}% Pick Rate
            </talent-box>
          </div>
        </div>

        <h2 class="title is-2">Blitz Hero Statistics</h2>
        <report-table :report="reports.blitz_pvp_ranked" :totalPicks="totalPicks.blitz_pvp_ranked"></report-table>
      </b-tab-item>

      <b-tab-item label="Battle Royale">
        <h2 class="title is-2">Battle Royale Hero Statistics</h2>
        <report-table :report="reports.casual_aral" :totalPicks="totalPicks.casual_aral"></report-table>
      </b-tab-item>
    </b-tabs>
  </div>
</template>

<script>
import report from '../data/98aae7f0/report.json';
import ReportTable from './ReportTable.vue';
import TalentBox from './TalentBox.vue';

const MODES = [
  'casual_aral', 'blitz_pvp_ranked'
];

const reports = {};
const totalPicks = {};
const topPicks = {};
const topWins = {};

for(let mode of MODES) {
  reports[mode] = report.filter((entry) => entry.Mode == mode);
  totalPicks[mode] = report.map((entry) => entry.Count).reduce((agg, cur) => agg + cur, 0);
  topPicks[mode] = reports[mode].sort((entry1, entry2) => entry2.Count - entry1.Count)[0];
  topWins[mode] = reports[mode]
    .filter((entry) => 100 * 6 * entry.Count / totalPicks[mode] > 0.05)
    .sort((entry1, entry2) => entry2.Winner - entry1.Winner)[0];
}

export default {
  name: 'app',
  data: function() {
    return {
      reports,
      topPicks,
      topWins,
      totalPicks,
      activeTab: 0,
    };
  },
  components: {
    ReportTable,
    TalentBox,
  },
};
</script>