Skip to content
Permalink
Browse files

read deck from GRE

  • Loading branch information...
Manuel-777 committed Sep 18, 2019
1 parent 4cf26b8 commit 349fd3c5a2d3f6fa69a4e65378e57a1e50bfe4e8
Showing with 15 additions and 2 deletions.
  1. +1 −1 window_background/background.js
  2. +14 −1 window_background/gre-to-client-interpreter.js
@@ -153,7 +153,7 @@ var tokenAuth = undefined;

var currentMatch = null;

var originalDeck = new Deck();
var originalDeck = null;

var currentDeck = new Deck();
var duringMatch = false;
@@ -16,9 +16,10 @@ global
*/
const { IPC_OVERLAY } = require("../shared/constants.js");
const { objectClone } = require("../shared/util");

const { ipc_send } = require("./background-util");

const Deck = require("../shared/deck");

let actionType = [];
actionType[0] = "ActionType_None";
actionType[1] = "ActionType_Cast";
@@ -552,6 +553,18 @@ GREMessages.GREMessageType_QueuedGameStateMessage = function(msg) {
GREMessages.GREMessageType_GameStateMessage(msg);
};

GREMessages.GREMessageType_ConnectResp = function(msg) {
if (
msg.connectResp.deckMessage.deckCards &&
currentMatch.player.originalDeck == null
) {
let deck = new Deck({}, msg.connectResp.deckMessage.deckCards);
currentMatch.player.originalDeck = deck;
currentMatch.player.deck = deck.clone();
currentMatch.playerCardsLeft = deck.clone();
}
};

GREMessages.GREMessageType_GameStateMessage = function(msg) {
if (
!currentMatch.msgId ||

0 comments on commit 349fd3c

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