完成寰宇蝗灾查询 (#74)

* 完成寰宇蝗灾查询

* 🚨 `pre-commit-ci`修复格式错误

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
季落 2023-09-09 18:05:54 +08:00 committed by GitHub
parent 331f828a46
commit ca1fe55666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 756 additions and 85 deletions

View File

@ -42,6 +42,9 @@ CHALLENGE_INFO_URL = f'{NEW_URL}/game_record/app/hkrpg/api/challenge'
CHALLENGE_INFO_URL_OS = f'{OS_INFO_URL}/game_record/hkrpg/api/challenge' CHALLENGE_INFO_URL_OS = f'{OS_INFO_URL}/game_record/hkrpg/api/challenge'
ROGUE_INFO_URL = f'{NEW_URL}/game_record/app/hkrpg/api/rogue' # 角色模拟宇宙信息接口 ROGUE_INFO_URL = f'{NEW_URL}/game_record/app/hkrpg/api/rogue' # 角色模拟宇宙信息接口
ROGUE_LOCUST_INFO_URL = (
f'{NEW_URL}/game_record/app/hkrpg/api/rogue_locust' # 角色寰宇蝗灾信息接口
)
STAR_RAIL_GACHA_LOG_URL = f'{OLD_URL}/common/gacha_record/api/getGachaLog' STAR_RAIL_GACHA_LOG_URL = f'{OLD_URL}/common/gacha_record/api/getGachaLog'
STAR_RAIL_GACHA_LOG_URL_OS = ( STAR_RAIL_GACHA_LOG_URL_OS = (

View File

@ -113,12 +113,60 @@ class RogueBasicInfo(TypedDict):
unlocked_skill_points: int unlocked_skill_points: int
class LocustCntInfo(TypedDict):
narrow: int
miracle: int
event: int
class LocustDestinyInfo(TypedDict):
id: int
desc: str
level: int
class LocustBasicInfo(TypedDict):
cnt: LocustCntInfo
destiny: List[LocustDestinyInfo]
class RoleInfo(TypedDict): class RoleInfo(TypedDict):
server: str server: str
nickname: str nickname: str
level: int level: int
class LocustBlocks(TypedDict):
block_id: int
name: str
num: int
class LocustFury(TypedDict):
type: int
point: str
class LocustRecordInfo(TypedDict):
name: str
finish_time: RogueTime
final_lineup: List[RogueAvatar]
base_type_list: List[RogueBaseType]
cached_avatars: List[RogueAvatar]
buffs: List[RogueBuffs]
miracles: List[RogueMiracles]
blocks: List[LocustBlocks]
worm_weak: Union[str, str]
difficulty: int
fury: LocustFury
detail_h: Union[int, None]
start_h: Union[int, None]
class LocustRecord(TypedDict):
records: List[LocustRecordInfo]
class RogueData(TypedDict): class RogueData(TypedDict):
role: RoleInfo role: RoleInfo
basic_info: RogueBasicInfo basic_info: RogueBasicInfo
@ -126,6 +174,12 @@ class RogueData(TypedDict):
last_record: RogueRecord last_record: RogueRecord
class RogueLocustData(TypedDict):
role: RoleInfo
basic: LocustBasicInfo
detail: LocustRecord
################ ################
# 深渊相关 # # 深渊相关 #
################ ################

View File

@ -103,6 +103,7 @@ async def draw_char_info_img(raw_mes: str, sr_uid: str):
1004, 1004,
1003, 1003,
1201, 1201,
1212,
]: ]:
skill_list = skill_dict[str(char.char_id)]['skilllist'] skill_list = skill_dict[str(char.char_id)]['skilllist']
damage_len = len(skill_list) damage_len = len(skill_list)
@ -755,6 +756,7 @@ async def cal(char_data: Dict):
1004, 1004,
1003, 1003,
1201, 1201,
1212,
]: ]:
if char.char_id == 1213: if char.char_id == 1213:
for skill_type in [ for skill_type in [
@ -772,6 +774,11 @@ async def cal(char_data: Dict):
role = RoleInstance(char) role = RoleInstance(char)
im_tmp = await role.cal_damage(skill_type) im_tmp = await role.cal_damage(skill_type)
skill_info_list.append(im_tmp) skill_info_list.append(im_tmp)
elif char.char_id == 1212:
for skill_type in ['Normal', 'BPSkill', 'BPSkill1', 'Ultra']:
role = RoleInstance(char)
im_tmp = await role.cal_damage(skill_type)
skill_info_list.append(im_tmp)
elif char.char_id == 1208: elif char.char_id == 1208:
for skill_type in ['Normal', 'Ultra']: for skill_type in ['Normal', 'Ultra']:
role = RoleInstance(char) role = RoleInstance(char)

View File

@ -381,11 +381,50 @@ class Qingque(BaseAvatar):
self.extra_ability_attribute['AttackAddedRatio'] = self.Talent() self.extra_ability_attribute['AttackAddedRatio'] = self.Talent()
class Jingliu(BaseAvatar):
Buff: BaseAvatarBuff
def __init__(
self, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]
):
super().__init__(char=char, skills=skills)
self.eidolon_attribute = {}
self.extra_ability_attribute = {}
self.eidolons()
self.extra_ability()
def Technique(self):
pass
def eidolons(self):
if self.avatar_rank >= 1:
self.eidolon_attribute['Ultra_CriticalChanceBase'] = mp.mpf(0.12)
self.eidolon_attribute['BPSkill1_CriticalChanceBase'] = mp.mpf(
0.12
)
if self.avatar_rank >= 2:
self.eidolon_attribute['UltraDmgAdd'] = mp.mpf(0.3)
if self.avatar_rank >= 4:
self.eidolon_attribute['BPSkill1AttackAddedRatio'] = mp.mpf(0.4)
self.eidolon_attribute['UltraAttackAddedRatio'] = mp.mpf(0.4)
if self.avatar_rank >= 6:
self.eidolon_attribute['Ultra_CriticalDamageBase'] = mp.mpf(0.5)
self.eidolon_attribute['BPSkill1_CriticalDamageBase'] = mp.mpf(0.5)
def extra_ability(self):
logger.info('额外能力')
logger.info('【转魄】状态下造成的伤害提高10%')
self.extra_ability_attribute['BPSkill1DmgAdd'] = mp.mpf(0.1)
self.extra_ability_attribute['UltraDmgAdd'] = mp.mpf(0.1)
class Avatar: class Avatar:
@classmethod @classmethod
def create( def create(
cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill] cls, char: DamageInstanceAvatar, skills: List[DamageInstanceSkill]
): ):
if char.id_ == 1212:
return Jingliu(char, skills)
if char.id_ == 1201: if char.id_ == 1201:
return Qingque(char, skills) return Qingque(char, skills)
if char.id_ == 1003: if char.id_ == 1003:

View File

@ -68,9 +68,9 @@
120 120
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1] "Ultra": ["attack","终结技", 1, "Ultra"]
} }
}, },
"1204": { "1204": {
@ -144,10 +144,10 @@
130 130
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1], "Ultra": ["attack","终结技", 1, "Ultra"],
"Talent": ["attack","10层神君", 1] "Talent": ["attack","10层神君", 1, "Talent"]
} }
}, },
"1107": { "1107": {
@ -220,10 +220,10 @@
130 130
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","强化反击", 1], "Ultra": ["attack","强化反击", 1, "Ultra"],
"Talent": ["attack","反击", 1] "Talent": ["attack","反击", 1, "Talent"]
} }
}, },
"1213": { "1213": {
@ -330,11 +330,11 @@
140 140
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 2], "Normal": ["attack","普攻", 2, "Normal"],
"Normal1": ["attack","瞬华", 3], "Normal1": ["attack","瞬华", 3, "Normal1"],
"Normal2": ["attack","天矢阴", 5], "Normal2": ["attack","天矢阴", 5, "Normal2"],
"Normal3": ["attack","盘拏耀跃", 7], "Normal3": ["attack","盘拏耀跃", 7, "Normal3"],
"Ultra": ["attack","终结技", 3] "Ultra": ["attack","终结技", 3, "Ultra"]
} }
}, },
"1006": { "1006": {
@ -440,9 +440,9 @@
110 110
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1] "Ultra": ["attack","终结技", 1, "Ultra"]
} }
}, },
"1005": { "1005": {
@ -531,11 +531,11 @@
110 110
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1], "Ultra": ["attack","终结技", 1, "Ultra"],
"DOT": ["attack","单次持续伤害", 1], "DOT": ["attack","单次持续伤害", 1, "DOT"],
"Talent": ["attack","追加攻击", 1] "Talent": ["attack","追加攻击", 1, "Talent"]
} }
}, },
"1205": { "1205": {
@ -664,10 +664,10 @@
110 110
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"Normal1": ["attack","无间剑树", 1], "Normal1": ["attack","无间剑树", 1, "Normal1"],
"Ultra": ["attack","终结技", 1], "Ultra": ["attack","终结技", 1, "Ultra"],
"Talent": ["attack","追加攻击", 1] "Talent": ["attack","追加攻击", 1, "Talent"]
} }
}, },
"1208": { "1208": {
@ -785,8 +785,8 @@
135 135
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"Ultra": ["attack","终结技", 1] "Ultra": ["attack","终结技", 1, "Ultra"]
} }
}, },
"1104": { "1104": {
@ -859,9 +859,9 @@
110 110
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["defence","终结技(护盾)", 1] "Ultra": ["defence","终结技(护盾)", 1, "Ultra"]
} }
}, },
"1209": { "1209": {
@ -984,10 +984,10 @@
120 120
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1], "Ultra": ["attack","终结技", 1, "Ultra"],
"Talent": ["attack","附加伤害", 1] "Talent": ["attack","附加伤害", 1, "Talent"]
} }
}, },
"1004": { "1004": {
@ -1059,9 +1059,9 @@
120 120
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 3], "BPSkill": ["attack","战技", 3, "BPSkill"],
"Ultra": ["attack","终结技", 1] "Ultra": ["attack","终结技", 1, "Ultra"]
} }
}, },
"1003": { "1003": {
@ -1133,10 +1133,10 @@
120 120
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 3], "BPSkill": ["attack","战技", 1, "BPSkill"],
"Ultra": ["attack","终结技", 1], "Ultra": ["attack","终结技", 1, "Ultra"],
"Talent": ["attack","追加攻击", 1] "Talent": ["attack","追加攻击", 1, "Talent"]
} }
}, },
"1201": { "1201": {
@ -1219,9 +1219,102 @@
140 140
], ],
"skilllist": { "skilllist": {
"Normal": ["attack","普攻", 1], "Normal": ["attack","普攻", 1, "Normal"],
"Normal1": ["attack","杠上开花!", 1], "Normal1": ["attack","杠上开花!", 1, "Normal1"],
"Ultra": ["attack","终结技", 1] "Ultra": ["attack","终结技", 1, "Ultra"]
}
},
"1212": {
"Normal": [
0.5000000004656613,
0.6000000005587935,
0.7000000006519258,
0.8000000007450581,
0.9000000008381903,
1.0000000000931323,
1.1000000001862645,
1.2000000002793968,
1.3000000002793968
],
"BPSkill": [
1.0000000005122274,
1.1000000006705523,
1.200000000828877,
1.300000000558794,
1.400000000214204,
1.500000000372529,
1.630000000745058,
1.750000000419095,
1.880000000860302,
2.000000000232831,
2.1000000003911555,
2.20000000054948,
2.300000000707805,
2.40000000086613,
2.50000000093132
],
"BPSkill1": [
1.2000000005122274,
1.3200000006705523,
1.440000000828877,
1.560000000558794,
1.680000000214204,
1.800000000372529,
1.950000000745058,
2.100000000419095,
2.250000000860302,
2.400000000232831,
2.5200000003911555,
2.64000000054948,
2.760000000707805,
2.88000000086613,
3.00000000093132
],
"Ultra": [
1.8000000005122274,
1.9200000006705523,
2.040000000828877,
2.160000000558794,
2.280000000214204,
2.400000000372529,
2.550000000745058,
2.700000000419095,
2.850000000860302,
3.000000000232831,
3.1200000003911555,
3.24000000054948,
3.360000000707805,
3.48000000086613,
3.60000000093132
],
"Talent": [
0.60000000037252903,
0.66000000040978193,
0.72000000044703484,
0.7800000004842877,
0.8400000005215406,
0.9000000005587935,
0.9800000006053597,
1.0500000006519258,
1.1200000006984919,
1.2000000007450581,
1.260000000782311,
1.3200000008195639,
1.3800000008568168,
1.4400000008940697,
1.5000000008940697
],
"Maze": [
20
],
"Ultra_Use": [
140
],
"skilllist": {
"Normal": ["attack","普攻", 1, "Normal"],
"BPSkill": ["attack","战技", 1, "BPSkill"],
"BPSkill1": ["attack","寒川映月", 1, "BPSkill1"],
"Ultra": ["attack","终结技", 1, "Ultra"]
} }
} }
} }

View File

@ -559,6 +559,24 @@
0.4000000001490116 0.4000000001490116
] ]
} }
},
"23014": {
"Param": {
"e_dmg": [
0.3000000000745058,
0.35000000009313226,
0.40000000011175871,
0.45000000013038516,
0.5000000001490116
],
"CriticalDamageBase": [
0.3600000000745058,
0.42000000009313226,
0.48000000011175871,
0.54000000013038516,
0.6000000001490116
]
}
}, },
"23002": { "23002": {
"Param": { "Param": {

View File

@ -172,6 +172,9 @@ class RoleInstance:
skill_multiplier = skill_multiplier + 1.56 skill_multiplier = skill_multiplier + 1.56
elif self.raw_data.avatar.id_ == 1205: elif self.raw_data.avatar.id_ == 1205:
skill_multiplier = self.avatar.Normalnum(skill_type) skill_multiplier = self.avatar.Normalnum(skill_type)
elif self.raw_data.avatar.id_ == 1212:
skill_multiplier = self.avatar.BPSkill_num(skill_type)
skill_type = 'BPSkill'
else: else:
raise Exception('skill type error') raise Exception('skill type error')
@ -213,7 +216,7 @@ class RoleInstance:
# 攻击加成 # 攻击加成
if attr.__contains__('AttackAddedRatio'): if attr.__contains__('AttackAddedRatio'):
attr_name = attr.split('AttackAddedRatio')[0] attr_name = attr.split('AttackAddedRatio')[0]
if attr_name == skill_type: if attr_name == skill_type or attr_name == skill_info[3]:
attack_added_ratio = self.attribute_bonus.get( attack_added_ratio = self.attribute_bonus.get(
'AttackAddedRatio', 0 'AttackAddedRatio', 0
) )
@ -223,7 +226,7 @@ class RoleInstance:
# 效果命中加成 # 效果命中加成
if attr.__contains__('StatusProbabilityBase'): if attr.__contains__('StatusProbabilityBase'):
attr_name = attr.split('StatusProbabilityBase')[0] attr_name = attr.split('StatusProbabilityBase')[0]
if attr_name == skill_type: if attr_name == skill_type or attr_name == skill_info[3]:
status_probability = self.attribute_bonus.get( status_probability = self.attribute_bonus.get(
'StatusProbabilityBase', 0 'StatusProbabilityBase', 0
) )
@ -383,7 +386,7 @@ class RoleInstance:
for attr in merged_attr: for attr in merged_attr:
if attr.__contains__('_DmgRatio'): if attr.__contains__('_DmgRatio'):
skill_name = attr.split('_')[0] skill_name = attr.split('_')[0]
if skill_name == skill_type: if skill_name == skill_type or skill_name == skill_info[3]:
logger.info( logger.info(
f'{attr}{skill_type}{merged_attr[attr]} 易伤加成' f'{attr}{skill_type}{merged_attr[attr]} 易伤加成'
) )
@ -401,9 +404,12 @@ class RoleInstance:
# 检查是否有对特定技能的爆伤加成 # 检查是否有对特定技能的爆伤加成
# Ultra_CriticalChance # Ultra_CriticalChance
for attr in merged_attr: for attr in merged_attr:
if attr.__contains__('_CriticalChance'): if attr.__contains__('_CriticalDamageBase'):
skill_name = attr.split('_')[0] skill_name = attr.split('_')[0]
if skill_name == skill_type: if (
skill_name == skill_type
or skill_name == skill_info[3]
):
logger.info( logger.info(
f'{attr}{skill_type}' f'{attr}{skill_type}'
f'{merged_attr[attr]} 爆伤加成' f'{merged_attr[attr]} 爆伤加成'
@ -413,7 +419,20 @@ class RoleInstance:
logger.info(f'暴伤: {critical_damage}') logger.info(f'暴伤: {critical_damage}')
# 暴击区 # 暴击区
critical_chance_base = min(1, merged_attr['CriticalChanceBase']) logger.info('检查是否有暴击加成')
critical_chance_base = merged_attr['CriticalChanceBase']
# 检查是否有对特定技能的爆伤加成
# Ultra_CriticalChance
for attr in merged_attr:
if attr.__contains__('_CriticalChance'):
skill_name = attr.split('_')[0]
if skill_name == skill_type or skill_name == skill_info[3]:
logger.info(
f'{attr}{skill_type}'
f'{merged_attr[attr]} 暴击加成'
)
critical_chance_base += merged_attr[attr]
critical_chance_base = min(1, critical_chance_base)
logger.info(f'暴击: {critical_chance_base}') logger.info(f'暴击: {critical_chance_base}')
# 期望伤害 # 期望伤害
@ -510,6 +529,15 @@ class RoleInstance:
damage_qw_z = damage_qw_z * 1.8 damage_qw_z = damage_qw_z * 1.8
damage_tz_z = damage_tz_z * 1.8 damage_tz_z = damage_tz_z * 1.8
if (
self.raw_data.avatar.id_ == 1212
and self.raw_data.avatar.rank >= 1
):
if skill_info[3] == 'BPSkill1' or skill_info[3] == 'Ultra':
damage_cd_z = damage_cd_z * 1.6
damage_qw_z = damage_qw_z * 1.6
damage_tz_z = damage_tz_z * 1.6
if self.avatar.avatar_element == 'Thunder': if self.avatar.avatar_element == 'Thunder':
element_area = 0 element_area = 0
damage_tz_fj = ( damage_tz_fj = (

View File

@ -315,10 +315,10 @@ class IntheNight(BaseWeapon):
* count_ * count_
) )
ultra_critical_chance_base = attribute_bonus.get( ultra_critical_chance_base = attribute_bonus.get(
'Ultra_CriticalChanceBase', 0 'Ultra_CriticalDamageBase', 0
) )
attribute_bonus[ attribute_bonus[
'Ultra_CriticalChanceBase' 'Ultra_CriticalDamageBase'
] = ultra_critical_chance_base + ( ] = ultra_critical_chance_base + (
mp.mpf( mp.mpf(
weapon_effect['23001']['Param']['q_crit_dmg'][ weapon_effect['23001']['Param']['q_crit_dmg'][
@ -477,12 +477,6 @@ class GeniusesRepose(BaseWeapon):
async def weapon_ability( async def weapon_ability(
self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict
): ):
# attack_added_ratio = attribute_bonus.get('AttackAddedRatio', 0)
# attribute_bonus['AttackAddedRatio'] = attack_added_ratio + mp.mpf(
# weapon_effect['21020']['Param']['AttackAddedRatio'][
# self.weapon_rank - 1
# ]
# )
if await self.check(): if await self.check():
critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0) critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0)
attribute_bonus['CriticalDamageBase'] = critical_chance_base + ( attribute_bonus['CriticalDamageBase'] = critical_chance_base + (
@ -620,22 +614,6 @@ class TheUnreachableSide(BaseWeapon):
async def weapon_ability( async def weapon_ability(
self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict
): ):
# critical_chance_base = attribute_bonus.get('CriticalChanceBase', 0)
# attribute_bonus[
# 'CriticalChanceBase'
# ] = critical_chance_base + mp.mpf(
# weapon_effect['23009']['Param']['CriticalChance'][
# self.weapon_rank - 1
# ]
# )
# hp_added_ratio = attribute_bonus.get('HPAddedRatio', 0)
# attribute_bonus[
# 'HPAddedRatio'
# ] = hp_added_ratio + mp.mpf(
# weapon_effect['23009']['Param']['HPAddedRatio'][
# self.weapon_rank - 1
# ]
# )
if await self.check(): if await self.check():
all_damage_added_ratio = attribute_bonus.get( all_damage_added_ratio = attribute_bonus.get(
'AllDamageAddedRatio', 0 'AllDamageAddedRatio', 0
@ -1561,6 +1539,39 @@ class DataBank(BaseWeapon):
return attribute_bonus return attribute_bonus
# 此身为剑
class Thisbodyisasword(BaseWeapon):
weapon_base_attributes: Dict
def __init__(self, weapon: DamageInstanceWeapon):
super().__init__(weapon)
async def check(self):
# 使装备者战技造成的伤害提高30%。施放终结技时立即恢复12点能量并使装备者的暴击伤害提高36%
pass
async def weapon_ability(
self, Ultra_Use: int, base_attr: Dict, attribute_bonus: Dict
):
ultra_dmg_add = attribute_bonus.get('BPSkillDmgAdd', 0)
attribute_bonus['BPSkillDmgAdd'] = ultra_dmg_add + (
mp.mpf(
weapon_effect['23014']['Param']['e_dmg'][self.weapon_rank - 1]
)
)
critical_chance_base = attribute_bonus.get('CriticalDamageBase', 0)
attribute_bonus['CriticalDamageBase'] = critical_chance_base + (
mp.mpf(
weapon_effect['23014']['Param']['CriticalDamageBase'][
self.weapon_rank - 1
]
)
)
return attribute_bonus
class Weapon: class Weapon:
@classmethod @classmethod
def create(cls, weapon: DamageInstanceWeapon): def create(cls, weapon: DamageInstanceWeapon):
@ -1622,7 +1633,10 @@ class Weapon:
20020, 20020,
20013, 20013,
20006, 20006,
23014,
]: ]:
if weapon.id_ == 23014:
return Thisbodyisasword(weapon)
if weapon.id_ == 20006: if weapon.id_ == 20006:
return DataBank(weapon) return DataBank(weapon)
if weapon.id_ == 20013: if weapon.id_ == 20013:

View File

@ -7,9 +7,10 @@ from gsuid_core.utils.error_reply import UID_HINT
from ..utils.convert import get_uid from ..utils.convert import get_uid
from ..utils.sr_prefix import PREFIX from ..utils.sr_prefix import PREFIX
from .draw_rogue_card import draw_rogue_img from .draw_rogue_card import draw_rogue_img, draw_rogue_locust_img
sv_srabyss = SV('sr查询模拟宇宙') sv_srabyss = SV('sr查询模拟宇宙')
sv_srabyss_locust = SV('sr查询寰宇蝗灾')
@sv_srabyss.on_command( @sv_srabyss.on_command(
@ -69,3 +70,33 @@ async def send_srabyss_info(bot: Bot, ev: Event):
im = await draw_rogue_img(user_id, uid, floor, schedule_type) im = await draw_rogue_img(user_id, uid, floor, schedule_type)
await bot.send(im) await bot.send(im)
return None return None
@sv_srabyss_locust.on_command(
(
f'{PREFIX}寰宇蝗灾',
f'{PREFIX}hyhz',
f'{PREFIX}查询寰宇蝗灾',
f'{PREFIX}sqhyhz',
),
block=True,
)
async def send_srabyss_locust_info(bot: Bot, ev: Event):
name = ''.join(re.findall('[\u4e00-\u9fa5]', ev.text))
if name:
return None
await bot.logger.info('开始执行[sr查询寰宇蝗灾信息]')
get_uid_ = await get_uid(bot, ev, True)
if get_uid_ is None:
return await bot.send(UID_HINT)
uid, user_id = get_uid_
if uid is None:
return await bot.send(UID_HINT)
await bot.logger.info(f'[sr查询寰宇蝗灾信息]uid: {uid}')
# data = GsCookie()
# raw_rogue_data = await data.get_rogue_data(uid, schedule_type)
# print(raw_rogue_data)
im = await draw_rogue_locust_img(user_id, uid)
await bot.send(im)
return None

View File

@ -13,17 +13,18 @@ from gsuid_core.utils.image.image_tools import (
from .utils import get_icon from .utils import get_icon
from ..utils.convert import GsCookie from ..utils.convert import GsCookie
from ..utils.image.convert import convert_img from ..utils.image.convert import convert_img
from ..sruid_utils.api.mys.models import (
RogueAvatar,
RogueMiracles,
RogueBuffitems,
)
from ..utils.fonts.starrail_fonts import ( from ..utils.fonts.starrail_fonts import (
sr_font_22, sr_font_22,
sr_font_28, sr_font_28,
sr_font_34, sr_font_34,
sr_font_42, sr_font_42,
) )
from ..sruid_utils.api.mys.models import (
RogueAvatar,
LocustBlocks,
RogueMiracles,
RogueBuffitems,
)
TEXT_PATH = Path(__file__).parent / 'texture2D' TEXT_PATH = Path(__file__).parent / 'texture2D'
white_color = (255, 255, 255) white_color = (255, 255, 255)
@ -79,6 +80,7 @@ bufflist = {
124: '巡猎', 124: '巡猎',
125: '毁灭', 125: '毁灭',
126: '欢愉', 126: '欢愉',
127: '繁育',
} }
@ -137,13 +139,48 @@ async def _draw_rogue_buff(
return draw_height return draw_height
async def _draw_rogue_blocks(
blocks: List[LocustBlocks],
floor_pic: Image.Image,
buff_height: int,
):
draw_height = 0
floor_pic_draw = ImageDraw.Draw(floor_pic)
blocks_num = len(blocks)
need_middle = math.ceil(blocks_num / 2)
draw_height = draw_height + need_middle * 80
zb_list = []
for m in range(need_middle):
for n in range(2):
zb_list.append([m, n])
jishu = 0
for block in blocks:
block_icon = Image.open(TEXT_PATH / f'{block["name"]}.png')
z_left_bg = 90 + 357 * zb_list[jishu][1]
z_top_bg = buff_height + 470 + 80 * zb_list[jishu][0]
jishu = jishu + 1
z_left_icon = z_left_bg + 10
z_top_icon = z_top_bg + 5
floor_pic.paste(block_icon, (z_left_icon, z_top_icon), mask=block_icon)
floor_pic_draw.text(
(z_left_bg + 80, z_top_bg + 35),
f"{block['name']} x{block['num']}",
font=sr_font_22,
fill=white_color,
anchor='lm',
)
return draw_height
async def _draw_rogue_miracles( async def _draw_rogue_miracles(
miracles: List[RogueMiracles], miracles: List[RogueMiracles],
floor_pic: Image.Image, floor_pic: Image.Image,
buff_height: int, buff_height: int,
): ):
draw_height = 0
miracles_num = len(miracles) miracles_num = len(miracles)
need_middle = math.ceil(miracles_num / 8) need_middle = math.ceil(miracles_num / 8)
draw_height = draw_height + need_middle * 90
zb_list = [] zb_list = []
for m in range(need_middle): for m in range(need_middle):
for n in range(8): for n in range(8):
@ -156,6 +193,8 @@ async def _draw_rogue_miracles(
jishu = jishu + 1 jishu = jishu + 1
floor_pic.paste(miracles_icon, (z_left, z_top), mask=miracles_icon) floor_pic.paste(miracles_icon, (z_left, z_top), mask=miracles_icon)
return draw_height
async def _draw_rogue_card( async def _draw_rogue_card(
char: RogueAvatar, char: RogueAvatar,
@ -226,7 +265,7 @@ async def draw_rogue_img(
# 记录打的宇宙列表 # 记录打的宇宙列表
detail_list = [] detail_list = []
based_h = 657 based_h = 700
for index_floor, detail in enumerate(rogue_detail): for index_floor, detail in enumerate(rogue_detail):
# 100+70+170 # 100+70+170
# 头+底+角色 # 头+底+角色
@ -489,3 +528,318 @@ async def draw_rogue_img(
res = await convert_img(img) res = await convert_img(img)
logger.info('[查询模拟宇宙]绘图已完成,等待发送!') logger.info('[查询模拟宇宙]绘图已完成,等待发送!')
return res return res
async def draw_rogue_locust_img(
qid: Union[str, int],
uid: str,
) -> Union[bytes, str]:
# 获取Cookies
data = GsCookie()
# retcode = await data.get_cookie(uid)
# if retcode:
# return retcode
# raw_data = data.raw_data
raw_rogue_data = await data.get_rogue_locust_data(uid)
# print(raw_rogue_data)
if isinstance(raw_rogue_data, int):
return get_error(raw_rogue_data)
# 获取数据
# if raw_data:
# char_data = raw_data['avatars']
# else:
# return '没有获取到角色数据'
# char_temp = {}
# 计算背景图尺寸
rogue_detail = raw_rogue_data['detail']['records']
# 记录打的宇宙列表
detail_list = []
based_h = 700
for index_floor, detail in enumerate(rogue_detail):
# 100+70+170
# 头+底+角色
detail_h = 340
# 祝福
if len(detail['base_type_list']) > 0:
buff_h = 60
for buff in detail['buffs']:
buff_h = buff_h + 50
buff_num = len(buff['items'])
buff_h = buff_h + math.ceil(buff_num / 3) * 55
else:
buff_h = 0
detail_h = detail_h + buff_h
# 奇物
if len(detail['miracles']) > 0:
miracles_h = 60
miracles_num = len(detail['miracles'])
miracles_h = miracles_h + math.ceil(miracles_num / 8) * 90
else:
miracles_h = 0
detail_h = detail_h + miracles_h
# 事件
if len(detail['blocks']) > 0:
blocks_h = 60
blocks_num = len(detail['blocks'])
blocks_h = blocks_h + math.ceil(blocks_num / 2) * 80
else:
blocks_num = 0
detail_h = detail_h + blocks_h
rogue_detail[index_floor]['detail_h'] = detail_h
rogue_detail[index_floor]['start_h'] = based_h
based_h = based_h + detail_h
# 获取查询者数据
if len(rogue_detail) == 0:
return '你还没有挑战寰宇蝗灾~'
# 获取背景图片各项参数
based_w = 900
img = Image.new("RGB", (based_w, based_h), (10, 18, 49))
img.paste(img_bg, (0, 0))
# img = img.crop((0, 0, based_w, based_h))
rogue_title = Image.open(TEXT_PATH / 'head.png')
img.paste(rogue_title, (0, 0), rogue_title)
# 获取头像
_id = str(qid)
if _id.startswith('http'):
char_pic = await get_qq_avatar(avatar_url=_id)
else:
char_pic = await get_qq_avatar(qid=qid)
char_pic = await draw_pic_with_ring(char_pic, 250, None, False)
img.paste(char_pic, (325, 132), char_pic)
# 绘制抬头
img_draw = ImageDraw.Draw(img)
img_draw.text((450, 442), f'UID {uid}', white_color, sr_font_28, 'mm')
# 总体数据
rogue_data = Image.open(TEXT_PATH / 'data.png')
img.paste(rogue_data, (0, 500), rogue_data)
# 行者之道激活
img_draw.text(
(165, 569),
f'{raw_rogue_data["basic"]["cnt"]["narrow"]}',
white_color,
sr_font_42,
'mm',
)
img_draw.text(
(165, 615),
'行者之道',
gray_color,
sr_font_28,
'mm',
)
# 奇物解锁
img_draw.text(
(450, 569),
f'{raw_rogue_data["basic"]["cnt"]["miracle"]}',
white_color,
sr_font_42,
'mm',
)
img_draw.text(
(450, 615),
'已解锁奇物',
gray_color,
sr_font_28,
'mm',
)
# 事件解锁
img_draw.text(
(730, 569),
f'{raw_rogue_data["basic"]["cnt"]["event"]}',
white_color,
sr_font_42,
'mm',
)
img_draw.text(
(730, 615),
'已解锁事件',
gray_color,
sr_font_28,
'mm',
)
for index_floor, detail in enumerate(rogue_detail):
if detail['detail_h'] is None:
continue
floor_pic = Image.open(TEXT_PATH / 'detail_bg.png').convert("RGBA")
floor_pic = floor_pic.resize((900, detail['detail_h']))
floor_top_pic = Image.open(TEXT_PATH / 'floor_bg_top.png').convert(
"RGBA"
)
floor_pic.paste(floor_top_pic, (0, 0), floor_top_pic)
floor_center_pic = Image.open(
TEXT_PATH / 'floor_bg_center.png'
).convert("RGBA")
floor_center_pic = floor_center_pic.resize(
(900, detail['detail_h'] - 170)
)
floor_pic.paste(floor_center_pic, (0, 100), floor_center_pic)
floor_bot_pic = Image.open(TEXT_PATH / 'floor_bg_bot.png').convert(
"RGBA"
)
floor_pic.paste(
floor_bot_pic, (0, detail['detail_h'] - 70), floor_bot_pic
)
floor_name = detail['name']
difficulty_name = difficultylist[detail['difficulty']]
time_array = detail['finish_time']
time_str = f"{time_array['year']}-{time_array['month']}"
time_str = f"{time_str}-{time_array['day']}"
time_str = f"{time_str} {time_array['hour']}:{time_array['minute']}"
floor_pic_draw = ImageDraw.Draw(floor_pic)
floor_pic_draw.text(
(450, 60),
f'{floor_name} {difficulty_name}',
white_color,
sr_font_42,
'mm',
)
floor_pic_draw.text(
(93, 120),
f'挑战时间:{time_str}',
gray_color,
sr_font_22,
'lm',
)
if detail["fury"]["type"] == 1:
floor_pic_draw.text(
(800, 120),
f'扰动等级:{detail["fury"]["point"]}',
gray_color,
sr_font_22,
'rm',
)
else:
floor_pic_draw.text(
(800, 120),
f'位面紊乱倒计时:{detail["fury"]["point"]}',
gray_color,
sr_font_22,
'rm',
)
# 角色
for index_char, char in enumerate(detail['final_lineup']):
# 获取命座
# if char["id"] in char_temp:
# talent_num = char_temp[char["id"]]
# else:
# for i in char_data:
# if i["id"] == char["id"]:
# talent_num = str(
# i["actived_constellation_num"]
# )
# char_temp[char["id"]] = talent_num
# break
await _draw_rogue_card(
char,
0, # type: ignore
floor_pic,
index_char,
)
# 祝福
buff_height = 0
if len(detail['base_type_list']) > 0:
floor_pic_draw.text(
(93, 370),
'获得祝福',
white_color,
sr_font_34,
'lm',
)
floor_pic.paste(content_center, (0, 390), content_center)
for buff in detail['buffs']:
buff_icon = bufflist[buff['base_type']['id']]
buff_name = buff['base_type']['name']
buffs = buff['items']
draw_height = await _draw_rogue_buff(
buffs,
buff_icon,
buff_name,
floor_pic,
buff_height,
)
buff_height = buff_height + draw_height
# 奇物
miracles_height = buff_height
if len(detail['miracles']) > 0:
floor_pic_draw.text(
(93, 370 + miracles_height + 60),
'获得奇物',
white_color,
sr_font_34,
'lm',
)
floor_pic.paste(
content_center, (0, 370 + miracles_height + 80), content_center
)
draw_height = await _draw_rogue_miracles(
detail['miracles'],
floor_pic,
miracles_height,
)
miracles_height = miracles_height + 80
miracles_height = miracles_height + draw_height
# 事件
blocks_height = miracles_height
if len(detail['blocks']) > 0:
floor_pic_draw.text(
(93, 370 + blocks_height + 60),
'通过区域类型',
white_color,
sr_font_34,
'lm',
)
floor_pic.paste(
content_center, (0, 370 + blocks_height + 80), content_center
)
draw_height = await _draw_rogue_blocks(
detail['blocks'],
floor_pic,
blocks_height,
)
blocks_height = blocks_height + 80
blocks_height = blocks_height + draw_height
if detail['start_h'] is None:
continue
img.paste(floor_pic, (0, detail['start_h']), floor_pic)
# await _draw_floor_card(
# level_star,
# floor_pic,
# img,
# index_floor,
# floor_name,
# round_num,
# )
res = await convert_img(img)
logger.info('[查询寰宇蝗灾]绘图已完成,等待发送!')
return res

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -8,7 +8,7 @@ from gsuid_core.utils.api.mys.models import IndexData
from .api import get_sqla from .api import get_sqla
from .mys_api import mys_api from .mys_api import mys_api
from .error_reply import VERIFY_HINT from .error_reply import VERIFY_HINT
from ..sruid_utils.api.mys.models import AbyssData, RogueData from ..sruid_utils.api.mys.models import AbyssData, RogueData, RogueLocustData
@overload @overload
@ -88,6 +88,13 @@ class GsCookie:
self.uid, schedule_type, self.cookie self.uid, schedule_type, self.cookie
) )
async def get_rogue_locust_data(
self, uid: str
) -> Union[RogueLocustData, int]:
self.uid = uid
self.cookie = await self.sqla.get_random_cookie(uid)
return await mys_api.get_rogue_locust_info(self.uid, self.cookie)
async def check_cookies_useable(self): async def check_cookies_useable(self):
if isinstance(self.raw_data, int) and self.cookie: if isinstance(self.raw_data, int) and self.cookie:
retcode = self.raw_data retcode = self.raw_data

View File

@ -24,6 +24,7 @@ from ..sruid_utils.api.mys.models import (
DailyNoteData, DailyNoteData,
RoleBasicInfo, RoleBasicInfo,
WidgetStamina, WidgetStamina,
RogueLocustData,
) )
RECOGNIZE_SERVER = { RECOGNIZE_SERVER = {
@ -366,6 +367,28 @@ class MysApi(_MysApi):
data = cast(RogueData, data['data']) data = cast(RogueData, data['data'])
return data return data
async def get_rogue_locust_info(
self,
uid: str,
ck: Optional[str] = None,
) -> Union[RogueLocustData, int]:
server_id = self.RECOGNIZE_SERVER.get(uid[0])
data = await self.simple_mys_req(
'ROGUE_LOCUST_INFO_URL',
uid,
params={
'need_detail': 'true',
'role_id': uid,
'server': server_id,
},
cookie=ck,
header=self._HEADER,
)
# print(data)
if isinstance(data, Dict):
data = cast(RogueData, data['data'])
return data
async def mys_sign( async def mys_sign(
self, uid, header=None, server_id='cn_gf01' self, uid, header=None, server_id='cn_gf01'
) -> Union[MysSign, int]: ) -> Union[MysSign, int]: