blob: 9ca482813a6a2407b81b632baa87754f02a7f924 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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")
|