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.