Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
@RequiredArgsConstructor
public enum HouseStyle {
BASIC_WOOD(1, new WorldPoint(1858, 5707, 0)),
BASIC_STONE(2, new WorldPoint(1858, 5707, 0)),
WHITEWASHED_STONE(3, new WorldPoint(1858, 5707, 0)),
FREMENNIK_STYLE_WOOD(4, new WorldPoint(1858, 5707, 0)),
TROPICAL_WOOD(5, new WorldPoint(1922, 5707, 2)),
FANCY_STONE(6, new WorldPoint(1922, 5707, 2)),
BASIC_STONE(2, new WorldPoint(1858, 5707, 1)),
WHITEWASHED_STONE(3, new WorldPoint(1858, 5707, 2)),
FREMENNIK_STYLE_WOOD(4, new WorldPoint(1858, 5707, 3)),
TROPICAL_WOOD(5, new WorldPoint(1922, 5707, 0)),
FANCY_STONE(6, new WorldPoint(1922, 5707, 1)),
DEADLY_MANSION(7, new WorldPoint(1922, 5707, 2)),
TWISTED_THEME(8, new WorldPoint(1922, 5707, 2)),
TWISTED_THEME(8, new WorldPoint(1922, 5707, 3)),
COSY_CABIN(10, new WorldPoint(1986, 5707, 0)),
HOSIDIUS(11, new WorldPoint(1986, 5707, 0)),
CIVITAS(13, new WorldPoint(1986, 5707, 0)),
CANIFIS(14, new WorldPoint(1986, 5707, 0)),
UNKNOWN(12, new WorldPoint(1986, 5707, 1)),
CIVITAS(13, new WorldPoint(1986, 5707, 2)),
CANIFIS(14, new WorldPoint(1986, 5707, 3)),
Comment on lines +24 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 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/**/*.java

Length 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.

Suggested change
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.

;

private final int varbitValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
# Origin Destination Skills Item IDs Quests Varbits Duration Display info
2412 4434 0 5
2996 3114 0 5
2700 3247 0 5
2328 4426 0 5
2735 5221 0 Death to the Dorgeshuun 5
2780 3613 0 5
2500 3896 0 5
3284 2706 0 5
2319 3619 0 5
1826 3540 0 5
2571 2956 0 5
2503 3636 0 5
3597 3495 0 5
3059 4875 0 5
2644 3495 0 5
3410 3324 0 5
3251 3095 0 5
2635 3266 0 5
2267 2976 0 5
2650 4730 0 Holy Grail 5
2150 3070 0 Regicide 5
2385 3035 0 5
3041 4532 0 5
3469 3431 0 5
2437 5126 0 5
3572 4372 0 Hopespear's Will 5
2740 3351 0 5
1295 3493 0 5
2513 3884 0 The Fremennik Trials 5
2528 3127 0 5
1302 3762 0 5
1639 3868 0 5
2705 3576 0 5
2075 4848 0 5
2801 3003 0 5
3447 3470 0 5
3082 3206 0 5
2740 2738 0 Monkey Madness I 5
2682 3081 0 5
3037 4763 0 5
# POH ring
1858 5707 0 2188=1 5
1858 5707 0 2188=2 5
1858 5707 0 2188=3 5
1858 5707 0 2188=4 5
1922 5707 2 2188=5 5
1922 5707 2 2188=6 5
1922 5707 2 2188=7 5
1922 5707 2 2188=8 5
1986 5707 0 2188=10 5
1986 5707 0 2188=11 5
1986 5707 0 2188=13 5
1986 5707 0 2188=14 5
# 2027 5700 0 5
3038 5348 0 5
3108 3149 0 5
2658 3230 0 5
1455 3658 0 5
2900 3111 0 5
3129 3496 0 5
2744 3719 0 5
3423 3016 0 5
2213 3099 0 5
3447 9824 0 In Search of the Myreque 5
1651 3010 0 9650=1 5
1359 2941 0 9650=1 5
1429 3324 0 9650=1 5
2412 4434 0 5
2996 3114 0 5
2700 3247 0 5
2328 4426 0 5
2735 5221 0 Death to the Dorgeshuun 5
2780 3613 0 5
2500 3896 0 5
3284 2706 0 5
2319 3619 0 5
1826 3540 0 5
2571 2956 0 5
2503 3636 0 5
3597 3495 0 5
3059 4875 0 5
2644 3495 0 5
3410 3324 0 5
3251 3095 0 5
2635 3266 0 5
2267 2976 0 5
2650 4730 0 Holy Grail 5
2150 3070 0 Regicide 5
2385 3035 0 5
3041 4532 0 5
3469 3431 0 5
2437 5126 0 5
3572 4372 0 Hopespear's Will 5
2740 3351 0 5
1295 3493 0 5
2513 3884 0 The Fremennik Trials 5
2528 3127 0 5
1302 3762 0 5
1639 3868 0 5
2705 3576 0 5
2075 4848 0 5
2801 3003 0 5
3447 3470 0 5
3082 3206 0 5
2740 2738 0 Monkey Madness I 5
2682 3081 0 5
3037 4763 0 5
# POH ring
1858 5707 0 2188=1 5
1858 5707 1 2188=2 5
1858 5707 2 2188=3 5
1858 5707 3 2188=4 5
1922 5707 0 2188=5 5
1922 5707 1 2188=6 5
1922 5707 2 2188=7 5
1922 5707 3 2188=8 5
1986 5707 0 2188=10 5
1986 5707 0 2188=11 5
1986 5707 1 2188=12 5
1986 5707 2 2188=13 5
1986 5707 3 2188=14 5
# 2027 5700 0 5
3038 5348 0 5
3108 3149 0 5
2658 3230 0 5
1455 3658 0 5
2900 3111 0 5
3129 3496 0 5
2744 3719 0 5
3423 3016 0 5
2213 3099 0 5
3447 9824 0 In Search of the Myreque 5
1651 3010 0 9650=1 5
1359 2941 0 9650=1 5
1429 3324 0 9650=1 5
2996 3114 0 5 AIQ
2700 3247 0 5 AIR
2328 4426 0 5 AIR DLR DJQ AJS
Expand Down Expand Up @@ -106,19 +107,20 @@
2740 2738 0 Monkey Madness I 5 CLR
2682 3081 0 5 CLS
3037 4763 0 5 DIP
# POH Ring
# POH Ring
1858 5707 0 2188=1 5 DIQ
1858 5707 0 2188=2 5 DIQ
1858 5707 0 2188=3 5 DIQ
1858 5707 0 2188=4 5 DIQ
1922 5707 2 2188=5 5 DIQ
1922 5707 2 2188=6 5 DIQ
1858 5707 1 2188=2 5 DIQ
1858 5707 2 2188=3 5 DIQ
1858 5707 3 2188=4 5 DIQ
1922 5707 0 2188=5 5 DIQ
1922 5707 1 2188=6 5 DIQ
1922 5707 2 2188=7 5 DIQ
1922 5707 2 2188=8 5 DIQ
1922 5707 3 2188=8 5 DIQ
1986 5707 0 2188=10 5 DIQ
1986 5707 0 2188=11 5 DIQ
1986 5707 0 2188=13 5 DIQ
1986 5707 0 2188=14 5 DIQ
1986 5707 1 2188=12 5 DIQ
1986 5707 2 2188=13 5 DIQ
1986 5707 3 2188=14 5 DIQ
3038 5348 0 5 DIR
3108 3149 0 5 DIS
2658 3230 0 5 DJP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,18 @@
1740 3517 0 8013 2187=8 Y T 19 4 Teleport to House tablet: Outside
# Teleport inside POH with tablet
1858 5707 0 8013 2188=1 Y T 19 4 Teleport to House tablet: Inside
1858 5707 0 8013 2188=2 Y T 19 4 Teleport to House tablet: Inside
1858 5707 0 8013 2188=3 Y T 19 4 Teleport to House tablet: Inside
1858 5707 0 8013 2188=4 Y T 19 4 Teleport to House tablet: Inside
1922 5707 1 8013 2188=5 Y T 19 4 Teleport to House tablet: Inside
1858 5707 1 8013 2188=2 Y T 19 4 Teleport to House tablet: Inside
1858 5707 2 8013 2188=3 Y T 19 4 Teleport to House tablet: Inside
1858 5707 3 8013 2188=4 Y T 19 4 Teleport to House tablet: Inside
1922 5707 0 8013 2188=5 Y T 19 4 Teleport to House tablet: Inside
1922 5707 1 8013 2188=6 Y T 19 4 Teleport to House tablet: Inside
1922 5707 1 8013 2188=7 Y T 19 4 Teleport to House tablet: Inside
1922 5707 1 8013 2188=8 Y T 19 4 Teleport to House tablet: Inside
1922 5707 2 8013 2188=7 Y T 19 4 Teleport to House tablet: Inside
1922 5707 3 8013 2188=8 Y T 19 4 Teleport to House tablet: Inside
1986 5707 0 8013 2188=10 Y T 19 4 Teleport to House tablet: Inside
1986 5707 0 8013 2188=11 Y T 19 4 Teleport to House tablet: Inside
1986 5707 0 8013 2188=13 Y T 19 4 Teleport to House tablet: Inside
1986 5707 0 8013 2188=14 Y T 19 4 Teleport to House tablet: Inside
1986 5707 1 8013 2188=12 Y T 19 4 Teleport to House tablet: Inside
1986 5707 2 8013 2188=13 Y T 19 4 Teleport to House tablet: Inside
1986 5707 3 8013 2188=14 Y T 19 4 Teleport to House tablet: Inside
# Teleport tablets
3213 3424 0 8007 4585=0 Y T 19 4 Varrock tablet
3164 3478 0 8007 4480=1;4585=1 Y T 19 4 Varrock tablet: Grand exchange
Expand Down Expand Up @@ -218,17 +219,18 @@
2931 3286 0 9780;9781 Y F 19 4 Crafting cape: Teleport
# The Construction cape's home teleports, determined by varbit 2188 (HouseStyle)
1858 5707 0 9789;9790 2188=1 Y F 19 4 Construction cape: Tele to POH
1858 5707 0 9789;9790 2188=2 Y F 19 4 Construction cape: Tele to POH
1858 5707 0 9789;9790 2188=3 Y F 19 4 Construction cape: Tele to POH
1858 5707 0 9789;9790 2188=4 Y F 19 4 Construction cape: Tele to POH
1922 5707 1 9789;9790 2188=5 Y F 19 4 Construction cape: Tele to POH
1858 5707 1 9789;9790 2188=2 Y F 19 4 Construction cape: Tele to POH
1858 5707 2 9789;9790 2188=3 Y F 19 4 Construction cape: Tele to POH
1858 5707 3 9789;9790 2188=4 Y F 19 4 Construction cape: Tele to POH
1922 5707 0 9789;9790 2188=5 Y F 19 4 Construction cape: Tele to POH
1922 5707 1 9789;9790 2188=6 Y F 19 4 Construction cape: Tele to POH
1922 5707 1 9789;9790 2188=7 Y F 19 4 Construction cape: Tele to POH
1922 5707 1 9789;9790 2188=8 Y F 19 4 Construction cape: Tele to POH
1922 5707 2 9789;9790 2188=7 Y F 19 4 Construction cape: Tele to POH
1922 5707 3 9789;9790 2188=8 Y F 19 4 Construction cape: Tele to POH
1986 5707 0 9789;9790 2188=10 Y F 19 4 Construction cape: Tele to POH
1986 5707 0 9789;9790 2188=11 Y F 19 4 Construction cape: Tele to POH
1986 5707 0 9789;9790 2188=13 Y F 19 4 Construction cape: Tele to POH
1986 5707 0 9789;9790 2188=14 Y F 19 4 Construction cape: Tele to POH
1986 5707 1 9789;9790 2188=12 Y F 19 4 Construction cape: Tele to POH
1986 5707 2 9789;9790 2188=13 Y F 19 4 Construction cape: Tele to POH
1986 5707 3 9789;9790 2188=14 Y F 19 4 Construction cape: Tele to POH
# 8 - Hosidius
#1740 3517 0 9789;9790 2187=8 Y F 19 4 Construction cape: Home
2952 3224 0 9789;9790 Y F 19 4 2. Construction cape: Rimmington
Expand Down
Loading