From 9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Nov 2014 20:25:48 +0300 Subject: hercules: add questvars.txt parsing. --- hercules/code/server/questsdb.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 hercules/code/server/questsdb.py (limited to 'hercules/code') diff --git a/hercules/code/server/questsdb.py b/hercules/code/server/questsdb.py new file mode 100644 index 0000000..489acc7 --- /dev/null +++ b/hercules/code/server/questsdb.py @@ -0,0 +1,34 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +import re + +from code.fileutils import * +from code.stringutils import * + +def convertQuestsDb(): + srcFile = "oldserverdata/db/questvars.txt" + dstFile = "newserverdata/db/quest_db.txt" + fieldsSplit = re.compile(",") + with open(srcFile, "r") as r: + with open(dstFile, "w") as w: + tpl = readFile("templates/quest_db.tpl") + w.write(tpl) + cnt = 1000 + for line in r: + if len(line) < 2 or line[0:2] == "//": + continue + + idx = line.find("// ") + if idx < 3: + continue + line = line[idx + 3:] + idx = line.find(" ") + if idx < 3: + continue + line = line[:idx] + + w.write("{0},0,0,0,0,0,0,0,\"{1}\"\n".format(cnt, line)) + cnt = cnt + 1 \ No newline at end of file -- cgit v1.2.3-70-g09d2