Skip to content
Permalink
Browse files

Draft decks not showing up

Tested with draft, should work with other events as well
  • Loading branch information...
Manuel-777 committed May 4, 2019
1 parent 040acea commit 2e84fc18950d3a51036846e0b7d53f0063b4e4ed
Showing with 40 additions and 34 deletions.
  1. +11 −0 window_background/background.js
  2. +29 −34 window_background/labels.js
@@ -1457,6 +1457,17 @@ function getNameBySeat(seat) {
}
}

//
function addCustomDeck(customDeck) {
if (decks.index.indexOf(customDeck.id) == -1) {
decks.index.push(customDeck.id);
}
decks[customDeck.id] = customDeck;
updateCustomDecks();
store.set("decks_index", decks.index);
store.set("decks." + customDeck.id, customDeck);
}

//
function updateCustomDecks() {
decks.index.forEach(_deckid => {
@@ -179,33 +179,6 @@ function onLabelClientToMatchServiceMessageTypeClientToGREMessage(entry, json) {
}
}

function onLabelInEventGetPlayerCourse(entry, json) {
if (!json) return;

if (json.Id != "00000000-0000-0000-0000-000000000000") {
json.date = parseWotcTime(entry.timestamp);
json._id = json.Id;
delete json.Id;

if (json.CourseDeck) {
json.CourseDeck.colors = get_deck_colors(json.CourseDeck);
//json.date = timestamp();
//console.log(json.CourseDeck, json.CourseDeck.colors)
httpApi.httpSubmitCourse(json);
saveCourse(json);
}
select_deck(json);
}
}

function onLabelInEventGetPlayerCourseV2(entry, json) {
if (!json) return;
if (json.CourseDeck) {
json.CourseDeck = convert_deck_from_v3(json.CourseDeck);
}
onLabelInEventGetPlayerCourse(entry, json);
}

function onLabelInEventGetCombinedRankInfo(entry, json) {
if (!json) return;

@@ -283,13 +256,7 @@ function onLabelInEventGetPlayerCourses(entry, json) {
json.forEach(course => {
if (course.CurrentEventState != "PreMatch") {
if (course.CourseDeck != null) {
if (decks.index.indexOf(course.CourseDeck.id) == -1) {
decks.index.push(course.CourseDeck.id);
}
decks[course.CourseDeck.id] = course.CourseDeck;
updateCustomDecks();
store.set("decks_index", decks.index);
store.set("decks." + course.CourseDeck.id, course.CourseDeck);
addCustomDeck(course.CourseDeck)
}
}
});
@@ -305,6 +272,34 @@ function onLabelInEventGetPlayerCoursesV2(entry, json) {
onLabelInEventGetPlayerCourses(entry, json);
}

function onLabelInEventGetPlayerCourse(entry, json) {
if (!json) return;

if (json.Id != "00000000-0000-0000-0000-000000000000") {
json.date = parseWotcTime(entry.timestamp);
json._id = json.Id;
delete json.Id;

if (json.CourseDeck) {
json.CourseDeck.colors = get_deck_colors(json.CourseDeck);
addCustomDeck(json.CourseDeck);
//json.date = timestamp();
//console.log(json.CourseDeck, json.CourseDeck.colors)
httpApi.httpSubmitCourse(json);
saveCourse(json);
}
select_deck(json);
}
}

function onLabelInEventGetPlayerCourseV2(entry, json) {
if (!json) return;
if (json.CourseDeck) {
json.CourseDeck = convert_deck_from_v3(json.CourseDeck);
}
onLabelInEventGetPlayerCourse(entry, json);
}

function onLabelInDeckUpdateDeck(entry, json) {
if (!json) return;
logTime = parseWotcTime(entry.timestamp);

0 comments on commit 2e84fc1

Please sign in to comment.
You can’t perform that action at this time.