diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
commit | c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe (patch) | |
tree | 742dd839971d2aab1f08fd0291af66e6439646ab /hercules/extract_mapcache.py | |
download | tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.gz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.bz2 tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.xz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.zip |
Add initial tools
Diffstat (limited to 'hercules/extract_mapcache.py')
-rwxr-xr-x | hercules/extract_mapcache.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hercules/extract_mapcache.py b/hercules/extract_mapcache.py new file mode 100755 index 0000000..39a63c3 --- /dev/null +++ b/hercules/extract_mapcache.py @@ -0,0 +1,24 @@ +#! /usr/bin/env python +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import os + +from code.fileutils import readInt16, readInt32 +from code.server.maps import extractMaps + + +def runFunction(path): + with open(path, "rb") as f: + size = readInt32(f) + if os.path.getsize(path) != size: + print "Map cache corrupted, wrong file size." + exit(1) + mapsCount = readInt16(f) + print "Maps count: " + str(mapsCount) + readInt16(f) # padding + extractMaps(f, mapsCount) + +runFunction("serverdata/db/re/map_cache.dat") |