summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-02 12:40:39 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-02 12:40:39 +0300
commit8dc2b2020ec745d33575c35821f8279d351519f2 (patch)
treea3c9a8f779bfa9513f123e48dd86df8594614878
parent58d6b3709c95a0ea1b3f97c99a29f7b529e647dc (diff)
downloadevol-tools-8dc2b2020ec745d33575c35821f8279d351519f2.tar.gz
evol-tools-8dc2b2020ec745d33575c35821f8279d351519f2.tar.bz2
evol-tools-8dc2b2020ec745d33575c35821f8279d351519f2.tar.xz
evol-tools-8dc2b2020ec745d33575c35821f8279d351519f2.zip
hercules: move config write functions to separate file.
-rw-r--r--hercules/code/configutils.py27
-rw-r--r--hercules/code/server/itemdb.py24
2 files changed, 28 insertions, 23 deletions
diff --git a/hercules/code/configutils.py b/hercules/code/configutils.py
new file mode 100644
index 0000000..a20f3a0
--- /dev/null
+++ b/hercules/code/configutils.py
@@ -0,0 +1,27 @@
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2014 Evol Online
+# Author: Andrei Karas (4144)
+
+def writeIntField(w, name, value):
+ if value == "":
+ value = "0"
+ w.write(" {0}: {1}\n".format(name, value))
+
+def writeStrField(w, name, value):
+ w.write(" {0}: \"{1}\"\n".format(name, value))
+
+def writeSubField(w, name, value):
+ w.write(" {0}: {1}\n".format(name, value));
+
+def writeStartBlock(w, text):
+ w.write(" {0}: {{\n".format(text));
+
+def writeEndBlock(w):
+ w.write(" }\n");
+
+def writeStartScript(w, name):
+ w.write(" {0}: <\"\n".format(name))
+
+def writeEndScript(w):
+ w.write(" \">\n")
diff --git a/hercules/code/server/itemdb.py b/hercules/code/server/itemdb.py
index e91682d..b0a2bff 100644
--- a/hercules/code/server/itemdb.py
+++ b/hercules/code/server/itemdb.py
@@ -5,32 +5,10 @@
import re
+from code.configutils import *
from code.fileutils import *
from code.stringutils import *
-def writeIntField(w, name, value):
- if value == "":
- value = "0"
- w.write(" {0}: {1}\n".format(name, value))
-
-def writeStrField(w, name, value):
- w.write(" {0}: \"{1}\"\n".format(name, value))
-
-def writeSubField(w, name, value):
- w.write(" {0}: {1}\n".format(name, value));
-
-def writeStartBlock(w, text):
- w.write(" {0}: {{\n".format(text));
-
-def writeEndBlock(w):
- w.write(" }\n");
-
-def writeStartScript(w, name):
- w.write(" {0}: <\"\n".format(name))
-
-def writeEndScript(w):
- w.write(" \">\n")
-
def convertItemDb():
srcFile = "oldserverdata/db/item_db.txt"
dstFile = "newserverdata/db/re/item_db.conf"