diff --git a/README.rst b/README.rst index e8dede7..0548053 100644 --- a/README.rst +++ b/README.rst @@ -235,8 +235,8 @@ zoom=ZOOM This is equivalent to setting the dimensions of the highest zoom level. It does not actually change how the map is rendered, but rather *how much of - the map is rendered.* (Calling this option "zoom" may be a bit misleading, - I know) + the map is rendered.* Setting this option too low *will crop your map.* + (Calling this option "zoom" may be a bit misleading, I know) To be precise, it sets the width and height of the highest zoom level, in tiles. A zoom level of z means the highest zoom level of your map will be diff --git a/contrib/benchmark.py b/contrib/benchmark.py index 145654e..6de19e1 100644 --- a/contrib/benchmark.py +++ b/contrib/benchmark.py @@ -1,3 +1,13 @@ +"""Simple Benchmarking script. + +Usage and example: + +$ python contrib/benchmark.py World4/ +Rendering 50 chunks... +Took 20.290062 seconds or 0.405801 seconds per chunk, or 2.464261 chunks per second +""" + + import chunk import world import tempfile @@ -8,12 +18,6 @@ import os import sys import shutil -# Simple Benchmarking script. Usage and example: - -# $ python contrib/benchmark.py World4/ -# Rendering 50 chunks... -# Took 20.290062 seconds or 0.405801 seconds per chunk, or 2.464261 chunks per second - # create a new, empty, cache dir cachedir = tempfile.mkdtemp(prefix="benchmark_cache", dir=".") diff --git a/contrib/blockcounter.py b/contrib/blockcounter.py index b3603d3..6d69d55 100644 --- a/contrib/blockcounter.py +++ b/contrib/blockcounter.py @@ -1,3 +1,7 @@ +"""Produces block counts + +""" + import world, chunk import sys diff --git a/contrib/clearOldCache.py b/contrib/clearOldCache.py index 01b604d..45f8b0a 100644 --- a/contrib/clearOldCache.py +++ b/contrib/clearOldCache.py @@ -1,5 +1,8 @@ #!/usr/bin/python +"""Deletes files from the old chunk-based cache""" + + usage = "python contrib/%prog [OPTIONS] " description = """ diff --git a/contrib/cyrillic_convert.py b/contrib/cyrillic_convert.py new file mode 100755 index 0000000..3273c02 --- /dev/null +++ b/contrib/cyrillic_convert.py @@ -0,0 +1,92 @@ +#!/usr/bin/python + +"""Convert gibberish back into Cyrillic""" + +import fileinput +import os +import sys + +usage = """ +If you have signs that should be Cyrillic, but are instead gibberish, +this script will convert it back to proper Cyrillic. + +usage: python %(script)s +ex. python %(script)s C:\\Inetpub\\www\\map\\markers.js + or %(script)s /srv/http/map/markers.js +""" % {'script': os.path.basename(sys.argv[0])} + +if len(sys.argv) < 2: + sys.exit(usage) + +gibberish_to_cyrillic = { + r"\u00c0": r"\u0410", + r"\u00c1": r"\u0411", + r"\u00c2": r"\u0412", + r"\u00c3": r"\u0413", + r"\u00c4": r"\u0414", + r"\u00c5": r"\u0415", + r"\u00c6": r"\u0416", + r"\u00c7": r"\u0417", + r"\u00c8": r"\u0418", + r"\u00c9": r"\u0419", + r"\u00ca": r"\u041a", + r"\u00cb": r"\u041b", + r"\u00cc": r"\u041c", + r"\u00cd": r"\u041d", + r"\u00ce": r"\u041e", + r"\u00cf": r"\u041f", + r"\u00d0": r"\u0420", + r"\u00d1": r"\u0421", + r"\u00d2": r"\u0422", + r"\u00d3": r"\u0423", + r"\u00d4": r"\u0424", + r"\u00d5": r"\u0425", + r"\u00d6": r"\u0426", + r"\u00d7": r"\u0427", + r"\u00d8": r"\u0428", + r"\u00d9": r"\u0429", + r"\u00da": r"\u042a", + r"\u00db": r"\u042b", + r"\u00dc": r"\u042c", + r"\u00dd": r"\u042d", + r"\u00de": r"\u042e", + r"\u00df": r"\u042f", + r"\u00e0": r"\u0430", + r"\u00e1": r"\u0431", + r"\u00e2": r"\u0432", + r"\u00e3": r"\u0433", + r"\u00e4": r"\u0434", + r"\u00e5": r"\u0435", + r"\u00e6": r"\u0436", + r"\u00e7": r"\u0437", + r"\u00e8": r"\u0438", + r"\u00e9": r"\u0439", + r"\u00ea": r"\u043a", + r"\u00eb": r"\u043b", + r"\u00ec": r"\u043c", + r"\u00ed": r"\u043d", + r"\u00ee": r"\u043e", + r"\u00ef": r"\u043f", + r"\u00f0": r"\u0440", + r"\u00f1": r"\u0441", + r"\u00f2": r"\u0442", + r"\u00f3": r"\u0443", + r"\u00f4": r"\u0444", + r"\u00f5": r"\u0445", + r"\u00f6": r"\u0446", + r"\u00f7": r"\u0447", + r"\u00f8": r"\u0448", + r"\u00f9": r"\u0449", + r"\u00fa": r"\u044a", + r"\u00fb": r"\u044b", + r"\u00fc": r"\u044c", + r"\u00fd": r"\u044d", + r"\u00fe": r"\u044e", + r"\u00ff": r"\u044f" +} + +for line in fileinput.FileInput(inplace=1): + for i, j in gibberish_to_cyrillic.iteritems(): + line = line.replace(i, j) + sys.stdout.write(line) + diff --git a/contrib/findSigns.py b/contrib/findSigns.py index 3213b35..a344c71 100644 --- a/contrib/findSigns.py +++ b/contrib/findSigns.py @@ -1,6 +1,8 @@ #!/usr/bin/python ''' +Updates overviewer.dat file sign info + This script will scan through every chunk looking for signs and write out an updated overviewer.dat file. This can be useful if your overviewer.dat file is either out-of-date or non-existant. diff --git a/contrib/playerInspect.py b/contrib/playerInspect.py new file mode 100644 index 0000000..d20d2ac --- /dev/null +++ b/contrib/playerInspect.py @@ -0,0 +1,22 @@ +import sys + +""" +Very basic player.dat inspection script +""" + +sys.path.append(".") + +from overviewer_core.nbt import load +from overviewer_core import items + +print "Inspecting %s" % sys.argv[1] + +data = load(sys.argv[1])[1] + + +print "Position: %r" % data['Pos'] +print "Health: %s" % data['Health'] +print "Inventory: %d items" % len(data['Inventory']) +for item in data['Inventory']: + print " %-3d %s" % (item['Count'], items.id2item(item['id'])) + diff --git a/contrib/rerenderBlocks.py b/contrib/rerenderBlocks.py index eb93871..ff7b02a 100644 --- a/contrib/rerenderBlocks.py +++ b/contrib/rerenderBlocks.py @@ -1,6 +1,8 @@ #!/usr/bin/python ''' +Generate a region list to rerender certain chunks + This is used to force the regeneration of any chunks that contain a certain blockID. The output is a chunklist file that is suitable to use with the --chunklist option to overviewer.py. diff --git a/contrib/testRender.py b/contrib/testRender.py index c4de264..4fa9e7e 100644 --- a/contrib/testRender.py +++ b/contrib/testRender.py @@ -1,5 +1,7 @@ #!/usr/bin/python +"Test Render Script" + import os, shutil, tempfile, time, sys, math, re from subprocess import Popen, PIPE, STDOUT, CalledProcessError from optparse import OptionParser diff --git a/contrib/validateRegionFile.py b/contrib/validateRegionFile.py index 7dd2763..b9276f3 100644 --- a/contrib/validateRegionFile.py +++ b/contrib/validateRegionFile.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +''' +Validate a region file + +TODO description here''' + import os.path import sys overviewer_dir = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0] diff --git a/contribManager.py b/contribManager.py new file mode 100755 index 0000000..0f89d1b --- /dev/null +++ b/contribManager.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +# The contrib manager is used to help control the contribs script +# that are shipped with overviewer in Windows packages + +import sys +import os.path +sys.path.append("overviewer_core") +import nbt +import ast + +scripts=dict( # keys are names, values are scripts + benchmark = "benchmark.py", + findSigns = "findSigns.py", + validate = "validateRegionFile.py", + playerInspect = "playerInspect.py", + convertCyrillic = "cyrillic_convert.py" + ) + +# you can symlink or hardlink contribManager.py to another name to have it +# automatically find the right script to run. For example: +# > ln -s contribManager.py validate.exe +# > chmod +x validate.exe +# > ./validate.exe -h + + +# figure out what script to execute +argv=os.path.basename(sys.argv[0]) + +if argv[-4:] == ".exe": + argv=argv[0:-4] +if argv[-3:] == ".py": + argv=argv[0:-3] + + +usage="""Usage: +%s --list-contribs |