Skip to content

Commit

Permalink
Merge branch release/0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasGassmann committed Dec 3, 2015
2 parents 85a8f36 + 3c819ff commit 90de3ef
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/app/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var app = angular.module('app.controllers', ['ngSanitize']);
app.controller('MainController', ['$scope', '$rootScope', '$mdDialog',
function($scope, $rootScope, $mdDialog) {
var ipc = require('ipc');

var matchClientVersionToReplayVersion = function() {
if ($scope.lolClientVersion && $scope.replay && $scope.replay.riotVersion) {
var regex = $scope.lolClientVersion.match(/(?:.*?\s)(\d+)\.(\d+)\./);
Expand All @@ -14,6 +14,7 @@ app.controller('MainController', ['$scope', '$rootScope', '$mdDialog',
}
};

$scope.ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.23.1/img/";
$scope.loading = true;
$scope.msg = "Loading...";
$scope.replay = null;
Expand Down
12 changes: 6 additions & 6 deletions src/app/tpl/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
<tr ng-repeat="player in replay.players | filter: { 'teamNr': 0 }">
<td>{{ player.summonerName }}</td>
<td style="text-align: center;">
<img style="float: left; margin-right: 2px; margin-left: 2px;" ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/champion/{{player.champion.image}}" width="48" height="48" />
<img style="float: left; margin-right: 2px; margin-left: 2px;" ng-src="{{ddragonBase}}champion/{{player.champion.image}}" width="48" height="48" />
<div style="float: left;">
<div class="spell1"><img ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/spell/{{player.d.image}}" width="23" height="23"></div>
<div class="spell2"><img ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/spell/{{player.f.image}}" width="23" height="23"></div>
<div class="spell1"><img ng-src="{{ddragonBase}}spell/{{player.d.image}}" width="23" height="23"></div>
<div class="spell2"><img ng-src="{{ddragonBase}}spell/{{player.f.image}}" width="23" height="23"></div>
</div>
</td>
<td style="text-align: center;">
Expand All @@ -64,10 +64,10 @@
</md-tooltip>
</td>
<td style="text-align: center;">
<img style="float: right; margin-right: 2px; margin-left: 2px;" ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/champion/{{player.champion.image}}" width="48" height="48" />
<img style="float: right; margin-right: 2px; margin-left: 2px;" ng-src="{{ddragonBase}}champion/{{player.champion.image}}" width="48" height="48" />
<div style="float: right;">
<div class="spell1"><img ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/spell/{{player.d.image}}" width="23" height="23"></div>
<div class="spell2"><img ng-src="http://ddragon.leagueoflegends.com/cdn/5.21.1/img/spell/{{player.f.image}}" width="23" height="23"></div>
<div class="spell1"><img ng-src="{{ddragonBase}}spell/{{player.d.image}}" width="23" height="23"></div>
<div class="spell2"><img ng-src="{{ddragonBase}}spell/{{player.f.image}}" width="23" height="23"></div>
</div>
<td style="text-align: right;">{{ player.summonerName }}</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let _ = require("underscore");
let fs = require("fs");
let winston = require("winston");

let ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.21.1/";
let ddragonBase = "http://ddragon.leagueoflegends.com/cdn/5.23.1/";
let replay = null;
let mainWindow = null;
let settings = {};
Expand Down
30 changes: 25 additions & 5 deletions src/modules/aof-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function(extLogger) {
replayMetadata.complete = buff.readUInt8(c); c += 1;
replayMetadata.endStartupChunkId = buff.readUInt8(c); c += 1;
replayMetadata.startGameChunkId = buff.readUInt8(c); c += 1;

// Read the player data
replayMetadata.players = [];
let num = buff.readUInt8(c); c += 1;
Expand All @@ -67,10 +67,20 @@ module.exports = function(extLogger) {

// Read the keyframes
replayData.keyframes = [];
num = buff.readUInt8(c); c += 1;
if (replayMetadata.version < 11) {
num = buff.readUInt8(c); c += 1;
} else {
num = buff.readUInt16BE(c); c += 2;
}
for (let i = 0; i < num; i++) {
let keyframe = {};
keyframe.id = buff.readUInt8(c); c += 1;
if (replayMetadata.version < 11) {
keyframe.id = buff.readUInt8(c); c += 1;
} else if (replayMetadata.version == 11) {
keyframe.id = i + 1; c += 1;
} else {
keyframe.id = buff.readUInt16BE(c); c += 2;
}
len = buff.readInt32BE(c); c += 4;
keyframe.data = new Buffer(len);
buff.copy(keyframe.data, 0, c, c + len); c += len;
Expand All @@ -80,10 +90,20 @@ module.exports = function(extLogger) {

// Read the chunks
replayData.chunks = [];
num = buff.readUInt8(c); c += 1;
if (replayMetadata.version < 11) {
num = buff.readUInt8(c); c += 1;
} else {
num = buff.readUInt16BE(c); c += 2;
}
for (let i = 0; i < num; i++) {
let chunk = {};
chunk.id = buff.readUInt8(c); c += 1;
if (replayMetadata.version < 11) {
chunk.id = buff.readUInt8(c); c += 1;
} else if (replayMetadata.version == 11) {
chunk.id = i + 1; c += 1;
} else {
chunk.id = buff.readUInt16BE(c); c += 2;
}
len = buff.readInt32BE(c); c += 4;
chunk.data = new Buffer(len);
buff.copy(chunk.data, 0, c, c + len); c += len;
Expand Down
8 changes: 5 additions & 3 deletions src/modules/lol-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let _ = require("underscore");
let domain = require("domain");
let logger;

const INTERNAL_PATH = "/solutions/lol_game_client_sln/releases/";

let leaguePath = false;
let fullPath = false;
let leagueVersion = "";
Expand Down Expand Up @@ -66,14 +68,14 @@ function checkPath(callback) {
callback(false);
};

fs.readdir(leaguePath + "/solutions/lol_game_client_sln/releases/", function(err, files) {
fs.readdir(leaguePath + INTERNAL_PATH, function(err, files) {
if (err) {
errorCallback(err);
} else {
files.sort(function(a, b) {
return fs.statSync(leaguePath + b).mtime.getTime() - fs.statSync(leaguePath + a).mtime.getTime();
return fs.statSync(leaguePath + INTERNAL_PATH + b).mtime.getTime() - fs.statSync(leaguePath + INTERNAL_PATH + a).mtime.getTime();
});
fullPath = leaguePath + "/solutions/lol_game_client_sln/releases/" + files[0] + "/deploy/";
fullPath = leaguePath + INTERNAL_PATH + files[0] + "/deploy/";

fs.readdir(fullPath, function(err, files) {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aof-replay-client",
"version": "0.1.5",
"version": "0.1.6",
"main": "./index.js",
"scripts": {
"start": "cd .. && npm start",
Expand Down

0 comments on commit 90de3ef

Please sign in to comment.