Permalink
Browse files

Display cards aetherized

(that go to the vault)
  • Loading branch information...
Manuel-777 committed Nov 2, 2018
1 parent df2c349 commit 0e8c030c5d418f0f0961157b2cf24754b517d032
Showing with 42 additions and 200 deletions.
  1. +4 −1 window_main/index.css
  2. +38 −199 window_main/renderer.js
@@ -815,13 +815,16 @@ a:hover {
box-shadow: 0 5px 14px 2px rgba(0, 0, 0, 0.25);
}
.inventory_card_img {
cursor: pointer;
-webkit-border-radius: 4.75% / 3.5%;
box-shadow: 0 5px 14px 2px rgba(0, 0, 0, 0.25);
}
.inventory_card_aetherized {
filter: brightness(0.5) grayscale(1);
}
.inventory_card_img:hover {
border: 2px solid rgba(250, 229, 210, 0.66);
margin: -2px 0 -2px -2px;
@@ -799,6 +799,7 @@ function setEconomy(loadMore) {
checkGoldPaid = false;
checkCardsAdded = false;
checkBoosterAdded = false;
checkAetherized = false;
checkWildcardsAdded = false;
checkGemsEarnt = false;
checkGoldEarnt = false;
@@ -824,12 +825,14 @@ function setEconomy(loadMore) {
checkWildcardsAdded = true;
checkCardsAdded = true;
checkAetherized = true;
}
else if (change.context == "Store") {
checkGemsPaid = true;
checkGoldPaid = true;
checkBoosterAdded = true;
checkCardsAdded = true;
checkAetherized = true;
}
else if (change.context == "Pay Event Entry") {
checkGemsPaid = true;
@@ -855,13 +858,15 @@ function setEconomy(loadMore) {
flb.appendChild(bos);
}
checkCardsAdded = true;1
checkCardsAdded = true;
checkAetherized = true;
}
else {
checkGemsEarnt = true;
checkGoldEarnt = true;
checkBoosterAdded = true;
checkCardsAdded = true;
checkAetherized = true;
checkWildcardsAdded = true;
}
@@ -998,6 +1003,38 @@ function setEconomy(loadMore) {
}
}
if (checkAetherized && change.aetherizedCards != undefined) {
change.aetherizedCards.forEach(function(obj) {
var grpId = obj.grpId;
var card = cardsDb.get(grpId);
var d = document.createElement("div");
d.classList.add("inventory_card");
d.style.width = "39px";
var img = document.createElement("img");
img.classList.add("inventory_card_img");
img.classList.add("inventory_card_aetherized");
img.style.width = "39px";
img.src = "https://img.scryfall.com/cards"+card.images[cardQuality];
d.appendChild(img);
flr.appendChild(d);
var imgDom = $(img);
addCardHover(imgDom, card);
imgDom.on('click', function(e) {
if (cardsDb.get(grpId).dfc == 'SplitHalf') {
card = cardsDb.get(card.dfcId);
}
let newname = card.name.split(' ').join('-');
shell.openExternal('https://scryfall.com/card/'+get_set_scryfall(card.set)+'/'+card.cid+'/'+card.name);
});
});
}
if (checkCardsAdded && change.delta.cardsAdded != undefined) {
change.delta.cardsAdded.sort(collectionSortRarity);
change.delta.cardsAdded.forEach(function(grpId) {
@@ -2846,204 +2883,6 @@ function open_match(id) {
}
//
function open_economy() {
$("#ux_0").html('');
$("#ux_1").html('');
var div = $('<div class="economy"></div>');
$('<div class="chart_container"><canvas id="goldChart"></canvas></div>').appendTo(div);
$('<div class="chart_container"><canvas id="wildcardsChart"></canvas></div>').appendTo(div);
$('<div class="chart_container"><canvas id="gemsChart"></canvas></div>').appendTo(div);
$("#ux_0").append(div);
$("#ux_0").removeClass("flex_item");
// Set gold chart
var labels = [];
var data = [];
goldHistory.forEach(function(item) {
var date = new Date(item.date);
labels.push(date);
data.push(item.value);
});
Chart.defaults.global.defaultFontColor="rgb(250, 229, 210)";
var ctx = document.getElementById("goldChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Gold',
data: data,
type: 'line',
fill: true,
backgroundColor: [
'rgba(221, 130, 99, 0.5)',
],
borderColor: [
'rgba(221, 130, 99, 0.5)',
]
}]
},
options: {
responsive: true,
elements: {
line: {
tension: 0.000001
}
},
scales: {
xAxes: [{
type: 'time',
distribution: 'series',
display: true,
time: {
unit: 'day'
},
ticks: {
source: 'labels'
}
}],
yAxes: [{
display: true
}]
}
}
});
// Set wildcards chart
wcCommon = [];
wcUncommon = [];
wcRare = [];
wcMythic = [];
labels = [];
wildcardHistory.forEach(function(item) {
var date = new Date(item.date);
labels.push(date);
wcCommon.push(item.value.wcCommon);
wcUncommon.push(item.value.wcUncommon);
wcRare.push(item.value.wcRare);
wcMythic.push(item.value.wcMythic);
});
var ctx = document.getElementById("wildcardsChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Common',
data: wcCommon,
type: 'line',
borderColor: [
'rgba(255, 255, 255, 0.5)',
]
},{
label: 'Uncommon',
data: wcUncommon,
type: 'line',
borderColor: [
'rgba(166, 206, 255, 0.5)',
]
},{
label: 'Rare',
data: wcRare,
type: 'line',
fill: true,
borderColor: [
'rgba(255, 186, 0, 0.5)',
]
},{
label: 'Mythic Rare',
data: wcMythic,
type: 'line',
fill: true,
borderColor: [
'rgba(255, 27, 0, 0.5)',
]
}]
},
options: {
responsive: true,
elements: {
line: {
tension: 0.000001
}
},
scales: {
xAxes: [{
type: 'time',
distribution: 'series',
time: {
unit: 'day'
},
ticks: {
source: 'labels'
}
}],
yAxes: [{
display: true
}]
}
}
});
// Set gems chart
labels = [];
data = [];
gemsHistory.forEach(function(item) {
var date = new Date(item.date);
labels.push(date);
data.push(item.value);
});
var ctx = document.getElementById("gemsChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'gems',
data: data,
type: 'line',
fill: true,
backgroundColor: [
'rgba(183, 200, 158, 0.5)',
],
borderColor: [
'rgba(183, 200, 158, 0.5)',
]
}]
},
options: {
responsive: true,
elements: {
line: {
tension: 0.000001
}
},
scales: {
xAxes: [{
type: 'time',
distribution: 'series',
time: {
unit: 'day'
},
ticks: {
source: 'labels'
}
}],
yAxes: [{
display: true
}]
}
}
});
}
//
function open_cards() {
$("#ux_0").html('');

0 comments on commit 0e8c030

Please sign in to comment.