diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-02 20:25:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-02 20:25:48 +0300 |
commit | 9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7 (patch) | |
tree | bde570dd14b4b22ffb34e917935be12a899da4c2 | |
parent | 8927537e465c698f11e06202ceec6a87bc60453e (diff) | |
download | evol-tools-9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7.tar.gz evol-tools-9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7.tar.bz2 evol-tools-9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7.tar.xz evol-tools-9e00fbb1d3d1d8d07a1e7aafdaeae3a94725e1d7.zip |
hercules: add questvars.txt parsing.
-rw-r--r-- | hercules/code/server/questsdb.py | 34 | ||||
-rwxr-xr-x | hercules/convert_server.py | 2 | ||||
-rw-r--r-- | hercules/templates/quest_db.tpl | 5 |
3 files changed, 41 insertions, 0 deletions
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 diff --git a/hercules/convert_server.py b/hercules/convert_server.py index 07fadc2..9eaba1a 100755 --- a/hercules/convert_server.py +++ b/hercules/convert_server.py @@ -10,6 +10,7 @@ from code.server.mobdb import * from code.server.mobskilldb import * from code.server.npcs import * from code.server.utils import * +from code.server.questsdb import * cleanServerData() createMainScript() @@ -18,3 +19,4 @@ convertMobDb() convertItemDb() convertConsts() convertMobSkillDb() +convertQuestsDb() diff --git a/hercules/templates/quest_db.tpl b/hercules/templates/quest_db.tpl new file mode 100644 index 0000000..e67b40f --- /dev/null +++ b/hercules/templates/quest_db.tpl @@ -0,0 +1,5 @@ +// Quest Database +// +// Structure of Database: +// Quest ID,Time Limit,Target1,Val1,Target2,Val2,Target3,Val3,Quest Title + |