summaryrefslogtreecommitdiff
path: root/hercules
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-02-18 19:33:42 +0300
committerAndrei Karas <akaras@inbox.ru>2015-02-18 19:33:42 +0300
commit561c8902706feec36316c270bcad0947da2a703d (patch)
treefcc113b5b193889d35e74ccc353c12c1c15105b4 /hercules
parente1413bbc4716e63a89d281b931c2f30d4a7017cd (diff)
downloadevol-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')
-rw-r--r--hercules/code/server/db/skill.py31
-rw-r--r--hercules/code/server/evol/main.py2
-rw-r--r--hercules/templates/skill.sql8
3 files changed, 41 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)
diff --git a/hercules/templates/skill.sql b/hercules/templates/skill.sql
new file mode 100644
index 0000000..d4a93df
--- /dev/null
+++ b/hercules/templates/skill.sql
@@ -0,0 +1,8 @@
+CREATE TABLE IF NOT EXISTS `skill` (
+ `char_id` INT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `id` SMALLINT(11) UNSIGNED NOT NULL DEFAULT '0',
+ `lv` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0',
+ `flag` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
+ PRIMARY KEY (`char_id`,`id`)
+) ENGINE=InnoDB;
+