def fix_missing(self): for creatureId in self.missing(): pet = self.id_to_bnet_pet[creatureId] print('Pet {} missing: {} https://www.wowhead.com/npc={}' .format(creatureId, pet['name'], creatureId)) asyncio.run(self.retrieve_missing_pets()) def run(self): self.fix_missing() if __name__ == '__main__': logging.basicConfig(level=logging.INFO) if len(sys.argv) < 3: sys.exit("Usage: {} pets.json battlepets.json") bnet_pets = bnet.get_master_list('pets') with open(sys.argv[1]) as pets_file: pets = json.load(pets_file) with open(sys.argv[2]) as bpets_file: battlepets = json.load(bpets_file) fixer = PetFixer(bnet_pets, pets, battlepets) fixer.run() with open(sys.argv[1], 'w') as pets_file: json.dump(fixer.pets, pets_file, indent=2, sort_keys=True) with open(sys.argv[2], 'w') as bpets_file: json.dump(fixer.battlepets, bpets_file, indent=2, sort_keys=True)
continue spellid = int(mount['spellId']) if ((spellid not in self.id_to_old_mount and spellid not in IGNORE_MOUNT_SPELLIDS)): changelog('Mount {} missing: {} ' 'https://www.wowhead.com/item={}' .format(spellid, mount['name'], mount['itemId'])) mounts_to_add.append({ 'name': mount['name'], 'spellid': mount['spellId'], 'itemId': mount['itemId'], 'icon': mount['icon'], }) json.dump(mounts_to_add, sys.stdout, indent=2, sort_keys=True) def run(self): self.fix_missing() if __name__ == '__main__': logging.basicConfig(level=logging.INFO) if len(sys.argv) < 2: sys.exit("Usage: {} mounts.json") bnet_mounts = bnet.get_master_list('mounts') mounts = json.load(open(sys.argv[1])) fixer = MountFixer(bnet_mounts, mounts) fixer.run()
return collections.Counter(dup) def run(self): self.delete_removed_achievements() self.add_new_cats_subcats() self.fix_moved_subcategories() self.add_missing_achievements() self.fix_broken_icons() self.fix_wrong_sides() self.del_empty() self.reorder_categories() # Output result json.dump(self.achievs, sys.stdout, indent=2, sort_keys=True) if __name__ == '__main__': logging.basicConfig(level=logging.INFO) if len(sys.argv) < 2: sys.exit("Usage: {} achievements.json") achievements = json.load(open(sys.argv[1])) bnet_achievements = bnet.get_master_list('achievements') fixer = AchievementFixer(achievements, bnet_achievements) fixer.run()
#!/usr/bin/env python3 import bnet import json import os import sys def write_server_json(master_list, path): realm_list = [{'name': realm['name'], 'slug': realm['slug']} for realm in master_list['realms']] realm_list.sort(key=lambda k: k['name']) realms = {'realms': realm_list} with open(path, 'w') as f: json.dump(realms, f, indent=2, sort_keys=True, ensure_ascii=False) if __name__ == '__main__': if len(sys.argv) < 2: sys.exit("Usage: {} path/to/app/data") for region in ('eu', 'us'): bnet_servers = bnet.get_master_list('realms', region) realm_f = os.path.join(sys.argv[1], 'servers.{}.json'.format(region)) write_server_json(bnet_servers, realm_f)
#!/usr/bin/env python3 import bnet import json import os import sys def write_server_json(master_list, path): realm_list = [{ 'name': realm['name'], 'slug': realm['slug'] } for realm in master_list['realms']] realm_list.sort(key=lambda k: k['name']) realms = {'realms': realm_list} with open(path, 'w') as f: json.dump(realms, f, indent=2, sort_keys=True, ensure_ascii=False) if __name__ == '__main__': if len(sys.argv) < 2: sys.exit("Usage: {} path/to/app/data") for region in ('eu', 'us'): bnet_servers = bnet.get_master_list('realms', region) realm_f = os.path.join(sys.argv[1], 'servers.{}.json'.format(region)) write_server_json(bnet_servers, realm_f)