Skip to content

Commit f86d0d6

Browse files
committed
fix time handling for the below-charts that come from periodic tracker events
1 parent 38debcb commit f86d0d6

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

app/assets/javascripts/angular/helpers/sc2.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,15 @@ for (var expansion_tag in Sc2.armyUnits) {
256256
}
257257
}
258258

259-
// I'd rather stuff these here, than in Match
259+
Sc2.LOTV_SPEEDUP = 1.4;
260260

261-
Sc2.frameToTime = function(frame) {
262-
minute = Math.floor(frame / (60 * 16));
263-
second = Math.floor((frame / 16) % 60).toString();
261+
Sc2.frameToTime = function(frame, expansion) {
262+
fps = 16;
263+
if (expansion >= 2) {
264+
fps *= Sc2.LOTV_SPEEDUP;
265+
}
266+
minute = Math.floor(frame / (60 * fps));
267+
second = Math.floor((frame / fps) % 60).toString();
264268
if (second.length < 2) {
265269
second = "0" + second;
266270
}
@@ -271,7 +275,11 @@ Sc2.timeToFrame = function(time) {
271275
parts = time.split(':');
272276
seconds = parseInt(parts[parts.length-1]);
273277
minutes = parseInt(parts[parts.length-2]);
274-
frame = ((minutes*60) + seconds) * 16;
278+
fps = 16;
279+
if (expansion >= 2) {
280+
fps *= Sc2.LOTV_SPEEDUP;
281+
}
282+
frame = ((minutes*60) + seconds) * fps;
275283
return frame;
276284
}
277285

@@ -282,3 +290,4 @@ Sc2.armyInfo = function(expansion_tag, unitname, infonum) {
282290
Sc2.isArmyUnit = function(unitname) {
283291
return (unitname in Sc2.armyUnits['LotV']);
284292
}
293+

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,14 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc
568568

569569
statx = function(statarray) {
570570
result = [];
571+
seconds_between_stat_updates = 10.0;
572+
if (this.expansion_tag == 'LotV') {
573+
seconds_between_stat_updates /= Sc2.LOTV_SPEEDUP;
574+
}
571575
now_seconds = 0;
572576
_.each(statarray, function(stat) {
573577
result.push([now_seconds / 60.0, stat]);
574-
now_seconds = now_seconds + 10.0;
578+
now_seconds = now_seconds + seconds_between_stat_updates;
575579
});
576580
// console.log("statarray", result);
577581
return result;

0 commit comments

Comments
 (0)