新增菜园查看

This commit is contained in:
2025-11-15 17:15:06 +08:00
parent 5d08fa0820
commit f94bd3f50d
3 changed files with 102 additions and 2 deletions

View File

@@ -508,7 +508,7 @@ class WPSGardenBase(WPSAPI):
return crop
return None
def format_garden_overview(self, user_id: int) -> str:
def format_garden_overview(self, user_id: int, show_trap: bool = True) -> str:
service = self.service()
plots = service.list_plots(user_id)
config = service.config
@@ -527,7 +527,7 @@ class WPSGardenBase(WPSAPI):
remaining = plot["remaining_fruit"]
theft_users = len(json.loads(plot["theft_users"])) if plot.get("theft_users") else 0
trap_info = ""
if plot.get("trap_item_id"):
if show_trap and plot.get("trap_item_id"):
trap_durability = int(plot.get("trap_durability", 0))
from .garden_models import GARDEN_TRAPS_DICT
trap = GARDEN_TRAPS_DICT.get(plot["trap_item_id"])