Git Product home page Git Product logo

war-council-army-decoder's Introduction

war-council-army-decoder

decode base64 encode blob from war council as protobuf into readable json format.

war-council-army-decoder's People

Contributors

chrisjd20 avatar

Watchers

 avatar  avatar

war-council-army-decoder's Issues

Using a protobuf description

As discussed on Stack overflow!!

I made a proto file which lines up with what I think you've deduced about the format and altered index.html to work with it, using a library called protobuf.js. I'm not a website expert so excuse my code!

You can see the files here: https://gist.github.com/pedro-w/c10fd851c0b4cdc4bcf2bd830e4c675a

You can convert the proto file to JS definitions quite easily:

     protobuf.load('main.proto', function (err, root) {
        if (err) {
            console.log("error", err)
        }
        else {
            Army = root.lookup("asoiaf.Army")
            FactionType = root.lookup("asoiaf.FactionType")
        }
    })

and then converting B64 is also straightforward:

    function decodeArmyFromBase64EncodedString(b64_string) {
        const len = protobuf.util.base64.length(b64_string)
        const data = new Uint8Array(len)
        protobuf.util.base64.decode(b64_string, data, 0)
        return Army.decode(data, len)
    }

The return value from Army.decode can be used like a normal object, it's got name, points, ... properties

Let me know how you get on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.