diff options
author | gumi <git@gumi.ca> | 2018-05-08 12:30:27 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-05-08 12:30:27 -0400 |
commit | 8c28fe458f5b73f8e26c7a154e31d1d74da943eb (patch) | |
tree | a501479a64c6359fa52208a97d2381293925c597 | |
parent | 165de2917208c1025b05e75f43f73102a77e066c (diff) | |
download | evol-tools-8c28fe458f5b73f8e26c7a154e31d1d74da943eb.tar.gz evol-tools-8c28fe458f5b73f8e26c7a154e31d1d74da943eb.tar.bz2 evol-tools-8c28fe458f5b73f8e26c7a154e31d1d74da943eb.tar.xz evol-tools-8c28fe458f5b73f8e26c7a154e31d1d74da943eb.zip |
-rwxr-xr-x | hercules/tmx_converter.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py index da78d82..969b007 100755 --- a/hercules/tmx_converter.py +++ b/hercules/tmx_converter.py @@ -35,15 +35,11 @@ check_mobs = True # mob_db.txt # lower case versions of everything except 'spawn' and 'warp' other_object_types = set([ 'particle_effect', - 'npc', # not interpreted by client - 'script', # for ManaServ - 'fixme', # flag for things that didn't have a type before 'music', ]) -# Somebody has put ManaServ fields in our data! other_spawn_fields = ( - 'spawn_rate', + 'monster_id', ) other_warp_fields = ( ) @@ -80,7 +76,6 @@ class Object(object): ) class Mob(Object): __slots__ = ( - 'monster_id', 'max_beings', 'spawn', 'death', @@ -320,14 +315,20 @@ class ContentHandler(xml.sax.ContentHandler): obj = self.object try: if isinstance(obj, Mob): + if not hasattr(obj, 'monster_id'): + obj.monster_id = 0 mob_id = obj.monster_id if check_mobs: try: name = mob_names[mob_id] except KeyError: - print('\n\nWarning: unknown mob ID %d (%s) on map %s.' % (mob_id, obj.name, self.base)) - # TODO: make it find the id by itself - return + for mid, mn in mob_names.iteritems(): + if mn == obj.name: + mob_id = mid + name = obj.name + if mob_id == obj.monster_id: + print('\n\nWarning: unknown mob ID %d (%s) on map %s.' % (mob_id, obj.name, self.base)) + return else: if name != obj.name: print('\n\nWarning: wrong mob name on map %s: %s (!= %s)' % (self.base, obj.name, name)) |