Fixes for buffing and party invites#13
Conversation
- Buffs and attack speed have been significantly increased by fixing the buffs' callback - Fixed a bug that caused party settings to be reset when inviting players after the party was disbanded - Added logging of the server closing the gateway connection before establishing a handshake
|
Warning Review limit reached
More reviews will be available in 27 minutes and 6 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR improves buff casting reliability and event consistency across skill management, network handling, and UI state. It adds network handshake detection to prevent premature gateway disconnections, refactors skill casting with refined callback logic and timeout handling, aligns buff removal events with UI matching logic, and initializes party settings automatically based on bot configuration. ChangesBuff Casting and Event Consistency
Party Auto-Settings Initialization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Plugins/RSBot.Party/Bundle/AutoParty/AutoPartyBundle.cs (1)
73-78: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winExtract duplicated settings initialization logic.
This initialization logic is duplicated at lines 166-171 in
CheckForPlayers(). Consider extracting it into a private helper method likeInitializePartySettingsFromConfig()to adhere to the DRY principle and simplify future maintenance.♻️ Proposed refactor to eliminate duplication
+ private void InitializePartySettingsFromConfig() + { + if (!Game.Party.IsInParty) + Game.Party.Settings = new PartySettings( + Config.ExperienceAutoShare, + Config.ItemAutoShare, + Config.AllowInvitations + ); + } + public void Refresh() { Config = new AutoPartyConfig { // ... existing config initialization ... }; - if (!Game.Party.IsInParty) - Game.Party.Settings = new PartySettings( - Config.ExperienceAutoShare, - Config.ItemAutoShare, - Config.AllowInvitations - ); + InitializePartySettingsFromConfig(); }Then replace lines 166-171 with a call to
InitializePartySettingsFromConfig().🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Plugins/RSBot.Party/Bundle/AutoParty/AutoPartyBundle.cs` around lines 73 - 78, Extract the duplicated PartySettings initialization into a private helper: create InitializePartySettingsFromConfig() that sets Game.Party.Settings = new PartySettings(Config.ExperienceAutoShare, Config.ItemAutoShare, Config.AllowInvitations) and call this helper in both the current location and inside CheckForPlayers() instead of duplicating the constructor call; ensure the helper is private and used wherever those three Config fields are applied to Game.Party.Settings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Library/RSBot.Core/Components/SkillManager.cs`:
- Around line 487-499: The current code reuses the full timeout for both
castCallback.AwaitResponse and actionStateCallback.AwaitResponse, effectively
doubling the allowed wait; change to compute a single deadline (e.g., now +
timeout) before calling castCallback.AwaitResponse, then after castCallback
returns compute the remaining time (deadline - now) and pass only that remaining
timeout to actionStateCallback.AwaitResponse (and return immediately if
remaining <= 0); reference the existing symbols castCallback,
actionStateCallback, AwaitResponse, IsCompleted, and the timeout calculation
using skill.Record.Action_CastingTime/Action_ActionDuration/Action_PreparingTime
to implement this.
In `@Plugins/RSBot.Party/Bundle/AutoParty/AutoPartyBundle.cs`:
- Around line 166-171: Add a null-guard at the start of CheckForPlayers(): if
Config is null, bail out (return) or skip logic that reads Config to avoid
NullReferenceException; specifically protect usages such as Game.Party.Settings
= new PartySettings(Config.ExperienceAutoShare, Config.ItemAutoShare,
Config.AllowInvitations) and all other accesses to Config within
CheckForPlayers() (e.g., the conditions referencing Config at the spots around
the Game.Party checks and subsequent logic). Ensure Refresh() still initializes
Config later, so the guard simply prevents early execution when Config is
missing rather than changing initialization flow.
---
Outside diff comments:
In `@Plugins/RSBot.Party/Bundle/AutoParty/AutoPartyBundle.cs`:
- Around line 73-78: Extract the duplicated PartySettings initialization into a
private helper: create InitializePartySettingsFromConfig() that sets
Game.Party.Settings = new PartySettings(Config.ExperienceAutoShare,
Config.ItemAutoShare, Config.AllowInvitations) and call this helper in both the
current location and inside CheckForPlayers() instead of duplicating the
constructor call; ensure the helper is private and used wherever those three
Config fields are applied to Game.Party.Settings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4b8bdc54-5f69-465b-8398-0b7dedcc7c05
📒 Files selected for processing (5)
Botbases/RSBot.Training/Bundle/Buff/BuffBundle.csLibrary/RSBot.Core/Components/SkillManager.csLibrary/RSBot.Core/Network/Socket/Server.csPlugins/RSBot.Party/Bundle/AutoParty/AutoPartyBundle.csPlugins/RSBot.Skills/Views/Main.cs
| var timeout = | ||
| skill.Record.Action_CastingTime | ||
| + skill.Record.Action_ActionDuration | ||
| + skill.Record.Action_PreparingTime | ||
| + 1500; | ||
|
|
||
| castCallback.AwaitResponse(timeout); | ||
|
|
||
| if (skill.Record.Basic_Activity != 1 && awaitBuffResponse) | ||
| callback.AwaitResponse(); | ||
| if (!castCallback.IsCompleted) | ||
| return; | ||
|
|
||
| if (skill.Record.Basic_Activity != 1) | ||
| actionStateCallback.AwaitResponse(timeout); |
There was a problem hiding this comment.
Keep a single timeout budget for the full cast lifecycle.
timeout already models the whole cast window. Reusing that full value for actionStateCallback.AwaitResponse(...) can block almost 2× that budget when the 0xB070 response arrives late, which slows the non-basic buff path and attack loop. Carry a deadline forward and wait only on the remaining time for the second callback.
⏱️ Proposed fix
var timeout =
skill.Record.Action_CastingTime
+ skill.Record.Action_ActionDuration
+ skill.Record.Action_PreparingTime
+ 1500;
+ var deadline = Environment.TickCount64 + timeout;
castCallback.AwaitResponse(timeout);
if (!castCallback.IsCompleted)
return;
if (skill.Record.Basic_Activity != 1)
- actionStateCallback.AwaitResponse(timeout);
+ {
+ var remaining = (int)Math.Max(0L, deadline - Environment.TickCount64);
+ actionStateCallback.AwaitResponse(remaining);
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var timeout = | |
| skill.Record.Action_CastingTime | |
| + skill.Record.Action_ActionDuration | |
| + skill.Record.Action_PreparingTime | |
| + 1500; | |
| castCallback.AwaitResponse(timeout); | |
| if (skill.Record.Basic_Activity != 1 && awaitBuffResponse) | |
| callback.AwaitResponse(); | |
| if (!castCallback.IsCompleted) | |
| return; | |
| if (skill.Record.Basic_Activity != 1) | |
| actionStateCallback.AwaitResponse(timeout); | |
| var timeout = | |
| skill.Record.Action_CastingTime | |
| skill.Record.Action_ActionDuration | |
| skill.Record.Action_PreparingTime | |
| 1500; | |
| var deadline = Environment.TickCount64 + timeout; | |
| castCallback.AwaitResponse(timeout); | |
| if (!castCallback.IsCompleted) | |
| return; | |
| if (skill.Record.Basic_Activity != 1) | |
| { | |
| var remaining = (int)Math.Max(0L, deadline - Environment.TickCount64); | |
| actionStateCallback.AwaitResponse(remaining); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Library/RSBot.Core/Components/SkillManager.cs` around lines 487 - 499, The
current code reuses the full timeout for both castCallback.AwaitResponse and
actionStateCallback.AwaitResponse, effectively doubling the allowed wait; change
to compute a single deadline (e.g., now + timeout) before calling
castCallback.AwaitResponse, then after castCallback returns compute the
remaining time (deadline - now) and pass only that remaining timeout to
actionStateCallback.AwaitResponse (and return immediately if remaining <= 0);
reference the existing symbols castCallback, actionStateCallback, AwaitResponse,
IsCompleted, and the timeout calculation using
skill.Record.Action_CastingTime/Action_ActionDuration/Action_PreparingTime to
implement this.
745afe0
into
Silkroad-Developer-Community:main
Summary by CodeRabbit
New Features
Bug Fixes
Refactor