Replace header encoding with lower case

This is just a commit, so the script being developed can write the exact
map out as read in. So diffing the changes is easy.
Remove empty objects from maps
empyrean family crypt: Add missing enemy type
Replace all enemy types by full pathes in all tmx files

Additional to the following script you'll need to have a file "maps.txt"
containing all maps to be processed
	find . -iname *.tmx > maps.txt
will do

--8<--
#!/usr/bin/env python

import sys
import os
import random

from lxml import etree

def replaceEnemyType(xmlroot, name, newname, filename):
	for obj in xmlroot.iterchildren(tag="objectgroup"):
		if obj.get('name') == 'enemy':
			for enemy in obj:
				t = enemy.get('type')
				if t == None:
					print "No enemy type set in ", filename
					raise
				if t == name:
					enemy.set('type', newname)
					t = enemy.get('type')
	return xmlroot

def getXMLRoot(filename):
	f = open(filename)
	lines = f.read()
	f.close()
	root = etree.fromstring(lines)
	return root

def writeXML(filename, root):
	f=open(filename, 'w')
	f.write(etree.tostring(root, pretty_print=True, xml_declaration=True, encoding='utf-8'))
	f.close()

def processMap(filename):
	root = getXMLRoot(filename)
	for enemyRepl in enemyReplacements:
		root = replaceEnemyType(root, enemyRepl[0], enemyRepl[1], filename)
	writeXML(filename, root)

enemyReplacements=[
("goblin", "enemies/goblin.txt"),
("goblin_spearman", "enemies/goblin_spearman.txt"),
("goblin_elite", "enemies/goblin_spearman.txt"),
("goblin_charger", "enemies/goblin_charger.txt"),
("goblin_shaman", "enemies/goblin_shaman.txt"),
("rilrak", "enemies/rilrak.txt"),
("skeletal_prophet", "enemies/skeletal_prophet.txt"),
("necromancer_apprentice", "enemies/necromancer_apprentice.txt"),
("skeletal_sniper", "enemies/skeletal_sniper.txt"),
("skeletal_occultist", "enemies/skeletal_occultist.txt"),
("the_warden", "enemies/the_warden.txt"),
("skeleton", "enemies/skeleton.txt"),
("skeletal_archer", "enemies/skeletal_archer.txt"),
("professor_langlier", "enemies/professor_langlier.txt"),
("antlion_freezer", "enemies/antlion_freezer.txt"),
("antlion", "enemies/antlion.txt"),
("krakatoa", "enemies/krakatoa.txt"),
("antlion_hatchling", "enemies/antlion_hatchling.txt"),
("ukkonen", "enemies/ukkonen.txt"),
("grisbon", "enemies/grisbon.txt"),
("minotaur", "enemies/minotaur.txt"),
("zombie_rotting", "enemies/zombie_rotting.txt"),
("cursed_grave", "enemies/cursed_grave.txt"),
("scathelocke", "enemies/scathelocke"),
("antlion_burster", "enemies/antlion_burster"),
("zombie_brute", "enemies/zombie_brute"),
("antlion_spitter", "enemies/antlion_spitter"),
("zombie_iceclaw", "enemies/zombie_iceclaw"),
("wyvern", "enemies/wyvern.txt"),
("skeletal_warrior", "enemies/skeletal_warrior.txt"),
("skeletal_knight", "enemies/skeletal_knight.txt"),
("zombie", "enemies/zombie.txt"),
("skeletal_mage", "enemies/skeletal_mage.txt"),
("antlion_blinker", "enemies/antlion_blinker"),
("skeletal_thundersword", "enemies/skeletal_thundersword.txt"),
("antlion_slasher", "enemies/antlion_slasher.txt"),
("goblin_charger_elite", "enemies/goblin_charger_elite.txt"),
("sir_evan_maddox", "enemies/sir_evan_maddox.txt"),
("zombie_bloodthirsty", "enemies/zombie_bloodthirsty.txt"),
("goblin_spearman_elite", "enemies/goblin_spearman_elite.txt"),
("vesuvvio", "enemies/vesuvvio.txt")
];

lines = open("maps.txt").readlines()
for map in lines:
	processMap(map.strip())
Revert "Replace header encoding with lower case"

This reverts commit b7900891a7ea4e75f01675a0a78f387637d15609.
Merge pull request #414 from stefanbeller/master

Replace enemy types by full path