fix(questhelper): require LoS before direct interaction; default to first available action#1755
Conversation
…irst available action
Three related improvements to the quest helper auto-runner so it stops
clicking through closed doors, picking the wrong menu option, and
crashing other plugins via null MenuOptionClicked events.
Reachability:
- applyNpcStep direct-click now also requires npc.hasLineOfSight().
Rs2Walker.canReach() pathfinds through closed doors (the walker
opens them en route), so canReach==true alone doesn't guarantee a
direct interaction will succeed.
- applyObjectStep walk gate now also fires when LoS to the target is
blocked, so the walker can route the player past the blocking
geometry instead of us bouncing on "I can't reach that!".
Menu option selection:
- chooseCorrect{Object,NPC,Item}Option fall back to the entity's
first non-empty action when no step-text keyword matches, instead
of returning "" / "use" / "Talk-to" blindly.
Null safety on MenuOptionClicked subscribers:
- Rs2Gembag, PouchScript, QuestBankTabInterface and IncantationStep
now early-return on null event.getMenuOption(); these previously
threw NPEs whenever a programmatic menu invoke fired with a null
option, spamming the chat box with stack traces.
- Removed a stray System.out.println in PouchScript.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis pull request addresses null-safety across multiple microbot plugin files and refines interaction logic in the questhelper module. Changes include defensive null checks for 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Summary
applyNpcStep/applyObjectSteprequire line-of-sight before direct interaction;Rs2Walker.canReach()alone is insufficient because it pathfinds through closed doors. The walker now handles the door-opening before we click instead of us bouncing on "I can't reach that!".chooseCorrect{Object,NPC,Item}Optionfall back to the entity's first non-empty action when step text doesn't match a known verb, instead of returning empty / "use" / "Talk-to" blindly.event.getMenuOption()in fourMenuOptionClickedsubscribers (Rs2Gembag,PouchScript,QuestBankTabInterface,IncantationStep); they were spamming NPEs whenever a programmatic invoke fired with a null option. Also removed a straySystem.out.printlninPouchScript.Test plan
Cannot invoke "String.equals"/"contains"/"startsWith" because ... getMenuOption() is nullduring quest runs.MenuOptionClickedwith a non-null option still triggers the original code paths (gem bag empty/fill, pouch fill/empty, quest bank tab close, Shadow of the Storm incantation).