73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
"""治疗系统插件 - 恢复受伤状态"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional, Sequence
|
|
|
|
from PWF.Convention.Runtime.GlobalConfig import ConsoleFrontColor, ProjectConfig
|
|
from Plugins.WPSAPI import GuideEntry
|
|
from Plugins.WPSCombatSystem.combat_models import CombatConfig
|
|
|
|
from .combat_plugin_base import WPSCombatBase
|
|
|
|
|
|
logger: ProjectConfig = ProjectConfig()
|
|
|
|
|
|
class WPSCombatHeal(WPSCombatBase):
|
|
"""治疗系统插件"""
|
|
|
|
def get_guide_subtitle(self) -> str:
|
|
return "恢复受伤状态并重返冒险"
|
|
|
|
def collect_command_entries(self) -> Sequence[GuideEntry]:
|
|
return (
|
|
GuideEntry(
|
|
title="治疗",
|
|
identifier="治疗",
|
|
description="消耗积分清除受伤状态,使角色可继续冒险或战斗。",
|
|
metadata={"别名": "heal / 恢复"},
|
|
icon="💊",
|
|
details=[
|
|
{"type": "list", "items": ["若未受伤会返回提示信息。", "扣除积分后立即清除受伤标记。"]},
|
|
],
|
|
),
|
|
)
|
|
|
|
def collect_guide_entries(self) -> Sequence[GuideEntry]:
|
|
heal_cost = CombatConfig.get_int("combat_heal_cost")
|
|
return (
|
|
{
|
|
"title": "费用计算",
|
|
"description": f"治疗费用由配置 `combat_heal_cost` 决定,当前为 {heal_cost} 分。",
|
|
},
|
|
)
|
|
|
|
def is_enable_plugin(self) -> bool:
|
|
return True
|
|
|
|
def wake_up(self) -> None:
|
|
super().wake_up()
|
|
logger.Log(
|
|
"Info",
|
|
f"{ConsoleFrontColor.GREEN}WPSCombatHeal 插件已加载{ConsoleFrontColor.RESET}"
|
|
)
|
|
self.register_plugin("治疗")
|
|
self.register_plugin("heal")
|
|
self.register_plugin("恢复")
|
|
|
|
async def callback(self, message: str, chat_id: int, user_id: int) -> Optional[str]:
|
|
"""
|
|
处理治疗命令
|
|
|
|
命令格式:
|
|
- 治疗
|
|
"""
|
|
service = self.service()
|
|
success, msg = service.heal_player(user_id)
|
|
|
|
return await self.send_markdown_message(msg, chat_id, user_id)
|
|
|
|
|
|
__all__ = ["WPSCombatHeal"]
|