Skip to content
Permalink
Browse files

Bugfixes misc (#748)

* full displays overlay (#730) (#747)

* bugfix overconverting decks, flip timestamp priority

* bugfix monitor bounds

* bugfix non-unique react key

* bugfix non-unique key take 2

* bugfix draft overlays
  • Loading branch information
lusbenjamin authored and Manuel-777 committed Nov 23, 2019
1 parent 505bbec commit d92303045ff1d45a436e85d26a7ee7f29f22baa3
@@ -441,8 +441,14 @@ function updateOverlayVisibility() {
electron.screen.getAllDisplays().forEach(display => {
newBounds.x = Math.min(newBounds.x, display.bounds.x);
newBounds.y = Math.min(newBounds.y, display.bounds.y);
newBounds.width += display.bounds.width;
newBounds.height = Math.max(newBounds.height, display.bounds.height);
newBounds.width = Math.max(
newBounds.width,
display.bounds.x + display.bounds.width
);
newBounds.height = Math.max(
newBounds.height,
display.bounds.y + display.bounds.height
);
});

overlay.setBounds(newBounds);
@@ -5,41 +5,35 @@ import queue from "queue";
import ArenaLogDecoder from "./arena-log-decoder/arena-log-decoder";
import playerData from "../shared/player-data";
import {
onLabelOutLogInfo,
onLabelGreToClient,
onLabelClientToMatchServiceMessageTypeClientToGREMessage,
onLabelInEventGetPlayerCourse,
onLabelEventMatchCreated,
onLabelGetPlayerInventoryGetRewardSchedule,
onLabelGreToClient,
onLabelInEventGetCombinedRankInfo,
onLabelInEventGetPlayerCourseV2,
onLabelInEventGetPlayerCoursesV2,
onLabelInEventJoin,
onLabelInEventGetCombinedRankInfo,
onLabelInDeckGetDeckLists,
onLabelInDeckGetDeckListsV3,
onLabelInDeckGetPreconDecks,
onLabelInEventGetPlayerCourses,
onLabelInEventGetPlayerCoursesV2,
onLabelInDeckUpdateDeck,
onLabelInDeckUpdateDeckV3,
onLabelInventoryUpdatedV4,
onLabelPostMatchUpdate,
onLabelInventoryUpdated,
onLabelInPlayerInventoryGetPlayerInventory,
onLabelInPlayerInventoryGetPlayerCardsV3,
onLabelInProgressionGetPlayerProgress,
onLabelInEventDeckSubmit,
onLabelInEventDeckSubmitV3,
onLabelInEventGetActiveEvents,
onLabelEventMatchCreated,
onLabelOutDirectGameChallenge,
onLabelOutEventAIPractice,
onLabelInEventGetActiveEventsV2,
onLabelInDraftDraftStatus,
onLabelInDraftMakePick,
onLabelOutDraftMakePick,
onLabelInEventCompleteDraft,
onLabelMatchGameRoomStateChangedEvent,
onLabelInEventGetSeasonAndRankDetail,
onLabelGetPlayerInventoryGetRewardSchedule,
onLabelRankUpdated,
onLabelMatchGameRoomStateChangedEvent,
onLabelMythicRatingUpdated,
onLabelTrackProgressUpdated,
onLabelOutLogInfo,
onLabelOutDirectGameChallenge,
onLabelOutEventAIPractice,
onLabelPostMatchUpdate,
onLabelRankUpdated,
onLabelTrackRewardTierUpdated
} from "./labels";
import {
@@ -192,7 +186,7 @@ function onLogEntryFound(entry) {
try {
entrySwitch(entry);
let timestamp = entry.timestamp;
if (entry.json) {
if (!timestamp && entry.json) {
const json = entry.json();
if (json && json.timestamp) {
timestamp = json.timestamp;
@@ -234,12 +228,6 @@ function entrySwitch(entry) {
onLabelClientToMatchServiceMessageTypeClientToGREMessage(entry);
break;

case "Event.GetPlayerCourse":
if (entry.arrow == "<==") {
onLabelInEventGetPlayerCourse(entry);
}
break;

case "Event.GetPlayerCourseV2":
if (entry.arrow == "<==") {
onLabelInEventGetPlayerCourseV2(entry);
@@ -270,24 +258,12 @@ function entrySwitch(entry) {
}
break;

case "Event.GetPlayerCourses":
if (entry.arrow == "<==") {
onLabelInEventGetPlayerCourses(entry);
}
break;

case "Event.GetPlayerCoursesV2":
if (entry.arrow == "<==") {
onLabelInEventGetPlayerCoursesV2(entry);
}
break;

case "Deck.GetDeckLists":
if (entry.arrow == "<==") {
onLabelInDeckGetDeckLists(entry);
}
break;

case "Deck.GetDeckListsV3":
if (entry.arrow == "<==") {
onLabelInDeckGetDeckListsV3(entry);
@@ -300,12 +276,6 @@ function entrySwitch(entry) {
}
break;

case "Deck.UpdateDeck":
if (entry.arrow == "<==") {
onLabelInDeckUpdateDeck(entry);
}
break;

case "Deck.UpdateDeckV3":
if (entry.arrow == "<==") {
onLabelInDeckUpdateDeckV3(entry);
@@ -314,7 +284,7 @@ function entrySwitch(entry) {

case "Inventory.Updated":
// handler works for both out and in arrows
onLabelInventoryUpdatedV4(entry);
onLabelInventoryUpdated(entry);
break;

case "PostMatch.Update":
@@ -345,12 +315,6 @@ function entrySwitch(entry) {
onLabelTrackRewardTierUpdated(entry);
break;

case "Event.DeckSubmit":
if (entry.arrow == "<==") {
onLabelInEventDeckSubmit(entry);
}
break;

case "Event.DeckSubmitV3":
if (entry.arrow == "<==") {
onLabelInEventDeckSubmitV3(entry);
@@ -397,7 +361,7 @@ function entrySwitch(entry) {

case "Event.GetActiveEventsV2":
if (entry.arrow == "<==") {
onLabelInEventGetActiveEvents(entry);
onLabelInEventGetActiveEventsV2(entry);
}
break;

@@ -565,7 +565,7 @@ export function onLabelInEventGetCombinedRankInfo(entry) {
}
}

export function onLabelInEventGetActiveEvents(entry) {
export function onLabelInEventGetActiveEventsV2(entry) {
const json = entry.json();
if (!json) return;

@@ -688,12 +688,15 @@ export function onLabelInDeckGetPreconDecks(entry) {
// console.log(json);
}

export function onLabelInEventGetPlayerCourses(entry, json = false) {
json = json || entry.json();
export function onLabelInEventGetPlayerCoursesV2(entry) {
const json = entry.json();
if (!json) return;

const static_events = [];
json.forEach(course => {
if (course.CourseDeck) {
course.CourseDeck = convertDeckFromV3(course.CourseDeck);
}
if (course.CurrentEventState != "PreMatch") {
if (course.CourseDeck != null) {
addCustomDeck(course.CourseDeck);
@@ -707,46 +710,26 @@ export function onLabelInEventGetPlayerCourses(entry, json = false) {
globals.store.set("static_events", static_events);
}

export function onLabelInEventGetPlayerCoursesV2(entry) {
export function onLabelInEventGetPlayerCourseV2(entry) {
const json = entry.json();
if (!json) return;
json.forEach(course => {
if (course.CourseDeck) {
course.CourseDeck = convertDeckFromV3(course.CourseDeck);
}
});
onLabelInEventGetPlayerCourses(entry, json);
}

export function onLabelInEventGetPlayerCourse(entry, json = false) {
json = json || entry.json();
if (!json) return;
if (json.Id == "00000000-0000-0000-0000-000000000000") return;

if (json.Id != "00000000-0000-0000-0000-000000000000") {
json.date = globals.logTime;
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)
const httpApi = require("./http-api");
httpApi.httpSubmitCourse(json);
saveCourse(json);
}
select_deck(convertDeckFromV3(json));
}
}
json.date = globals.logTime;
json._id = json.Id;
delete json.Id;

export function onLabelInEventGetPlayerCourseV2(entry) {
const json = entry.json();
if (!json) return;
if (json.CourseDeck) {
json.CourseDeck = convertDeckFromV3(json.CourseDeck);
json.CourseDeck.colors = get_deck_colors(json.CourseDeck);
addCustomDeck(json.CourseDeck);
//json.date = timestamp();
//console.log(json.CourseDeck, json.CourseDeck.colors)
const httpApi = require("./http-api");
httpApi.httpSubmitCourse(json);
saveCourse(json);
select_deck(json);
}
onLabelInEventGetPlayerCourse(entry, json);
}

export function onLabelInEventJoin(entry) {
@@ -760,10 +743,11 @@ export function onLabelInEventJoin(entry) {
}
}

export function onLabelInDeckUpdateDeck(entry, json = false) {
if (!json && entry.json) json = entry.json();
export function onLabelInDeckUpdateDeckV3(entry) {
let json = entry.json();
if (!json) return;

json = convertDeckFromV3(json);
const _deck = playerData.deck(json.id);

const changeId = sha1(json.id + "-" + json.lastUpdated);
@@ -849,12 +833,6 @@ export function onLabelInDeckUpdateDeck(entry, json = false) {
setData({ decks });
}

export function onLabelInDeckUpdateDeckV3(entry) {
const json = entry.json();
if (!json) return;
onLabelInDeckUpdateDeck(entry, convertDeckFromV3(json));
}

// Given a shallow object of numbers and lists return a
// new object which doesn't contain 0s or empty lists.
function minifiedDelta(delta) {
@@ -870,7 +848,7 @@ function minifiedDelta(delta) {
}

// Called for all "Inventory.Updated" labels
export function onLabelInventoryUpdatedV4(entry) {
export function onLabelInventoryUpdated(entry) {
const transaction = entry.json();
if (!transaction) return;

@@ -881,27 +859,21 @@ export function onLabelInventoryUpdatedV4(entry) {
delta.subContext = update.context; // preserve sub-context object data
delta.context = transaction.context + "." + update.context.source;
}
onLabelInventoryUpdated(delta);
// Construct a unique ID
delta.id = sha1(JSON.stringify(delta));
// Add missing data
delta.date = globals.logTime;
// Add delta to our current values
if (delta.delta) {
inventoryAddDelta(delta.delta);
}
// Reduce the size for storage
delta.delta = minifiedDelta(delta.delta);
// Do not modify the context from now on.
saveEconomyTransaction(delta);
});
}

function onLabelInventoryUpdated(transaction) {
if (!transaction) return;
// Construct a unique ID
transaction.id = sha1(JSON.stringify(transaction));
// Add missing data
transaction.date = globals.logTime;
// Add delta to our current values
if (transaction.delta) {
inventoryAddDelta(transaction.delta);
}
// Reduce the size for storage
transaction.delta = minifiedDelta(transaction.delta);
// Do not modify the context from now on.
saveEconomyTransaction(transaction);
return;
}

function inventoryAddDelta(delta) {
const economy = playerData.economy;
economy.gems += delta.gemsDelta;
@@ -930,7 +902,7 @@ function inventoryAddDelta(delta) {
economy.wcUncommon += delta.wcUncommonDelta;
economy.wcRare += delta.wcRareDelta;
economy.wcMythic += delta.wcMythicDelta;
console.log("cardsNew", cardsNew);
// console.log("cardsNew", cardsNew);
setData({ economy, cardsNew, cards });
}

@@ -1137,16 +1109,10 @@ export function onLabelTrackRewardTierUpdated(entry) {
globals.store.set("economy", economy);
}

export function onLabelInEventDeckSubmit(entry) {
const json = entry.json();
if (!json) return;
select_deck(convertDeckFromV3(json));
}

export function onLabelInEventDeckSubmitV3(entry) {
const json = entry.json();
if (!json) return;
onLabelInEventDeckSubmit(entry, convertDeckFromV3(json));
select_deck(convertDeckFromV3(json));
}

export function onLabelEventMatchCreated(entry) {
@@ -1210,7 +1176,13 @@ export function onLabelInDraftDraftStatus(entry) {
if (!json) return;

startDraft();
const { draftId, eventName, packNumber, pickNumber, PickedCards } = json;
const {
DraftId: draftId,
EventName: eventName,
PackNumber: packNumber,
PickNumber: pickNumber,
PickedCards
} = json;
if (packNumber === 0 && pickNumber === 0 && PickedCards.length === 0) {
// ensure new drafts have clear working-space
clearDraftData(draftId);
@@ -1230,11 +1202,21 @@ export function onLabelInDraftMakePick(entry) {
const json = entry.json();
// console.log("LABEL: Make pick > ", json);
if (!json) return;
const { DraftId, eventName } = json;
const {
DraftId: draftId,
EventName: eventName,
PackNumber: packNumber,
PickNumber: pickNumber,
PickedCards: pickedCards
} = json;
startDraft();
const data = {
...getDraftData(DraftId, entry),
...json,
...getDraftData(draftId, entry),
draftId,
eventName,
packNumber,
pickNumber,
pickedCards,
currentPack: (json.DraftPack || []).slice(0)
};
data.draftId = data.id;

0 comments on commit d923030

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