From c58b5deb24a3512000ce0258bc5f0097f765c184 Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 4 Dec 2021 02:38:34 +0000 Subject: [PATCH] these are probably trash 'tools' which no one will ever want or need to use but i already made them for importing into spreadsheets. --- tools/format_drops.py | 198 +++++++++++++++++++++++++++++++++++++ tools/get_area_percents.py | 73 ++++++++++++++ tools/print_drop_rates.py | 2 +- 3 files changed, 272 insertions(+), 1 deletion(-) create mode 100755 tools/format_drops.py create mode 100755 tools/get_area_percents.py mode change 100644 => 100755 tools/print_drop_rates.py diff --git a/tools/format_drops.py b/tools/format_drops.py new file mode 100755 index 0000000..819526e --- /dev/null +++ b/tools/format_drops.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python3 + +episodes = ['ep1', 'ep2', 'ep4'] +difficulties = ['normal', 'hard', 'veryhard', 'ultimate'] +sectionids = ['viridia', 'greenill', 'skyly', 'bluefull', 'purplenum', 'pinkal', 'redria', 'oran', 'yellowboze', 'whitill'] + +with open('drops','r') as infile: + drops = infile.readlines() + +ep1drops = list(filter(lambda d: d.split(',')[0] == 'ep1', drops)) +ep2drops = list(filter(lambda d: d.split(',')[0] == 'ep2', drops)) +ep4drops = list(filter(lambda d: d.split(',')[0] == 'ep4', drops)) + +ep1monsters = list(set(line.split(',')[3] for line in ep1drops)) +ep2monsters = list(set(line.split(',')[3] for line in ep2drops)) +ep4monsters = list(set(line.split(',')[3] for line in ep4drops)) + +ep1monsters.sort() +ep2monsters.sort() +ep4monsters.sort() + +ep1normal = list(filter(lambda d: d.split(',')[1] == 'normal', ep1drops)) +ep1hard = list(filter(lambda d: d.split(',')[1] == 'hard', ep1drops)) +ep1veryhard = list(filter(lambda d: d.split(',')[1] == 'veryhard', ep1drops)) +ep1ultimate = list(filter(lambda d: d.split(',')[1] == 'ultimate', ep1drops)) + +print('ep1 normal drops') +for monster in ep1monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep1normal)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep1 hard drops') +for monster in ep1monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep1hard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep1 veryhard drops') +for monster in ep1monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep1veryhard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep1 ultimate drops') +for monster in ep1monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep1ultimate)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('\n\n\n\n\n\n') + + +# print drops per difficulty +ep2normal = list(filter(lambda d: d.split(',')[1] == 'normal', ep2drops)) +ep2hard = list(filter(lambda d: d.split(',')[1] == 'hard', ep2drops)) +ep2veryhard = list(filter(lambda d: d.split(',')[1] == 'veryhard', ep2drops)) +ep2ultimate = list(filter(lambda d: d.split(',')[1] == 'ultimate', ep2drops)) + +print('ep2 normal drops') +for monster in ep2monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep2normal)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep2 hard drops') +for monster in ep2monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep2hard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep2 veryhard drops') +for monster in ep2monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep2veryhard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep2 ultimate drops') +for monster in ep2monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep2ultimate)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('\n\n\n\n\n\n') + + +# print drops per difficulty +ep4normal = list(filter(lambda d: d.split(',')[1] == 'normal', ep4drops)) +ep4hard = list(filter(lambda d: d.split(',')[1] == 'hard', ep4drops)) +ep4veryhard = list(filter(lambda d: d.split(',')[1] == 'veryhard', ep4drops)) +ep4ultimate = list(filter(lambda d: d.split(',')[1] == 'ultimate', ep4drops)) + +print('ep4 normal drops') +for monster in ep4monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep4normal)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep4 hard drops') +for monster in ep4monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep4hard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep4 veryhard drops') +for monster in ep4monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep4veryhard)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + +print('\n\n') + +print('ep4 ultimate drops') +for monster in ep4monsters: + monster_drops = list(filter(lambda d: d.split(',')[3] == monster, ep4ultimate)) # all drops for specific monster (list of strings) + print('{},'.format(monster), sep='', end='') + for sectionid in sectionids: + for md in monster_drops: + if sectionid in md: + print('{}'.format(md.split(',')[4]),sep='', end='') + print(',', sep='', end='') + print() + diff --git a/tools/get_area_percents.py b/tools/get_area_percents.py new file mode 100755 index 0000000..4d02c91 --- /dev/null +++ b/tools/get_area_percents.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 + +import toml + +episodes = ['ep1', 'ep2', 'ep4'] +difficulties = ['normal', 'hard', 'veryhard', 'ultimate'] +sectionids = ['viridia', 'greenill', 'skyly', 'bluefull', 'purplenum', 'pinkal', 'redria', 'oran', 'yellowboze', 'whitill'] +base_dir = '../data/drops' # assumes script is running from /path/to/elseware/tools + +def get_area_percents(): + for episode in episodes: + print('episode: {}'.format(episode)) + for difficulty in difficulties: + print('difficulty: {}'.format(difficulty)) + for sectionid in sectionids: + #print('sectionid: {}'.format(sectionid)) + area_toml = toml.load('{}/{}/{}/{}/area_percent_pattern.toml'.format(base_dir, episode, difficulty, sectionid)) + keys = list(area_toml.keys()) + attrs1 = [0,0,0,0,0,0,0,0,0,0] + attrs2 = [0,0,0,0,0,0,0,0,0,0] + attrs3 = [0,0,0,0,0,0,0,0,0,0] + for i in range(0, len(keys)): + if 'attribute1' in area_toml[keys[i]]: + attrs1[i] = area_toml[keys[i]]['attribute1'] + if 'attribute2' in area_toml[keys[i]]: + attrs2[i] = area_toml[keys[i]]['attribute2'] + if 'attribute3' in area_toml[keys[i]]: + attrs3[i] = area_toml[keys[i]]['attribute3'] + #print('episode: {}, difficulty: {}, sectionid: {}'.format(episode, difficulty, sectionid)) + print('{}\n{}\n{}'.format(attrs1,attrs2,attrs3)) + print('\n\n') + +# print('episode: {}, difficulty: {}, sectionid: {}, key: {}\ntoml: {}'.format(episode, difficulty, sectionid, key, area_toml[key])) +# if 'attribute1' in area_toml[key]: +# print('attribute1,{}'.format(area_toml[key]['attribute1']), sep=',', end=',') +# if 'attribute2' in area_toml[key]: +# print('attribute2,{}'.format(area_toml[key]['attribute2']), sep=',', end=',') +# if 'attribute3' in area_toml[key]: +# print('attribute3,{}'.format(area_toml[key]['attribute3']), sep=',', end='') +# print() + + +def get_percent_patterns(): + for episode in episodes: +# print('episode: {}'.format(episode)) + for difficulty in difficulties: +# print('difficulty: {}'.format(difficulty)) + for sectionid in sectionids: + print('{}, {}, {}'.format(episode, difficulty, sectionid)) + percent_toml = toml.load('{}/{}/{}/{}/percent_rate.toml'.format(base_dir, episode, difficulty, sectionid)) + keys = list(percent_toml.keys()) + for key in percent_toml.keys(): + print('percent_toml[{}]: '.format(key), sep='', end='') + for p in range(5,95,5): + print(' p{}: {}'.format(p, percent_toml[key]['p' + str(p)] / 100.0), sep=',', end=',') + print() + print() + pattern1 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pattern2 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pattern3 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pattern4 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pattern5 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pattern6 = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] + pass + + +def main(): + #get_area_percents() + get_percent_patterns() + + +if __name__ == '__main__': + main() diff --git a/tools/print_drop_rates.py b/tools/print_drop_rates.py old mode 100644 new mode 100755 index de352b4..1364e8a --- a/tools/print_drop_rates.py +++ b/tools/print_drop_rates.py @@ -12,7 +12,7 @@ import toml, os episodes = ['ep1', 'ep2', 'ep4'] difficulties = ['normal', 'hard', 'veryhard', 'ultimate'] sectionids = ['viridia', 'greenill', 'skyly', 'bluefull', 'purplenum', 'pinkal', 'redria', 'oran', 'yellowboze', 'whitill'] -base_dir = '../data/drops/' # assumes script is running from /path/to/elseware/tools +base_dir = '../data/drops' # assumes script is running from /path/to/elseware/tools def print_all_drops(): for episode in episodes: