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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# -*- coding: utf8 -*-
#
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
from code.fileutils import *
from code.stringutils import *
def saveCharTable(users):
dstFile = "newdb/char.sql"
firstLine = True
tpl = readFile("templates/char.sql")
with open(dstFile, "w") as w:
w.write(tpl)
w.write("INSERT INTO `char` VALUES ")
for userId in users:
user = users[userId]
if firstLine == False:
w.write(",\n")
else:
firstLine = False
w.write(("({char_id},{account_id},{char_num},'{name}',{CLASS}," +
"{base_level},{job_level},{base_exp},{job_exp},{zeny}," +
"{str},{agi},{vit},{INT},{dex},{luk},{max_hp},{hp},{max_sp}," +
"{sp},{status_point},{skill_point},{option},{karma},{manner}," +
"{party_id},{guild_id},{pet_id},{homun_id},{elemental_id}," +
"{hair},{hair_color},{clothes_color},{weapon},{shield}," +
"{head_top},{head_mid},{head_bottom},{robe}," +
"'{last_map}',{last_x},{last_y},'{save_map}',{save_x},{save_y}," +
"{partner_id},{online},{father},{mother},{child},{fame}," +
"{rename},{delete_date},{slotchange},{char_opt},{font}," +
"{unban_time},{uniqueitem_counter},'{sex}')").format(
char_id = user.char_id,
account_id = user.account_id,
char_num = user.char_num,
name = escapeSqlStr(user.char_name),
CLASS = user.char_class,
base_level = user.base_level,
job_level = user.job_level,
base_exp = user.base_exp,
job_exp = user.job_exp,
zeny = user.zeny,
str = user.stat_str,
agi = user.stat_agi,
vit = user.stat_vit,
INT = user.stat_int,
dex = user.stat_dex,
luk = user.stat_luk,
max_hp = user.max_hp,
hp = user.hp,
max_sp = user.max_sp,
sp = user.sp,
status_point = user.status_point,
skill_point = user.skill_point,
option = user.option,
karma = user.karma,
manner = user.manner,
party_id = user.party_id,
guild_id = user.guild_id,
pet_id = user.pet_id,
homun_id = "0",
elemental_id = "0",
hair = user.hair,
hair_color = user.hair_color,
clothes_color = user.clothes_color,
weapon = user.weapon,
shield = user.shield,
head_top = user.head_top,
head_mid = user.head_mid,
head_bottom = user.head_bottom,
robe = "0",
last_map = escapeSqlStr(user.last_map),
last_x = user.last_x,
last_y = user.last_y,
save_map = escapeSqlStr(user.save_map),
save_x = user.save_x,
save_y = user.save_y,
partner_id = user.partner_id,
online = "0",
father = "0",
mother = "0",
child = "0",
fame = "0",
rename = "0",
delete_date = "0",
slotchange = "0",
char_opt = "0",
font = "0",
unban_time = "0",
uniqueitem_counter = len(user.inventory),
sex = "U"
))
w.write("\n")
|