def dispatch_blob(blob): seq = blob.get("block_title_sequence", -1) log_line = blob.get("log_line", -1) if seq: app.mtga_app.mtga_logger.debug("{}dispatching seq ({}) / log_line {}".format(util.ld(), seq, log_line)) if "method" in blob and "jsonrpc" in blob: dispatch_jsonrpc_method(blob) elif "greToClientEvent" in blob: dispatch_gre_to_client(blob) elif "clientToGreMessage" in blob: dispatch_client_to_gre(blob) elif "Deck.GetDeckLists" in blob: # this looks like it's a response to a jsonrpc method parsers.parse_get_decklists(blob) elif "block_title" in blob and (blob["block_title"] == "Event.DeckSubmit" or blob["block_title"] == "Event.GetPlayerCourse"): parsers.parse_event_decksubmit(blob) elif "block_title" in blob and blob["block_title"] == "PlayerInventory.GetPlayerCardsV3": parsers.parse_get_player_cards_v3(blob) elif "block_title" in blob and (blob["block_title"] == "Draft.DraftStatus" or blob["block_title"] == "Draft.MakePick"): parsers.parse_draft_status(blob) # PlayerInventory.GetPlayerInventory elif "block_title" in blob and blob["block_title"] == "PlayerInventory.GetPlayerInventory": parsers.pass_through("inventory", blob["playerId"], blob) elif "block_title" in blob and blob["block_title"] == "Rank.Updated": parsers.pass_through("rank_change", blob["playerId"], blob) elif "block_title" in blob and blob["block_title"] == "Inventory.Updated": parsers.pass_through("inventory_update", None, blob) elif ("block_title" in blob and blob["block_title"] == "ClientToMatchServiceMessageType_ClientToGREMessage" and "Payload" in blob and "SubmitDeckResp" in blob['Payload']): parsers.parse_sideboard_submit(blob) elif "matchGameRoomStateChangedEvent" in blob: dispatch_match_gametoom_state_change(blob) elif "block_title" in blob and blob["block_title"] == "Event.MatchCreated": parsers.parse_match_created(blob)
def dispatch_blob(blob): seq = blob.get("block_title_sequence", -1) log_line = blob.get("log_line", -1) if seq: app.mtga_app.mtga_logger.debug( "{}dispatching seq ({}) / log_line {}".format( util.ld(), seq, log_line)) if "method" in blob and "jsonrpc" in blob: dispatch_jsonrpc_method(blob) elif "greToClientEvent" in blob: dispatch_gre_to_client(blob) elif "clientToGreMessage" in blob: dispatch_client_to_gre(blob) elif "Deck.GetDeckLists" in blob: # this looks like it's a response to a jsonrpc method parsers.parse_get_decklists(blob) elif "block_title" in blob and (blob["block_title"] == "Event.DeckSubmit" or blob["block_title"] == "Event.GetPlayerCourse"): parsers.parse_event_decksubmit(blob) elif "block_title" in blob and blob[ "block_title"] == "PlayerInventory.GetPlayerCardsV3": parsers.parse_get_player_cards_v3(blob) elif "block_title" in blob and (blob["block_title"] == "Draft.DraftStatus" or blob["block_title"] == "Draft.MakePick"): parsers.parse_draft_status(blob) elif "matchGameRoomStateChangedEvent" in blob: dispatch_match_gametoom_state_change(blob)
def dispatch_blob(blob): if "method" in blob and "jsonrpc" in blob: dispatch_jsonrpc_method(blob) elif "greToClientEvent" in blob: dispatch_gre_to_client(blob) elif "clientToGreMessage" in blob: dispatch_client_to_gre(blob) elif "Deck.GetDeckLists" in blob: # this looks like it's a response to a jsonrpc method parsers.parse_get_decklists(blob) elif "block_title" in blob and (blob["block_title"] == "Event.DeckSubmit" or \ blob["block_title"] == "Event.GetPlayerCourse"): parsers.parse_event_decksubmit(blob) elif "matchGameRoomStateChangedEvent" in blob: dispatch_match_gametoom_state_change(blob)
def dispatch_blob(blob): seq = blob.get("block_title_sequence", -1) if seq: app.mtga_app.mtga_logger.debug("{}dispatching seq ({})".format( util.ld(), seq)) if "method" in blob and "jsonrpc" in blob: dispatch_jsonrpc_method(blob) elif "greToClientEvent" in blob: dispatch_gre_to_client(blob) elif "clientToGreMessage" in blob: dispatch_client_to_gre(blob) elif "Deck.GetDeckLists" in blob: # this looks like it's a response to a jsonrpc method parsers.parse_get_decklists(blob) elif "block_title" in blob and (blob["block_title"] == "Event.DeckSubmit" or \ blob["block_title"] == "Event.GetPlayerCourse"): parsers.parse_event_decksubmit(blob) elif "matchGameRoomStateChangedEvent" in blob: dispatch_match_gametoom_state_change(blob)
def dispatch_blob(blob): seq = blob.get("block_title_sequence", -1) log_line = blob.get("log_line", -1) if seq: app.mtga_app.mtga_logger.debug("{}dispatching seq ({}) / log_line {}".format(util.ld(), seq, log_line)) if "method" in blob and "jsonrpc" in blob: dispatch_jsonrpc_method(blob) elif "greToClientEvent" in blob: dispatch_gre_to_client(blob) elif "clientToGreMessage" in blob: dispatch_client_to_gre(blob) elif "block_title" in blob and blob["block_title"] == "Deck.GetDeckListsV3": parsers.parse_get_decklists(blob, version=3) elif "block_title" in blob and blob["block_title"] == "Deck.UpdateDeckV3": parsers.parse_update_deck_v3(blob) elif "block_title" in blob and (blob["block_title"] == "Event.DeckSubmit" or blob["block_title"] == "Event.GetPlayerCourse"): parsers.parse_event_decksubmit(blob) elif "block_title" in blob and blob["block_title"] == "Event.DeckSubmitV3": parsers.parse_event_decksubmit(blob, version=3) elif "block_title" in blob and blob["block_title"] == "Event.GetPlayerCourseV2": parsers.parse_event_decksubmit(blob, version=3) # TODO: is GetPlayerCoursesV2 useful? # elif "block_title" in blob and blob["block_title"] == "Event.GetPlayerCoursesV2": # parsers.parse_player_courses_v2(blob) elif "block_title" in blob and blob["block_title"] == "PlayerInventory.GetPlayerCardsV3": parsers.parse_get_player_cards_v3(blob["payload"]) elif "block_title" in blob and (blob["block_title"] == "Draft.DraftStatus" or blob["block_title"] == "Draft.MakePick"): parsers.parse_draft_status(blob) elif "block_title" in blob and blob["block_title"] == "PlayerInventory.GetPlayerInventory": parsers.pass_through("inventory", blob["payload"]["playerId"], blob["payload"]) elif "block_title" in blob and blob["block_title"] == "Rank.Updated": parsers.pass_through("rank_change", blob["playerId"], blob) elif "block_title" in blob and blob["block_title"] == "Inventory.Updated": parsers.pass_through("inventory_update", None, blob) elif ("block_title" in blob and blob["block_title"] == "ClientToMatchServiceMessageType_ClientToGREMessage" and "Payload" in blob and "SubmitDeckResp" in blob['Payload']): parsers.parse_sideboard_submit(blob) elif "matchGameRoomStateChangedEvent" in blob: dispatch_match_gameroom_state_change(blob) elif "block_title" in blob and blob["block_title"] == "Event.MatchCreated": parsers.parse_match_created(blob) # parse on hover event to check what we are looking at, at this moment elif "block_title" in blob and blob["block_title"] == "ClientToMatchServiceMessageType_ClientToGREUIMessage": parsers.parse_hover(blob)