summaryrefslogtreecommitdiff
path: root/tmx_converter.py
diff options
context:
space:
mode:
authorwushin <pasekei@gmail.com>2014-04-30 20:29:22 -0500
committerwushin <pasekei@gmail.com>2014-05-01 14:45:43 -0500
commitabe679bfff7f36535fe2d526a2a6f6623e93d6f1 (patch)
tree0766970a5054a36047c6b3332d16c8b0b9f2d631 /tmx_converter.py
parentd6159dee63b22c214939120962b8b01fa2621578 (diff)
downloadtools-abe679bfff7f36535fe2d526a2a6f6623e93d6f1.tar.gz
tools-abe679bfff7f36535fe2d526a2a6f6623e93d6f1.tar.bz2
tools-abe679bfff7f36535fe2d526a2a6f6623e93d6f1.tar.xz
tools-abe679bfff7f36535fe2d526a2a6f6623e93d6f1.zip
Updating tmx_converter for multiple mob_db files
Diffstat (limited to 'tmx_converter.py')
-rwxr-xr-xtmx_converter.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/tmx_converter.py b/tmx_converter.py
index dbfedf8..d25430a 100755
--- a/tmx_converter.py
+++ b/tmx_converter.py
@@ -55,7 +55,7 @@ MESSAGE = 'This file is generated automatically. All manually changes will be re
CLIENT_MAPS = 'maps'
SERVER_WLK = 'data'
SERVER_NPCS = 'npc'
-SERVER_MOB_DB = 'db/mob_db.txt'
+TMWA_MAP_CONF = 'conf/tmwa-map.conf'
NPC_MOBS = '_mobs.txt'
NPC_WARPS = '_warps.txt'
NPC_IMPORTS = '_import.txt'
@@ -328,16 +328,17 @@ def main(argv):
if check_mobs:
global mob_names
mob_names = {}
- with open(posixpath.join(server_data, SERVER_MOB_DB)) as mob_db:
- for line in mob_db:
- if not line.strip():
- continue
- if line.startswith('#'):
- continue
- if line.startswith('//'):
- continue
- k, v, _ = line.split(',', 2)
- mob_names[int(k)] = v.strip()
+ with open(posixpath.join(server_data, TMWA_MAP_CONF)) as mob_dbs:
+ for mob_db_line in mob_dbs:
+ if mob_db_line.startswith('mob_db:'):
+ with open(posixpath.join(server_data, mob_db_line.split(':')[1].strip())) as mob_db:
+ for line in mob_db:
+ if not line.strip():
+ continue
+ if line.startswith('//'):
+ continue
+ k, v, _ = line.split(',', 2)
+ mob_names[int(k)] = v.strip()
npc_master = []
map_basenames = []