支持版本深渊4.011格式查询4.0版本深渊11层 (#504)

This commit is contained in:
Wuyi无疑 2023-07-19 03:39:12 +08:00
parent b403ed95fc
commit 047a8056ce
4 changed files with 109 additions and 11 deletions

View File

@ -1,3 +1,4 @@
import re
from typing import List
from gsuid_core.sv import SV
@ -46,13 +47,22 @@ async def send_bluekun_pic(bot: Bot, ev: Event):
@sv_abyss_review.on_command(('版本深渊', '深渊阵容'))
async def send_abyss_review(bot: Bot, ev: Event):
floor = '12'
if not ev.text:
version = Genshin_version[:-2]
else:
version = ev.text
if '.' in ev.text:
num = ev.text.index('.')
version = ev.text[num - 1 : num + 2] # noqa:E203
_deal = ev.text.replace(version, '').strip()
if _deal:
floor = re.findall(r'[0-9]+', _deal)[0]
else:
floor = ev.text
version = Genshin_version[:-2]
if gsconfig.get_config('PicWiki').data:
im = await get_review_data(version)
im = await get_review_data(version, floor)
else:
im = await get_review(version)

View File

@ -40,12 +40,10 @@ async def download_Oceanid():
async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
half_img = Image.new('RGBA', (1100, 3000), (0, 0, 0, 0))
half_draw = ImageDraw.Draw(half_img)
upper_h = 60
temp = 0
for index, wave in enumerate(data):
if 'ExtraDesc' in wave:
pass
# ExtraDesc = wave['ExtraDesc']['CH']
monsters = wave['Monsters']
wave_monster_uh = (((len(monsters) - 1) // 3) + 1) * 125 + 40
upper_h += wave_monster_uh
@ -55,6 +53,14 @@ async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
wave_tag_draw.text(
(36, 20), f'{index+1}', (210, 210, 210), gs_font_24, 'lm'
)
if 'ExtraDesc' in wave:
ExtraDesc: str = wave['ExtraDesc']['CH']
ExtraDesc = ' > ' + ExtraDesc.replace('<b>', '').replace(
'</b>', ''
)
half_draw.text(
(150, 65 + temp), ExtraDesc, (210, 210, 210), gs_font_24, 'lm'
)
half_img.paste(wave_tag, (53, 45 + temp), wave_tag)
for m_index, monster in enumerate(monsters):
monster_id = monster['ID']
@ -71,6 +77,10 @@ async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
monster_name = monster_data[real_id]['name']
icon_name = monster_data[real_id]['icon']
if 'Mark' in monster:
if monster['Mark']:
monster_name = '*' + monster_name
monster_icon = await get_ambr_icon(
'monster', icon_name, MONSTER_ICON_PATH
)
@ -81,7 +91,7 @@ async def get_half_img(data: List, half: Literal['Upper', 'Lower']):
monster_draw = ImageDraw.Draw(monster_img)
monster_draw.text(
(137, 52), monster_name[:8], 'white', gs_font_24, 'lm'
(137, 52), monster_name[:10], 'white', gs_font_24, 'lm'
)
monster_draw.text(
(137, 82),
@ -114,7 +124,7 @@ async def get_review_data(
):
floor_data = history_data[version][floor]
data = abyss_data[floor_data]
floor_buff = data['Disorder']['CH']
floor_buff = data['Disorder']['CH'].replace('<b>', '').replace('</b>', '')
floor_monster = data['Chambers']
icon = Image.open(TEXT2D_PATH / 'icon.png')

View File

@ -20,10 +20,11 @@ class _CvApi:
async with self.session.get(MAIN_API) as resp:
cookies = resp.cookies
cookies_dict = dict(cookies)
sid = cookies_dict.get(
"connect.sid",
{"connect.sid": "NVybrjSdSZISA0JRuKFoZIndoCfDWdA2"},
).get("connect.sid", "NVybrjSdSZISA0JRuKFoZIndoCfDWdA2")
sid = cookies_dict.get('connect.sid', None)
if sid is not None:
sid = sid.value
else:
sid = 'NVybrjSdSZISA0JRuKFoZIndoCfDWdA2'
sid = unquote(str(sid))
sessionID = sid.split(".")[0].split(":")[-1]
return sessionID

View File

@ -188,6 +188,13 @@
"icon": "UI_MonsterIcon_MachinaIustitia_Ruggiero_02",
"route": "Suppression Specialist Mek"
},
"24060901": {
"id": 24060901,
"name": "压制特化型机关·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Ruggiero_02",
"route": "Suppression Specialist Mek"
},
"24066201": {
"id": 24066201,
"name": "建造特化型机关·芒",
@ -209,6 +216,76 @@
"icon": "UI_MonsterIcon_MachinaIustitia_Bradamante",
"route": "Suppression Specialist Mek"
},
"24066001": {
"id": 24066001,
"name": "歼灭特化型机关·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Bradamante",
"route": "Suppression Specialist Mek"
},
"24060801": {
"id": 24060801,
"name": "攻坚特化型机关·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Ruggiero_01",
"route": "Suppression Specialist Mek"
},
"24065801": {
"id": 24065801,
"name": "攻坚特化型机关·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Ruggiero_01",
"route": "Suppression Specialist Mek"
},
"24060101": {
"id": 24060101,
"name": "机关·侦察记录型·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Sentry",
"route": "Suppression Specialist Mek"
},
"24065101": {
"id": 24065101,
"name": "机关·侦察记录型·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Sentry",
"route": "Suppression Specialist Mek"
},
"24060701": {
"id": 24060701,
"name": "机关·灵活采集型·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Assimilator",
"route": "Suppression Specialist Mek"
},
"24065701": {
"id": 24065701,
"name": "机关·灵活采集型·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Assimilator",
"route": "Suppression Specialist Mek"
},
"24060201": {
"id": 24060201,
"name": "机关·算力增幅器·荒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Pylon",
"route": "Suppression Specialist Mek"
},
"24065201": {
"id": 24065201,
"name": "机关·算力增幅器·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Pylon",
"route": "Suppression Specialist Mek"
},
"24065401": {
"id": 24065401,
"name": "机关地质勘探型·芒",
"type": "BEAST",
"icon": "UI_MonsterIcon_MachinaIustitia_Probe",
"route": "Suppression Specialist Mek"
},
"26170101": {
"id": 26170101,
"name": "铁甲熔火帝皇",