diff options
author | Haru <haru@dotalux.com> | 2018-06-29 11:33:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 11:33:11 +0200 |
commit | 9d24045d743a11eda0c825ea3c989fc5e78bc8af (patch) | |
tree | 91d8f55d2aed6fb58661fd7fada8f3f6e53ed814 /tools/utils/common.py | |
parent | c419726752ebd1b532f487e5683f63232a6c237b (diff) | |
parent | 9876ae283e9ca68e60de3a0745a765e460d4c434 (diff) | |
download | hercules-9d24045d743a11eda0c825ea3c989fc5e78bc8af.tar.gz hercules-9d24045d743a11eda0c825ea3c989fc5e78bc8af.tar.bz2 hercules-9d24045d743a11eda0c825ea3c989fc5e78bc8af.tar.xz hercules-9d24045d743a11eda0c825ea3c989fc5e78bc8af.zip |
Merge pull request #2063 from dastgirp/2-petevol
Implemented Pet Evolution and Pet Feeding
Diffstat (limited to 'tools/utils/common.py')
-rw-r--r-- | tools/utils/common.py | 15 |
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) |