Skip to content

mod-multibot-bridge: Native bridge endpoints and inventory enhancements - #15

Open
Jellypowered wants to merge 3 commits into
Wishmaster117:mainfrom
Jellypowered:NewBridgeStuff
Open

mod-multibot-bridge: Native bridge endpoints and inventory enhancements#15
Jellypowered wants to merge 3 commits into
Wishmaster117:mainfrom
Jellypowered:NewBridgeStuff

Conversation

@Jellypowered

@Jellypowered Jellypowered commented Jun 24, 2026

Copy link
Copy Markdown

Summary

Adds new native bridge endpoints for quest management, item actions, spell casting, talent applying, and targeted profession crafting. Improves inventory data with bag entries and exact item locations. Fixes quiver/ammo pouch equip support and refactors legacy bank/guild-bank helper functions.

Important notes

  • Fully additive: All changes are new endpoints and data packets; existing endpoints and legacy whisper flows remain unchanged.
  • MultiBot-Chatless compatibility: This PR does not alter any existing behavior. MultiBot-Chatless works exactly as before — no addon changes required, no breaking changes.
  • PBAltManager integration: These endpoints were added to extend PBAltManager functionality. Merging this PR is optional; MultiBot-Chatless continues to function independently without these additions.
  • Co-existence: PBAltManager and MultiBot-Chatless operate simultaneously using their respective flows; they do not interfere with each other.

New endpoints

Endpoint Description
RUN~QUEST_ABANDON Abandon a quest from bot's log
RUN~QUEST_SHARE Share quest to group (empty target = group-wide)
RUN~ITEM_EQUIP Equip item with slot hint (AUTO, BAG, MAIN_HAND, OFF_HAND, RANGED)
RUN~ITEM_TRADE Trade item to another player/bot with optional count
RUN~CAST_SPELL Cast spell with optional target (returns full SpellCastResult mapping)
RUN~TALENT_APPLY Apply talent build (including reset via 0-0-0)
RUN~CRAFT_RECIPE_TARGET Craft profession recipe targeting an item (bag, equipped, or trade slot)

New inventory data packets

Packet Description
INV_BAG Lists bot's bags with type, slots, and item ID
INV_ITEM_LOC Exact bag~slot location for each inventory item
INV_EQUIP_LOC Equipped items with slot index and count

Helper functions

  • SendRunResult() – unified run-result payload
  • ParseUint32Field(), ParseUint8Field() – safe integer parsing
  • SameName() – case-insensitive name comparison
  • FindQuestLogSlot() – quest log slot lookup
  • FindAllowedPlayerTarget() – resolve target for spells/trade
  • ResolveSpellTarget() – smart spell target resolution (selected, named, AI possible/all targets)
  • CheckBridgeSpellCast() – full validation before cast (returns actual SpellCastResult)
  • CastBridgeSpellDirect() – direct spell casting with validated targets
  • FindItemByOptionalPosition() – item lookup by optional bag/slot
  • BuildBagEntries() – build bag list for inventory view
  • GetBagTypeString() – classify bags (QUIVER, AMMO_POUCH, etc.)
  • ResolveEquipSlot() – resolve destination slot with container/bag support
  • EquipItemToSlot() – equip item to resolved slot

Fixes/improvements

  • Quiver/ammo pouch equip: ITEM_EQUIP now accepts ITEM_CLASS_CONTAINER, routes to bag slots
  • Quest share: empty target is valid; group-wide share works without single-target pre-validation
  • Spell cast errors: full SpellCastResult → bridge reason mapping (no more generic TRY_AGAIN)
  • Talent apply native path: uses same parser/factory as working legacy talents apply <link>
  • Inventory snapshot now includes bag entries and exact item locations

Breaking changes

None. All changes are additive; existing endpoints remain unchanged.

Testing notes

  • Lua syntax validation passed (luac -p) (kind of a moot since this module isn't where the LUA was but ok 😆 )
  • C++ syntax-only compile OK
  • No diff lint errors (git diff --check)

Files changed

  • src/MultiBotBridge.cpp: ~1,700 lines added, legacy helper functions preserved

AI assistance/Disclaimer

AI assistance was utilized to compose this PR message and to help identify bridge hooks/functions for extending the protocol. The implementation follows existing patterns and conventions in MultiBotBridge.cpp. This was not "vibe coded", but it goes without saying people get a little testy about AI usage. I did test these endpoints extensively while developing, this is several iterations worth of work over a couple of weeks to get it to what I felt was a PR ready state.

Thanks for taking over MultiBot and creating this wonderful module!

Jelly

Summary by CodeRabbit

  • New Features
    • Ajout de nouvelles commandes pour gérer les quêtes (abandon, partage).
    • Ajout de commandes pour l’équipement et l’échange d’objets, avec ciblage précis (bag/slot) et support du trade.
    • Ajout de commandes pour le lancement de sorts, avec prise en compte des raisons d’échec.
    • Ajout de commandes pour l’application et le reset des builds de talents (incluant un mode de validation).
    • Ajout de commandes pour le craft d’une recette vers une cible.
    • Ajout de nouvelles requêtes “bulk” pour synchroniser l’inventaire et les compétences multi-bots.
    • Enrichissement des paquets d’inventaire avec des détails de localisation (équipement et positions d’items), ainsi que de nouveaux types de messages.
  • Documentation
    • Mise à jour de la documentation des zones/endpoints supportés par le protocole de bridge.

…pells, talents, and targeted crafting

New endpoints: QUEST_ABANDON, QUEST_SHARE, ITEM_EQUIP, ITEM_TRADE, CAST_SPELL, TALENT_APPLY, CRAFT_RECIPE_TARGET. New inventory packets: INV_BAG, INV_ITEM_LOC, INV_EQUIP_LOC. Fixes: quiver/ammo pouch equip, quest share group-wide, spell cast error reporting, talent apply native path. Fully additive; preserves MultiBot-Chatless compatibility.
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13b5d7e5-027d-4a6c-b36e-f3b194a5c8c8

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff1347 and 04061f0.

📒 Files selected for processing (1)
  • src/MultiBotBridge.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/MultiBotBridge.cpp

📝 Walkthrough

Walkthrough

Ajout de nouvelles commandes RUN, de deux endpoints GET bulk, de paquets INV localisés, et du routage associé dans MultiBotBridge.cpp, avec mise à jour de la documentation README.md.

Changes

Extension du protocole bridge MultiBotBridge

Layer / File(s) Summary
Headers, déclarations en avant et documentation
src/MultiBotBridge.cpp, README.md
Ajout des includes ObjectAccessor.h et Talentspec.h, extension des déclarations en avant pour les nouvelles commandes et fonctions bulk, et mise à jour du README avec les nouveaux endpoints GET, commandes RUN et types INV.
Paquets INV localisés
src/MultiBotBridge.cpp
SendInventorySnapshot émet INV_BAG, puis INV_EQUIP_LOC pour les objets équipés et INV_ITEM_LOC pour les objets d'inventaire avec leur localisation bag/slot, avant les paquets d'agrégation existants.
Validation et cast de sorts
src/MultiBotBridge.cpp
Ajout de SendRunResult, des parseurs de champs numériques, de la normalisation de noms, des helpers de résolution de cible, du mapping des raisons d'échec de sort, et de la validation/cast via la couche bridge de sort.
Commandes RUN
src/MultiBotBridge.cpp
Implémentation des commandes QUEST_ABANDON, QUEST_SHARE, ITEM_EQUIP, ITEM_TRADE, CAST_SPELL, TALENT_APPLY et CRAFT_RECIPE_TARGET, avec résolution de slot, sélection de stacks, vérifications de tradabilité, autoequip, reset de talents et reporting via SendRunResult.
Endpoints bulk et routage
src/MultiBotBridge.cpp
Ajout de SendInventoryBulkPackets et SendBotSkillsBulkPackets, puis routage de INVENTORY_BULK, BOT_SKILLS_BULK et des commandes RUN dans HandleBridgeOpcode avec découpage du payload et dispatch vers les implémentations correspondantes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Poem

🐇 J’ai sauté sur le bridge, hop hop, sans bruit,
Des quêtes aux sorts, tout s’enchaîne la nuit.
Bulk dans les sacs, et talents en bouquet,
Le lapin sourit : quel joli paquet !
INV, RUN, GET : la piste est bien tracée,
Et mes petites oreilles sont toutes zébrées.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Le titre résume bien l’ajout d’endpoints natifs du bridge et les améliorations d’inventaire.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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: 3

🤖 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 `@src/MultiBotBridge.cpp`:
- Around line 5584-5601: The SendInventoryBulkPackets function currently only
sends inventory summary data via INV_BULK_ITEM packets but is missing the actual
inventory item location details. After building the InventorySummaryData and
sending the summary via INV_BULK_ITEM, you must also send INV_BAG and
INV_ITEM_LOC packets for each bot to expose the actual inventory locations and
items as part of the bulk inventory response. Add these additional packet sends
within the loop for each bot returned by GetBridgeVisibleBots to complete the
contract with the expected bulk inventory functionality.
- Around line 3336-3338: The selection restoration after the check/cast
operation is conditional on oldSelection being non-empty, which leaves a
persistent forced target when the bot had no prior selection. Remove the if
condition checking oldSelection in the SetSelection call within the relevant
code blocks, and instead call bot->SetSelection(oldSelection) unconditionally to
ensure the selection is always restored to its original state, whether it was
empty or not. This same fix must be applied at both occurrences mentioned in the
comment.
- Around line 3948-3964: The inventory action loop in the code starting with
FindBagItemByEntry does not respect the requested count strictly because it
moves entire item stacks and only checks if moved >= requestedCount after the
fact, potentially exceeding the requested amount. Before moving items in this
loop and in the similar deposit/withdrawal/purchase paths mentioned in the
comment, calculate how many items should actually be moved to not exceed
requestedCount (for example, if requestedCount is positive and moving the entire
stackCount would exceed it, only move the difference needed). Apply this
validation logic before calling RemoveItem and BankItem (or equivalent move
operations in the other paths) to ensure the total moved quantity never exceeds
the originally requested count.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 33414ba7-789a-49be-9889-9ac91bde6168

📥 Commits

Reviewing files that changed from the base of the PR and between fba3d24 and 13059a9.

📒 Files selected for processing (2)
  • README.md
  • src/MultiBotBridge.cpp

Comment thread src/MultiBotBridge.cpp Outdated
Comment thread src/MultiBotBridge.cpp
Comment thread src/MultiBotBridge.cpp
@Jellypowered

Copy link
Copy Markdown
Author

Woah, that's fancy!

@Wishmaster117

Copy link
Copy Markdown
Owner

Thank you for the substantial contribution. The native chatless endpoints are aligned with the project direction, but the current PR combines several independent and high-risk write paths in one large change. Before merging, we need it rebased on the current bridge main branch and split into smaller PRs. Inventory stack splitting, native quest state changes, direct spell construction, talent reset/apply semantics, trade transactionality, bulk packet limits, and request validation all require targeted review and tests. Please do not close the work; we would like to evaluate and integrate the safe parts incrementally.

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