Skip to content

feat(CaiBotLite): support boss locks of ProgressControl#1026

Merged
ACaiCat merged 2 commits intomasterfrom
feat-caibotlite-pc
Sep 12, 2025
Merged

feat(CaiBotLite): support boss locks of ProgressControl#1026
ACaiCat merged 2 commits intomasterfrom
feat-caibotlite-pc

Conversation

@ACaiCat
Copy link
Copy Markdown
Member

@ACaiCat ACaiCat commented Sep 12, 2025

更新插件/修复BUG

  • 插件已修改版本号
  • 更新插件README.md中的更新日志
  • 插件可以正常工作

其他

  • ❤️熙恩我喜欢你

Summary by Sourcery

添加与 ProgressControls 插件的集成,以在 CaiBotLite 中显示首领锁定信息,将其与现有的首领锁定数据合并,提升版本,更新文档,并引入额外的调试日志记录。

新功能:

  • 添加 ProgressControlSupport 模块,用于从 ProgressControls 插件检测并检索首领锁定数据
  • 在 CaiBotLite API 进度响应中包含合并后的 ProgressControl 和现有 BossLock 数据

改进:

  • 通过选择更大的集合来合并首领锁定字典
  • 在插件启动时初始化 ProgressControlSupport
  • 将插件版本提升至 2025.09.12.0
  • 在 AutoResetPlugin 中添加 WorldID 调试日志记录

文档:

  • 更新 README 变更日志,添加 v2025.09.12.0 条目,支持 ProgressControl 首领锁定
Original summary in English

Summary by Sourcery

Add integration with the ProgressControls plugin to display boss lock information in CaiBotLite, merge it with existing boss lock data, bump the version, update documentation, and introduce additional debug logging.

New Features:

  • Add ProgressControlSupport module to detect and retrieve boss lock data from the ProgressControls plugin
  • Include merged ProgressControl and existing BossLock data in the CaiBotLite API progress response

Enhancements:

  • Merge boss lock dictionaries by choosing the larger set
  • Initialize ProgressControlSupport in plugin startup
  • Bump plugin version to 2025.09.12.0
  • Add WorldID debug logging in AutoResetPlugin

Documentation:

  • Update README changelog with v2025.09.12.0 entry for ProgressControl boss lock support

@ACaiCat ACaiCat requested a review from a team September 12, 2025 05:06
Copy link
Copy Markdown
Contributor

@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.

你好 - 我已经审阅了你的更改,它们看起来很棒!

AI 代理提示
请处理此代码审查中的注释:
## 单独的注释

### 注释 1
<location> `src/CaiBotLite/Services/CaiBotApi.cs:67` </location>
<code_context>
+                    if (ProgressControlSupport.Support)
+                    {
+                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
+                        bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
+                    }
+                    
</code_context>

<issue_to_address>
选择 bossLock 的逻辑可能会无意中丢弃来自两个源的 boss。

合并两个字典将保留所有 boss 锁定条目,除非有意省略某些条目。
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
                    if (BossLockSupport.Support)
                    {
                        bossLock = BossLockSupport.GetLockBosses();
                    }

                    if (ProgressControlSupport.Support)
                    {
                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
                        bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
                    }

=======
                    if (BossLockSupport.Support)
                    {
                        bossLock = BossLockSupport.GetLockBosses();
                    }

                    if (ProgressControlSupport.Support)
                    {
                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
                        foreach (var kvp in progressControlBosses)
                        {
                            // If the key already exists, you may choose to overwrite or skip.
                            // Here, we overwrite with the ProgressControl value.
                            bossLock[kvp.Key] = kvp.Value;
                        }
                    }

>>>>>>> REPLACE

</suggested_fix>

### 注释 2
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:22` </location>
<code_context>
+
+    public static Dictionary<string, string> GetLockBosses()
+    {
+        if (!Support)
+        {
+            throw new NotSupportedException("没有安装ProgressControls插件!");
+        }
+
</code_context>

<issue_to_address>
抛出 NotSupportedException 可能不适用于所有调用点。

考虑返回一个空字典或受控错误信号,除非您确定所有调用者都处理此异常。
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    public static Dictionary<string, string> GetLockBosses()
    {
+        if (!Support)
+        {
+            throw new NotSupportedException("没有安装ProgressControls插件!");
+        }
=======
    public static Dictionary<string, string> GetLockBosses()
    {
        if (!Support)
        {
            return new Dictionary<string, string>();
        }
>>>>>>> REPLACE

</suggested_fix>

### 注释 3
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:62` </location>
<code_context>
+        
+        foreach (var lockedBoss in lockedBosses)
+        {
+            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
+            {
+                continue;
+            }
+            
</code_context>

<issue_to_address>
静默跳过未知 boss 键可能会掩盖配置问题。

当 boss 键缺失时记录警告,以帮助识别配置问题。
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        foreach (var lockedBoss in lockedBosses)
        {
            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
            {
                continue;
            }

=======
        foreach (var lockedBoss in lockedBosses)
        {
            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
            {
                Console.WriteLine($"[Warning] Unknown boss key '{lockedBoss.Key}' found in lockedBosses. Please check your configuration.");
                continue;
            }

>>>>>>> REPLACE

</suggested_fix>

Sourcery 对开源免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将利用这些反馈来改进你的评论。
Original comment in English

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/CaiBotLite/Services/CaiBotApi.cs:67` </location>
<code_context>
+                    if (ProgressControlSupport.Support)
+                    {
+                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
+                        bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
+                    }
+                    
</code_context>

<issue_to_address>
The logic for selecting bossLock may unintentionally discard bosses from both sources.

Merging both dictionaries would preserve all boss lock entries, unless omitting some is intentional.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
                    if (BossLockSupport.Support)
                    {
                        bossLock = BossLockSupport.GetLockBosses();
                    }

                    if (ProgressControlSupport.Support)
                    {
                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
                        bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
                    }

=======
                    if (BossLockSupport.Support)
                    {
                        bossLock = BossLockSupport.GetLockBosses();
                    }

                    if (ProgressControlSupport.Support)
                    {
                        var progressControlBosses = ProgressControlSupport.GetLockBosses();
                        foreach (var kvp in progressControlBosses)
                        {
                            // If the key already exists, you may choose to overwrite or skip.
                            // Here, we overwrite with the ProgressControl value.
                            bossLock[kvp.Key] = kvp.Value;
                        }
                    }

>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:22` </location>
<code_context>
+
+    public static Dictionary<string, string> GetLockBosses()
+    {
+        if (!Support)
+        {
+            throw new NotSupportedException("没有安装ProgressControls插件!");
+        }
+
</code_context>

<issue_to_address>
Throwing NotSupportedException may not be ideal for all call sites.

Consider returning an empty dictionary or a controlled error signal instead, unless you are certain all callers handle this exception.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
    public static Dictionary<string, string> GetLockBosses()
    {
+        if (!Support)
+        {
+            throw new NotSupportedException("没有安装ProgressControls插件!");
+        }
=======
    public static Dictionary<string, string> GetLockBosses()
    {
        if (!Support)
        {
            return new Dictionary<string, string>();
        }
>>>>>>> REPLACE

</suggested_fix>

### Comment 3
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:62` </location>
<code_context>
+        
+        foreach (var lockedBoss in lockedBosses)
+        {
+            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
+            {
+                continue;
+            }
+            
</code_context>

<issue_to_address>
Silently skipping unknown boss keys may obscure configuration issues.

Log a warning when a boss key is missing to help identify configuration problems.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        foreach (var lockedBoss in lockedBosses)
        {
            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
            {
                continue;
            }

=======
        foreach (var lockedBoss in lockedBosses)
        {
            if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
            {
                Console.WriteLine($"[Warning] Unknown boss key '{lockedBoss.Key}' found in lockedBosses. Please check your configuration.");
                continue;
            }

>>>>>>> REPLACE

</suggested_fix>

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.

@ACaiCat ACaiCat added this pull request to the merge queue Sep 12, 2025
Merged via the queue into master with commit fe8209b Sep 12, 2025
3 checks passed
@ACaiCat ACaiCat deleted the feat-caibotlite-pc branch September 21, 2025 02:02
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