diff --git a/app/assets/javascripts/angular/controllers/match.js b/app/assets/javascripts/angular/controllers/match.js index fbc359a..e3737d2 100644 --- a/app/assets/javascripts/angular/controllers/match.js +++ b/app/assets/javascripts/angular/controllers/match.js @@ -44,7 +44,7 @@ function($scope, $window, $route, $location, $element, Match) { // console.log("matchscope", $scope); $scope.$watch('current_frame', function(v) { if(v) { - $scope.current_time = Sc2.frameToTime(v); + $scope.current_time = Sc2.frameToTime(v, $scope.match.expansion); $scope.time_has_been_set = true } }); diff --git a/app/assets/javascripts/angular/directives/armychart.js b/app/assets/javascripts/angular/directives/armychart.js index ea790bd..fc01823 100644 --- a/app/assets/javascripts/angular/directives/armychart.js +++ b/app/assets/javascripts/angular/directives/armychart.js @@ -115,7 +115,7 @@ gg.directive('armychart', ['$location', '$timeout', function($location, $timeout scope.freeze = function(frame, updateURL) { switch(typeof frame) { case "number": frame = frame; break; - case "string": frame = Sc2.timeToFrame(frame); break; + case "string": frame = Sc2.timeToFrame(frame, scope.match.expansion); break; default: return false; } @@ -162,7 +162,7 @@ gg.directive('armychart', ['$location', '$timeout', function($location, $timeout if(typeof e == "number") { frame = e; } else if(typeof e == "string") { - frame = Sc2.timeToFrame(e); + frame = Sc2.timeToFrame(e, scope.match.expansion); } else { // If clicked on the background, we have xAxis on the event, if clicked // on a series, we'll have the point. diff --git a/app/assets/javascripts/angular/helpers/sc2.js b/app/assets/javascripts/angular/helpers/sc2.js index e9e4233..7e96edb 100644 --- a/app/assets/javascripts/angular/helpers/sc2.js +++ b/app/assets/javascripts/angular/helpers/sc2.js @@ -256,11 +256,15 @@ for (var expansion_tag in Sc2.armyUnits) { } } -// I'd rather stuff these here, than in Match +Sc2.LOTV_SPEEDUP = 1.4; -Sc2.frameToTime = function(frame) { - minute = Math.floor(frame / (60 * 16)); - second = Math.floor((frame / 16) % 60).toString(); +Sc2.frameToTime = function(frame, expansion) { + fps = 16; + if (expansion >= 2) { + fps *= Sc2.LOTV_SPEEDUP; + } + minute = Math.floor(frame / (60 * fps)); + second = Math.floor((frame / fps) % 60).toString(); if (second.length < 2) { second = "0" + second; } @@ -271,7 +275,11 @@ Sc2.timeToFrame = function(time) { parts = time.split(':'); seconds = parseInt(parts[parts.length-1]); minutes = parseInt(parts[parts.length-2]); - frame = ((minutes*60) + seconds) * 16; + fps = 16; + if (expansion >= 2) { + fps *= Sc2.LOTV_SPEEDUP; + } + frame = ((minutes*60) + seconds) * fps; return frame; } @@ -282,3 +290,4 @@ Sc2.armyInfo = function(expansion_tag, unitname, infonum) { Sc2.isArmyUnit = function(unitname) { return (unitname in Sc2.armyUnits['LotV']); } + diff --git a/app/assets/javascripts/angular/resources/match.js b/app/assets/javascripts/angular/resources/match.js index 7a795d1..3826be5 100644 --- a/app/assets/javascripts/angular/resources/match.js +++ b/app/assets/javascripts/angular/resources/match.js @@ -568,10 +568,14 @@ gg.factory('Match', ['$ggResource', '$compile', 'Matchnote', function($ggResourc statx = function(statarray) { result = []; + seconds_between_stat_updates = 10.0; + if (this.expansion_tag == 'LotV') { + seconds_between_stat_updates /= Sc2.LOTV_SPEEDUP; + } now_seconds = 0; _.each(statarray, function(stat) { result.push([now_seconds / 60.0, stat]); - now_seconds = now_seconds + 10.0; + now_seconds = now_seconds + seconds_between_stat_updates; }); // console.log("statarray", result); return result;