新增插件指引网页
This commit is contained in:
@@ -13,7 +13,7 @@ from PWF.CoreModules.database import get_db, STATUS_COMPLETED
|
||||
from PWF.CoreModules.plugin_interface import DatabaseModel
|
||||
from PWF.CoreModules.flags import get_internal_debug
|
||||
|
||||
from .WPSAPI import WPSAPI
|
||||
from .WPSAPI import GuideEntry, GuideSection, WPSAPI
|
||||
from .WPSBackpackSystem import (
|
||||
BackpackItemDefinition,
|
||||
BackpackItemTier,
|
||||
@@ -73,6 +73,210 @@ class WPSAlchemyGame(WPSAPI):
|
||||
self._max_points_per_batch = MAX_POINTS_PER_BATCH
|
||||
logger.SaveProperties()
|
||||
|
||||
def get_guide_subtitle(self) -> str:
|
||||
return "积分炼金与材料合成系统"
|
||||
|
||||
def get_guide_metadata(self) -> Dict[str, str]:
|
||||
return {
|
||||
"配方数量": str(len(self._recipes)),
|
||||
"冷却时间(分钟)": str(self._cooldown_minutes),
|
||||
"单次积分上限": str(self._max_points_per_batch),
|
||||
}
|
||||
|
||||
def collect_command_entries(self) -> Sequence[GuideEntry]:
|
||||
return (
|
||||
{
|
||||
"title": "炼金",
|
||||
"identifier": "炼金",
|
||||
"description": "投入积分或三件材料,等待冷却后获取结果。",
|
||||
"metadata": {"别名": "alchemy"},
|
||||
},
|
||||
)
|
||||
|
||||
def collect_item_entries(self) -> Sequence[GuideEntry]:
|
||||
return (
|
||||
{
|
||||
"title": self.ASH_ITEM_NAME,
|
||||
"identifier": self.ASH_ITEM_ID,
|
||||
"description": "炼金失败后获得的基础材料,可再次参与配方或出售。",
|
||||
},
|
||||
{
|
||||
"title": self.SLAG_ITEM_NAME,
|
||||
"identifier": self.SLAG_ITEM_ID,
|
||||
"description": "由 `炉灰` 合成,部分园艺/商店配方会引用该物品。",
|
||||
},
|
||||
)
|
||||
|
||||
def collect_guide_entries(self) -> Sequence[GuideEntry]:
|
||||
return (
|
||||
{
|
||||
"title": "积分炼金",
|
||||
"description": (
|
||||
f"`炼金 <积分>` 消耗积分尝试炼金,单次上限 {self._max_points_per_batch},"
|
||||
"结果与运势、阶段概率表 `_PHASE_TABLE` 相关。"
|
||||
),
|
||||
"icon": "💎",
|
||||
},
|
||||
{
|
||||
"title": "材料炼金",
|
||||
"description": (
|
||||
"`炼金 <材料1> <材料2> <材料3> [次数]` 支持批量执行,配方信息可通过 `炼金配方` 查询。"
|
||||
),
|
||||
"icon": "🧪",
|
||||
},
|
||||
{
|
||||
"title": "冷却与恢复",
|
||||
"description": (
|
||||
f"默认冷却 {self._cooldown_minutes} 分钟,任务调度用于结算完成;"
|
||||
"重启后会自动恢复未结算记录。"
|
||||
),
|
||||
"icon": "⏲️",
|
||||
},
|
||||
)
|
||||
|
||||
def collect_additional_sections(self) -> Sequence[GuideSection]:
|
||||
sections = list(super().collect_additional_sections())
|
||||
sections.append(
|
||||
GuideSection(
|
||||
title="基础配方",
|
||||
entries=self._build_core_recipes(),
|
||||
layout="grid",
|
||||
section_id="alchemy-core",
|
||||
description="系统内置的基础配方,可在没有额外模块时直接使用。",
|
||||
)
|
||||
)
|
||||
|
||||
garden_recipes = self._build_garden_wine_recipes()
|
||||
if garden_recipes:
|
||||
sections.append(
|
||||
GuideSection(
|
||||
title="果酒配方",
|
||||
entries=garden_recipes,
|
||||
layout="grid",
|
||||
section_id="alchemy-garden",
|
||||
description="菜园系统提供的果酒炼金配方,使用三份果实即可酿造果酒。",
|
||||
)
|
||||
)
|
||||
|
||||
crystal_recipes = self._build_crystal_chain_recipes()
|
||||
if crystal_recipes:
|
||||
sections.append(
|
||||
GuideSection(
|
||||
title="水晶链路",
|
||||
entries=crystal_recipes,
|
||||
layout="list",
|
||||
section_id="alchemy-crystal",
|
||||
description="水晶系统的多阶段炼金链路,最终可获得黑水晶核心。",
|
||||
)
|
||||
)
|
||||
|
||||
return tuple(sections)
|
||||
|
||||
def _build_core_recipes(self) -> Sequence[GuideEntry]:
|
||||
entries: List[GuideEntry] = []
|
||||
entries.append(
|
||||
GuideEntry(
|
||||
title="炉灰 → 炉渣",
|
||||
identifier=f"{self.ASH_ITEM_ID} × 3",
|
||||
description="循环利用基础产物,将多余炉灰转化为更稀有的炉渣。",
|
||||
category="基础配方",
|
||||
metadata={
|
||||
"成功率": "100%",
|
||||
"失败产物": self.ASH_ITEM_ID,
|
||||
},
|
||||
icon="🔥",
|
||||
details=[
|
||||
{
|
||||
"type": "list",
|
||||
"items": [
|
||||
f"材料:{self.ASH_ITEM_ID} × 3",
|
||||
f"成功产物:{self.SLAG_ITEM_ID}",
|
||||
f"失败产物:{self.ASH_ITEM_ID}",
|
||||
],
|
||||
}
|
||||
],
|
||||
)
|
||||
)
|
||||
return entries
|
||||
|
||||
def _build_garden_wine_recipes(self) -> Sequence[GuideEntry]:
|
||||
try:
|
||||
from Plugins.WPSGardenSystem.garden_models import GARDEN_CROPS
|
||||
except ImportError:
|
||||
return ()
|
||||
entries: List[GuideEntry] = []
|
||||
for crop in GARDEN_CROPS.values():
|
||||
if not crop.wine_item_id:
|
||||
continue
|
||||
items = [
|
||||
f"材料:{crop.fruit_id} × 3",
|
||||
f"成功产物:{crop.wine_item_id}",
|
||||
"失败产物:garden_item_rot_fruit",
|
||||
"基础成功率:75%",
|
||||
]
|
||||
entries.append(
|
||||
GuideEntry(
|
||||
title=f"{crop.display_name}果酒",
|
||||
identifier=f"{crop.fruit_id} ×3",
|
||||
description=f"使用 {crop.display_name} 的果实炼制同名果酒。",
|
||||
category="果酒配方",
|
||||
metadata={
|
||||
"果酒稀有度": crop.wine_tier or "rare",
|
||||
},
|
||||
icon="🍷",
|
||||
tags=(crop.tier.title(),),
|
||||
details=[{"type": "list", "items": items}],
|
||||
)
|
||||
)
|
||||
return entries
|
||||
|
||||
def _build_crystal_chain_recipes(self) -> Sequence[GuideEntry]:
|
||||
try:
|
||||
from Plugins.WPSCrystalSystem.crystal_models import (
|
||||
DEFAULT_CRYSTAL_COLOR_MAP,
|
||||
DEFAULT_CRYSTAL_EXCHANGE_ENTRIES,
|
||||
)
|
||||
except ImportError:
|
||||
return ()
|
||||
entries: List[GuideEntry] = []
|
||||
for color_def in DEFAULT_CRYSTAL_COLOR_MAP.values():
|
||||
stage_details: List[str] = []
|
||||
for stage in color_def.chain_stages:
|
||||
mats = " + ".join(stage.materials)
|
||||
stage_details.append(
|
||||
f"{stage.identifier}:{mats} → {stage.result_item}(成功率 {stage.base_success_rate*100:.0f}%)"
|
||||
)
|
||||
stage_details.append(
|
||||
f"等待阶段:消耗 {', '.join(f'{k}×{v}' for k, v in color_def.wait_stage.consumed_items.items())},"
|
||||
f"耗时 {color_def.wait_stage.delay_minutes} 分钟"
|
||||
)
|
||||
fusion = color_def.final_fusion
|
||||
stage_details.append(
|
||||
f"最终融合:{', '.join(fusion.materials)} → {fusion.result_item}(成功率 {fusion.base_success_rate*100:.0f}%)"
|
||||
)
|
||||
entries.append(
|
||||
GuideEntry(
|
||||
title=color_def.display_name,
|
||||
identifier=color_def.color_key,
|
||||
description="水晶染色与融合的完整链路。",
|
||||
category="水晶链路",
|
||||
icon="💠",
|
||||
details=[{"type": "list", "items": stage_details}],
|
||||
)
|
||||
)
|
||||
for exchange in DEFAULT_CRYSTAL_EXCHANGE_ENTRIES.values():
|
||||
items = ", ".join(f"{item_id}×{qty}" for item_id, qty in exchange.required_items.items())
|
||||
entries.append(
|
||||
GuideEntry(
|
||||
title=exchange.metadata.get("display_name", exchange.identifier),
|
||||
identifier=exchange.identifier,
|
||||
description=f"兑换奖励:{exchange.reward_item}",
|
||||
category="水晶兑换",
|
||||
icon="🔁",
|
||||
details=[f"需求:{items}"],
|
||||
)
|
||||
)
|
||||
return entries
|
||||
@override
|
||||
def dependencies(self) -> List[type]:
|
||||
return [WPSAPI, WPSBackpackSystem, WPSConfigAPI, WPSFortuneSystem, WPSStoreSystem]
|
||||
@@ -858,6 +1062,31 @@ class WPSAlchemyRecipeLookup(WPSAPI):
|
||||
self._alchemy: Optional[WPSAlchemyGame] = None
|
||||
self._backpack: Optional[WPSBackpackSystem] = None
|
||||
|
||||
def get_guide_subtitle(self) -> str:
|
||||
return "查询指定物品涉及的炼金配方"
|
||||
|
||||
def collect_command_entries(self) -> Sequence[GuideEntry]:
|
||||
return (
|
||||
{
|
||||
"title": "炼金配方",
|
||||
"identifier": "炼金配方",
|
||||
"description": "展示物品作为材料、成功产物或失败产物的所有配方。",
|
||||
"metadata": {"别名": "alchemy_recipe"},
|
||||
},
|
||||
)
|
||||
|
||||
def collect_guide_entries(self) -> Sequence[GuideEntry]:
|
||||
return (
|
||||
{
|
||||
"title": "查询格式",
|
||||
"description": "`炼金配方 <物品ID>` 或 `炼金配方 <物品名称>`,忽略大小写。",
|
||||
},
|
||||
{
|
||||
"title": "输出结构",
|
||||
"description": "结果按材料/成功/失败三类分组,列出配方材料与成功率。",
|
||||
},
|
||||
)
|
||||
|
||||
def dependencies(self) -> List[type]:
|
||||
return [WPSAlchemyGame, WPSBackpackSystem]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user