diff --git a/client/visualizer/src/main/looper.ts b/client/visualizer/src/main/looper.ts index e4d8b181..16105700 100644 --- a/client/visualizer/src/main/looper.ts +++ b/client/visualizer/src/main/looper.ts @@ -74,7 +74,7 @@ export default class Looper { teamNames.push(meta.teams[team].name) teamIDs.push(meta.teams[team].teamID) } - this.stats.initializeGame(teamNames, teamIDs) + this.stats.initializeGame(teamNames, teamIDs, match.current.mapStats.island_stats.size) const extraInfo = (this.mapinfo ? this.mapinfo + "\n" : "") + (this.conf.doingRotate ? " (Map rotated and flipped! Disable for new matches with 'Z'.)" : "") this.stats.setExtraInfo(extraInfo) if (!showTourneyUpload) this.stats.hideTourneyUpload() diff --git a/client/visualizer/src/sidebar/stats.ts b/client/visualizer/src/sidebar/stats.ts index 44ede8d9..3e2492b7 100644 --- a/client/visualizer/src/sidebar/stats.ts +++ b/client/visualizer/src/sidebar/stats.ts @@ -106,7 +106,7 @@ export default class Stats { let teamNames: Array = ["?????", "?????"]; let teamIDs: Array = [1, 2]; - this.initializeGame(teamNames, teamIDs); + this.initializeGame(teamNames, teamIDs, 0); } /** @@ -179,6 +179,12 @@ export default class Stats { return table; } + private initIslandCount(islands: number){ + let wrapper = document.createElement("div"); + wrapper.innerHTML = `${islands} islands (${Math.ceil(islands * .75)} to win)` + return wrapper; + } + private initRelativeBars(teamIDs: Array) { let metalIDs = [0, 1, 2]; let colors = ["#963749", "#25b5bc", "#f413b1"]; @@ -448,7 +454,7 @@ export default class Stats { /** * Clear the current stats bar and reinitialize it with the given teams. */ - initializeGame(teamNames: Array, teamIDs: Array) { + initializeGame(teamNames: Array, teamIDs: Array, islands: number) { // Remove the previous match info while (this.div.firstChild) { this.div.removeChild(this.div.firstChild); @@ -510,6 +516,9 @@ export default class Stats { this.div.appendChild(teamDiv); } + + this.div.appendChild(document.createElement("hr")); + this.div.append(this.initIslandCount(islands)) this.div.appendChild(document.createElement("hr")); // Add stats table @@ -541,7 +550,7 @@ export default class Stats { const relativeBarsParent = document.createElement("tbody"); relativeBarsParent.style.width = "100%"; relativeBarsTable.appendChild(relativeBarsParent); - this.div.appendChild(relativeBarsTable); + this.div.appendChild(relativeBarsTable); this.relativeBars = this.initRelativeBars(teamIDs); const relativeBarsElements = [