mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
commit
c21200c2a9
@ -293,7 +293,7 @@ class AzurHandle(BaseHandle[AzurChar]):
|
|||||||
type_ = ship.xpath("./tbody/tr/td[2]/p/small/text()")[0] # 舰船类型
|
type_ = ship.xpath("./tbody/tr/td[2]/p/small/text()")[0] # 舰船类型
|
||||||
try:
|
try:
|
||||||
p = float(str(ship.xpath(".//sup/text()")[0]).strip("%"))
|
p = float(str(ship.xpath(".//sup/text()")[0]).strip("%"))
|
||||||
except IndexError:
|
except (IndexError, ValueError):
|
||||||
p = 0
|
p = 0
|
||||||
star = self.parse_star(
|
star = self.parse_star(
|
||||||
ship.xpath("./tbody/tr/td[1]/div/div/div/a/img/@alt")[0]
|
ship.xpath("./tbody/tr/td[1]/div/div/div/a/img/@alt")[0]
|
||||||
|
|||||||
@ -19,7 +19,7 @@ except ModuleNotFoundError:
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from .base_handle import BaseHandle, BaseData, UpChar, UpEvent
|
from .base_handle import BaseHandle, BaseData, UpChar, UpEvent
|
||||||
from ..config import draw_config
|
from ..config import draw_config, DRAW_PATH
|
||||||
from ..util import remove_prohibited_str, cn2py, load_font
|
from ..util import remove_prohibited_str, cn2py, load_font
|
||||||
from utils.image_utils import BuildImage
|
from utils.image_utils import BuildImage
|
||||||
|
|
||||||
@ -106,8 +106,6 @@ class PrtsHandle(BaseHandle[Operator]):
|
|||||||
|
|
||||||
async def draw(self, count: int, **kwargs) -> Message:
|
async def draw(self, count: int, **kwargs) -> Message:
|
||||||
return await asyncio.get_event_loop().run_in_executor(None, self._draw, count)
|
return await asyncio.get_event_loop().run_in_executor(None, self._draw, count)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _draw(self, count: int, **kwargs) -> Message:
|
def _draw(self, count: int, **kwargs) -> Message:
|
||||||
index2card = self.get_cards(count)
|
index2card = self.get_cards(count)
|
||||||
@ -164,8 +162,9 @@ class PrtsHandle(BaseHandle[Operator]):
|
|||||||
|
|
||||||
def load_up_char(self):
|
def load_up_char(self):
|
||||||
try:
|
try:
|
||||||
data = self.load_data(f"draw_card_up/{self.game_name}_up_char.json")
|
if (DRAW_PATH / "draw_card_up" / f"{self.game_name}_up_char.json").exists():
|
||||||
self.UP_EVENT = UpEvent.parse_obj(data.get("char", {}))
|
data = self.load_data(f"draw_card_up/{self.game_name}_up_char.json")
|
||||||
|
self.UP_EVENT = UpEvent.parse_obj(data.get("char", {}))
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
logger.warning(f"{self.game_name}_up_char 解析出错")
|
logger.warning(f"{self.game_name}_up_char 解析出错")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user