mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-04 21:47:28 +08:00
[Enhance] New skills
- For Arcaea 6.0.3 - Add support for `skill_chinatsu` and `skill_intruder`. - Add support for the invasion toggle (toggle intruder's skill states). Note that the invasion toggle in 4 states, which is different from the official server.
This commit is contained in:
@@ -12,7 +12,7 @@ class Config:
|
||||
|
||||
SONG_FILE_HASH_PRE_CALCULATE = True
|
||||
|
||||
GAME_API_PREFIX = '/autumnequinox/33' # str | list[str]
|
||||
GAME_API_PREFIX = '/coldwind/35' # 6.0.0 '/fallingleaves/34' # str | list[str]
|
||||
OLD_GAME_API_PREFIX = [] # str | list[str]
|
||||
|
||||
ALLOW_APPVERSION = [] # list[str]
|
||||
@@ -86,6 +86,9 @@ class Config:
|
||||
BEST30_WEIGHT = 1 / 40
|
||||
RECENT10_WEIGHT = 1 / 40
|
||||
|
||||
INVASION_START_WEIGHT = 0.1
|
||||
INVASION_HARD_WEIGHT = 0.1
|
||||
|
||||
MAX_FRIEND_COUNT = 50
|
||||
|
||||
WORLD_MAP_FOLDER_PATH = './database/map/'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from .config_manager import Config
|
||||
|
||||
ARCAEA_SERVER_VERSION = 'v2.12.0.1'
|
||||
ARCAEA_DATABASE_VERSION = 'v2.12.0.1'
|
||||
ARCAEA_SERVER_VERSION = 'v2.12.0.2'
|
||||
ARCAEA_DATABASE_VERSION = 'v2.12.0.2'
|
||||
ARCAEA_LOG_DATBASE_VERSION = 'v1.1'
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ class Constant:
|
||||
|
||||
MAX_STAMINA = 12
|
||||
|
||||
# INSIGHT_STATES = [x for x in range(7)]
|
||||
INSIGHT_TOGGLE_STATES = [3, 4, 5, 6]
|
||||
# DEFAULT_INSIGHT_STATE = Config.DEFAULT_INSIGHT_STATE
|
||||
|
||||
STAMINA_RECOVER_TICK = 1800000
|
||||
FRAGSTAM_RECOVER_TICK = 23 * 3600 * 1000
|
||||
|
||||
@@ -40,6 +44,8 @@ class Constant:
|
||||
|
||||
BEST30_WEIGHT = Config.BEST30_WEIGHT
|
||||
RECENT10_WEIGHT = Config.RECENT10_WEIGHT
|
||||
INVASION_START_WEIGHT = Config.INVASION_START_WEIGHT
|
||||
INVASION_HARD_WEIGHT = Config.INVASION_HARD_WEIGHT
|
||||
|
||||
WORLD_MAP_FOLDER_PATH = Config.WORLD_MAP_FOLDER_PATH
|
||||
SONG_FILE_FOLDER_PATH = Config.SONG_FILE_FOLDER_PATH
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from base64 import b64encode
|
||||
from os import urandom
|
||||
from random import choices
|
||||
from time import time
|
||||
|
||||
from .bgtask import BGTask, logdb_execute
|
||||
@@ -244,10 +245,14 @@ class UserPlay(UserScore):
|
||||
self.course_play: 'CoursePlay' = None
|
||||
|
||||
self.combo_interval_bonus: int = None # 不能给 None 以外的默认值
|
||||
self.hp_interval_bonus: int = None # 不能给 None 以外的默认值
|
||||
self.skill_cytusii_flag: str = None
|
||||
self.skill_chinatsu_flag: str = None
|
||||
self.highest_health: int = None
|
||||
self.lowest_health: int = None
|
||||
|
||||
self.invasion_flag: int = None # 1: invasion_start, 2: invasion_hard
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
# 不能super
|
||||
if self.is_world_mode is None or self.course_play_state is None:
|
||||
@@ -288,6 +293,9 @@ class UserPlay(UserScore):
|
||||
return False
|
||||
x = x + str(self.combo_interval_bonus)
|
||||
|
||||
if self.hp_interval_bonus is not None and self.hp_interval_bonus < 0:
|
||||
return False
|
||||
|
||||
y = f'{self.user.user_id}{self.song_hash}'
|
||||
checksum = md5(x+md5(y))
|
||||
|
||||
@@ -326,16 +334,27 @@ class UserPlay(UserScore):
|
||||
self.prog_boost_multiply = int(x[10])
|
||||
self.beyond_boost_gauge_usage = int(x[11])
|
||||
self.skill_cytusii_flag = x[12]
|
||||
self.skill_chinatsu_flag = x[13]
|
||||
self.invasion_flag = x[14]
|
||||
self.is_world_mode = True
|
||||
self.course_play_state = -1
|
||||
|
||||
def set_play_state_for_world(self, stamina_multiply: int = 1, fragment_multiply: int = 100, prog_boost_multiply: int = 0, beyond_boost_gauge_usage: int = 0, skill_cytusii_flag: str = None) -> None:
|
||||
def set_play_state_for_world(
|
||||
self,
|
||||
stamina_multiply: int = 1,
|
||||
fragment_multiply: int = 100,
|
||||
prog_boost_multiply: int = 0,
|
||||
beyond_boost_gauge_usage: int = 0,
|
||||
skill_cytusii_flag: str = None,
|
||||
skill_chinatsu_flag: str = None
|
||||
) -> None:
|
||||
self.song_token = b64encode(urandom(64)).decode()
|
||||
self.stamina_multiply = int(stamina_multiply)
|
||||
self.fragment_multiply = int(fragment_multiply)
|
||||
self.prog_boost_multiply = int(prog_boost_multiply)
|
||||
self.beyond_boost_gauge_usage = int(beyond_boost_gauge_usage)
|
||||
self.skill_cytusii_flag = skill_cytusii_flag
|
||||
self.skill_chinatsu_flag = skill_chinatsu_flag
|
||||
if self.prog_boost_multiply != 0 or self.beyond_boost_gauge_usage != 0:
|
||||
self.c.execute('''select prog_boost, beyond_boost_gauge from user where user_id=:a''', {
|
||||
'a': self.user.user_id})
|
||||
@@ -346,10 +365,6 @@ class UserPlay(UserScore):
|
||||
# 注意:偷懒了,没判断是否是beyond图
|
||||
self.beyond_boost_gauge_usage = 0
|
||||
|
||||
self.clear_play_state()
|
||||
self.c.execute('''insert into songplay_token values(:t,:a,:b,:c,'',-1,0,0,:d,:e,:f,:g,:h)''', {
|
||||
'a': self.user.user_id, 'b': self.song.song_id, 'c': self.song.difficulty, 'd': self.stamina_multiply, 'e': self.fragment_multiply, 'f': self.prog_boost_multiply, 'g': self.beyond_boost_gauge_usage, 'h': self.skill_cytusii_flag, 't': self.song_token})
|
||||
|
||||
self.user.select_user_about_current_map()
|
||||
self.user.current_map.select_map_info()
|
||||
|
||||
@@ -360,13 +375,23 @@ class UserPlay(UserScore):
|
||||
self.user.select_user_about_character()
|
||||
if not self.user.is_skill_sealed:
|
||||
self.user.character.select_character_info()
|
||||
if self.user.character.skill_id_displayed == 'skill_fatalis':
|
||||
# invasion 扔骰子
|
||||
_flag = choices([0, 1, 2], [
|
||||
max(1 - Constant.INVASION_START_WEIGHT - Constant.INVASION_HARD_WEIGHT, 0), Constant.INVASION_START_WEIGHT, Constant.INVASION_HARD_WEIGHT])[0]
|
||||
if self.user.is_insight_enabled and _flag != 0:
|
||||
self.invasion_flag = _flag
|
||||
|
||||
elif self.user.character.skill_id_displayed == 'skill_fatalis':
|
||||
# 特殊判断hikari fatalis的双倍体力消耗
|
||||
self.user.stamina.stamina -= self.user.current_map.stamina_cost * \
|
||||
self.stamina_multiply * 2
|
||||
self.user.stamina.update()
|
||||
return None
|
||||
|
||||
self.clear_play_state()
|
||||
self.c.execute('''insert into songplay_token values(:t,:a,:b,:c,'',-1,0,0,:d,:e,:f,:g,:h,:i,:j)''', {
|
||||
'a': self.user.user_id, 'b': self.song.song_id, 'c': self.song.difficulty, 'd': self.stamina_multiply, 'e': self.fragment_multiply, 'f': self.prog_boost_multiply, 'g': self.beyond_boost_gauge_usage, 'h': self.skill_cytusii_flag, 'i': self.skill_chinatsu_flag, 'j': self.invasion_flag, 't': self.song_token})
|
||||
|
||||
self.user.stamina.stamina -= self.user.current_map.stamina_cost * self.stamina_multiply
|
||||
self.user.stamina.update()
|
||||
|
||||
@@ -380,8 +405,8 @@ class UserPlay(UserScore):
|
||||
self.course_play.score = 0
|
||||
self.course_play.clear_type = 3 # 设置为PM,即最大值
|
||||
|
||||
self.c.execute('''insert into songplay_token values(?,?,?,?,?,?,?,?,1,100,0,0,"")''', (self.song_token, self.user.user_id, self.song.song_id,
|
||||
self.song.difficulty, self.course_play.course_id, self.course_play_state, self.course_play.score, self.course_play.clear_type))
|
||||
self.c.execute('''insert into songplay_token values(?,?,?,?,?,?,?,?,1,100,0,0,"","",0)''', (self.song_token, self.user.user_id, self.song.song_id,
|
||||
self.song.difficulty, self.course_play.course_id, self.course_play_state, self.course_play.score, self.course_play.clear_type))
|
||||
self.user.select_user_about_stamina()
|
||||
if use_course_skip_purchase:
|
||||
x = ItemCore(self.c)
|
||||
|
||||
@@ -326,6 +326,8 @@ class UserInfo(User):
|
||||
self.current_map: 'Map' = None
|
||||
self.stamina: 'UserStamina' = None
|
||||
|
||||
self.insight_state: int = None
|
||||
|
||||
self.__cores: list = None
|
||||
self.__packs: list = None
|
||||
self.__singles: list = None
|
||||
@@ -336,6 +338,12 @@ class UserInfo(User):
|
||||
self.curr_available_maps: list = None
|
||||
self.__course_banners: list = None
|
||||
|
||||
@property
|
||||
def is_insight_enabled(self) -> bool:
|
||||
if self.insight_state is None:
|
||||
self.select_user_one_column('insight_state', 4, int)
|
||||
return self.insight_state == 3 or self.insight_state == 5
|
||||
|
||||
@property
|
||||
def cores(self) -> list:
|
||||
if self.__cores is None:
|
||||
@@ -547,6 +555,7 @@ class UserInfo(User):
|
||||
# 'custom_banner': 'online_banner_2024_06',
|
||||
# 'subscription_multiplier': 114,
|
||||
# 'memory_boost_ticket': 5,
|
||||
'insight_state': self.insight_state, # 0~2 不可选,3 技能激活,4 未激活,5 激活可选,6 未激活可选
|
||||
}
|
||||
|
||||
def from_list(self, x: list) -> 'UserInfo':
|
||||
@@ -591,6 +600,8 @@ class UserInfo(User):
|
||||
|
||||
self.mp_notification_enabled = x[37] == 1
|
||||
|
||||
self.insight_state = x[38]
|
||||
|
||||
return self
|
||||
|
||||
def select_user(self) -> None:
|
||||
@@ -795,6 +806,19 @@ class UserOnline(UserInfo):
|
||||
self.c.execute('''update user set favorite_character = :a where user_id = :b''',
|
||||
{'a': self.favorite_character.character_id, 'b': self.user_id})
|
||||
|
||||
def toggle_invasion(self) -> None:
|
||||
self.c.execute(
|
||||
'''select insight_state from user where user_id = ?''', (self.user_id,))
|
||||
x = self.c.fetchone()
|
||||
if not x:
|
||||
raise NoData('No user.', 108, -3)
|
||||
self.insight_state = x[0]
|
||||
rq = Constant.INSIGHT_TOGGLE_STATES
|
||||
self.insight_state = rq[(rq.index(self.insight_state) + 1) % len(rq)]
|
||||
|
||||
self.c.execute(
|
||||
'''update user set insight_state = ? where user_id = ?''', (self.insight_state, self.user_id))
|
||||
|
||||
|
||||
class UserChanger(UserInfo, UserRegister):
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from json import load
|
||||
from random import randint
|
||||
from time import time
|
||||
|
||||
from .character import Character
|
||||
from .character import Character, UserCharacter
|
||||
from .constant import Constant
|
||||
from .error import InputError, MapLocked, NoData
|
||||
from .item import ItemFactory
|
||||
@@ -133,6 +133,7 @@ class Map:
|
||||
self.chain_info: dict = None
|
||||
|
||||
# self.requires: list[dict] = None
|
||||
self.requires_any: 'list[dict]' = None
|
||||
|
||||
self.disable_over: bool = None
|
||||
self.new_law: str = None
|
||||
@@ -188,6 +189,8 @@ class Map:
|
||||
r['disable_over'] = self.disable_over
|
||||
if self.new_law is not None and self.new_law != '':
|
||||
r['new_law'] = self.new_law
|
||||
if self.requires_any:
|
||||
r['requires_any'] = self.requires_any
|
||||
return r
|
||||
|
||||
def from_dict(self, raw_dict: dict) -> 'Map':
|
||||
@@ -216,6 +219,7 @@ class Map:
|
||||
|
||||
self.disable_over = raw_dict.get('disable_over')
|
||||
self.new_law = raw_dict.get('new_law')
|
||||
self.requires_any = raw_dict.get('requires_any')
|
||||
return self
|
||||
|
||||
def select_map_info(self):
|
||||
@@ -474,7 +478,8 @@ class WorldSkillMixin:
|
||||
'skill_ilith_ivy': self._skill_ilith_ivy,
|
||||
'ilith_awakened_skill': self._ilith_awakened_skill,
|
||||
'skill_hikari_vanessa': self._skill_hikari_vanessa,
|
||||
'skill_mithra': self._skill_mithra
|
||||
'skill_mithra': self._skill_mithra,
|
||||
'skill_chinatsu': self._skill_chinatsu,
|
||||
}
|
||||
if self.user_play.beyond_gauge == 0 and self.character_used.character_id == 35 and self.character_used.skill_id_displayed:
|
||||
self._special_tempest()
|
||||
@@ -492,6 +497,7 @@ class WorldSkillMixin:
|
||||
'luna_uncap': self._luna_uncap,
|
||||
'skill_kanae_uncap': self._skill_kanae_uncap,
|
||||
'skill_eto_hoppe': self._skill_eto_hoppe,
|
||||
'skill_intruder': self._skill_intruder,
|
||||
}
|
||||
if self.character_used.skill_id_displayed in factory_dict:
|
||||
factory_dict[self.character_used.skill_id_displayed]()
|
||||
@@ -630,9 +636,11 @@ class WorldSkillMixin:
|
||||
kanae 觉醒技能,保存世界模式 progress 并在下次结算
|
||||
直接加减在 progress 最后
|
||||
技能存储 base_progress * PROG / 50,下一次消耗全部存储值(无视技能和搭档,但需要非技能隐藏状态)
|
||||
6.0 更新:需要体力消耗才存
|
||||
'''
|
||||
self.kanae_stored_progress = self.progress_normalized
|
||||
self.user.current_map.reclimb(self.final_progress)
|
||||
if self.user.current_map.stamina_cost > 0:
|
||||
self.kanae_stored_progress = self.progress_normalized
|
||||
self.user.current_map.reclimb(self.final_progress)
|
||||
|
||||
def _skill_eto_hoppe(self) -> None:
|
||||
'''
|
||||
@@ -642,6 +650,26 @@ class WorldSkillMixin:
|
||||
self.character_bonus_progress_normalized = self.progress_normalized
|
||||
self.user.current_map.reclimb(self.final_progress)
|
||||
|
||||
def _skill_chinatsu(self) -> None:
|
||||
'''
|
||||
chinatsu 技能,hp 超过时提高搭档能力值
|
||||
'''
|
||||
_flag = self.user_play.skill_chinatsu_flag
|
||||
if not self.user_play.hp_interval_bonus or not _flag:
|
||||
return
|
||||
|
||||
x = _flag[:min(len(_flag), self.user_play.hp_interval_bonus)]
|
||||
self.over_skill_increase = x.count('2') * 5
|
||||
self.prog_skill_increase = x.count('1') * 5
|
||||
|
||||
def _skill_intruder(self) -> None:
|
||||
'''
|
||||
intruder 技能,夺舍后世界进度翻倍
|
||||
'''
|
||||
if self.user_play.invasion_flag:
|
||||
self.character_bonus_progress_normalized = self.progress_normalized
|
||||
self.user.current_map.reclimb(self.final_progress)
|
||||
|
||||
|
||||
class BaseWorldPlay(WorldSkillMixin):
|
||||
'''
|
||||
@@ -690,9 +718,13 @@ class BaseWorldPlay(WorldSkillMixin):
|
||||
'world_mode_locked_end_ts': self.user.world_mode_locked_end_ts,
|
||||
'beyond_boost_gauge': self.user.beyond_boost_gauge,
|
||||
# 'wpaid': 'helloworld', # world play id ???
|
||||
# progress_before_sub_boost
|
||||
# progress_sub_boost_amount
|
||||
# subscription_multiply
|
||||
'progress_before_sub_boost': self.final_progress,
|
||||
'progress_sub_boost_amount': 0,
|
||||
# 'subscription_multiply'
|
||||
|
||||
# lephon_final: bool dynamic map info
|
||||
# lephon_active: bool dynamic map info
|
||||
# 'steps_modified': False,
|
||||
}
|
||||
|
||||
if self.character_used.skill_id_displayed == 'skill_maya':
|
||||
@@ -751,6 +783,11 @@ class BaseWorldPlay(WorldSkillMixin):
|
||||
if self.user_play.beyond_gauge == 0 and self.user.kanae_stored_prog > 0:
|
||||
# 实在不想拆开了,在这里判断一下,注意这段不会在 BeyondWorldPlay 中执行
|
||||
self.kanae_added_progress = self.user.kanae_stored_prog
|
||||
|
||||
if self.user_play.invasion_flag: # not None and != 0
|
||||
# 这里硬编码了搭档 id 72
|
||||
self.character_used = UserCharacter(self.c, 72, self.user)
|
||||
self.character_used.select_character_info()
|
||||
else:
|
||||
self.character_used.character_id = self.user.character.character_id
|
||||
self.character_used.level.level = self.user.character.level.level
|
||||
@@ -808,6 +845,7 @@ class WorldPlay(BaseWorldPlay):
|
||||
def to_dict(self) -> dict:
|
||||
r = super().to_dict()
|
||||
|
||||
|
||||
# 基础进度加上搭档倍数 不带 character_bonus_progress 但是带 kanae 技能
|
||||
r['progress_partial_after_stat'] = self.progress_normalized
|
||||
|
||||
@@ -932,6 +970,7 @@ class BeyondWorldPlay(BaseWorldPlay):
|
||||
r['char_stats']['over_skill_increase'] = self.over_skill_increase
|
||||
|
||||
r["user_map"]["steps"] = len(self.user.current_map.steps_for_climbing)
|
||||
|
||||
r['affinity_multiply'] = self.affinity_multiplier
|
||||
if self.user_play.beyond_boost_gauge_usage != 0:
|
||||
r['beyond_boost_gauge_usage'] = self.user_play.beyond_boost_gauge_usage
|
||||
|
||||
Reference in New Issue
Block a user