diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-18 19:33:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-18 19:33:42 +0300 |
commit | 561c8902706feec36316c270bcad0947da2a703d (patch) | |
tree | fcc113b5b193889d35e74ccc353c12c1c15105b4 /hercules/code/server | |
parent | e1413bbc4716e63a89d281b931c2f30d4a7017cd (diff) | |
download | evol-tools-561c8902706feec36316c270bcad0947da2a703d.tar.gz evol-tools-561c8902706feec36316c270bcad0947da2a703d.tar.bz2 evol-tools-561c8902706feec36316c270bcad0947da2a703d.tar.xz evol-tools-561c8902706feec36316c270bcad0947da2a703d.zip |
hercules: convert to skill.sql
Diffstat (limited to 'hercules/code/server')
-rw-r--r-- | hercules/code/server/db/skill.py | 31 | ||||
-rw-r--r-- | hercules/code/server/evol/main.py | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/hercules/code/server/db/skill.py b/hercules/code/server/db/skill.py new file mode 100644 index 0000000..9ca4828 --- /dev/null +++ b/hercules/code/server/db/skill.py @@ -0,0 +1,31 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2015 Evol Online +# Author: Andrei Karas (4144) + +from code.fileutils import * +from code.stringutils import * + +def saveSkillTable(users): + dstFile = "newdb/skill.sql" + firstLine = True + tpl = readFile("templates/skill.sql") + with open(dstFile, "w") as w: + w.write(tpl) + w.write("INSERT INTO `skill` VALUES ") + for userId in users: + user = users[userId] + for skill in user.skills: + + if firstLine == False: + w.write(",\n") + else: + firstLine = False + + w.write(("({char_id},{id},{lv},{flag})").format( + char_id = user.char_id, + id = skill.skillId, + lv = skill.level, + flag = skill.flags + )) + w.write("\n") diff --git a/hercules/code/server/evol/main.py b/hercules/code/server/evol/main.py index 577c868..6910bf5 100644 --- a/hercules/code/server/evol/main.py +++ b/hercules/code/server/evol/main.py @@ -7,6 +7,7 @@ from code.server.account import * from code.server.db.char import * from code.server.db.charregnumdb import * +from code.server.db.skill import * from code.server.evol.athena import * from code.server.evol.consts import * from code.server.evol.itemdb import * @@ -32,3 +33,4 @@ def dbEvolMain(): users = readAthena() saveCharTable(users) saveCharRegNumDbTable(users) + saveSkillTable(users) |