fit nonebot.beta2

This commit is contained in:
HibiKier
2022-02-19 18:20:19 +08:00
parent ab443a21ec
commit 7dd68cf1ef
212 changed files with 6857 additions and 5615 deletions
+6 -7
View File
@@ -1,9 +1,8 @@
from nonebot.adapters.cqhttp import MessageSegment
from nonebot.adapters.onebot.v11 import MessageSegment
import random
from .update_game_requests_info import update_requests_info
from .util import generate_img, init_star_rst, BaseData, set_list, get_star, max_card
from .config import ONMYOJI_SR, ONMYOJI_SSR, ONMYOJI_SP, ONMYOJI_R, DRAW_PATH, ONMYOJI_FLAG
from .config import DRAW_DATA_PATH, draw_config
from dataclasses import dataclass
from .init_card_pool import init_game_pool
try:
@@ -39,8 +38,8 @@ async def update_onmyoji_info():
async def init_onmyoji_data():
global ALL_CHAR
if ONMYOJI_FLAG:
with open(DRAW_PATH + 'onmyoji.json', 'r', encoding='utf8') as f:
if draw_config.ONMYOJI_FLAG:
with (DRAW_DATA_PATH / 'onmyoji.json').open('r', encoding='utf8') as f:
azur_dict = json.load(f)
ALL_CHAR = init_game_pool('onmyoji', azur_dict, OnmyojiChar)
@@ -56,7 +55,8 @@ onmyoji_star = {
# 抽取卡池
def _get_onmyoji_card():
global ALL_CHAR
star = get_star([5, 4, 3, 2], [ONMYOJI_SP, ONMYOJI_SSR, ONMYOJI_SR, ONMYOJI_R])
onmyoji_config = draw_config.onmyoji
star = get_star([5, 4, 3, 2], [onmyoji_config.ONMYOJI_SP, onmyoji_config.ONMYOJI_SSR, onmyoji_config.ONMYOJI_SR, onmyoji_config.ONMYOJI_R])
chars = [x for x in ALL_CHAR if x.star == onmyoji_star[star] and not x.limited]
return random.choice(chars), 5 - star
@@ -79,4 +79,3 @@ def format_card_information(count: int):
obj_dict[obj.name] = 1
obj_list.append(obj)
return obj_list, obj_dict, star_list, rst