Created
August 1, 2023 11:04
-
-
Save sekaiwish/6f7e0c8a050eb7d0b92feac3c0259fb7 to your computer and use it in GitHub Desktop.
Python script to port Erupe 9.2 event quests to Erupe 9.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
d = 'bin/events' | |
out = 'begin;insert into event_quests(max_players, quest_type, quest_id, mark)values' | |
for y, _, x in os.walk(d): | |
for z in x: | |
f = os.path.join(y, z) | |
if os.stat(f).st_size < 352: | |
continue | |
with open(f, 'rb') as p: | |
p.seek(9, 0) | |
max_players = int.from_bytes(p.read(1), 'big') | |
quest_type = int.from_bytes(p.read(1), 'big') | |
p.seek(14, 0) | |
mark = int.from_bytes(p.read(4), 'big') | |
p.seek(68, 0) | |
quest_id = int.from_bytes(p.read(2), 'big') | |
out += f'({max_players},{quest_type},{quest_id},{mark}),' | |
with open('PortedEventQuests.sql', 'w') as f: | |
f.write(out[:-1]+';end') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment