WorldPoints inside PoH changed (more than I realized)#1503
WorldPoints inside PoH changed (more than I realized)#1503chsami merged 2 commits intochsami:developmentfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe HouseStyle enum mapping to WorldPoint values was updated. Z-levels changed for BASIC_STONE (to z=1), WHITEWASHED_STONE (z=2), FREMENNIK_STYLE_WOOD (z=3), TROPICAL_WOOD (to z=0), FANCY_STONE (z=1), TWISTED_THEME (z=3), CIVITAS (z=2), and CANIFIS (z=3). A new enum constant UNKNOWN(12, WorldPoint(1986, 5707, 1)) was added. BASIC_WOOD and DEADLY_MANSION remain unchanged. The enum order reflects the insertion of UNKNOWN. No other files were modified. Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
runelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_items.tsvis excluded by!**/*.tsvrunelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_poh.tsvis excluded by!**/*.tsvrunelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_portal_poh.tsvis excluded by!**/*.tsvrunelite-client/src/main/resources/net/runelite/client/plugins/microbot/shortestpath/teleportation_spells.tsvis excluded by!**/*.tsv
📒 Files selected for processing (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java (1)
15-21: Z-level remap for styles 1–8 looks consistent.Planes now follow a clear 0..3 pattern per anchor (1858/1922). No issues spotted with these constants.
| UNKNOWN(12, new WorldPoint(1986, 5707, 1)), | ||
| CIVITAS(13, new WorldPoint(1986, 5707, 2)), | ||
| CANIFIS(14, new WorldPoint(1986, 5707, 3)), |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Handle unknown varbit values defensively (avoid null from getStyle).
Adding UNKNOWN(12, …) is good, but any unlisted varbit (e.g., 9 or future additions) still yields null → likely NPEs downstream. Prefer failing fast (or returning Optional) instead of returning null.
Apply this diff to fail fast with context:
@@
public static HouseStyle getStyle() {
int varbitValue = Microbot.getVarbitValue(VarbitID.POH_HOUSE_STYLE);
for (HouseStyle style : values()) {
if (varbitValue == style.varbitValue) {
return style;
}
}
- return null;
+ throw new IllegalStateException("Unknown POH house style varbit: " + varbitValue);
}Run these to check for risky usages and missing mappings:
🏁 Script executed:
#!/bin/bash
# Call sites that may assume non-null:
rg -nP -C2 'HouseStyle\.getStyle\(\)'
# Any ordinal-based usages (fragile if enum order changed):
rg -nP -C2 '\.ordinal\(\)'
# References to varbit 9 (if it exists in-game and needs mapping):
rg -nP -C2 '\b9\b' runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/**/*.javaLength of output: 37660
Fail-fast on unknown POH house styles
Change getStyle() to throw rather than return null to eliminate silent NPEs downstream:
@@ public static HouseStyle getStyle() {
- return null;
+ throw new IllegalStateException("Unknown POH house style varbit: " + varbitValue);
}📝 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.
| UNKNOWN(12, new WorldPoint(1986, 5707, 1)), | |
| CIVITAS(13, new WorldPoint(1986, 5707, 2)), | |
| CANIFIS(14, new WorldPoint(1986, 5707, 3)), | |
| public static HouseStyle getStyle() | |
| { | |
| int varbitValue = /* existing varbit‐reading logic */; | |
| for (HouseStyle style : values()) | |
| { | |
| if (style.getVarbitValue() == varbitValue) | |
| { | |
| return style; | |
| } | |
| } | |
| throw new IllegalStateException("Unknown POH house style varbit: " + varbitValue); | |
| } |
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/poh/data/HouseStyle.java
around lines 24-26, the enum lookup method getStyle(int) currently returns null
for unknown IDs which causes silent NPEs downstream; change it to throw an
IllegalArgumentException (or a custom unchecked exception) when no matching
HouseStyle is found, include the unknown id in the message for diagnostics,
update the method signature to return HouseStyle (non-null) and ensure any
existing callers are adjusted to handle or allow the unchecked exception.
All house styles have their own level now