Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log file format changed in 2019-11-21 patch #19

Closed
pak21 opened this issue Nov 22, 2019 · 3 comments
Closed

Log file format changed in 2019-11-21 patch #19

pak21 opened this issue Nov 22, 2019 · 3 comments

Comments

@pak21
Copy link
Contributor

pak21 commented Nov 22, 2019

The 2019-11-21 patch to the client has changed the log file format so that the whole JSON response is on one line, rather than containing newlines:

[UnityCrossThreadLogger]<== PlayerInventory.GetPlayerCardsV3 {"id":15,"payload":{"69110":2,"70094":2,...,"70395":1}}

(response clipped for clarity). This breaks the logfile parsing... it should actually make the parsing easier as we can throw away that clunky brace counting.

I'll try and come up with a patch in the next couple of days if you don't get one in first :-)

@kelesi
Copy link
Owner

kelesi commented Nov 23, 2019

I changed the code to work for both the old and new log versions.
One small seemingly unrelated issue popped up though.

This should return a card object, but returns a string:
>>> all_mtga_cards.find_one(70361)
'Skewer the Critics deals 3 damage to any target.'

Seems like a potential bug in the python-mtga. For now I am double checking if the instance is correct and issue a warning.

@kelesi
Copy link
Owner

kelesi commented Nov 25, 2019

I switched to Python 3 and latest python-mtga and the id 70361 works fine now:

>>> mtga.set_data.all_mtga_cards.find_one(70361)
<Card: 'Resolute Rider' ['White', 'Black'] ELD 70361>

@kelesi kelesi closed this as completed Nov 25, 2019
@pak21
Copy link
Contributor Author

pak21 commented Nov 25, 2019

Looks mostly good to me. One small issue I found: the keyword matching matches prefixes, so if there were two responses in the log for (say) <== KeywordOne {"id":1,"payload":{}} followed by <== KeywordOneHundred {"id":2,"payload":{}}, attempting to fetch <== KeywordOne fails as it attempts to parse Hundred {"id":2,"payload":{}} as a JSON string. Doesn't seem to affect the actual game logs for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants