Introduce Rs2Player.isIdle() and waitForXpDrop() overloads#1779
Conversation
- Add waitForXpDrop() overloads that monitor overall XP drop (any skill) to complement existing skill-specific variants - Add isIdle() method that checks if the player is idle by verifying: no recent animation, no combat, no movement, no bank/deposit box/ grand exchange/dialogue interactions, and no XP drop within 3000ms - Add required imports for Rs2Bank, Rs2DepositBox, Rs2Dialogue, Rs2GrandExchange
…er.isIdle() Replace the two-phase evaluation + waitForXpDrop pattern with a single sleepUntilTrue loop that polls every 100ms for both XP drops and blocking conditions (animation, combat, movement, UI). This eliminates the race condition where a blocking action could start during the wait and go undetected until after the timeout (example: some skilling activities like cooking and smithing have a short idle animation period which could falsely indicate a idle condition, while the action fails to trigger a xp drop in 3 seconds, common when burning food or failing to smelt iron).
…, instead of 5 ticks
…previous, instead of 5 ticks" This reverts commit 99e32e1.
|
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 (1)
WalkthroughThis PR extends the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
ClientThreadGuardrailTest claims net.runelite.api.Client#getOverallExperience() requires to be called in the client thread, however I didn't detect any exceptions during runtime. I'll review this further. |
This PR introduces:
The player is considered idle if all of the following are true: