summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoro11c <b.r.longbons@gmail.com>2014-05-01 12:53:55 -0700
committero11c <b.r.longbons@gmail.com>2014-05-01 12:53:55 -0700
commitc6f51d80a42f0002fa71617c64952747f8fba281 (patch)
tree0766970a5054a36047c6b3332d16c8b0b9f2d631
parentd6159dee63b22c214939120962b8b01fa2621578 (diff)
parentabe679bfff7f36535fe2d526a2a6f6623e93d6f1 (diff)
downloadtools-c6f51d80a42f0002fa71617c64952747f8fba281.tar.gz
tools-c6f51d80a42f0002fa71617c64952747f8fba281.tar.bz2
tools-c6f51d80a42f0002fa71617c64952747f8fba281.tar.xz
tools-c6f51d80a42f0002fa71617c64952747f8fba281.zip
Merge pull request #4 from wushin/mob-db-split
Updating tmx_converter for multiple mob_db files
-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 = []