Monstrofil / replays_unpack

51 stars 19 forks source link

version name creation in get_definitions for wows 0.9.10 #12

Open m-freiberg opened 3 years ago

m-freiberg commented 3 years ago

https://github.com/Monstrofil/replays_unpack/blob/0d99291d17fcf612dfebc05a8caf49cd5c2665c3/replay_unpack/clients/wows/player.py#L28-L32

this join statement here to support longer version lengths (such as 0.9.10 as opposed to 0.9.9) is splitting 0.9.10 into 0_9_1_0 instead of 0_9_10. Not sure if this is what you wanted but it created errors for me when using it as i don't think it was getting the correct definitions from it. In my cloned version I ended up changing it to what i pasted below which is running smoothly! There's probably a better way to do it than I what I did below but I just needed a quick fix.

    def _get_definitions(self, version):
        try:
            iter_version = '_'.join(version[:4])
            iter_version = iter_version[:5] + iter_version[-1]
            return get_definitions(iter_version)
        except RuntimeError:
            return get_definitions('_'.join(version[:3]))

Feel free to use if you'd like.