summaryrefslogtreecommitdiff
path: root/hercules/code/server/consts.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-29 15:16:29 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-29 15:16:29 +0300
commit8621f3e93bad320dc61ea9bea7cfc4767b1c5a8b (patch)
tree98b81fe09d9cd9406d8b65aa82313148eddbdae2 /hercules/code/server/consts.py
parent3e422ea7eb8e83638971bdff4f584db2750ee0a4 (diff)
downloadtools-8621f3e93bad320dc61ea9bea7cfc4767b1c5a8b.tar.gz
tools-8621f3e93bad320dc61ea9bea7cfc4767b1c5a8b.tar.bz2
tools-8621f3e93bad320dc61ea9bea7cfc4767b1c5a8b.tar.xz
tools-8621f3e93bad320dc61ea9bea7cfc4767b1c5a8b.zip
hercules: add support for convert consts.txt from tmw.
Diffstat (limited to 'hercules/code/server/consts.py')
-rw-r--r--hercules/code/server/consts.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/hercules/code/server/consts.py b/hercules/code/server/consts.py
deleted file mode 100644
index d2c5c9b..0000000
--- a/hercules/code/server/consts.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf8 -*-
-#
-# Copyright (C) 2014 Evol Online
-# Author: Andrei Karas (4144)
-
-import re
-
-from code.fileutils import *
-from code.stringutils import *
-
-def convertConsts(quests):
- dstFile = "newserverdata/db/const.txt"
- fieldsSplit = re.compile("\t+")
- fields = dict()
- with open(dstFile, "w") as w:
- srcFile = "serverdata/db/const.txt"
- with open(srcFile, "r") as r:
- for line in r:
- if len(line) < 2 or line[0:2] == "//":
- continue
- line = line.replace(" ", "\t")
- rows = fieldsSplit.split(line)
- sz = len(rows)
- if sz < 2 or sz > 3:
- continue
-
- fields[rows[0]] = rows[1][:-1]
- if sz == 2:
- w.write("{0}\t{1}".format(rows[0], rows[1]))
- else:
- w.write("{0}\t{1}\t{2}".format(rows[0], rows[1], rows[2]))
- # build in parameters
- w.write("ClientVersion\t10000\t1\n");
-
- srcFile = "oldserverdata/db/const.txt"
- w.write("// evol constants\n")
- with open(srcFile, "r") as r:
- for line in r:
- if len(line) < 2 or line[0:2] == "//":
- continue
- line = line.replace(" ", "\t")
- rows = fieldsSplit.split(line)
- if len(rows) != 2:
- continue
-
- if rows[0] in quests:
- rows[1] = str(quests[rows[0]]) + "\n"
- if rows[0] in fields:
- if fields[rows[0]] != rows[1][:-1]:
- print "warning: different const values for {0} ({1}, {2})".format(rows[0], rows[1][:-1], fields[rows[0]])
- else:
- w.write("{0}\t{1}".format(rows[0], rows[1]))