summaryrefslogtreecommitdiff
path: root/tools/utils/common.py
diff options
context:
space:
mode:
authorDastgir <dastgirp@gmail.com>2018-06-17 16:47:00 +0100
committerAsheraf <acheraf1998@gmail.com>2018-06-25 21:21:28 +0100
commit5584624537159eed3e811df8ace4f42e9035951f (patch)
treeb4861ca885471c7c3320dc965eca6dc64e1dea71 /tools/utils/common.py
parent02c6b96f4aecae69e800b9623a76a93ad3f0802f (diff)
downloadhercules-5584624537159eed3e811df8ace4f42e9035951f.tar.gz
hercules-5584624537159eed3e811df8ace4f42e9035951f.tar.bz2
hercules-5584624537159eed3e811df8ace4f42e9035951f.tar.xz
hercules-5584624537159eed3e811df8ace4f42e9035951f.zip
Added Pet Evolution Lua to DB Converter
Diffstat (limited to 'tools/utils/common.py')
-rw-r--r--tools/utils/common.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/utils/common.py b/tools/utils/common.py
index 1a398d544..7b7811654 100644
--- a/tools/utils/common.py
+++ b/tools/utils/common.py
@@ -48,3 +48,18 @@ def LoadDBConsts(DBname, mode, serverpath):
print('LoadDBConsts: invalid database name {}'.format(DBname))
exit(1)
return consts
+
+def LoadDB(DBname, mode, serverpath):
+ filenames = [serverpath + 'db/{}/{}.conf'.format(mode, DBname)]
+
+ if os.path.isfile(serverpath + 'db/{}2.conf'.format(DBname)):
+ filenames.append(serverpath + 'db/{}2.conf'.format(DBname))
+
+ consts = dict()
+ for filename in filenames:
+ with io.open(filename) as f:
+ config = libconf.load(f)
+ db = config[DBname]
+ return db
+ print('LoadDB: invalid database name {}'.format(DBname))
+ exit(1)