mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-07 12:43:25 +08:00
✨ 优化代码格式,调整导入顺序,统一字符串引号
This commit is contained in:
parent
b3f4606545
commit
7db08353fa
@ -1,5 +1,3 @@
|
||||
from gsuid_core.sv import Plugins
|
||||
|
||||
Plugins(
|
||||
name="StarRailUID", force_prefix=['sr'], allow_empty_prefix=False
|
||||
)
|
||||
Plugins(name="StarRailUID", force_prefix=["sr"], allow_empty_prefix=False)
|
||||
|
@ -3,4 +3,4 @@
|
||||
from .models import MihomoData as MihomoData
|
||||
from .requests import get_char_card_info as requests
|
||||
|
||||
__all__ = ["requests", "MihomoData"]
|
||||
__all__ = ["MihomoData", "requests"]
|
||||
|
@ -53,7 +53,9 @@ ROGUE_LOCUST_INFO_URL = (
|
||||
f"{NEW_URL}/game_record/app/hkrpg/api/rogue_locust" # 角色寰宇蝗灾信息接口
|
||||
)
|
||||
|
||||
STAR_RAIL_GACHA_LOG_URL = f"https://public-operation-hkrpg.mihoyo.com/common/gacha_record/api/getGachaLog"
|
||||
STAR_RAIL_GACHA_LOG_URL = (
|
||||
f"https://public-operation-hkrpg.mihoyo.com/common/gacha_record/api/getGachaLog"
|
||||
)
|
||||
STAR_RAIL_GACHA_LOG_URL_OS = f"{OS_OLD_URL}/common/gacha_record/api/getGachaLog"
|
||||
|
||||
GET_FP_URL = "https://public-data-api.mihoyo.com/device-fp/api/getFp"
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_abyss_card import draw_abyss_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_srabyss = SV("sr查询深渊")
|
||||
|
||||
|
@ -2,17 +2,14 @@ from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import prefix
|
||||
from ..sruid_utils.api.mys.models import AbyssAvatar
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
from ..utils.image.image_tools import elements, _get_event_avatar
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_28,
|
||||
@ -20,6 +17,9 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_34,
|
||||
sr_font_42,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar, elements
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2D"
|
||||
white_color = (255, 255, 255)
|
||||
@ -121,9 +121,7 @@ async def draw_abyss_img(
|
||||
return f"你还没有挑战本期深渊!\n可以使用[{prefix}上期深渊]命令查询上期~"
|
||||
# 过滤掉 is_fast (快速通关) 为 True 的项
|
||||
floor_detail = [
|
||||
detail
|
||||
for detail in raw_abyss_data.all_floor_detail
|
||||
if not detail.is_fast
|
||||
detail for detail in raw_abyss_data.all_floor_detail if not detail.is_fast
|
||||
]
|
||||
floor_num = len(floor_detail)
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_abyss_card import draw_abyss_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_abyss_boss = SV("sr查询末日幻影")
|
||||
|
||||
|
@ -2,17 +2,14 @@ from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import prefix
|
||||
from ..sruid_utils.api.mys.models import AbyssAvatar
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
from ..utils.image.image_tools import elements, _get_event_avatar
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_28,
|
||||
@ -20,6 +17,9 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_34,
|
||||
sr_font_42,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar, elements
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2D"
|
||||
white_color = (255, 255, 255)
|
||||
@ -125,9 +125,7 @@ async def draw_abyss_img(
|
||||
return f"你还没有挑战本期末日幻影!\n可以使用[{prefix}上期末日幻影]命令查询上期~"
|
||||
# 过滤掉 is_fast (快速通关) 为 True 的项
|
||||
floor_detail = [
|
||||
detail
|
||||
for detail in raw_abyss_data.all_floor_detail
|
||||
if not detail.is_fast
|
||||
detail for detail in raw_abyss_data.all_floor_detail if not detail.is_fast
|
||||
]
|
||||
floor_num = len(floor_detail)
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_abyss_card import draw_abyss_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_abyss_story = SV("sr查询虚构叙事")
|
||||
|
||||
|
@ -2,17 +2,14 @@ from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import prefix
|
||||
from ..sruid_utils.api.mys.models import AbyssAvatar
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
from ..utils.image.image_tools import elements, _get_event_avatar
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_28,
|
||||
@ -20,6 +17,9 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_34,
|
||||
sr_font_42,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar, elements
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2D"
|
||||
white_color = (255, 255, 255)
|
||||
@ -140,9 +140,7 @@ async def draw_abyss_img(
|
||||
return f"你还没有挑战本期虚构叙事!\n可以使用[{prefix}上期虚构叙事]命令查询上期~"
|
||||
# 过滤掉 is_fast (快速通关) 为 True 的项
|
||||
floor_detail = [
|
||||
detail
|
||||
for detail in raw_abyss_data.all_floor_detail
|
||||
if not detail.is_fast
|
||||
detail for detail in raw_abyss_data.all_floor_detail if not detail.is_fast
|
||||
]
|
||||
floor_num = len(floor_detail)
|
||||
|
||||
|
@ -2,12 +2,12 @@ from typing import TYPE_CHECKING
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..utils.name_covert import name_to_avatar_id, alias_to_char_name
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.name_covert import alias_to_char_name, name_to_avatar_id
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from gsuid_core.bot import Bot
|
||||
|
@ -1,21 +1,21 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
import re
|
||||
from typing import Tuple, cast
|
||||
|
||||
from PIL import Image
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.message_models import Button
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from starrail_damage_cal.map.SR_MAP_PATH import avatarId2Name
|
||||
|
||||
from .get_char_img import draw_char_info_img
|
||||
from .to_card import api_to_card
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .get_char_img import draw_char_info_img
|
||||
from ..utils.resource.RESOURCE_PATH import TEMP_PATH
|
||||
|
||||
sv_char_info_config = SV("sr面板设置", pm=2)
|
||||
|
@ -482,8 +482,7 @@ async def draw_char_img(
|
||||
relic_piece_new_img,
|
||||
)
|
||||
rarity_img = Image.open(
|
||||
TEXT_PATH / f"LightCore_Rarity"
|
||||
f"{RelicId2Rarity[str(relic.relicId)]}.png"
|
||||
TEXT_PATH / f"LightCore_Rarity{RelicId2Rarity[str(relic.relicId)]}.png"
|
||||
).resize((200, 48))
|
||||
relic_img.paste(rarity_img, (-10, 80), rarity_img)
|
||||
relic_img_draw = ImageDraw.Draw(relic_img)
|
||||
@ -672,7 +671,7 @@ async def draw_char_img(
|
||||
char_info.paste(damage_img, (0, 2028 + damage_num * 48), damage_img)
|
||||
char_img_draw.text(
|
||||
(55, 2048 + damage_num * 48),
|
||||
f'{damage_info["name"]}',
|
||||
f"{damage_info['name']}",
|
||||
white_color,
|
||||
sr_font_26,
|
||||
"lm",
|
||||
|
@ -33,10 +33,8 @@ async def api_to_card(uid: str) -> Union[Tuple[bytes, List[str]], bytes]:
|
||||
uid,
|
||||
save_path=PLAYER_PATH,
|
||||
)
|
||||
if (
|
||||
not isinstance(char_id_list, str)
|
||||
and char_id_list == []
|
||||
or isinstance(char_id_list, str)
|
||||
if (not isinstance(char_id_list, str) and char_id_list == []) or isinstance(
|
||||
char_id_list, str
|
||||
):
|
||||
return await convert_img(pic_500)
|
||||
|
||||
@ -63,7 +61,7 @@ async def draw_enka_card(uid: str, char_list: List, showfrom: int = 0):
|
||||
return await convert_img(Image.new("RGBA", (0, 1), (255, 255, 255)))
|
||||
else:
|
||||
line1 = f"UID {uid} 刷新成功"
|
||||
line2 = f'可以使用 {prefix}查询{char_data_list[0]["avatarName"]} 查询详情角色面板'
|
||||
line2 = f"可以使用 {prefix}查询{char_data_list[0]['avatarName']} 查询详情角色面板"
|
||||
char_num = len(char_data_list)
|
||||
if char_num <= 4:
|
||||
based_w, based_h = 1380, 926
|
||||
|
@ -1,18 +1,18 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from .set_config import set_config_func, set_push_value
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .set_config import set_push_value, set_config_func
|
||||
|
||||
sv_self_config = SV("星铁配置")
|
||||
|
||||
|
||||
@sv_self_config.on_prefix(("设置"))
|
||||
@sv_self_config.on_prefix("设置")
|
||||
async def send_config_ev(bot: Bot, ev: Event):
|
||||
logger.info("开始执行[设置阈值信息]")
|
||||
uid = await GsBind.get_uid_by_game(ev.user_id, ev.bot_id, "sr")
|
||||
@ -26,9 +26,9 @@ async def send_config_ev(bot: Bot, ev: Event):
|
||||
if value is None:
|
||||
return await bot.send("请输入正确的阈值数字...")
|
||||
|
||||
logger.info("[设置阈值信息]func: {}, value: {}".format(func, value))
|
||||
logger.info(f"[设置阈值信息]func: {func}, value: {value}")
|
||||
im = await set_push_value(ev.bot_id, func, uid, int(value))
|
||||
await bot.send(im)
|
||||
return await bot.send(im)
|
||||
|
||||
|
||||
# 开启 自动签到 和 推送树脂提醒 功能
|
||||
@ -66,4 +66,4 @@ async def open_switch_func(bot: Bot, ev: Event):
|
||||
query=query,
|
||||
is_admin=is_admin,
|
||||
)
|
||||
await bot.send(im)
|
||||
return await bot.send(im)
|
||||
|
@ -2,9 +2,9 @@ from typing import Dict
|
||||
|
||||
from gsuid_core.utils.plugins_config.models import (
|
||||
GSC,
|
||||
GsStrConfig,
|
||||
GsBoolConfig,
|
||||
GsListStrConfig,
|
||||
GsStrConfig,
|
||||
)
|
||||
|
||||
CONIFG_DEFAULT: Dict[str, GSC] = {
|
||||
|
@ -1,14 +1,13 @@
|
||||
from typing import Optional
|
||||
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.database.models import GsUser
|
||||
from gsuid_core.sv import get_plugin_available_prefix
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.database.config_switch import set_database_value
|
||||
from gsuid_core.utils.database.models import GsUser
|
||||
|
||||
from .config_default import CONIFG_DEFAULT
|
||||
from .sr_config import srconfig
|
||||
from ..utils.database.model import SrPush
|
||||
from .config_default import CONIFG_DEFAULT
|
||||
|
||||
PUSH_MAP = {
|
||||
"体力": "stamina",
|
||||
@ -21,7 +20,7 @@ async def set_push_value(bot_id: str, func: str, uid: str, value: int):
|
||||
status = PUSH_MAP[func]
|
||||
else:
|
||||
return "该配置项不存在!"
|
||||
logger.info("[设置推送阈值]func: {}, value: {}".format(status, value))
|
||||
logger.info(f"[设置推送阈值]func: {status}, value: {value}")
|
||||
if (
|
||||
await SrPush.update_data_by_uid(
|
||||
uid,
|
||||
@ -59,12 +58,10 @@ async def set_config_func(
|
||||
bot_id,
|
||||
"sr",
|
||||
**{
|
||||
f'{PUSH_MAP[config_name.replace("推送", "")]}_push': option,
|
||||
f"{PUSH_MAP[config_name.replace('推送', '')]}_push": option,
|
||||
},
|
||||
)
|
||||
await GsUser.update_data_by_uid(
|
||||
uid, bot_id, 'sr', sr_push_switch=option
|
||||
)
|
||||
await GsUser.update_data_by_uid(uid, bot_id, "sr", sr_push_switch=option)
|
||||
else:
|
||||
if await GsUser.data_exist(sr_uid=uid):
|
||||
text = await set_database_value(
|
||||
@ -77,12 +74,11 @@ async def set_config_func(
|
||||
option,
|
||||
)
|
||||
else:
|
||||
return '请先绑定Cookies!'
|
||||
return "请先绑定Cookies!"
|
||||
|
||||
if not text:
|
||||
return "该配置项不存在!"
|
||||
else:
|
||||
return text
|
||||
return text
|
||||
|
||||
if option == "on":
|
||||
succeed_msg = "开启至私聊消息!"
|
||||
|
@ -1,13 +1,13 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .get_gachalogs import save_gachalogs
|
||||
from .draw_gachalogs import draw_gachalogs_img
|
||||
from .get_gachalogs import save_gachalogs
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_gacha_log = SV("sr抽卡记录")
|
||||
sv_get_gachalog_by_link = SV("sr导入抽卡链接", area="DIRECT")
|
||||
|
@ -1,23 +1,16 @@
|
||||
import json
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple, Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import get_color_bg, draw_pic_with_ring
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring, get_color_bg
|
||||
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.image.image_tools import _get_event_avatar
|
||||
from ..utils.name_covert import name_to_avatar_id, name_to_weapon_id
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
PLAYER_PATH,
|
||||
WEAPON_PATH,
|
||||
CHAR_ICON_PATH,
|
||||
)
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_20,
|
||||
sr_font_24,
|
||||
@ -25,6 +18,13 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_38,
|
||||
sr_font_40,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar
|
||||
from ..utils.name_covert import name_to_avatar_id, name_to_weapon_id
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
CHAR_ICON_PATH,
|
||||
PLAYER_PATH,
|
||||
WEAPON_PATH,
|
||||
)
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2d"
|
||||
EMO_PATH = Path(__file__).parent / "texture2d" / "emo"
|
||||
@ -100,13 +100,7 @@ async def _draw_card(
|
||||
text_color = green_color
|
||||
else:
|
||||
text_color = brown_color
|
||||
card_img_draw.text(
|
||||
text_point,
|
||||
f"{gacha_num}抽",
|
||||
text_color,
|
||||
sr_font_24,
|
||||
"mm"
|
||||
)
|
||||
card_img_draw.text(text_point, f"{gacha_num}抽", text_color, sr_font_24, "mm")
|
||||
if is_up:
|
||||
logger.info(f"up: {name}")
|
||||
# card_img.paste(up_tag, (47, -2), up_tag)
|
||||
@ -186,7 +180,7 @@ async def draw_gachalogs_img(uid: str, ev: Event) -> Union[bytes, str]:
|
||||
_fm = "%Y-%m-%d %H:%M:%S"
|
||||
t1 = datetime.strptime(data["time"], _fm)
|
||||
t2 = datetime.strptime(total_data[i]["time_range"], _fm)
|
||||
total_data[i]["all_time"] = (t1-t2).total_seconds()
|
||||
total_data[i]["all_time"] = (t1 - t2).total_seconds()
|
||||
total_data[i]["time_range"] += "~" + data["time"]
|
||||
|
||||
# 计算时间间隔
|
||||
@ -201,9 +195,7 @@ async def draw_gachalogs_img(uid: str, ev: Event) -> Union[bytes, str]:
|
||||
total_data[i]["long_gacha_data"]["num"] += 1
|
||||
total_data[i]["long_gacha_data"]["time"] += dis
|
||||
else:
|
||||
temp_time = datetime.strptime(
|
||||
data["time"], "%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
temp_time = datetime.strptime(data["time"], "%Y-%m-%d %H:%M:%S")
|
||||
|
||||
# 如果这是个五星
|
||||
if data["rank_type"] == "5":
|
||||
@ -392,12 +384,7 @@ async def draw_gachalogs_img(uid: str, ev: Event) -> Union[bytes, str]:
|
||||
"mm",
|
||||
)
|
||||
y_extend += (
|
||||
(
|
||||
1
|
||||
+ (
|
||||
(total_data[type_list[index - 1]]["total"] - 1) // 5
|
||||
)
|
||||
) * single_y
|
||||
(1 + ((total_data[type_list[index - 1]]["total"] - 1) // 5)) * single_y
|
||||
if index != 0
|
||||
else 0
|
||||
)
|
||||
|
@ -1,16 +1,16 @@
|
||||
import json
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from urllib import parse
|
||||
from datetime import datetime
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional
|
||||
from urllib import parse
|
||||
|
||||
import msgspec
|
||||
import aiofiles
|
||||
import msgspec
|
||||
|
||||
from ..sruid_utils.api.mys.models import SingleGachaLog
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
||||
from ..sruid_utils.api.mys.models import SingleGachaLog
|
||||
|
||||
gacha_type_meta_data = {
|
||||
"群星跃迁": ["1"],
|
||||
@ -37,8 +37,8 @@ async def get_new_gachalog_by_link(
|
||||
if "authkey" not in url_parse:
|
||||
return {}
|
||||
authkey = url_parse["authkey"][0]
|
||||
authkey = parse.quote(authkey, safe='')
|
||||
if 'gacha_id' in url_parse:
|
||||
authkey = parse.quote(authkey, safe="")
|
||||
if "gacha_id" in url_parse:
|
||||
gacha_id = url_parse["gacha_id"][0]
|
||||
else:
|
||||
gacha_id = None
|
||||
@ -102,8 +102,7 @@ async def save_gachalogs(
|
||||
if gachalogs_path.exists():
|
||||
async with aiofiles.open(
|
||||
gachalogs_path,
|
||||
mode='r',
|
||||
encoding='UTF-8',
|
||||
encoding="UTF-8",
|
||||
) as f:
|
||||
gachalogs_history = json.loads(await f.read())
|
||||
gachalogs_history = gachalogs_history["data"]
|
||||
|
@ -1,9 +1,9 @@
|
||||
from PIL import Image
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.help.utils import register_help
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
|
||||
from .get_help import ICON, get_help
|
||||
from ..utils.error_reply import prefix
|
||||
@ -17,4 +17,5 @@ async def send_help_img(bot: Bot, ev: Event):
|
||||
im = await get_help()
|
||||
await bot.send(im)
|
||||
|
||||
register_help('StarRailUID', f'{prefix}帮助', Image.open(ICON))
|
||||
|
||||
register_help("StarRailUID", f"{prefix}帮助", Image.open(ICON))
|
||||
|
@ -1,40 +1,40 @@
|
||||
from typing import Dict
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
import aiofiles
|
||||
from PIL import Image
|
||||
from msgspec import json as msgjson
|
||||
import aiofiles
|
||||
from gsuid_core.help.draw_new_plugin_help import get_new_help
|
||||
from gsuid_core.help.model import PluginHelp
|
||||
from gsuid_core.sv import get_plugin_available_prefix
|
||||
from gsuid_core.help.draw_new_plugin_help import get_new_help
|
||||
from msgspec import json as msgjson
|
||||
|
||||
from ..version import StarRailUID_version
|
||||
from ..utils.image.image_tools import get_footer
|
||||
from ..version import StarRailUID_version
|
||||
|
||||
ICON = Path(__file__).parent.parent.parent / 'ICON.png'
|
||||
HELP_DATA = Path(__file__).parent / 'help.json'
|
||||
ICON_PATH = Path(__file__).parent / 'icon_path'
|
||||
TEXT_PATH = Path(__file__).parent / 'texture2d'
|
||||
ICON = Path(__file__).parent.parent.parent / "ICON.png"
|
||||
HELP_DATA = Path(__file__).parent / "help.json"
|
||||
ICON_PATH = Path(__file__).parent / "icon_path"
|
||||
TEXT_PATH = Path(__file__).parent / "texture2d"
|
||||
|
||||
|
||||
async def get_help_data() -> Dict[str, PluginHelp]:
|
||||
async with aiofiles.open(HELP_DATA, 'rb') as file:
|
||||
async with aiofiles.open(HELP_DATA, "rb") as file:
|
||||
return msgjson.decode(await file.read(), type=Dict[str, PluginHelp])
|
||||
|
||||
|
||||
async def get_help():
|
||||
return await get_new_help(
|
||||
plugin_name='StarRailUID',
|
||||
plugin_info={f'v{StarRailUID_version}': ''},
|
||||
plugin_name="StarRailUID",
|
||||
plugin_info={f"v{StarRailUID_version}": ""},
|
||||
plugin_icon=Image.open(ICON),
|
||||
plugin_help=await get_help_data(),
|
||||
plugin_prefix=get_plugin_available_prefix('StarRailUID'),
|
||||
help_mode='dark',
|
||||
banner_bg=Image.open(TEXT_PATH / 'banner_bg.jpg'),
|
||||
banner_sub_text='「愿此行, 终抵群星!」',
|
||||
help_bg=Image.open(TEXT_PATH / 'bg.jpg'),
|
||||
cag_bg=Image.open(TEXT_PATH / 'cag_bg.png'),
|
||||
item_bg=Image.open(TEXT_PATH / 'item.png'),
|
||||
plugin_prefix=get_plugin_available_prefix("StarRailUID"),
|
||||
help_mode="dark",
|
||||
banner_bg=Image.open(TEXT_PATH / "banner_bg.jpg"),
|
||||
banner_sub_text="「愿此行, 终抵群星!」",
|
||||
help_bg=Image.open(TEXT_PATH / "bg.jpg"),
|
||||
cag_bg=Image.open(TEXT_PATH / "cag_bg.png"),
|
||||
item_bg=Image.open(TEXT_PATH / "item.png"),
|
||||
icon_path=ICON_PATH,
|
||||
footer=get_footer(),
|
||||
enable_cache=True,
|
||||
|
@ -1,13 +1,13 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from .draw_note_card import draw_note_img
|
||||
from .note_text import award
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_note_card import draw_note_img
|
||||
|
||||
sv_get_monthly_data = SV("sr查询月历")
|
||||
|
||||
@ -18,8 +18,7 @@ async def send_monthly_data(bot: Bot, ev: Event):
|
||||
sr_uid = await GsBind.get_uid_by_game(ev.user_id, ev.bot_id, "sr")
|
||||
if sr_uid is None:
|
||||
return await bot.send(UID_HINT)
|
||||
await bot.send(await award(sr_uid))
|
||||
return None
|
||||
return await bot.send(await award(sr_uid))
|
||||
|
||||
|
||||
@sv_get_monthly_data.on_fullmatch(
|
||||
@ -35,5 +34,4 @@ async def send_monthly_pic(bot: Bot, ev: Event):
|
||||
if sr_uid is None:
|
||||
return await bot.send(UID_HINT)
|
||||
im = await draw_note_img(str(sr_uid))
|
||||
await bot.send(im)
|
||||
return None
|
||||
return await bot.send(im)
|
||||
|
@ -1,7 +1,7 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
|
||||
from ..utils.resource.download_all_file import check_use
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_rogue_card import draw_rogue_img, draw_rogue_locust_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_srabyss = SV("sr查询模拟宇宙")
|
||||
sv_srabyss_locust = SV("sr查询寰宇蝗灾")
|
||||
|
@ -1,30 +1,30 @@
|
||||
import math
|
||||
from pathlib import Path
|
||||
from typing import List, Union, Optional
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
LocustBlocks,
|
||||
RogueAvatar,
|
||||
RogueBuffitems,
|
||||
RogueMiracles,
|
||||
)
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
from ..utils.image.image_tools import elements, _get_event_avatar
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_28,
|
||||
sr_font_34,
|
||||
sr_font_42,
|
||||
)
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
RogueAvatar,
|
||||
LocustBlocks,
|
||||
RogueMiracles,
|
||||
RogueBuffitems,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar, elements
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2D"
|
||||
white_color = (255, 255, 255)
|
||||
@ -479,11 +479,7 @@ async def draw_rogue_img(
|
||||
sr_font_34,
|
||||
"lm",
|
||||
)
|
||||
floor_pic.paste(
|
||||
content_center,
|
||||
(0, 370 + buff_height + 80),
|
||||
content_center
|
||||
)
|
||||
floor_pic.paste(content_center, (0, 370 + buff_height + 80), content_center)
|
||||
await _draw_rogue_miracles(
|
||||
detail.miracles,
|
||||
floor_pic,
|
||||
|
@ -1,14 +1,14 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from .draw_roleinfo_card import get_detail_img, get_role_img
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .draw_roleinfo_card import get_role_img, get_detail_img
|
||||
|
||||
sv_get_info = SV("sr查询信息")
|
||||
|
||||
|
@ -1,18 +1,22 @@
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Union, TypeVar, Optional, Generator
|
||||
from typing import Dict, Generator, List, Optional, TypeVar, Union
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
from gsuid_core.utils.image.image_tools import draw_pic_with_ring
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
AvatarDetail,
|
||||
AvatarListItem,
|
||||
AvatarListItemDetail,
|
||||
RoleBasicInfo,
|
||||
Stats,
|
||||
)
|
||||
from ..utils.fonts.first_world import fw_font_24
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
from ..utils.image.image_tools import elements, _get_event_avatar
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_24,
|
||||
@ -20,13 +24,9 @@ from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_30,
|
||||
sr_font_36,
|
||||
)
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
Stats,
|
||||
AvatarDetail,
|
||||
RoleBasicInfo,
|
||||
AvatarListItem,
|
||||
AvatarListItemDetail,
|
||||
)
|
||||
from ..utils.image.image_tools import _get_event_avatar, elements
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.resource.get_pic_from import get_roleinfo_icon
|
||||
|
||||
TEXT_PATH = Path(__file__).parent / "texture2D"
|
||||
|
||||
@ -65,7 +65,7 @@ T = TypeVar("T")
|
||||
|
||||
def wrap_list(lst: List[T], n: int) -> Generator[List[T], None, None]:
|
||||
for i in range(0, len(lst), n):
|
||||
yield lst[i : i + n] # noqa: E203
|
||||
yield lst[i : i + n]
|
||||
|
||||
|
||||
async def _draw_card_1(
|
||||
@ -88,13 +88,7 @@ async def _draw_card_1(
|
||||
bg1_draw = ImageDraw.Draw(img_bg1)
|
||||
|
||||
# 写Nickname
|
||||
bg1_draw.text(
|
||||
(400, 85),
|
||||
nickname,
|
||||
font=sr_font_36,
|
||||
fill=white_color,
|
||||
anchor="mm"
|
||||
)
|
||||
bg1_draw.text((400, 85), nickname, font=sr_font_36, fill=white_color, anchor="mm")
|
||||
# 写UID
|
||||
bg1_draw.text(
|
||||
(400, 165),
|
||||
@ -208,10 +202,7 @@ async def _draw_card_2(
|
||||
) -> Image.Image:
|
||||
# 角色部分 每五个一组
|
||||
lines = await asyncio.gather(
|
||||
*[
|
||||
_draw_line(five_avatars, equips)
|
||||
for five_avatars in wrap_list(avatars, 5)
|
||||
]
|
||||
*[_draw_line(five_avatars, equips) for five_avatars in wrap_list(avatars, 5)]
|
||||
)
|
||||
img_card_2 = Image.new("RGBA", (800, len(lines) * 200))
|
||||
|
||||
@ -420,8 +411,8 @@ async def get_detail_card(ev: Event, sr_uid: str) -> Union[bytes, str]:
|
||||
)
|
||||
|
||||
# 写底层文字
|
||||
text1 = 'SR skill statistics by StarrailUID'
|
||||
text2 = 'Code by jiluoQAQ & Power by GsCore'
|
||||
text1 = "SR skill statistics by StarrailUID"
|
||||
text2 = "Code by jiluoQAQ & Power by GsCore"
|
||||
char_img_draw.text(
|
||||
(525, img_height - 45),
|
||||
f"--{text1} & {text2}--",
|
||||
|
@ -1,14 +1,14 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
from gsuid_core.utils.sign.sign import sign_in, daily_sign
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.boardcast.send_msg import send_board_cast_msg
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
from gsuid_core.utils.sign.sign import daily_sign, sign_in
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..starrailuid_config.sr_config import srconfig
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
SIGN_TIME = srconfig.get_config("SignTime").data
|
||||
IS_REPORT = srconfig.get_config("PrivateSignReport").data
|
||||
|
@ -1,20 +1,20 @@
|
||||
import asyncio
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.gss import gss
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.aps import scheduler
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.segment import MessageSegment
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.api import get_uid
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from .notice import get_notice_list
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from .stamina_text import get_stamina_text
|
||||
from .draw_stamina_card import get_stamina_img
|
||||
from .notice import get_notice_list
|
||||
from .stamina_text import get_stamina_text
|
||||
from ..starrailuid_config.sr_config import srconfig
|
||||
from ..utils.error_reply import UID_HINT
|
||||
|
||||
sv_get_stamina = SV("sr查询体力")
|
||||
sv_get_stamina_admin = SV("sr强制推送", pm=1)
|
||||
@ -43,7 +43,7 @@ async def force_notice_job(bot: Bot, ev: Event):
|
||||
async def sr_notice_job():
|
||||
StaminaCheck = srconfig.get_config("StaminaCheck").data
|
||||
if not StaminaCheck:
|
||||
logger.trace('[sr推送检查] 暂停...')
|
||||
logger.trace("[sr推送检查] 暂停...")
|
||||
return
|
||||
|
||||
result = await get_notice_list()
|
||||
|
@ -45,7 +45,7 @@ red_color = (235, 61, 75)
|
||||
def seconds2hours(seconds: int) -> str:
|
||||
m, s = divmod(int(seconds), 60)
|
||||
h, m = divmod(m, 60)
|
||||
return "%02d:%02d:%02d" % (h, m, s)
|
||||
return f"{h:02d}:{m:02d}:{s:02d}"
|
||||
|
||||
|
||||
async def download_image(url: str) -> Image.Image:
|
||||
@ -164,9 +164,9 @@ def get_error(img: Image.Image, uid: str, daily_data: int):
|
||||
|
||||
|
||||
async def seconds2hours_zhcn(seconds: int) -> str:
|
||||
m, s = divmod(int(seconds), 60)
|
||||
m, _ = divmod(int(seconds), 60)
|
||||
h, m = divmod(m, 60)
|
||||
return "%02d小时%02d分" % (h, m)
|
||||
return f"{h:02d}小时{m:02d}分"
|
||||
|
||||
|
||||
async def draw_stamina_img(sr_uid: str) -> Image.Image:
|
||||
|
@ -7,7 +7,7 @@ from gsuid_core.utils.database.models import GsUser
|
||||
from ..sruid_utils.api.mys.models import DailyNoteData
|
||||
from ..starrailuid_config.sr_config import srconfig
|
||||
from ..utils.database.model import SrPush
|
||||
from..utils.error_reply import prefix
|
||||
from ..utils.error_reply import prefix
|
||||
from ..utils.mys_api import mys_api
|
||||
|
||||
MR_NOTICE = f"\n可发送[{prefix}mr]或者[{prefix}每日]来查看更多信息!\n"
|
||||
@ -21,7 +21,7 @@ NOTICE = {
|
||||
async def get_notice_list() -> Dict[str, Dict[str, Dict]]:
|
||||
msg_dict: Dict[str, Dict[str, Dict]] = {}
|
||||
for _ in gss.active_bot:
|
||||
user_list = await GsUser.get_push_user_list('sr')
|
||||
user_list = await GsUser.get_push_user_list("sr")
|
||||
for user in user_list:
|
||||
if user.sr_uid is not None:
|
||||
raw_data = await mys_api.get_sr_daily_data(user.sr_uid)
|
||||
|
@ -2,8 +2,8 @@ from typing import List
|
||||
|
||||
from gsuid_core.logger import logger
|
||||
|
||||
from ..utils.mys_api import mys_api
|
||||
from ..utils.error_reply import get_error
|
||||
from ..utils.mys_api import mys_api
|
||||
|
||||
daily_im = """*数据刷新可能存在一定延迟,请以当前游戏实际数据为准
|
||||
==============
|
||||
@ -16,7 +16,7 @@ daily_im = """*数据刷新可能存在一定延迟,请以当前游戏实际数
|
||||
def seconds2hours(seconds: int) -> str:
|
||||
m, s = divmod(int(seconds), 60)
|
||||
h, m = divmod(m, 60)
|
||||
return "%02d:%02d:%02d" % (h, m, s)
|
||||
return f"{h:02d}:{m:02d}:{s:02d}"
|
||||
|
||||
|
||||
async def get_stamina_text(uid: str) -> str:
|
||||
|
@ -1,11 +1,11 @@
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.database.models import GsBind
|
||||
|
||||
from ..utils.message import send_diff_msg
|
||||
from .draw_user_card import get_user_card
|
||||
from ..utils.message import send_diff_msg
|
||||
|
||||
sv_user_config = SV("sr用户管理", pm=2)
|
||||
sv_user_info = SV("sr用户信息")
|
||||
|
@ -1,25 +1,25 @@
|
||||
import re
|
||||
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.bot import Bot
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.sv import SV
|
||||
from gsuid_core.utils.image.convert import convert_img
|
||||
|
||||
from ..utils.name_covert import (
|
||||
alias_to_char_id,
|
||||
name_to_avatar_id,
|
||||
name_to_weapon_id,
|
||||
alias_to_char_name,
|
||||
name_to_avatar_id,
|
||||
name_to_relic_set_id,
|
||||
name_to_weapon_id,
|
||||
)
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
WIKI_ROLE_PATH,
|
||||
WIKI_RELIC_PATH,
|
||||
GUIDE_CHARACTER_PATH,
|
||||
WIKI_LIGHT_CONE_PATH,
|
||||
GUIDE_LIGHT_CONE_PATH,
|
||||
WIKI_LIGHT_CONE_PATH,
|
||||
WIKI_MATERIAL_FOR_ROLE,
|
||||
WIKI_RELIC_PATH,
|
||||
WIKI_ROLE_PATH,
|
||||
)
|
||||
|
||||
sv_sr_wiki = SV("星铁WIKI")
|
||||
|
@ -8,7 +8,7 @@ from sqlmodel import Field
|
||||
|
||||
|
||||
class SrPush(Push, table=True):
|
||||
__table_args__ = {'extend_existing': True}
|
||||
__table_args__ = {"extend_existing": True}
|
||||
bot_id: str = Field(title="平台")
|
||||
sr_uid: str = Field(default=None, title="星铁UID")
|
||||
|
||||
|
@ -7,14 +7,16 @@ prefix = get_plugin_available_prefix("StarRailUID")
|
||||
|
||||
UID_HINT = f"你还没有绑定过uid哦!\n请使用[{prefix}绑定uid123456]命令绑定!"
|
||||
_CHAR_HINT = f"再使用【{prefix}强制刷新】命令来缓存数据进行查询! !"
|
||||
CHAR_HINT = "您的支援/星海同行角色没有{}的数据哦!\n请先把{}放入支援/星海同行中" + _CHAR_HINT
|
||||
CHAR_HINT = (
|
||||
"您的支援/星海同行角色没有{}的数据哦!\n请先把{}放入支援/星海同行中" + _CHAR_HINT
|
||||
)
|
||||
|
||||
|
||||
SR_ERROR_CODE = deepcopy(ERROR_CODE)
|
||||
|
||||
|
||||
def get_error(retcode: int) -> str:
|
||||
msg_list = [f'❌错误代码为: {retcode}']
|
||||
msg_list = [f"❌错误代码为: {retcode}"]
|
||||
if retcode in SR_ERROR_CODE:
|
||||
msg_list.append(f'📝错误信息: {SR_ERROR_CODE[retcode]}')
|
||||
return '\n'.join(msg_list)
|
||||
msg_list.append(f"📝错误信息: {SR_ERROR_CODE[retcode]}")
|
||||
return "\n".join(msg_list)
|
||||
|
@ -5,7 +5,7 @@ from PIL import Image
|
||||
from gsuid_core.models import Event
|
||||
from gsuid_core.utils.image.image_tools import CustomizeImage, get_event_avatar
|
||||
|
||||
from ..resource.RESOURCE_PATH import CU_BG_PATH, CHAR_ICON_PATH
|
||||
from ..resource.RESOURCE_PATH import CHAR_ICON_PATH, CU_BG_PATH
|
||||
|
||||
BG_PATH = Path(__file__).parent / "bg"
|
||||
NM_BG_PATH = BG_PATH / "nm_bg"
|
||||
@ -13,27 +13,19 @@ TEXT_PATH = Path(__file__).parent / "texture2d"
|
||||
NATURE_ICON_PATH = Path(__file__).parent / "icon_nature"
|
||||
|
||||
elements = {
|
||||
"ice": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorIce.png"
|
||||
).convert("RGBA"),
|
||||
"fire": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorFire.png"
|
||||
).convert("RGBA"),
|
||||
"imaginary": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorImaginary.png"
|
||||
).convert("RGBA"),
|
||||
"quantum": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorQuantum.png"
|
||||
).convert("RGBA"),
|
||||
"lightning": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorThunder.png"
|
||||
).convert("RGBA"),
|
||||
"wind": Image.open(
|
||||
NATURE_ICON_PATH / "IconNatureColorWind.png"
|
||||
).convert("RGBA"),
|
||||
"physical": Image.open(
|
||||
NATURE_ICON_PATH / "IconNaturePhysical.png"
|
||||
).convert("RGBA"),
|
||||
"ice": Image.open(NATURE_ICON_PATH / "IconNatureColorIce.png").convert("RGBA"),
|
||||
"fire": Image.open(NATURE_ICON_PATH / "IconNatureColorFire.png").convert("RGBA"),
|
||||
"imaginary": Image.open(NATURE_ICON_PATH / "IconNatureColorImaginary.png").convert(
|
||||
"RGBA"
|
||||
),
|
||||
"quantum": Image.open(NATURE_ICON_PATH / "IconNatureColorQuantum.png").convert(
|
||||
"RGBA"
|
||||
),
|
||||
"lightning": Image.open(NATURE_ICON_PATH / "IconNatureColorThunder.png").convert(
|
||||
"RGBA"
|
||||
),
|
||||
"wind": Image.open(NATURE_ICON_PATH / "IconNatureColorWind.png").convert("RGBA"),
|
||||
"physical": Image.open(NATURE_ICON_PATH / "IconNaturePhysical.png").convert("RGBA"),
|
||||
}
|
||||
|
||||
if list(CU_BG_PATH.iterdir()) != []:
|
||||
@ -55,7 +47,7 @@ async def get_simple_bg(
|
||||
|
||||
|
||||
def get_footer():
|
||||
return Image.open(TEXT_PATH / 'footer.png')
|
||||
return Image.open(TEXT_PATH / "footer.png")
|
||||
|
||||
|
||||
async def _get_event_avatar(event: Event) -> Image.Image:
|
||||
|
@ -181,7 +181,7 @@ class MysApi(_MysApi):
|
||||
url = self.MAPI["STAR_RAIL_GACHA_LOG_URL"]
|
||||
game_biz = "hkrpg_cn"
|
||||
data = await self._mys_request(
|
||||
url=url + f'?authkey={authkey}',
|
||||
url=url + f"?authkey={authkey}",
|
||||
method="GET",
|
||||
header=header,
|
||||
params={
|
||||
|
@ -2,9 +2,8 @@ from typing import Optional
|
||||
|
||||
from starrail_damage_cal.excel.model import CharAlias
|
||||
from starrail_damage_cal.map.SR_MAP_PATH import (
|
||||
SetId2Name,
|
||||
EquipmentID2Name,
|
||||
EquipmentID2EnName,
|
||||
SetId2Name,
|
||||
avatarId2Name,
|
||||
avatarId2Rarity,
|
||||
)
|
||||
@ -17,10 +16,6 @@ async def name_to_relic_set_id(name: str):
|
||||
return None
|
||||
|
||||
|
||||
async def avatar_id_to_name(avatar_id: str) -> str:
|
||||
return avatarId2Name[avatar_id]
|
||||
|
||||
|
||||
async def name_to_avatar_id(name: str) -> str:
|
||||
avatar_id = ""
|
||||
for i in avatarId2Name:
|
||||
@ -56,10 +51,6 @@ async def alias_to_weapon_name(weapon_name: str) -> str:
|
||||
return weapon_name
|
||||
|
||||
|
||||
async def weapon_id_to_name(weapon_id: str) -> str:
|
||||
return EquipmentID2Name[weapon_id]
|
||||
|
||||
|
||||
async def name_to_weapon_id(name: str) -> str:
|
||||
weapon_id = ""
|
||||
for i in EquipmentID2Name:
|
||||
@ -67,16 +58,3 @@ async def name_to_weapon_id(name: str) -> str:
|
||||
weapon_id = i
|
||||
break
|
||||
return weapon_id
|
||||
|
||||
|
||||
async def weapon_id_to_en_name(weapon_id: str) -> str:
|
||||
return EquipmentID2EnName[weapon_id]
|
||||
|
||||
|
||||
async def en_name_to_weapon_id(name: str) -> str:
|
||||
weapon_id = ""
|
||||
for i in EquipmentID2EnName:
|
||||
if EquipmentID2EnName[i] == name:
|
||||
weapon_id = i
|
||||
break
|
||||
return weapon_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user