Skip to content

Commit 25d1704

Browse files
committed
Fix engagements on stat charts.
1 parent 582b7d9 commit 25d1704

File tree

5 files changed

+37
-14
lines changed

5 files changed

+37
-14
lines changed

app/assets/javascripts/angular/directives/chart.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,15 @@ gg.directive('chart', ['$compile', function($compile) {
125125

126126
if (scope.$parent.match.engagements) {
127127
options.xAxis.plotBands = [];
128+
speed_multiplier = 1;
129+
if (scope.$parent.match.expansion_tag == 'LotV') {
130+
speed_multiplier = 1.4;
131+
}
128132
_.each(scope.$parent.match.engagements, function(engagement) {
129133
options.xAxis.plotBands.push({
130134
color: 'rgba(150, 50, 50, 0.10)',
131-
from: engagement[0] / 960.0,
132-
to: engagement[1] / 960.0,
135+
from: engagement[0] / 960.0 / speed_multiplier,
136+
to: engagement[1] / 960.0 / speed_multiplier,
133137
zIndex: 10
134138
});
135139
});

app/assets/javascripts/angular/directives/macrochart.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,18 @@ gg.directive('macrochart', [function() {
7373

7474
};
7575

76+
speed_multiplier = 1;
77+
if (scope.$parent.match.expansion_tag == 'LotV') {
78+
speed_multiplier = 1.4;
79+
}
80+
7681
if (scope.$parent.match.engagements) {
7782
options.yAxis.plotBands = [];
7883
_.each(scope.$parent.match.engagements, function(engagement) {
7984
options.yAxis.plotBands.push({
8085
color: 'rgba(150, 50, 50, 0.1)',
81-
from: engagement[0] / 960.0,
82-
to: engagement[1] / 960.0,
86+
from: engagement[0] / 960.0 / speed_multiplier,
87+
to: engagement[1] / 960.0 / speed_multiplier,
8388
zIndex: 10
8489
});
8590
});
@@ -105,7 +110,7 @@ gg.directive('macrochart', [function() {
105110
for (i=0; i<hatches.length; i++) {
106111
times = hatches[i].times;
107112
for (inj=0; inj<times.length; inj++) {
108-
hatchdata.push([i, times[inj] / (16.0 * 60.0), (times[inj] + 16 * 40)/(16.0 * 60.0)])
113+
hatchdata.push([i, times[inj] / (16.0 * 60.0 * speed_multiplier), (times[inj] + 16 * 40)/(16.0 * 60.0 * speed_multiplier)])
109114
}
110115
}
111116
scope.chart.addSeries({

app/assets/javascripts/angular/directives/protosschart.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ gg.directive('protosschart', [function() {
7474

7575
macro = scope.match.pmacro;
7676

77+
speed_multiplier = 1;
78+
if (scope.$parent.match.expansion_tag == 'LotV') {
79+
speed_multiplier = 1.4;
80+
}
81+
7782
nametoshow = scope.$parent.entity.identity.name;
7883
idtoshow = scope.$parent.entity.identity.id;
7984
nexus_stats = macro[idtoshow];
@@ -85,7 +90,7 @@ gg.directive('protosschart', [function() {
8590
maxout_blob = nexus_stats[basenum][1];
8691
for (j=0; j<maxout_blob.length; j++) {
8792
maxout = maxout_blob[j]
88-
maxouts.push([basenum, maxout[0] / (16.0 * 60.0), maxout[1] / (16.0 * 60.0)])
93+
maxouts.push([basenum, maxout[0] / (16.0 * 60.0 * speed_multiplier), maxout[1] / (16.0 * 60.0 * speed_multiplier)])
8994
}
9095
}
9196

@@ -101,8 +106,8 @@ gg.directive('protosschart', [function() {
101106
_.each(scope.$parent.match.engagements, function(engagement) {
102107
options.yAxis.plotBands.push({
103108
color: 'rgba(150, 50, 50, 0.1)',
104-
from: engagement[0] / 960.0,
105-
to: engagement[1] / 960.0,
109+
from: engagement[0] / 960.0 / speed_multiplier,
110+
to: engagement[1] / 960.0 / speed_multiplier,
106111
zIndex: 10
107112
});
108113
});
@@ -113,7 +118,7 @@ gg.directive('protosschart', [function() {
113118
for (basenum=0; basenum<numbases; basenum++) {
114119
chrono_blob = nexus_stats[basenum][0];
115120
for (chrono=0; chrono<chrono_blob.length; chrono++) {
116-
chronoboosts.push([basenum, chrono_blob[chrono] / (16.0 * 60.0)]);
121+
chronoboosts.push([basenum, chrono_blob[chrono] / (16.0 * 60.0 * speed_multiplier)]);
117122
}
118123
}
119124

app/assets/javascripts/angular/directives/terranchart.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ gg.directive('terranchart', [function() {
7474

7575
macro = scope.match.tmacro;
7676

77+
speed_multiplier = 1;
78+
if (scope.$parent.match.expansion_tag == 'LotV') {
79+
speed_multiplier = 1.4;
80+
}
81+
7782
nametoshow = scope.$parent.entity.identity.name;
7883
idtoshow = scope.$parent.entity.identity.id;
7984
base_stats = macro[idtoshow];
@@ -85,7 +90,7 @@ gg.directive('terranchart', [function() {
8590
maxout_blob = base_stats[basenum][3];
8691
for (j=0; j<maxout_blob.length; j++) {
8792
maxout = maxout_blob[j]
88-
maxouts.push([basenum, maxout[0] / (16.0 * 60.0), maxout[1] / (16.0 * 60.0)])
93+
maxouts.push([basenum, maxout[0] / (16.0 * 60.0 * speed_multiplier), maxout[1] / (16.0 * 60.0 * speed_multiplier)])
8994
}
9095
}
9196

@@ -103,7 +108,7 @@ gg.directive('terranchart', [function() {
103108
for (basenum=0; basenum<numbases; basenum++) {
104109
ability_blob = base_stats[basenum][i];
105110
for (abilnum=0; abilnum<ability_blob.length; abilnum++) {
106-
abilities.push([basenum, ability_blob[abilnum] / (16.0 * 60.0)]);
111+
abilities.push([basenum, ability_blob[abilnum] / (16.0 * 60.0 * speed_multiplier)]);
107112
}
108113
}
109114

@@ -133,8 +138,8 @@ gg.directive('terranchart', [function() {
133138
_.each(scope.$parent.match.engagements, function(engagement) {
134139
options.yAxis.plotBands.push({
135140
color: 'rgba(150, 50, 50, 0.1)',
136-
from: engagement[0] / 960.0,
137-
to: engagement[1] / 960.0,
141+
from: engagement[0] / 960.0 / speed_multiplier,
142+
to: engagement[1] / 960.0 / speed_multiplier,
138143
zIndex: 10
139144
});
140145
});

app/assets/javascripts/angular/resources/match.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,11 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
554554
// don't graph the last base-time; its y-value is zero by definition
555555
_bases_x.pop();
556556

557-
_bases_x_minutes = _.map(_bases_x, function(_frame_x) { return _frame_x / 960.0 });
557+
speed_multiplier = 1.0;
558+
if (this.expansion_tag == 'LotV') {
559+
speed_multiplier = Sc2.LOTV_SPEEDUP;
560+
}
561+
_bases_x_minutes = _.map(_bases_x, function(_frame_x) { return _frame_x / 960.0 / speed_multiplier });
558562

559563
_series_y = [];
560564
_.each(_bases_x, function(_x) {

0 commit comments

Comments
 (0)