Skip to content
Permalink
Browse files

setting for first pass skip

  • Loading branch information...
Manuel-777 committed Feb 4, 2019
1 parent d76ee05 commit 46ad5ed0b33df7aac27dab44dac4e581979bb795
Showing with 155 additions and 125 deletions.
  1. +9 −4 window_background/arena-log-watcher.js
  2. +129 −118 window_background/background.js
  3. +6 −0 window_main/index.css
  4. +11 −3 window_main/renderer.js
@@ -48,10 +48,15 @@ function start({ path, chunkSize, onLogEntry, onError, onFinish }) {
position = 0;
}
while (position < size) {
const buffer = await readChunk(path, position, Math.min(size - position, chunkSize));
const text = stringDecoder.write(buffer);
logDecoder.append(text, entry => onLogEntry({ ...entry, size }));
position += buffer.length;
if (!skipFirstPass) {
const buffer = await readChunk(path, position, Math.min(size - position, chunkSize));
const text = stringDecoder.write(buffer);
logDecoder.append(text, entry => onLogEntry({ ...entry, size }));
position += buffer.length;
}
else {
position = size;
}
}
onFinish();
}
@@ -692,6 +692,10 @@ function loadPlayerConfig(playerId) {
ipc_send("set_tags_colors", tags_colors);
ipc_send("overlay_set_bounds", obj);

ipc_send("set_cards", {cards: entireConfig.cards.cards, new: {}});

sendEconomy();

loadSettings();
requestHistorySend(0);

@@ -705,12 +709,15 @@ function updateSettings(_settings, relay) {
//console.log(_settings);
//const exeName = path.basename(process.execPath);

if (_settings.overlay_top == undefined) _settings.overlay_top = true;
if (_settings.overlay_title == undefined) _settings.overlay_title = true;
if (_settings.overlay_deck == undefined) _settings.overlay_deck = true;
if (_settings.overlay_clock == undefined) _settings.overlay_clock = true;
if (_settings.overlay_ontop == undefined) _settings.overlay_ontop = true;
if (_settings.overlay_scale == undefined) _settings.overlay_scale = 100;
if (_settings.overlay_top == undefined) _settings.overlay_top = true;
if (_settings.overlay_title == undefined) _settings.overlay_title = true;
if (_settings.overlay_deck == undefined) _settings.overlay_deck = true;
if (_settings.overlay_clock == undefined) _settings.overlay_clock = true;
if (_settings.overlay_ontop == undefined) _settings.overlay_ontop = true;
if (_settings.overlay_scale == undefined) _settings.overlay_scale = 100;
if (_settings.skip_firstpass == undefined) _settings.skip_firstpass = false;

skipFirstPass = _settings.skip_firstpass;

ipc_send("overlay_set_ontop", _settings.overlay_ontop);

@@ -785,6 +792,7 @@ function startWatchingLog() {
}

let skipMatch = false;
let skipFirstPass = false;

function onLogEntryFound(entry) {
if (debugLog) {
@@ -805,142 +813,144 @@ function onLogEntryFound(entry) {
if (firstPass) {
updateLoading(entry);
}
switch (entry.label) {
case "Log.Info":
if (entry.arrow == "==>") {
json = entry.json();
onLabelOutLogInfo(entry, json);
}
break;

case "GreToClientEvent":
json = entry.json();
onLabelGreToClient(entry, json);
break;

case "ClientToMatchServiceMessageType_ClientToGREMessage":
json = entry.json();
onLabelClientToMatchServiceMessageTypeClientToGREMessage(entry, json);
break;
if ((firstPass && !skipFirstPass) || (!firstPass) ) {
switch (entry.label) {
case "Log.Info":
if (entry.arrow == "==>") {
json = entry.json();
onLabelOutLogInfo(entry, json);
}
break;

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

case "Event.GetCombinedRankInfo":
if (entry.arrow == "<==") {
case "ClientToMatchServiceMessageType_ClientToGREMessage":
json = entry.json();
onLabelInEventGetCombinedRankInfo(entry, json);
}
break;
onLabelClientToMatchServiceMessageTypeClientToGREMessage(entry, json);
break;

case "Rank.Updated": {
json = entry.json();
onLabelRankUpdated(entry, json);
}
break;
case "Event.GetPlayerCourse":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventGetPlayerCourse(entry, json);
}
break;

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

case "Deck.GetDeckLists":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInDeckGetDeckLists(entry, json);
}
break;
case "Event.GetCombinedRankInfo":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventGetCombinedRankInfo(entry, json);
}
break;

case "Deck.UpdateDeck":
if (entry.arrow == "<==") {
case "Rank.Updated": {
json = entry.json();
onLabelInDeckUpdateDeck(entry, json);
onLabelRankUpdated(entry, json);
}
break;
break;

case "Inventory.Updated":
json = entry.json();
onLabelInventoryUpdated(entry, json);
break;
case "Event.GetPlayerCourses":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventGetPlayerCourses(entry, json);
}
break;

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

case "PlayerInventory.GetPlayerInventory":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInPlayerInventoryGetPlayerInventory(entry, json);
}
break;
case "Deck.UpdateDeck":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInDeckUpdateDeck(entry, json);
}
break;

case "PlayerInventory.GetPlayerCardsV3":
if (entry.arrow == "<==") {
case "Inventory.Updated":
json = entry.json();
onLabelInPlayerInventoryGetPlayerCardsV3(entry, json);
}
break;
onLabelInventoryUpdated(entry, json);
break;

case "Event.DeckSubmit":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventDeckSubmit(entry, json);
}
break;
case "PlayerInventory.GetPlayerInventory":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInPlayerInventoryGetPlayerInventory(entry, json);
}
break;

case "Event.MatchCreated":
json = entry.json();
onLabelEventMatchCreated(entry, json);
break;
case "PlayerInventory.GetPlayerCardsV3":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInPlayerInventoryGetPlayerCardsV3(entry, json);
}
break;

case "DirectGame.Challenge":
if (entry.arrow == "==>") {
json = entry.json();
onLabelOutDirectGameChallenge(entry, json);
}
break;
case "Event.DeckSubmit":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventDeckSubmit(entry, json);
}
break;

case "Draft.DraftStatus":
if (entry.arrow == "<==") {
case "Event.MatchCreated":
json = entry.json();
onLabelInDraftDraftStatus(entry, json);
}
break;
onLabelEventMatchCreated(entry, json);
break;

case "Draft.MakePick":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInDraftMakePick(entry, json);
}
else {
json = entry.json();
onLabelOutDraftMakePick(entry, json);
}
break;
case "DirectGame.Challenge":
if (entry.arrow == "==>") {
json = entry.json();
onLabelOutDirectGameChallenge(entry, json);
}
break;

case "Event.CompleteDraft":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventCompleteDraft(entry, json);
}
break;
case "Draft.DraftStatus":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInDraftDraftStatus(entry, json);
}
break;

case "Draft.MakePick":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInDraftMakePick(entry, json);
}
else {
json = entry.json();
onLabelOutDraftMakePick(entry, json);
}
break;

case "MatchGameRoomStateChangedEvent":
json = entry.json();
onLabelMatchGameRoomStateChangedEvent(entry, json);
break;
case "Event.CompleteDraft":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventCompleteDraft(entry, json);
}
break;

case "Event.GetSeasonAndRankDetail":
if (entry.arrow == "<==") {
case "MatchGameRoomStateChangedEvent":
json = entry.json();
onLabelInEventGetSeasonAndRankDetail(entry, json);
}
break;
onLabelMatchGameRoomStateChangedEvent(entry, json);
break;

default:
break;
case "Event.GetSeasonAndRankDetail":
if (entry.arrow == "<==") {
json = entry.json();
onLabelInEventGetSeasonAndRankDetail(entry, json);
}
break;

default:
break;
}
}
}
}
@@ -1025,6 +1035,7 @@ function processLogUser(rawString) {
strCheck = '"PlayerScreenName":"';
if (value.indexOf(strCheck) > -1) {
playerName = dataChop(value, strCheck, '"');
ipc_send("set_username", playerName);
ipc_send("init_login", playerName);
ipc_send("ipc_log", 'Arena screen name: '+playerName);
}
@@ -2258,6 +2258,12 @@ a:hover {
display: none;
}

.settings_note {
color: rgba(250, 229, 210, 1);
font-size: 14px;
margin: 0px 64px 20px 16px !important;
}

.deck_visual_stats {
padding: 0 !important;
margin: 32px !important;
@@ -2040,6 +2040,11 @@ function open_settings(openSection) {
section.append('<div class="settings_title">Behaviour</div>');

add_checkbox(section, 'Launch on startup', 'settings_startup', settings.startup);
add_checkbox(section, 'Read log on login', 'settings_readlogonlogin', !settings.skip_firstpass);
section.append(`
<div class="settings_note">
<i>Reading the log on startup can take a while, disabling this will make mtgatool load instantly, but you may have have to play with Arena to load some data, like Rank, wildcards and decklists. <b>This feature makes mtgatool read games when it was closed.</b></i>
</div>`);
add_checkbox(section, 'Close main window on match found', 'settings_closeonmatch', settings.close_on_match);
add_checkbox(section, 'Close to tray', 'settings_closetotray', settings.close_to_tray);
add_checkbox(section, 'Sound when priority changes', 'settings_soundpriority', settings.sound_priority);
@@ -2052,7 +2057,9 @@ function open_settings(openSection) {
export_input.appendTo(icd);
icd.appendTo(label);

section.append('<label style="color: rgba(250, 229, 210, 0.75); font-size: 14px; margin-left: 16px;"><i>Possible variables: $Name, $Count, $SetName, $SetCode, $Collector, $Rarity, $Type, $Cmc</i></label>');
section.append(`<div class="settings_note">
<i>Possible variables: $Name, $Count, $SetName, $SetCode, $Collector, $Rarity, $Type, $Cmc</i>
</div>`);


section = $('<div class="settings_section ss2"></div>');
@@ -2448,6 +2455,7 @@ function eraseData() {
//
function updateSettings() {
var startup = document.getElementById("settings_startup").checked;
var readonlogin = document.getElementById("settings_readlogonlogin").checked;
var showOverlay = document.getElementById("settings_showoverlay").checked;
var showOverlayAlways = document.getElementById("settings_showoverlayalways").checked;
var soundPriority = document.getElementById("settings_soundpriority").checked;
@@ -2474,7 +2482,6 @@ function updateSettings() {
var overlaySideboard = document.getElementById("settings_overlay_sideboard").checked;

var exportFormat = document.getElementById("settings_export_format").value;

settings = {
sound_priority: soundPriority,
show_overlay: showOverlay,
@@ -2497,7 +2504,8 @@ function updateSettings() {
anon_explore: anonExplore,
back_color: backColor,
back_url: backUrl,
export_format: exportFormat
export_format: exportFormat,
skip_firstpass: !readonlogin
};
cardSize = 100+(cardSizePos*10);
ipc_send('save_settings', settings);

0 comments on commit 46ad5ed

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