From abe679bfff7f36535fe2d526a2a6f6623e93d6f1 Mon Sep 17 00:00:00 2001 From: wushin Date: Wed, 30 Apr 2014 20:29:22 -0500 Subject: Updating tmx_converter for multiple mob_db files --- tmx_converter.py | 23 ++++++++++++----------- 1 file 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 = [] -- cgit v1.2.3-60-g2f50