This commit is contained in:
CMHopeSunshine 2022-04-26 18:50:56 +08:00
parent 0e01531dd1
commit 957473e2ce
6 changed files with 20 additions and 9 deletions

View File

@ -1,5 +1,6 @@
from hoshino import logger, Service from hoshino import logger, Service
from aiocqhttp.exceptions import ActionFailed from aiocqhttp.exceptions import ActionFailed
from json import JSONDecodeError
from ..util import get_uid_in_msg from ..util import get_uid_in_msg
from ..get_data import get_abyss_data from ..get_data import get_abyss_data
from .get_img import draw_abyss_card from .get_img import draw_abyss_card

View File

@ -1,5 +1,6 @@
import re import re
from aiocqhttp.exceptions import ActionFailed from aiocqhttp.exceptions import ActionFailed
from json import JSONDecodeError
from hoshino import Service,get_bot, logger from hoshino import Service,get_bot, logger
from ..util import get_uid_in_msg from ..util import get_uid_in_msg
from ..get_data import get_daily_note_data from ..get_data import get_daily_note_data

View File

@ -1,5 +1,6 @@
import re, datetime import re, datetime
from aiocqhttp.exceptions import ActionFailed from aiocqhttp.exceptions import ActionFailed
from json import JSONDecodeError
from hoshino import logger, Service from hoshino import logger, Service
from hoshino.util import filt_message from hoshino.util import filt_message
from ..util import get_uid_in_msg from ..util import get_uid_in_msg

View File

@ -1,6 +1,6 @@
from hoshino import Service, get_bot, logger from hoshino import Service, get_bot, logger
from ..util import get_uid_in_msg from ..util import get_uid_in_msg
from ..db_util import get_auto_sign, add_auto_sign, delete_auto_sign from ..db_util import get_auto_sign, add_auto_sign, delete_auto_sign, get_private_cookie
from ..get_data import get_sign_info, sign, get_sign_list from ..get_data import get_sign_info, sign, get_sign_list
from ..config import auto_sign_time from ..config import auto_sign_time
from datetime import datetime from datetime import datetime
@ -44,6 +44,10 @@ async def bbs_auto_sign(bot, ev):
find_action = re.search(r'(?P<action>开启|启用|打开|关闭|禁用)', msg) find_action = re.search(r'(?P<action>开启|启用|打开|关闭|禁用)', msg)
if find_action: if find_action:
if find_action.group('action') in ['开启', '启用', '打开']: if find_action.group('action') in ['开启', '启用', '打开']:
cookie = await get_private_cookie(uid, key='uid')
if not cookie:
await bot.send(ev, '你的该uid还没绑定cookie哦先用ysb绑定吧!', at_sender=True)
return
await add_auto_sign(str(ev.user_id), uid, str(ev.group_id)) await add_auto_sign(str(ev.user_id), uid, str(ev.group_id))
await bot.send(ev, '开启米游社自动签到成功,派蒙会在每日0点帮你签到', at_sender=True) await bot.send(ev, '开启米游社自动签到成功,派蒙会在每日0点帮你签到', at_sender=True)
elif find_action.group('action') in ['关闭', '禁用']: elif find_action.group('action') in ['关闭', '禁用']:

View File

@ -1,4 +1,5 @@
from aiocqhttp.exceptions import ActionFailed from aiocqhttp.exceptions import ActionFailed
from json import JSONDecodeError
from hoshino import logger, Service from hoshino import logger, Service
from hoshino.util import filt_message from hoshino.util import filt_message
from ..util import get_uid_in_msg, get_at_target from ..util import get_uid_in_msg, get_at_target

View File

@ -4,6 +4,7 @@ from ..util import pil2b64
from hoshino.typing import MessageSegment from hoshino.typing import MessageSegment
from hoshino import logger, aiorequests from hoshino import logger, aiorequests
from io import BytesIO from io import BytesIO
import copy
res_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'res') res_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'res')
@ -433,29 +434,31 @@ async def draw_chara_card(data, skill_data, chara_name, uid):
i += 1 i += 1
if not skill_data: if not skill_data:
skill_data = {'retcode' : 'error'} skill_data_ = {'retcode' : 'error'}
else:
skill_data_ = copy.deepcopy(skill_data)
# 补上三命和五命的技能等级提升 # 补上三命和五命的技能等级提升
if skill_data['retcode'] == 0 and character['constellations'][2]['is_actived']: if skill_data_['retcode'] == 0 and character['constellations'][2]['is_actived']:
skill_name = re.search(r'>(.*)</color>', character['constellations'][2]['effect']) skill_name = re.search(r'>(.*)</color>', character['constellations'][2]['effect'])
if skill_name: if skill_name:
skill_name = skill_name.group(1) skill_name = skill_name.group(1)
for skill in skill_data['data']['skill_list']: for skill in skill_data_['data']['skill_list']:
if skill['name'] == skill_name: if skill['name'] == skill_name:
skill['level_current'] += 3 skill['level_current'] += 3
if skill_data['retcode'] == 0 and character['constellations'][4]['is_actived']: if skill_data_['retcode'] == 0 and character['constellations'][4]['is_actived']:
skill_name = re.search(r'>(.*)</color>', character['constellations'][4]['effect']) skill_name = re.search(r'>(.*)</color>', character['constellations'][4]['effect'])
if skill_name: if skill_name:
skill_name = skill_name.group(1) skill_name = skill_name.group(1)
for skill in skill_data['data']['skill_list']: for skill in skill_data_['data']['skill_list']:
if skill['name'] == skill_name: if skill['name'] == skill_name:
skill['level_current'] += 3 skill['level_current'] += 3
# 天赋等级 # 天赋等级
i = 0 i = 0
if skill_data['retcode'] == 0: if skill_data_['retcode'] == 0:
skill_p = [(621, 98), (621, 168), (621, 238)] skill_p = [(621, 98), (621, 168), (621, 238)]
skill_data_t = skill_data['data']['skill_list'] skill_data_t = skill_data_['data']['skill_list']
for skill in skill_data_t[0:2]: for skill in skill_data_t[0:2]:
skill_icon = await draw_const_skill_icon(skill, character['name']) skill_icon = await draw_const_skill_icon(skill, character['name'])
bg_img.alpha_composite(skill_icon, skill_p[i]) bg_img.alpha_composite(skill_icon, skill_p[i])
@ -473,7 +476,7 @@ async def draw_chara_card(data, skill_data, chara_name, uid):
bg_draw.text((skill_p[i][0]+73+(6 if skill["level_current"] < 10 else 0),skill_p[i][1]+22), f'Lv.{skill["level_current"]}', font=get_font(18), fill='white') bg_draw.text((skill_p[i][0]+73+(6 if skill["level_current"] < 10 else 0),skill_p[i][1]+22), f'Lv.{skill["level_current"]}', font=get_font(18), fill='white')
# 命座 # 命座
i = 0 i = 0
if skill_data['retcode'] == 0: if skill_data_['retcode'] == 0:
const_p = [(669, 8), (734, 60), (757, 130), (757, 207), (734, 277), (669, 329)] const_p = [(669, 8), (734, 60), (757, 130), (757, 207), (734, 277), (669, 329)]
else: else:
const_p = [(626, 8), (691, 60), (714, 130), (714, 207), (691, 277), (626, 329)] const_p = [(626, 8), (691, 60), (714, 130), (714, 207), (691, 277), (626, 329)]