pixeltris / YgoMaster

Offline Yu-Gi-Oh! Master Duel
MIT License
874 stars 125 forks source link

matserduel deck edit endpoint. #116

Closed shadowshadow725 closed 2 years ago

shadowshadow725 commented 2 years ago

Hi, I'm trying to work on a deck importer for masterduel. I found the api that masterduel uses to update the deck. The restful api takes data in Content-Type: application/octet-stream. The octet-stream consists of a some binary data and a json following it by a json with the deck data. I'm trying to figureout what is this binary data is and how is it constracted.

pixeltris commented 2 years ago

Importing decks at a network level without interacting with the game probably isn't the best way to go about it as each packet has its own identifier.

You'd be better off calling the network functions in-game or one of the in-game functions to modify the deck. YgoMaster actually does the later and supports importing ydk/json decks both offline and on the live servers.

https://github.com/pixeltris/YgoMaster/blob/e8405e801ad7622f46108ffbeecb41b9661bd261/YgoMasterClient/DeckEditorUtils.cs#L574

That being said I don't think there's any binary data for the client requests other than the token. The server LZ4 compresses data. You can find the code for both serializers here

https://github.com/pixeltris/YgoMaster/blob/e8405e801ad7622f46108ffbeecb41b9661bd261/YgoMasterServer/GameServer.cs#L367-L390