mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-08 08:47:32 +08:00
Ready to update to v2.5
Please wait for some time. I need to change readme. I almost forgot what I changed before. WARNING: There will be many bugs!
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from server.sql import Connect
|
||||
from setting import Config
|
||||
import server.info
|
||||
import server.character
|
||||
|
||||
|
||||
def b2int(x):
|
||||
@@ -23,18 +25,27 @@ def change_char(user_id, character_id, skill_sealed):
|
||||
re = False
|
||||
|
||||
with Connect() as c:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
if Config.CHARACTER_FULL_UNLOCK:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char_full where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
else:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
x = c.fetchone()
|
||||
if x is not None:
|
||||
if skill_sealed == 'false':
|
||||
skill_sealed = False
|
||||
else:
|
||||
skill_sealed = True
|
||||
c.execute('''update user set is_skill_sealed = :a, character_id = :b, is_char_uncapped = :c, is_char_uncapped_override = :d where user_id = :e''', {
|
||||
'a': b2int(skill_sealed), 'b': character_id, 'c': x[0], 'd': x[1], 'e': user_id})
|
||||
if x:
|
||||
is_uncapped = x[0]
|
||||
is_uncapped_override = x[1]
|
||||
else:
|
||||
return False
|
||||
|
||||
re = True
|
||||
if skill_sealed == 'false':
|
||||
skill_sealed = False
|
||||
else:
|
||||
skill_sealed = True
|
||||
c.execute('''update user set is_skill_sealed = :a, character_id = :b, is_char_uncapped = :c, is_char_uncapped_override = :d where user_id = :e''', {
|
||||
'a': b2int(skill_sealed), 'b': character_id, 'c': is_uncapped, 'd': is_uncapped_override, 'e': user_id})
|
||||
|
||||
re = True
|
||||
|
||||
return re
|
||||
|
||||
@@ -43,40 +54,46 @@ def change_char_uncap(user_id, character_id):
|
||||
# 角色觉醒改变,返回字典
|
||||
r = None
|
||||
with Connect() as c:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
if not Config.CHARACTER_FULL_UNLOCK:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
else:
|
||||
c.execute('''select is_uncapped, is_uncapped_override from user_char_full where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
x = c.fetchone()
|
||||
|
||||
if x is not None and x[0] == 1:
|
||||
c.execute('''update user set is_char_uncapped_override = :a where user_id = :b''', {
|
||||
'a': b2int(x[1] == 0), 'b': user_id})
|
||||
c.execute('''update user_char set is_uncapped_override = :a where user_id = :b and character_id = :c''', {
|
||||
'a': b2int(x[1] == 0), 'b': user_id, 'c': character_id})
|
||||
c.execute('''select * from user_char where user_id = :a and character_id = :b''',
|
||||
{'a': user_id, 'b': character_id})
|
||||
|
||||
if not Config.CHARACTER_FULL_UNLOCK:
|
||||
c.execute('''update user_char set is_uncapped_override = :a where user_id = :b and character_id = :c''', {
|
||||
'a': b2int(x[1] == 0), 'b': user_id, 'c': character_id})
|
||||
c.execute(
|
||||
'''select * from user_char a,character b where a.user_id=? and a.character_id=b.character_id and a.character_id=?''', (user_id, character_id))
|
||||
else:
|
||||
c.execute('''update user_char_full set is_uncapped_override = :a where user_id = :b and character_id = :c''', {
|
||||
'a': b2int(x[1] == 0), 'b': user_id, 'c': character_id})
|
||||
c.execute(
|
||||
'''select * from user_char_full a,character b where a.user_id=? and a.character_id=b.character_id and a.character_id=?''', (user_id, character_id))
|
||||
y = c.fetchone()
|
||||
c.execute(
|
||||
'''select name from character where character_id = :x''', {'x': y[1]})
|
||||
z = c.fetchone()
|
||||
if z is not None:
|
||||
char_name = z[0]
|
||||
if y is not None:
|
||||
r = {
|
||||
"is_uncapped_override": int2b(y[14]),
|
||||
"is_uncapped": int2b(y[13]),
|
||||
"uncap_cores": [],
|
||||
"char_type": y[12],
|
||||
"skill_id_uncap": y[11],
|
||||
"skill_requires_uncap": int2b(y[10]),
|
||||
"skill_unlock_level": y[9],
|
||||
"skill_id": y[8],
|
||||
"overdrive": y[7],
|
||||
"prog": y[6],
|
||||
"frag": y[5],
|
||||
"level_exp": y[4],
|
||||
"is_uncapped_override": int2b(y[5]),
|
||||
"is_uncapped": int2b(y[4]),
|
||||
"uncap_cores": server.character.get_char_core(c, y[1]),
|
||||
"char_type": y[22],
|
||||
"skill_id_uncap": y[21],
|
||||
"skill_requires_uncap": int2b(y[20]),
|
||||
"skill_unlock_level": y[19],
|
||||
"skill_id": y[18],
|
||||
"overdrive": server.character.calc_char_value(y[2], y[11], y[14], y[17]),
|
||||
"prog": server.character.calc_char_value(y[2], y[10], y[13], y[16]),
|
||||
"frag": server.character.calc_char_value(y[2], y[9], y[12], y[15]),
|
||||
"level_exp": server.character.LEVEL_STEPS[y[2]],
|
||||
"exp": y[3],
|
||||
"level": y[2],
|
||||
"name": char_name,
|
||||
"name": y[7],
|
||||
"character_id": y[1]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user