mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2025-04-12 23:29:37 +08:00
🐛 修复原神日历
权限问题和ysa
未知制图问题
This commit is contained in:
parent
f3e7376aa5
commit
198ee3a71f
@ -1,15 +1,12 @@
|
||||
from typing import Union
|
||||
|
||||
from nonebot import get_bot, on_command
|
||||
from nonebot.adapters.onebot.v11 import MessageEvent, MessageSegment, GROUP_ADMIN
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.adapters.onebot.v11 import MessageEvent, MessageSegment
|
||||
from nonebot.plugin import PluginMetadata
|
||||
|
||||
from .generate import *
|
||||
from LittlePaimon.utils.message import CommandObjectID, CommandSwitch, CommandTime
|
||||
from LittlePaimon.utils import scheduler, logger
|
||||
from LittlePaimon.database.models import GeneralSub
|
||||
from LittlePaimon import DRIVER
|
||||
from LittlePaimon import DRIVER, SUPERUSERS
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="原神日历",
|
||||
@ -26,7 +23,7 @@ __plugin_meta__ = PluginMetadata(
|
||||
},
|
||||
)
|
||||
|
||||
calendar = on_command('原神日历', aliases={'原神日程', '活动日历'}, permission=SUPERUSER | GROUP_ADMIN, priority=10, block=True)
|
||||
calendar = on_command('原神日历', aliases={'原神日程', '活动日历'}, priority=10, block=True)
|
||||
|
||||
|
||||
@calendar.handle()
|
||||
@ -35,6 +32,8 @@ async def _(event: MessageEvent, sub_id=CommandObjectID(), switch=CommandSwitch(
|
||||
im = await generate_day_schedule('cn')
|
||||
await calendar.finish(MessageSegment.image(im))
|
||||
else:
|
||||
if event.sender.role not in ['admin', 'owner'] or event.user_id not in SUPERUSERS:
|
||||
await calendar.finish('你没有权限管理原神日历订阅')
|
||||
sub_data = {'sub_id': sub_id, 'sub_type': event.message_type, 'sub_event': '原神日历'}
|
||||
|
||||
if event.message_type == 'guild':
|
||||
|
@ -175,9 +175,9 @@ async def draw_gacha_log(user_id: str, uid: str, nickname: Optional[str], signat
|
||||
await img.text(str(total_five_star_count), (789, 884), 286, fm.get('bahnschrift_regular', 48), '#040404', 'center')
|
||||
four_star_detail = await draw_four_star_detail(list(data4.values()))
|
||||
if total_five_star_count:
|
||||
chara_pool_per = round(len(data5['角色祈愿']) / total_five_star_count * 100, 3)
|
||||
weapon_pool_per = round(len(data5['武器祈愿']) / total_five_star_count * 100, 3)
|
||||
new_pool_per = round((len(data5['常驻祈愿']) + len(data5['新手祈愿'])) / total_five_star_count * 100, 3)
|
||||
chara_pool_per = round(len(data5['角色祈愿']) / total_five_star_count * 100, 1)
|
||||
weapon_pool_per = round(len(data5['武器祈愿']) / total_five_star_count * 100, 1)
|
||||
new_pool_per = round((len(data5['常驻祈愿']) + len(data5['新手祈愿'])) / total_five_star_count * 100, 1)
|
||||
now_used_width = 56
|
||||
pers = [chara_pool_per, weapon_pool_per, new_pool_per]
|
||||
i = 0
|
||||
|
@ -40,6 +40,7 @@ def sort_characters(characters: List[Character]) -> List[Character]:
|
||||
圣遗物每级0.5/0.8/1分,每个两件套20分,四件套60分,最后按降序排序
|
||||
"""
|
||||
for chara in characters:
|
||||
try:
|
||||
chara.score = chara.level * (0.8 if chara.rarity == 4 else 1) + chara.fetter * 3
|
||||
if chara.talents:
|
||||
for talent in chara.talents:
|
||||
@ -58,6 +59,9 @@ def sort_characters(characters: List[Character]) -> List[Character]:
|
||||
chara.score += artifact.level * (0.5 if artifact.rarity <= 3 else 0.8 if artifact.rarity == 4 else 1)
|
||||
else:
|
||||
chara.suit = []
|
||||
except Exception:
|
||||
chara.score = 0
|
||||
chara.suit = []
|
||||
return sorted(characters, key=lambda x: x.score, reverse=True)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user