Skip to content

feat(PinkPawHeist): 增加粉爪策略二后台版本#242

Open
fangfengfen wants to merge 1 commit into
1bananachicken:devfrom
fangfengfen:feat/pinkpaw-bg
Open

feat(PinkPawHeist): 增加粉爪策略二后台版本#242
fangfengfen wants to merge 1 commit into
1bananachicken:devfrom
fangfengfen:feat/pinkpaw-bg

Conversation

@fangfengfen
Copy link
Copy Markdown

@fangfengfen fangfengfen commented May 29, 2026

概述

增加粉爪大劫案策略二的后台版本,使用 Win32-Background 控制器,支持窗口最小化运行。

改动内容

  • 新增 PinkPawHeistBG 后台版任务定义和 pipeline
  • 新增 pinkpaw_bg_click custom action(后台点击)
  • interface.json 添加后台版任务 import
  • 后台控制器 screencap 改为 Background(FramePool+PrintWindow),支持伪最小化

使用说明

  • 选择"桌面端-后台"控制器时自动显示后台版任务
  • 建议启动后将游戏窗口最小化,框架会以伪最小化方式继续截图

Summary by Sourcery

使用 Win32-Background 控制器以及相应的任务/流水线定义,添加支持后台运行的 PinkPawHeist 策略版本。

新功能:

  • 引入 PinkPawHeistBG 后台任务和流水线定义,用于在后台控制器下运行 heist 策略。
  • 添加 pinkpaw_bg_click 自定义动作,基于 OCR 识别框或备用坐标,通过 controller.post_click 执行后台点击。

改进:

  • 将新的 PinkPawHeistBG 后台任务接入全局接口配置,使其在使用桌面后台控制器时可用。
Original summary in English

Summary by Sourcery

Add a background-capable version of the PinkPawHeist strategy using the Win32-Background controller and corresponding task/pipeline definitions.

New Features:

  • Introduce the PinkPawHeistBG background task and pipeline definitions for running the heist strategy with a background controller.
  • Add the pinkpaw_bg_click custom action to perform background clicks using controller.post_click based on OCR boxes or fallback coordinates.

Enhancements:

  • Wire the new PinkPawHeistBG background task into the global interface configuration so it becomes available when using desktop background controllers.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 29, 2026

Reviewer's Guide

添加了一个支持后台运行的 PinkPawHeist 策略变体,使用 Win32-Background 控制器运行。该变体包括新的 pipeline / 任务定义,以及一个自定义的后台点击动作,该动作同时支持基于 OCR 区域和可配置坐标的点击,并通过 interface.json 接线,这样在使用桌面后台控制器时,该任务会出现在界面中。

PinkPawBGClick 后台点击自定义动作的时序图

sequenceDiagram
    actor Framework
    participant PinkPawBGClick
    participant Context
    participant Controller
    participant Job

    Framework ->> PinkPawBGClick: run(context, argv)
    activate PinkPawBGClick

    PinkPawBGClick ->> PinkPawBGClick: [derive x,y from argv.box or custom_action_param]

    PinkPawBGClick ->> Context: bg_click_at(context, x, y)
    activate Context
    Context ->> Controller: post_click(x, y)
    activate Controller
    Controller -->> Context: Job
    deactivate Controller

    Context ->> Job: wait()
    activate Job
    Job -->> Context: succeeded
    deactivate Job

    Context -->> PinkPawBGClick: bool
    deactivate Context

    PinkPawBGClick -->> Framework: RunResult(success)
    deactivate PinkPawBGClick
Loading

File-Level Changes

Change Details Files
引入一个后台点击自定义动作,使用 controller.post_click API,并同时支持基于 OCR 区域的点击,以及灵活的参数解析以实现坐标回退。
  • 定义 bg_click_at helper,通过 controller 发送点击并等待完成,返回成功状态。
  • 实现 PinkPawBGClick 自定义动作,在 AgentServer 上注册为 "pinkpaw_bg_click",在有 OCR/识别区域时优先点击其中心点。
  • 为 custom_action_param 添加健壮的解析逻辑,可处理 dict 或 JSON 字符串输入,包括嵌套的 custom_action_param 负载和多种 schema 变体,在解析失败时使用合理的默认坐标。
agent/custom/action/pinkpaw/pinkpaw_bg_click.py
添加后台版本的 PinkPawHeist 任务和 pipeline,使其与 Win32-Background 控制器连接,并确保在选择 desktop-background 控制器时在界面中展示。
  • 创建 PinkPawHeistBG pipeline 定义,配置为 Background(FramePool+PrintWindow)截屏,以支持伪最小化窗口操作。
  • 创建 PinkPawHeistBG 任务定义,使用新的后台 pipeline,并引用 pinkpaw_bg_click 自定义动作以进行后台交互。
  • 更新 interface.json,在桌面后台控制器变体下导入并暴露 PinkPawHeistBG 任务,使其只在合适场景下显示。
assets/resource/base/pipeline/PinkPawHeistBG.json
assets/resource/tasks/PinkPawHeistBG.json
assets/interface.json

Tips and commands

Interacting with Sourcery

  • 触发新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 在审查评论下回复,让 Sourcery 从该评论创建一个 issue。你也可以在审查评论下回复 @sourcery-ai issue 来创建 issue。
  • 生成 pull request 标题: 在 pull request 标题任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在你想要的位置随时生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审查员指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审查员指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可一次性解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 撤销所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 审查。特别适用于你想从头开始新一轮审查的情况——别忘了再评论 @sourcery-ai review 来触发新的审查!

Customizing Your Experience

前往你的 dashboard 来:

  • 启用或禁用审查功能,例如 Sourcery 自动生成的 pull request 摘要、审查员指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

Getting Help

Original review guide in English

Reviewer's Guide

Adds a background-capable variant of the PinkPawHeist strategy that runs with the Win32-Background controller, including a new pipeline/task definition and a custom background click action that works with both OCR boxes and configurable coordinates, plus wiring into interface.json so the task appears when using the desktop background controller.

Sequence diagram for PinkPawBGClick background click custom action

sequenceDiagram
    actor Framework
    participant PinkPawBGClick
    participant Context
    participant Controller
    participant Job

    Framework ->> PinkPawBGClick: run(context, argv)
    activate PinkPawBGClick

    PinkPawBGClick ->> PinkPawBGClick: [derive x,y from argv.box or custom_action_param]

    PinkPawBGClick ->> Context: bg_click_at(context, x, y)
    activate Context
    Context ->> Controller: post_click(x, y)
    activate Controller
    Controller -->> Context: Job
    deactivate Controller

    Context ->> Job: wait()
    activate Job
    Job -->> Context: succeeded
    deactivate Job

    Context -->> PinkPawBGClick: bool
    deactivate Context

    PinkPawBGClick -->> Framework: RunResult(success)
    deactivate PinkPawBGClick
Loading

File-Level Changes

Change Details Files
Introduce a background click custom action that uses the controller.post_click API and supports both OCR box-based clicks and flexible param parsing for fallback coordinates.
  • Define bg_click_at helper that posts a click via the controller and waits for completion, returning success status.
  • Implement PinkPawBGClick custom action registered as "pinkpaw_bg_click" on AgentServer, preferring the center of an OCR/recognition box when available.
  • Add robust parsing logic for custom_action_param to handle dict or JSON string inputs, including nested custom_action_param payloads and multiple schema variants, with sane default coordinates when parsing fails.
agent/custom/action/pinkpaw/pinkpaw_bg_click.py
Add a background-version PinkPawHeist task and pipeline wired for Win32-Background controller and ensure it is exposed in the interface when the desktop-background controller is selected.
  • Create PinkPawHeistBG pipeline definition configured for Background (FramePool+PrintWindow) screencap to support pseudo-minimized window operation.
  • Create PinkPawHeistBG task definition that uses the new background pipeline and references the pinkpaw_bg_click custom action for background interactions.
  • Update interface.json to import and expose the PinkPawHeistBG task under the desktop background controller variant so it shows up only when appropriate.
assets/resource/base/pipeline/PinkPawHeistBG.json
assets/resource/tasks/PinkPawHeistBG.json
assets/interface.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我提供了一些整体性的反馈:

  • 在根据 argv.box 推导坐标时,你只校验了 box.w,并假设 box.h 一定存在;建议在使用前检查 hasattr(box, 'h')box.h > 0,以避免潜在的属性错误或无效的点击位置。
  • custom_action_param 的解析逻辑目前比较复杂;可以考虑抽取成一个小的辅助函数(清晰处理 dict 与 JSON 字符串,以及嵌套的 custom_action_param),这样能提升可读性,并减少未来扩展时出错的可能性。
面向 AI Agent 的提示词
Please address the comments from this code review:

## Overall Comments
- When deriving coordinates from `argv.box`, you only validate `box.w` and assume `box.h` exists; consider checking `hasattr(box, 'h')` and `box.h > 0` before using it to avoid potential attribute errors or invalid click positions.
- The `custom_action_param` parsing logic is fairly complex; extracting it into a small helper (with clear handling for dict vs JSON string and nested `custom_action_param`) would improve readability and make future extensions less error-prone.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • When deriving coordinates from argv.box, you only validate box.w and assume box.h exists; consider checking hasattr(box, 'h') and box.h > 0 before using it to avoid potential attribute errors or invalid click positions.
  • The custom_action_param parsing logic is fairly complex; extracting it into a small helper (with clear handling for dict vs JSON string and nested custom_action_param) would improve readability and make future extensions less error-prone.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When deriving coordinates from `argv.box`, you only validate `box.w` and assume `box.h` exists; consider checking `hasattr(box, 'h')` and `box.h > 0` before using it to avoid potential attribute errors or invalid click positions.
- The `custom_action_param` parsing logic is fairly complex; extracting it into a small helper (with clear handling for dict vs JSON string and nested `custom_action_param`) would improve readability and make future extensions less error-prone.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread assets/interface.json Outdated
"class_regex": "UnrealWindow",
"window_regex": "^\\s*(异环|NTE)\\s*$",
"screencap": "PrintWindow",
"screencap": "Background",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用的win32-background控制器为什么改win32控制器的截图方式

Comment thread assets/interface.json
@@ -109,6 +109,7 @@
// group:HethereauHobbies
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么删注释呢()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants