forked from omicron/d2warehouse
		
	Add skills.json parser & data
Build a lookup table to map from Id to string.
This commit is contained in:
		
							
								
								
									
										28
									
								
								contrib/skills.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								contrib/skills.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | |||||||
|  | import json | ||||||
|  | import csv | ||||||
|  | import os | ||||||
|  | import sys | ||||||
|  |  | ||||||
|  | path = sys.argv[1] if len(sys.argv) >= 2 else "." | ||||||
|  |  | ||||||
|  | items = {} | ||||||
|  |  | ||||||
|  | item_patches = { | ||||||
|  |     "tbk": {"class": "tome"}, | ||||||
|  |     "ibk": {"class": "tome"}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | with open(os.path.join(path, "skills.json"), encoding="utf-8-sig") as f: | ||||||
|  |     rows = json.load(f) | ||||||
|  |  | ||||||
|  | lookup_table = {} | ||||||
|  | for entry in rows: | ||||||
|  |     key = entry["Key"] | ||||||
|  |     text = entry["enUS"] | ||||||
|  |     if len(text.strip()) == 0: | ||||||
|  |         continue | ||||||
|  |     lookup_table[key] = text | ||||||
|  |  | ||||||
|  | with open("skills.json", "w", newline="\n") as f: | ||||||
|  |     json.dump(lookup_table, f, indent=4) | ||||||
|  |     f.write("\n") | ||||||
							
								
								
									
										1251
									
								
								d2warehouse/data/skills.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1251
									
								
								d2warehouse/data/skills.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user