Skip to content

Instantly share code, notes, and snippets.

@devdave
Created April 7, 2023 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdave/36ae26ac33cc8635e26bd24af10c3491 to your computer and use it in GitHub Desktop.
Save devdave/36ae26ac33cc8635e26bd24af10c3491 to your computer and use it in GitHub Desktop.
print portal names for valheim
"""
1. Download & install Python, be sure to click option for it to be added to the system Path
2. Save this to Desktop or somewhere/anywhere
3. Find the file path to your valheim world db file.
4. Put the file path in between the quotes on line 23 / test_file
5. Using the command line, run `python printout.py`
"""
def portals(dbfile):
with open(dbfile, 'rb') as db:
mm = mmap.mmap(db.fileno(), 0, access= mmap.ACCESS_READ)
i, l = 0, set()
while True:
i = mm.find(b'\xea\x91|)', i)
if i == -1:
break
l.add(mm[i+5:i+5+mm[i+4]].decode())
i += 5 + mm[i+4]
return l
test_file = r"CHANGE ME TO THE PATH OF YOUR WORLDFILE"
portal_names = portals(test_file)
print(portal_names)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment