Skip to content

Updated pets spawn for rusro#11

Merged
kis1yi merged 1 commit into
Silkroad-Developer-Community:mainfrom
kis1yi:rusro-pets
May 28, 2026
Merged

Updated pets spawn for rusro#11
kis1yi merged 1 commit into
Silkroad-Developer-Community:mainfrom
kis1yi:rusro-pets

Conversation

@kis1yi

@kis1yi kis1yi commented May 28, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Improved inventory update packet parsing consistency between Global and RuSro game clients to ensure proper item synchronization across all game versions.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR aligns packet parsing behavior in InventoryUpdateItemResponse by extending the initial byte validation and consumption logic to apply to both Global and RuSro game client types, previously limited to Global only.

Changes

Inventory packet parsing alignment

Layer / File(s) Summary
Packet parsing condition update for multi-client support
Library/RSBot.Core/Network/Handler/Agent/Inventory/InventoryUpdateItemResponse.cs
The client-type condition guarding early-return byte read and subsequent extra byte consumption is extended to apply to both GameClientType.Global and GameClientType.RuSro, aligning packet parsing behavior across client types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A packet travels far and wide,
Global and RuSro side by side,
Same bytes they read, the same they chew,
Aligned at last, now parsing true! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'pets spawn for rusro' but the actual change is about inventory update item response packet parsing behavior, not pet spawning. Update the title to reflect the actual change: something like 'Apply inventory packet parsing changes to RuSro client type' would more accurately describe the modification.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Library/RSBot.Core/Network/Handler/Agent/Inventory/InventoryUpdateItemResponse.cs (1)

32-33: ⚡ Quick win

Consider extracting the repeated client type check.

The same condition Game.ClientType == GameClientType.Global || Game.ClientType == GameClientType.RuSro appears twice. Extracting it to a local variable or helper method improves maintainability if additional client types need the same behavior in the future.

♻️ Refactor option: extract to local variable
 public void Invoke(Packet packet)
 {
-    if (Game.ClientType == GameClientType.Global
-        || Game.ClientType == GameClientType.RuSro)
+    var usesExtendedFormat = Game.ClientType == GameClientType.Global 
+                          || Game.ClientType == GameClientType.RuSro;
+    
+    if (usesExtendedFormat)
         if (packet.ReadByte() != 0) //sometimes appears 9 with unknown structure
             return; 
 
     var sourceSlot = packet.ReadByte();
 
-    if (Game.ClientType == GameClientType.Global
-        || Game.ClientType == GameClientType.RuSro)
+    if (usesExtendedFormat)
         packet.ReadByte(); //0 - normal, 2 - item disappearing

Also applies to: 39-40

🤖 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/Network/Handler/Agent/Inventory/InventoryUpdateItemResponse.cs`
around lines 32 - 33, Extract the repeated client-type condition into a single
reusable predicate to avoid duplication: create a local bool (e.g., bool
isGlobalOrRuSro = Game.ClientType == GameClientType.Global || Game.ClientType ==
GameClientType.RuSro) at the start of the method in InventoryUpdateItemResponse
and replace both occurrences of the expression with that variable (or
alternatively add a small helper property/method on Game like IsGlobalOrRuSro
and use that) so the same logic is centralized and easy to extend.
🤖 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.

Nitpick comments:
In
`@Library/RSBot.Core/Network/Handler/Agent/Inventory/InventoryUpdateItemResponse.cs`:
- Around line 32-33: Extract the repeated client-type condition into a single
reusable predicate to avoid duplication: create a local bool (e.g., bool
isGlobalOrRuSro = Game.ClientType == GameClientType.Global || Game.ClientType ==
GameClientType.RuSro) at the start of the method in InventoryUpdateItemResponse
and replace both occurrences of the expression with that variable (or
alternatively add a small helper property/method on Game like IsGlobalOrRuSro
and use that) so the same logic is centralized and easy to extend.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0339edf7-3597-4d9a-b56e-f4aada7b9b56

📥 Commits

Reviewing files that changed from the base of the PR and between 39e5f3c and 06c8341.

📒 Files selected for processing (1)
  • Library/RSBot.Core/Network/Handler/Agent/Inventory/InventoryUpdateItemResponse.cs

@kis1yi kis1yi merged commit 5eb7768 into Silkroad-Developer-Community:main May 28, 2026
1 of 2 checks passed
@kis1yi kis1yi deleted the rusro-pets branch May 28, 2026 21:38
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.

1 participant