import Ragnarok.module.files as files import Ragnarok.module.db as db ids = files.open_lines('ids.txt') id_dbname = list() for line in ids: table, dict = db.find_table('ropru', int(line)) print(line) try: new = line +'\t'+ dict['NAME'] id_dbname.append(new) except: new = line id_dbname.append(new) files.write_lines(id_dbname, 'ids_dbnames.txt')
import Ragnarok.module.files as files all_consumable = files.open_lines("consumable.txt") consumable = list() for line in all_consumable: if line.strip() not in consumable: consumable.append(line.strip()) consumable = sorted(consumable) all_important = files.open_lines("important.txt") important = list() for line in all_important: if line.strip() not in important: important.append(line.strip()) important = sorted(important) files.write_lines(important, 'all_important_items.txt') important_consumable = list() for line in important: if line in consumable: important_consumable.append(line) important_consumable = sorted(important_consumable) files.write_lines(important_consumable, 'all_important_consumable_items.txt')
name_en = item_line.split("\"")[1] break try: desc_en = info_en.split("unidentifiedDescriptionName")[1] desc_en = desc_en.split("identifiedDescriptionName")[1] desc_en = desc_en.split("\"", 1)[1] desc_en = desc_en.rsplit("\"", 1)[0] desc_en = desc_en.replace("\"", "") desc_en_lines = list() for desc_line in desc_en.splitlines(): if len(desc_line) == 0: continue if desc_line[-1] == ',': desc_line = desc_line[:-1] desc_en_lines.append(desc_line.strip()) desc_en = '\n'.join(desc_en_lines) except: desc_en = '' print(name_ru) print(name_en) print(desc_ru) print(desc_en) sheet.cell(column=1, row=current_row, value=id) sheet.cell(column=3, row=current_row, value=name_ru) sheet.cell(column=4, row=current_row, value=name_en) sheet.cell(column=5, row=current_row, value=desc_ru) sheet.cell(column=6, row=current_row, value=desc_en) current_row += 1 wb.save(filename='desc.xlsx') done.append(str(id)) files.write_lines(done, 'done.txt')
import re import Ragnarok.module.files as files lines = files.open_lines('2021_halloween_ru.sc', 'Windows-1251') npcs = list() names = list() for line in lines: if line.strip().startswith('npc '): npcs.append(line.strip().replace(' ', '\t')) names.append(line.split('\"')[3].split('#')[0]) files.write_lines(npcs, 'npcs.txt', 'Windows-1251') files.write_lines(names, 'names.txt', 'Windows-1251')
import re import Ragnarok.module.files as files import Ragnarok.module.patterns as pattern obb_filtered1 = files.open_lines('obb_filtered1.txt') ovb_filtered1 = files.open_lines('ovb_filtered1.txt') cashitems_ru = files.open_lines('D:/RO/rot/zone/CashItemList.txt') cashitems_eu = files.open_lines('D:/RO/roteu/zone/CashItemList.txt') cashitemlist = list() for line in cashitems_ru: if line.strip().startswith('\"'): if line.split('\"')[1] not in cashitemlist: cashitemlist.append(line.split('\"')[1]) for line in cashitems_eu: if line.strip().startswith('\"'): if line.split('\"')[1] not in cashitemlist: cashitemlist.append(line.split('\"')[1]) obb_filtered2 = list() ovb_filtered2 = list() for line in obb_filtered1: if re.split(r'\s+', line)[1] in cashitemlist: obb_filtered2.append('удалить\t'+re.split(r'\s+', line)[1]) else: obb_filtered2.append(line) for line in ovb_filtered1: if re.split(r'\s+', line)[1] in cashitemlist: ovb_filtered2.append('удалить\t'+re.split(r'\s+', line)[1]) else: ovb_filtered2.append(line) files.write_lines(obb_filtered2, 'obb_filtered2.txt') files.write_lines(ovb_filtered2, 'ovb_filtered2.txt')
import re import Ragnarok.module.files as files exist_maps = files.open_lines('exist_map.txt') all_maps = files.open_lines('map.txt') not_exist = list() for line in all_maps: map = line.split()[1] type = line.split()[3] not_exist.append(type + '\t' + map) exist = list() exist_mapss = list() for i in range(len(not_exist)): for exist_map in exist_maps: not_map = not_exist[i].split()[1].replace('.gat', '') if not_map == exist_map: exist.append(not_exist[i]) not_exist[i] = '' exist_mapss.append(not_map) break files.write_lines(exist, 'exist_result.txt') files.write_lines(not_exist, 'not_exist_result.txt') for exist_map in exist_maps: if exist_map not in exist_mapss: print(exist_map)
import re import Ragnarok.module.files as files codirovka = 'utf-8' lines = files.open_lines('msgstringtable.txt', codirovka=codirovka, errors='ignore') new_lines = list() counter = 1 for line in lines: if line.replace('#', '').isspace() or len(line.replace('#', '')) == 0: line = 'missing_line' + str(counter) + '#' counter += 1 new_lines.append(line) files.write_lines(new_lines, 'msgstringtable2.txt', codirovka=codirovka)
table, db_dict = db.find_table('ropru', re.split(r'\s+', line)[1], 'NAME') if db_dict is not None: info = find.iteminfo('ropru', db_dict['ID']).split('identifiedDisplayName')[1] for letter in alph: if letter in info: exist = 1 break if exist == 0: obb_filtered3.append('удалить\t' + re.split(r'\s+', line)[1]) else: obb_filtered3.append(line) for line in ovb_filtered2: print(re.split(r'\s+', line)[1]) exist = 0 table, db_dict = db.find_table('ropru', re.split(r'\s+', line)[1], 'NAME') if db_dict is not None: info = find.iteminfo('ropru', db_dict['ID']).split('identifiedDisplayName')[1] for letter in alph: if letter in info: exist = 1 break if exist == 0: ovb_filtered3.append('удалить\t' + re.split(r'\s+', line)[1]) else: ovb_filtered3.append(line) files.write_lines(obb_filtered3, 'obb_filtered3.txt') files.write_lines(ovb_filtered3, 'ovb_filtered3.txt')
list_txt = files.open_lines('D:/RO/rot/zone/npcdata/list.txt') active_scripts = list() for line in list_txt: if line.startswith('./npcdata'): active_scripts.append(line) maps = set() for script in active_scripts: print(script) path = script.replace('.', 'D:/RO/rot/zone/', 1) script_lines = files.open_lines(path, codirovka='Windows-1251', errors='ignore') for line in script_lines: if re.search(patterns.callmonster, line): map = re.search(patterns.callmonster, line).group(1) maps.add(map) if re.search(patterns.moveto, line): map = re.search(patterns.moveto, line).group(1) maps.add(map) if re.search(patterns.npc, line): map = re.search(patterns.npc, line).group(1) maps.add(map) if re.search(patterns.trader, line): map = re.search(patterns.trader, line).group(1) maps.add(map) maps = sorted(list(maps)) for i in range(len(maps)): maps[i] = maps[i].replace('\"', '') files.write_lines(maps, 'maps_not_putmob.txt')
import re import Ragnarok.module.files as files import Ragnarok.module.db as db item_lines = files.open_lines('ItemSummonList.txt') ids = set() for line in item_lines: if re.split(r'\s+', line)[0] == 'Old_Blue_Box': if re.split(r'\s+', line)[1] not in ids: ids.add(re.split(r'\s+', line)[1]) print(len(ids)) obb_classic = list() for id in ids: table, db_dict = db.find_table('ropru', id) obb_classic.append(db_dict['NAME']) files.write_lines(obb_classic, 'obb_classic.txt')
import re import Ragnarok.module.files as files import Ragnarok.module.patterns as pattern obb_lines = files.open_lines('obb_kRO.txt') ovb_lines = files.open_lines('ovb_kRO.txt') obb_classic_lines = files.open_lines('obb_classic.txt') ovb_classic_lines = files.open_lines('ovb_classic.txt') obb_filtered1 = list() ovb_filtered1 = list() for line in obb_lines: if line in obb_classic_lines: obb_filtered1.append('добавить\t' + line) else: obb_filtered1.append('\t' + line) for line in ovb_lines: if line in ovb_classic_lines: ovb_filtered1.append('добавить\t' + line) else: ovb_filtered1.append('\t' + line) files.write_lines(obb_filtered1, 'obb_filtered1.txt') files.write_lines(ovb_filtered1, 'ovb_filtered1.txt')
import Ragnarok.module.files as files for maptype in [ 0, 1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 21, 23, 24, 25, 27, 28, 29, 31, 39, 40, 41 ]: maps = files.open_lines('maps_' + str(maptype) + '.txt') new_maps = set() old_maps = set() new = False old = False for line in maps: map = line.strip() if '[new]' in line: new = True continue if '[old]' in line: new = False old = True continue if new == True: new_maps.add(map) elif old == True: old_maps.add(map) added = new_maps.difference(old_maps) deleted = old_maps.difference(new_maps) differ = ['Добавлены'] + sorted(list(added)) + ['Удалены'] + sorted( list(deleted)) files.write_lines(differ, 'differ_' + str(maptype) + '.txt')