Skip to content

Commit

Permalink
fix python-mtga for 11/21 patch (.....wtf)
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencatro committed Nov 21, 2019
1 parent 3568c4e commit a22ddb1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions source/mtga/set_data/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@

dynamic_set_tuples = []

data_location = r"C:\Program Files (x86)\Wizards of the Coast\MTGA\MTGA_Data\Downloads\Data"
try:
from winreg import ConnectRegistry, OpenKey, HKEY_LOCAL_MACHINE, QueryValueEx
registry_connection = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
reg_path = "SOFTWARE\WOW6432Node\Wizards of the Coast\MTGArena"
registry_key = OpenKey(registry_connection, reg_path)
data_location = QueryValueEx(registry_key, "Path")[0] + r"MTGA_Data\Downloads\Data"
print("Found data @ ")
print(data_location)
print(r"C:\Program Files (x86)\Wizards of the Coast\MTGA\MTGA_Data\Downloads\Data")
except:
print("Couldn't locate MTGA from registry, falling back to hardcoded path...")
data_location = r"C:\Program Files (x86)\Wizards of the Coast\MTGA\MTGA_Data\Downloads\Data"

json_filepaths = {"enums": "", "cards": "", "abilities": "", "loc": ""}

Expand All @@ -40,7 +51,11 @@
all_abilities = {}

loc_map = {}
en = list(filter(lambda x: x["langkey"] == "EN", loc))[0]
try:
en = list(filter(lambda x: x["langkey"] == "EN", loc))[0]
except:
## langkeys are null in 11/21 patch???
en = loc[0]
for obj in en["keys"]:
# if obj["id"] in loc_map.keys():
# print("WARNING: overwriting id {} = {} with {}".format(obj["id"], loc_map[obj["id"]], obj["text"]))
Expand Down

0 comments on commit a22ddb1

Please sign in to comment.