def finish(self): # Break loop with event. self.stop_thread.set() self.main_thread.join() self.main_thread = None # Save file in case there were any updates that got missed. save_file(self.workbook, self.filename) self.update_label('Finished :)') self.entry['state'] = 'normal' self.start_button['command'] = self.begin self.update_button('Restart', False)
def set_dragon(): table = 'Dragons' fields = 'BaseId,Name,NameJP,Rarity,ElementalType,' + \ 'MinHp,MaxHp,MinAtk,MaxAtk,' + \ 'Abilities11,Abilities12,Abilities21,Abilities22,' + \ 'IsPlayable' group = 'BaseId' parse_int = ['MinHp', 'MaxHp', 'MinAtk', 'MaxAtk'] raw_data = main.get_data(table, fields, group) names = main.load_name(FILE_NAME) data_new = [] # data_list = [] data_dict = {} data_updates = [False] for i in raw_data: item = i['title'] if item['BaseId'] and item[ 'IsPlayable'] == '1' and item['BaseId'] != '210091': uid = '{}_01'.format(item['BaseId']) name = main.set_name(names, item, data_new, data_updates) new_item = { 'id': uid, 'name': name, 'element': item['ElementalType'], 'rarity': item['Rarity'], } for k in parse_int: new_item[k] = int(item[k]) HP_V = {'incHP1': 0, 'incHP2': 0} STR_V = {'incSTR1': 0, 'incSTR2': 0} res_V = {} for a in [ 'Abilities11', 'Abilities12', 'Abilities21', 'Abilities22' ]: ability = abilities.get(item[a], '') if ability: new_item[a.lower()] = ability['Might'] level = a[-1] if 'reqEle' in ability: new_item['reqEle'] = ability['reqEle'] if 'HP' in ability: HP_V['incHP' + level] = ability['HP'] elif 'STR' in ability: STR_V['incSTR' + level] = ability['STR'] elif 'Hybrid' in ability: HP_V['incHP' + level] = ability['Hybrid'] STR_V['incSTR' + level] = ability['Hybrid'] if 'res' in ability: res_V['resEle'] = ability['resEle'] res_V['incRes'] = ability['res'] else: new_item[a.lower()] = 0 new_item.update(HP_V) new_item.update(STR_V) new_item.update(res_V) # data_list.append(new_item) data_dict[uid] = new_item # main.save_file('list', FILE_NAME, data_list) main.save_file('dict', FILE_NAME, data_dict) if data_updates[0]: main.save_file('locales', FILE_NAME, names) if data_new: print(data_new) main.download_images(FILE_NAME, data_new)
def set_adventurer(): table = "Adventurers" fields = ( "Id,VariationId,Name,NameJP,WeaponType,Rarity,ElementalType," + "MinHp3,MinHp4,MinHp5,MaxHp,PlusHp0,PlusHp1,PlusHp2,PlusHp3,PlusHp4,McFullBonusHp5," + "MinAtk3,MinAtk4,MinAtk5,MaxAtk,PlusAtk0,PlusAtk1,PlusAtk2,PlusAtk3,PlusAtk4,McFullBonusAtk5," + "Skill1Name,Skill2Name,Abilities11,Abilities12,Abilities21,Abilities22,Abilities31,Abilities32," + "DefCoef,IsPlayable") group = "Id,VariationId" parse_int = [ "MinHp3", "MinHp4", "MinHp5", "MaxHp", "PlusHp0", "PlusHp1", "PlusHp2", "PlusHp3", "PlusHp4", "McFullBonusHp5", "MinAtk3", "MinAtk4", "MinAtk5", "MaxAtk", "PlusAtk0", "PlusAtk1", "PlusAtk2", "PlusAtk3", "PlusAtk4", "McFullBonusAtk5", "DefCoef", ] raw_data = main.get_data(table, fields, group) abilities = main.set_abilities() skills = main.set_skills() names = main.load_name(FILE_NAME) data_list = [] data_dict = {} data_new = [] data_updates = [False] for i in raw_data: item = i['title'] if item['IsPlayable'] == '1': uid = '{}_0{}'.format(item['Id'], item['VariationId']) name = main.set_name(names, item, data_new, data_updates) weapon = item['WeaponType'] rarity = item['Rarity'] new_item = { "id": uid, "name": name, "weapon": weapon, "element": item["ElementalType"], "rarity": rarity, } for k in parse_int: if item[k].isdigit(): new_item[k] = int(item[k]) inc_LV = {} inc_Value = {} for a in [ "Abilities11", "Abilities12", "Abilities21", "Abilities22", "Abilities31", "Abilities32", ]: ability = abilities.get(item[a]) if ability: # new_item[a.lower()] = ability['Might'] new_item[a.lower()] = ability level = a[-1] if "STR" in ability: inc_LV["STRLV" + level] = ABILITY_LEVEL.get( rarity, ABILITY_LEVEL["res"])[a] inc_Value["incSTR" + level] = ability["STR"] if "def" in ability: inc_LV["defLV" + level] = ABILITY_LEVEL.get( rarity, ABILITY_LEVEL["res"])[a] inc_Value["incDef" + level] = ability["def"] for s in ["Skill1Name", "Skill2Name"]: skill = skills.get(item[s], {}) if skill: new_item[s[0:6].lower()] = skill new_item.update(inc_LV) new_item.update(inc_Value) data_list.append(new_item) data_dict[uid] = new_item main.save_file("list", FILE_NAME, data_list) main.save_file("dict", FILE_NAME, data_dict) if data_updates[0]: main.save_file('locales', FILE_NAME, names) if data_new: print(data_new) main.download_images(FILE_NAME, data_new)
def set_adventurer(): table = 'Adventurers' fields = 'Id,VariationId,Name,NameJP,WeaponType,Rarity,ElementalType,' + \ 'MinHp3,MinHp4,MinHp5,MaxHp,PlusHp0,PlusHp1,PlusHp2,PlusHp3,PlusHp4,McFullBonusHp5,' + \ 'MinAtk3,MinAtk4,MinAtk5,MaxAtk,PlusAtk0,PlusAtk1,PlusAtk2,PlusAtk3,PlusAtk4,McFullBonusAtk5,' + \ 'Abilities11,Abilities12,Abilities21,Abilities22,Abilities31,Abilities32,' + \ 'DefCoef,IsPlayable' group = 'Id,VariationId' parse_int = [ 'MinHp3', 'MinHp4', 'MinHp5', 'MaxHp', 'PlusHp0', 'PlusHp1', 'PlusHp2', 'PlusHp3', 'PlusHp4', 'McFullBonusHp5', 'MinAtk3', 'MinAtk4', 'MinAtk5', 'MaxAtk', 'PlusAtk0', 'PlusAtk1', 'PlusAtk2', 'PlusAtk3', 'PlusAtk4', 'McFullBonusAtk5', 'DefCoef' ] raw_data = main.get_data(table, fields, group) names = main.load_name(FILE_NAME) o_len = len(names) data_list = [] data_dict = {} data_new = [] for i in raw_data: item = i['title'] if item['IsPlayable'] == '1': uid = '{}_0{}'.format(item['Id'], item['VariationId']) name = main.set_name(names, item, data_new) weapon = item['WeaponType'] rarity = item['Rarity'] new_item = { 'id': uid, 'name': name, 'weapon': weapon, 'element': item['ElementalType'], 'rarity': rarity, } for k in parse_int: new_item[k] = int(item[k]) inc_LV = {} inc_Value = {} for a in [ 'Abilities11', 'Abilities12', 'Abilities21', 'Abilities22', 'Abilities31', 'Abilities32' ]: ability = abilities.get(item[a], '') if ability: new_item[a.lower()] = ability['Might'] level = a[-1] if 'STR' in ability: inc_LV['STRLV' + level] = ABILITY_LEVEL.get( rarity, ABILITY_LEVEL['res'])[a] inc_Value['incSTR' + level] = ability['STR'] if 'def' in ability: inc_LV['defLV' + level] = ABILITY_LEVEL.get( rarity, ABILITY_LEVEL['res'])[a] inc_Value['incDef' + level] = ability['def'] new_item.update(inc_LV) new_item.update(inc_Value) data_list.append(new_item) data_dict[uid] = new_item main.save_file('list', FILE_NAME, data_list) main.save_file('dict', FILE_NAME, data_dict) if len(names) != o_len: print(data_new) main.save_file('locales', FILE_NAME, names) main.download_images(FILE_NAME, data_new)
def set_weapon(): table = 'Weapons' fields = 'Id,BaseId,FormId,WeaponName,WeaponNameJP,Type,Rarity,ElementalType,' + \ 'MinHp,MaxHp,MinAtk,MaxAtk,SkillName,Abilities11,Abilities21,IsPlayable' group = 'BaseId,FormId' parse_int = ['MinHp', 'MaxHp', 'MinAtk', 'MaxAtk'] raw_data = main.get_data(table, fields, group) abilities = main.set_abilities() skills = main.set_skills() names = main.load_name(FILE_NAME) data_list = [] data_dict = {} data_new = [] data_updates = [False] for i in raw_data: item = i['title'] rarity = int(item['Rarity']) if item['IsPlayable'] == '1' and rarity >= 3: uid = '{}_01_{}'.format(item['BaseId'], item['FormId']) name = main.set_name(names, item, data_new, data_updates) new_item = { "id": uid, "name": name, "weapon": item["Type"], "element": item["ElementalType"], "rarity": item["Rarity"], # 'skill': item['SkillName'] "skill": skills.get(item["SkillName"]), } for k in parse_int: new_item[k] = int(item[k]) # new_item['skill'] = item['SkillName'] != '' special = {} for a in ["Abilities11", "Abilities21"]: ability = abilities.get(item[a]) if ability: # new_item[a.lower()] = ability['might'] new_item[a.lower()] = ability if "STR" in ability: special["req"] = ability["req"] special["incSTR"] = ability["STR"] elif "def" in ability: special["req"] = ability["req"] special["incDef"] = ability["def"] else: new_item[a.lower()] = 0 if len(special): new_item.update(special) data_list.append(new_item) data_dict[uid] = new_item main.save_file("list", FILE_NAME, data_list) main.save_file("dict", FILE_NAME, data_dict) if data_updates[0]: main.save_file('locales', FILE_NAME, names) if data_new: print(data_new) main.download_images(FILE_NAME, data_new)
def set_wyrmprint(): table = 'Wyrmprints' fields = 'BaseId,Name,NameJP,Rarity,IsPlayable,' + \ 'MinHp,MaxHp,MinAtk,MaxAtk,' + \ 'Abilities11,Abilities12,Abilities13,Abilities21,Abilities22,Abilities23,Abilities31,Abilities32,Abilities33' group = 'BaseId' parse_int = ['MinHp', 'MaxHp', 'MinAtk', 'MaxAtk'] raw_data = main.get_data(table, fields, group) names = main.load_name(FILE_NAME) o_len = len(names) data_new = [] data_list = [] data_dict = {} for i in raw_data: item = i['title'] rarity = int(item['Rarity']) if item['BaseId'] and item['IsPlayable'] == '1' and rarity >= 3: uid = '{}'.format(item['BaseId']) name = main.set_name(names, item, data_new) new_item = { 'id': uid, 'name': name, 'rarity': item['Rarity'], } for k in parse_int: new_item[k] = int(item[k]) addition1 = {} for a in [ 'Abilities11', 'Abilities12', 'Abilities13', 'Abilities21', 'Abilities22', 'Abilities23', 'Abilities31', 'Abilities32', 'Abilities33' ]: ability = abilities.get(item[a], '') if ability: new_item[a.lower()] = ability['Might'] level = a[-1] if 'STR' in ability: addition1['incSTR' + level] = ability['STR'] if 'def' in ability: addition1['incDef' + level] = ability['def'] if 'res' in ability: addition1['resEle'] = ability['resEle'] addition1['incRes' + level] = ability['res'] if 'dungeon' in ability: addition1['dungeon'] = ability['dungeon'] addition1['counter' + level] = ability['counter'] else: new_item[a.lower()] = 0 if len(addition1): new_item.update(addition1) data_list.append(new_item) data_dict[uid] = new_item main.save_file('list', FILE_NAME, data_list) main.save_file('dict', FILE_NAME, data_dict) if len(names) != o_len: print(data_new) main.save_file('locales', FILE_NAME, names) main.download_images(FILE_NAME, data_new)
def set_weapon(): table = 'Weapons' fields = 'Id,BaseId,FormId,WeaponName,Type,Rarity,ElementalType,' + \ 'MinHp,MaxHp,MinAtk,MaxAtk,SkillName,Abilities11,Abilities21,IsPlayable' group = 'BaseId,FormId' parse_int = ['MinHp', 'MaxHp', 'MinAtk', 'MaxAtk'] raw_data = main.get_data(table, fields, group) names = main.load_name(FILE_NAME) o_len = len(names) data_list = [] data_dict = {} data_new = [] for i in raw_data: item = i['title'] rarity = int(item['Rarity']) if item['IsPlayable'] == '1' and rarity >= 3: uid = '{}_01_{}'.format(item['BaseId'], item['FormId']) name = main.set_name(names, item, data_new) new_item = { 'id': uid, 'name': name, 'weapon': item['Type'], 'element': item['ElementalType'], 'rarity': item['Rarity'], } for k in parse_int: new_item[k] = int(item[k]) new_item['skill'] = item['SkillName'] != '' special = {} for a in ['Abilities11', 'Abilities21']: ability = abilities.get(item[a], '') if ability: new_item[a.lower()] = ability['Might'] if 'STR' in ability: special['reqEle'] = ability['reqEle'] special['incSTR'] = ability['STR'] elif 'def' in ability: special['reqEle'] = ability['reqEle'] special['incDef'] = ability['def'] else: new_item[a.lower()] = 0 if len(special): new_item.update(special) data_list.append(new_item) data_dict[uid] = new_item main.save_file('list', FILE_NAME, data_list) main.save_file('dict', FILE_NAME, data_dict) if len(names) != o_len: print(data_new) main.save_file('locales', FILE_NAME, names) main.download_images(FILE_NAME, data_new)
def set_dragon(): table = "Dragons" fields = ("BaseId,Name,NameJP,Rarity,ElementalType," + "MinHp,MaxHp,MinAtk,MaxAtk,SkillName," + "Abilities11,Abilities12,Abilities21,Abilities22," + "IsPlayable") group = "BaseId" parse_int = ["MinHp", "MaxHp", "MinAtk", "MaxAtk"] raw_data = main.get_data(table, fields, group) abilities = main.set_abilities() skills = main.set_skills() names = main.load_name(FILE_NAME) data_new = [] data_list = [] data_dict = {} data_updates = [False] for i in raw_data: item = i['title'] if item['BaseId'] and item['IsPlayable'] == '1': uid = '{}_01'.format(item['BaseId']) name = main.set_name(names, item, data_new, data_updates) new_item = { "id": uid, "name": name, "element": item["ElementalType"], "rarity": item["Rarity"], "skill": skills.get(item["SkillName"]), } for k in parse_int: new_item[k] = int(item[k]) HP_V = {"incHP1": 0, "incHP2": 0} STR_V = {"incSTR1": 0, "incSTR2": 0} res_V = {} for a in [ "Abilities11", "Abilities12", "Abilities21", "Abilities22" ]: ability = abilities.get(item[a]) if ability: # new_item[a.lower()] = ability['Might'] new_item[a.lower()] = ability level = a[-1] if "HP" in ability: HP_V["incHP" + level] = ability["HP"] elif "STR" in ability: STR_V["incSTR" + level] = ability["STR"] elif "Hybrid" in ability: HP_V["incHP" + level] = ability["Hybrid"] STR_V["incSTR" + level] = ability["Hybrid"] if "res" in ability: res_V["resEle"] = ability["resEle"] res_V["incRes"] = ability["res"] else: new_item[a.lower()] = 0 new_item.update(HP_V) new_item.update(STR_V) new_item.update(res_V) data_list.append(new_item) data_dict[uid] = new_item main.save_file("list", FILE_NAME, data_list) main.save_file("dict", FILE_NAME, data_dict) if data_updates[0]: main.save_file('locales', FILE_NAME, names) if data_new: print(data_new) main.download_images(FILE_NAME, data_new)
def set_wyrmprint(): table = "Wyrmprints" fields = ( "BaseId,Name,NameJP,Rarity,IsPlayable," + "MinHp,MaxHp,MinAtk,MaxAtk," + "Abilities11,Abilities12,Abilities13,Abilities21,Abilities22,Abilities23,Abilities31,Abilities32,Abilities33" ) group = "BaseId" parse_int = ["MinHp", "MaxHp", "MinAtk", "MaxAtk"] raw_data = main.get_data(table, fields, group) abilities = main.set_abilities() names = main.load_name(FILE_NAME) data_new = [] data_list = [] data_dict = {} data_updates = [False] for i in raw_data: item = i['title'] rarity = int(item['Rarity']) if item['BaseId'] and item['IsPlayable'] == '1' and rarity >= 3: uid = '{}'.format(item['BaseId']) name = main.set_name(names, item, data_new, data_updates) new_item = {"id": uid, "name": name, "rarity": item["Rarity"]} for k in parse_int: new_item[k] = int(item[k]) addition1 = {} for a in [ "Abilities11", "Abilities12", "Abilities13", "Abilities21", "Abilities22", "Abilities23", "Abilities31", "Abilities32", "Abilities33", ]: ability = abilities.get(item[a]) if ability: # new_item[a.lower()] = ability['Might'] new_item[a.lower()] = ability level = a[-1] if 'HP' in ability: addition1['incHP' + level] = ability['HP'] if 'STR' in ability: addition1['incSTR' + level] = ability['STR'] if "def" in ability: addition1["incDef" + level] = ability["def"] if "res" in ability: addition1["resEle"] = ability["resEle"] addition1["incRes" + level] = ability["res"] if "dungeon" in ability: addition1["dungeon"] = ability["dungeon"] addition1["counter" + level] = ability["counter"] else: new_item[a.lower()] = 0 if len(addition1): new_item.update(addition1) data_list.append(new_item) data_dict[uid] = new_item main.save_file("list", FILE_NAME, data_list) main.save_file("dict", FILE_NAME, data_dict) if data_updates[0]: main.save_file('locales', FILE_NAME, names) if data_new: print(data_new) main.download_images(FILE_NAME, data_new)