Permalink
Browse files

ranks update

  • Loading branch information...
Manuel-777 committed Dec 15, 2018
1 parent 1f0086f commit a747aa2f423d444695cf06a454d5d9255ce24d0b
BIN +287 Bytes (110%) images/ranks_16.png
Binary file not shown.
BIN -22.2 KB images/ranks_32.png
Binary file not shown.
BIN -31.3 KB images/ranks_48.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
"description": "An MTG Arena deck tracker and statistics manager.",
"author": "Manuel-777",
"repository": "https://github.com/Manuel-777/MTG-Arena-Tool",
"version": "2.2.2",
"version": "2.2.3",
"main": "main.js",
"build": {
"appId": "com.github.manuel777.mtgatool",
@@ -219,24 +219,26 @@ function addCardHover(div, _card) {
//
function get_rank_index(_rank, _tier) {
var ii = 0;
if (_rank == "Beginner") ii = 0;
if (_rank == "Bronze") ii = 1 + _tier;
if (_rank == "Silver") ii = 6 + _tier;
if (_rank == "Gold") ii = 11 + _tier;
if (_rank == "Diamond") ii = 16 + _tier;
if (_rank == "Master") ii = 21;
if (_rank == "Unranked") ii = 0;
if (_rank == "Bronze") ii = 1 + (_tier-1);//1 2 3 4
if (_rank == "Silver") ii = 5 + (_tier-1);//5 6 7 8
if (_rank == "Gold") ii = 9 + (_tier-1);//9 0 1 2
if (_rank == "Platinum") ii = 13 + (_tier-1);//3 4 5 6
if (_rank == "Diamond") ii = 17 + (_tier-1);//7 8 9 0
if (_rank == "Mythic") ii = 21 + (_tier-1);//1 2 3 4
return ii;
}

//
function get_rank_index_16(_rank) {
var ii = 0;
if (_rank == "Beginner") ii = 0;
if (_rank == "Bronze") ii = 1;
if (_rank == "Unranked") ii = 0;
if (_rank == "Bronze") ii = 1;
if (_rank == "Silver") ii = 2;
if (_rank == "Gold") ii = 3;
if (_rank == "Diamond") ii = 4;
if (_rank == "Master") ii = 5;
if (_rank == "Platinum") ii = 4;
if (_rank == "Diamond") ii = 5;
if (_rank == "Mythic") ii = 6;
return ii;
}

@@ -118,8 +118,10 @@ var matchBeginTime = 0;
var arenaVersion = '';
var playerUsername = '';
var playerName = null;
var playerRank = null;
var playerTier = null;
var playerConstructedRank = null;
var playerConstructedTier = null;
var playerLimitedRank = null;
var playerLimitedTier = null;
var playerId = null;
var playerSeat = null;
var playerWin = 0;
@@ -988,54 +990,56 @@ function processLogData(data) {
strCheck = 'ClientToMatchServiceMessageType_ClientToGREMessage';
json = checkJson(data, strCheck, '');
if (json != false) {
if (json.payload.type !== undefined) {
// Get sideboard changes
if (json.payload.type == "ClientMessageType_SubmitDeckResp") {

let tempMain = {};
let tempSide = {};
json.payload.submitDeckResp.deck.deckCards.forEach( function (grpId) {
if (tempMain[grpId] == undefined) {
tempMain[grpId] = 1
}
else {
tempMain[grpId] += 1;
}
});
if (json.payload.submitDeckResp.deck.sideboardCards !== undefined) {
json.payload.submitDeckResp.deck.sideboardCards.forEach( function (grpId) {
if (tempSide[grpId] == undefined) {
tempSide[grpId] = 1
if (json.payload) {
if (json.payload.type !== undefined) {
// Get sideboard changes
if (json.payload.type == "ClientMessageType_SubmitDeckResp") {

let tempMain = {};
let tempSide = {};
json.payload.submitDeckResp.deck.deckCards.forEach( function (grpId) {
if (tempMain[grpId] == undefined) {
tempMain[grpId] = 1
}
else {
tempSide[grpId] += 1;
tempMain[grpId] += 1;
}
});
}

var newDeck = {}
newDeck.mainDeck = [];
Object.keys(tempMain).forEach(function(key) {
var c = {"id": key, "quantity": tempMain[key]};
newDeck.mainDeck.push(c);
});
if (json.payload.submitDeckResp.deck.sideboardCards !== undefined) {
json.payload.submitDeckResp.deck.sideboardCards.forEach( function (grpId) {
if (tempSide[grpId] == undefined) {
tempSide[grpId] = 1
}
else {
tempSide[grpId] += 1;
}
});
}

newDeck.sideboard = [];
if (json.payload.submitDeckResp.deck.sideboardCards !== undefined) {
Object.keys(tempSide).forEach(function(key) {
var c = {"id": key, "quantity": tempSide[key]};
newDeck.sideboard.push(c);
var newDeck = {}
newDeck.mainDeck = [];
Object.keys(tempMain).forEach(function(key) {
var c = {"id": key, "quantity": tempMain[key]};
newDeck.mainDeck.push(c);
});
}

//get_deck_sideboarded(currentDeck, newDeck)
//select_deck(newDeck);
currentDeck = newDeck;
ipc_send("set_deck", currentDeck, windowOverlay);
//console.log(JSON.stringify(currentDeck));
//console.log(currentDeck);
newDeck.sideboard = [];
if (json.payload.submitDeckResp.deck.sideboardCards !== undefined) {
Object.keys(tempSide).forEach(function(key) {
var c = {"id": key, "quantity": tempSide[key]};
newDeck.sideboard.push(c);
});
}

//get_deck_sideboarded(currentDeck, newDeck)
//select_deck(newDeck);
currentDeck = newDeck;
ipc_send("set_deck", currentDeck, windowOverlay);
//console.log(JSON.stringify(currentDeck));
//console.log(currentDeck);
}
}
}
}
return;
}

@@ -1109,12 +1113,18 @@ function processLogData(data) {
strCheck = '<== Event.GetCombinedRankInfo(';
json = checkJsonWithStart(data, strCheck, '', ')');
if (json != false) {
playerRank = json.constructedClass;
playerTier = json.constructedTier;
playerConstructedRank = json.constructedClass;
playerConstructedTier = json.constructedLevel;
playerLimitedRank = json.limitedClass;
playerLimitedTier = json.limitedLevel;

let rank;
rank = get_rank_index(playerConstructedRank, playerConstructedTier);
ipc_send("set_constructed_rank", {rank: rank, str: playerConstructedRank+" "+playerConstructedTier});

let rank = get_rank_index(playerRank, playerTier);
rank = get_rank_index(playerLimitedRank, playerLimitedTier);
ipc_send("set_limited_rank", {rank: rank, str: playerLimitedRank+" "+playerLimitedTier});

ipc_send("set_rank", {rank: rank, str: playerRank+" "+playerTier});
return;
}

@@ -2138,18 +2148,6 @@ function update_deck(force) {
}
}

//
function get_rank_index(_rank, _tier) {
var ii = 0;
if (_rank == "Beginner") ii = 0;
if (_rank == "Bronze") ii = 1 + _tier;
if (_rank == "Silver") ii = 6 + _tier;
if (_rank == "Gold") ii = 11 + _tier;
if (_rank == "Diamond") ii = 16 + _tier;
if (_rank == "Master") ii = 21;
return ii;
}

//
function forceDeckUpdate() {
var decksize = 0;
@@ -2348,8 +2346,8 @@ function saveMatch() {
}
match.player = {
name: playerName,
rank: playerRank,
tier: playerTier,
rank: playerConstructedRank,
tier: playerConstructedTier,
userid: playerId,
seat: playerSeat,
win: playerWin
@@ -2443,7 +2441,7 @@ function finishLoading() {
ipc_send("renderer_set_bounds", obj);

if (playerName != null) {
httpSetPlayer(playerName, playerRank, playerTier);
httpSetPlayer(playerName, playerConstructedRank, playerConstructedTier, playerLimitedRank, playerLimitedTier);
}
}

@@ -216,13 +216,23 @@ span i {
}


.top_rank {
.top_constructed_rank {
-webkit-app-region: no-drag;
align-self: center;
margin-left: 16px;
width: 48px;
height: 48px;
background: url(../images/ranks_48.png);
background: url(../images/ranks_constructed_48.png);
background-position: 0px 0px;
}

.top_limited_rank {
-webkit-app-region: no-drag;
align-self: center;
margin-left: 16px;
width: 48px;
height: 48px;
background: url(../images/ranks_limited_48.png);
background-position: 0px 0px;
}

@@ -232,7 +242,7 @@ span i {
margin-left: 16px;
width: 48px;
height: 48px;
background: url(../images/ranks_48.png);
background: url(../images/ranks_constructed_48.png);
background-position: 0px 0px;
}

@@ -49,7 +49,8 @@
<div class="flex_item" style="margin-left: auto;">
<div class="top_status"></div>
<div class="top_status_pop"></div>
<div class="top_rank" ></div>
<div class="top_constructed_rank" ></div>
<div class="top_limited_rank" ></div>
<div class="top_username"></div>
<div class="top_username_id"></div>
</div>
@@ -173,11 +173,20 @@ ipc.on('set_username', function (event, arg) {
});

//
ipc.on('set_rank', function (event, offset, rank) {
rankOffset = offset;
rankTitle = rank;
ipc.on('set_constructed_rank', function (event, _rank) {
rankOffset = _rank.rank;
rankTitle = _rank.str;
if (sidebarActive != -99) {
$(".top_rank").css("background-position", (rankOffset*-48)+"px 0px").attr("title", rankTitle);
$(".top_constructed_rank").css("background-position", (rankOffset*-48)+"px 0px").attr("title", rankTitle);
}
});

//
ipc.on('set_limited_rank', function (event, _rank) {
rankOffset = _rank.rank;
rankTitle = _rank.str;
if (sidebarActive != -99) {
$(".top_limited_rank").css("background-position", (rankOffset*-48)+"px 0px").attr("title", rankTitle);
}
});

0 comments on commit a747aa2

Please sign in to comment.