From a14e3581f290d1980a170ae908bce0fbb94bd74b Mon Sep 17 00:00:00 2001 From: Christian Betz Date: Sat, 24 Oct 2020 19:20:19 +0200 Subject: [PATCH] add custom enum info from additional-enum-info.ini --- additional-enum-info.ini | 2 ++ poraclePvpHelper.py | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 additional-enum-info.ini diff --git a/additional-enum-info.ini b/additional-enum-info.ini new file mode 100644 index 0000000..57be40e --- /dev/null +++ b/additional-enum-info.ini @@ -0,0 +1,2 @@ +[Form] +SABLEYE_COSTUME_2020 = 2668 diff --git a/poraclePvpHelper.py b/poraclePvpHelper.py index a379d20..4e12158 100644 --- a/poraclePvpHelper.py +++ b/poraclePvpHelper.py @@ -21,9 +21,19 @@ def parseEnumProto(url, name): for line in r.iter_lines(decode_unicode=True): if not line.startswith("syntax") and not line.startswith("package") and "=" in line: enumDict[line.split("=")[0].strip()] = line.split("=")[1].replace(";", "").strip() + enumDict = addEnumInfo(name, enumDict) return Enum(name, enumDict) +def addEnumInfo(name, enumDict): + additionalInfo = configparser.ConfigParser() + additionalInfo.read(os.path.dirname(os.path.abspath(__file__)) + "/additional-enum-info.ini") + if name in additionalInfo: + for elem in additionalInfo[name]: + enumDict[elem.upper()] = additionalInfo[name][elem] + return enumDict + + PokemonId = parseEnumProto("https://raw.githubusercontent.com/Furtif/POGOProtos/master/src/" "POGOProtos/Enums/PokemonId.proto", "PokemonId") Form = parseEnumProto("https://raw.githubusercontent.com/Furtif/POGOProtos/master/src/"