From 65d2f4509049cc1f91e6dd922af15a83880e434d Mon Sep 17 00:00:00 2001 From: Macweese <50101641+Macweese@users.noreply.github.com;macweese@pm.me> Date: Sat, 5 Sep 2020 10:54:21 +0200 Subject: [PATCH] WorldLocation: Fields hierarchy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After some testing I found that a niche issue arises from the combination of the alphabetical sorting and the for loop. This aims to band-aid the issue as best possible until proper rework is done. Renamed fields Appended main areas (BB) which house other locations with `_ZONE` . Example Old → `HOSIDIUS("Hosidius", new Location(1737, 3627, 1789, 3582), 0),` New → `HOSIDIUS_ZONE("Hosidius", new Location(1737, 3627, 1789, 3582), 0),` Reason for this is to solve a problem with the `for loop` responsible for iterating over all locations to find which one the player is located in. Since they are sorted alphabetically, `HOSIDIUS` comes before `HOSIDIUS_BANK` or any other location prefixed with "hosidius". Disregarding if `worldArea ∈ BB`. So, coincidentally, appending BB areas with `_ZONE` is just a lucky "solution" as a result of the alphabetical sorting to push the area down in the hierarchy. To be clear; This is a hack, not a proper solution. Ideally, in a perfect world the entire thing would be replaced by a proper R-Tree or other spatial access method. However, for now, this is as good as it gets seeing as it'd be a pretty big task. --- .../runelite/client/game/WorldLocation.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/WorldLocation.java b/runelite-client/src/main/java/net/runelite/client/game/WorldLocation.java index d1e36b6679..a4cd3d6de4 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/WorldLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/game/WorldLocation.java @@ -23,7 +23,7 @@ import net.runelite.client.util.PvPUtil; /* * Enums sorted alphabetically by main regions (Kingdoms) and then their sub-regions or notable features * Example: - * Wilderness + * Wilderness * Mage Bank */ public enum WorldLocation @@ -62,13 +62,13 @@ public enum WorldLocation BURTHOPRE_GAMES_TELEPORT("Burthorpe Games Tele", new Location(2890, 3557, 2907, 3549), 0), CRAFTING_GUILD("Crafting Guild", new Location(2921, 3292, 2944, 3275), 0), EDGEVILLE_MONASTERY("Edgeville Monastery", new Location(3044, 3507, 3060, 3471), 0), - FALADOR_PARTYROOM("Falador Partyroom", new Location(3035, 3386, 3056, 3370), 0), + FALADOR_BANK("Fally Bank", new Location(2943, 3372, 2949, 3358), 0), + FALADOR_CENTER("Fally Center", new Location(2959, 3385, 2972, 3374), 0), + FALADOR_EAST_BANK("Fally East Bank", new Location(3008, 3358, 3021, 3353), 0), FALADOR_FARM("Falador Farm", new Location(3014, 3314, 3067, 3283), 0), - FALLY_BANK("Fally Bank", new Location(2943, 3372, 2949, 3358), 0), - FALLY_CENTER("Fally Center", new Location(2959, 3385, 2972, 3374), 0), - FALLY_EAST_BANK("Fally East Bank", new Location(3008, 3358, 3021, 3353), 0), - FALLY_PARK("Fally Park", new Location(2982, 3390, 3025, 3368), 0), - FALLY_RESPAWN("Fally Respawn", new Location(2957, 3355, 2998, 3325), 0), + FALADOR_PARK("Fally Park", new Location(2982, 3390, 3025, 3368), 0), + FALADOR_PARTYROOM("Falador Partyroom", new Location(3035, 3386, 3056, 3370), 0), + FALADOR_RESPAWN("Fally Respawn", new Location(2957, 3355, 2998, 3325), 0), GOBLIN_VILLAGE("Goblin Village", new Location(2948, 3516, 2963, 3493), 0), HEROES_GUILD("Heroes' Guild", new Location(2881, 3517, 2902, 3504), 0), HEROES_GUILD_DUNGEON("Heroes' Guild Dungeon", new Location(2885, 9918, 2945, 9882), 0), @@ -165,21 +165,21 @@ public enum WorldLocation MOUNTAIN_CAMP("Mountain Camp", new Location(2789, 3682, 2813, 3658), 0), NEITIZNOT("Neitiznot", new Location(2300, 3826, 2368, 3776), 0), PIRATES_COVE("Pirate's Cove", new Location(2186, 3842, 2228, 3785), 0), - RELLEKKA("Rellekka", new Location(2600, 3708, 2690, 3645), 0), RELLEKKA_MAIN_HALL("Rellekka Main Hall", new Location(2652, 3685, 2670, 3658), 0), - RELLEKA_MARKET("Rellekka Market", new Location(2629, 3682, 2651, 3654), 0), + RELLEKKA_MARKET("Rellekka Market", new Location(2629, 3682, 2651, 3654), 0), RELLEKKA_NORTH_DOCKS("Rellekka North Docks", new Location(2640, 3712, 2651, 3706), 0), RELLEKKA_NORTH_EAST("Rellekka North East", new Location(2652, 3712, 2690, 3686), 0), - RELLEKA_POH_PORTAL("Rellekka POH Portal", new Location(2662, 3635, 2676, 3624), 0), + RELLEKKA_POH_PORTAL("Rellekka POH Portal", new Location(2662, 3635, 2676, 3624), 0), RELLEKKA_SOUTH_DOCKS("Rellekka South Docks", new Location(2619, 3699, 2641, 3681), 0), + RELLEKKA_ZONE("Rellekka", new Location(2600, 3708, 2690, 3645), 0), ROCK_CRABS_EAST("Rock Crabs East (Near Keldagrim)", new Location(2691, 3738, 2730, 3713), 0), ROCK_CRABS_WEST("Rock Crabs West (North of Rellekka)", new Location(2650, 3738, 2690, 3713), 0), VORKATH("Vorkath", new Location(2237, 4096, 2301, 4031), 0), - WATERBIRTH_DUNGEON_1("Waterbirth Dungeon", new Location(2435, 10176, 2558, 10112), 0), - WATERBIRTH_DUNGEON_2("Waterbirth Dungeon", new Location(1788, 4413, 1966, 4352), 1), WATERBIRTH_DUNGEON_ROCK_LOBSTERS("Waterbirth Dungeon - Rock Lobsters", new Location(1875, 4380, 1919, 4412), 0), WATERBIRTH_DUNGEON_DKS_1("DKS", new Location(2886, 4473, 2941, 4424), 0), // One of these is private, not sure which WATERBIRTH_DUNGEON_DKS_2("DKS", new Location(2886, 4409, 2941, 4361), 0), // One of these is private, not sure which + WATERBIRTH_DUNGEON_ZONE_1("Waterbirth Dungeon", new Location(2435, 10176, 2558, 10112), 0), + WATERBIRTH_DUNGEON_ZONE_2("Waterbirth Dungeon", new Location(1788, 4413, 1966, 4352), 1), WATERBIRTH_ISLAND("Waterbirth Island", new Location(2494, 3774, 2562, 3710), 0), /*- @@ -218,7 +218,6 @@ public enum WorldLocation FISHING_HAMLET("Fishing Hamlet (East of Wintertodt Camp)", new Location(1683, 3969, 1720, 3917), 0), FOODHALL("Piscarilius Foodhall", new Location(1830, 3762, 1854, 3734), 0), FORTHOS_RUINS("Forthos Ruins", new Location(1666, 3590, 1684, 3561), 0), - FORTHOS_DUNGEON("Forthos Dungeon", new Location(1789, 9985, 1858, 9914), 0), FORTHOS_DUNGEON_ALTAR("Forthos Dungeon - Altar", new Location(1794, 9954, 1804, 9946), 0), FORTHOS_DUNGEON_GRUBBY_CHEST("Forthos Dungeon - Grubby Chest", new Location(1793, 9928, 1799, 9922), 0), FORTHOS_DUNGEON_LADDER_EAST("Forthos Dungeon - East Ladder", new Location(1825, 9978, 1835, 9969), 0), @@ -228,7 +227,7 @@ public enum WorldLocation FORTHOS_DUNGEON_SPIDERS("Forthos Dungeon - Red Spiders", new Location(1830, 9968, 1848, 9947), 0), FORTHOS_DUNGEON_UNDEAD_DRUIDS_1("Forthos Dungeon - Undead Druids", new Location(1795, 9944, 1806, 9933), 0), FORTHOS_DUNGEON_UNDEAD_DRUIDS_2("Forthos Dungeon - Undead Druids", new Location(1806, 9973, 1814, 9958), 0), - HOSIDIUS("Hosidius", new Location(1737, 3627, 1789, 3582), 0), + FORTHOS_DUNGEON_ZONE("Forthos Dungeon", new Location(1789, 9985, 1858, 9914), 0), HOSIDIUS_BANK("Hosidius Bank", new Location(1743, 3603, 1753, 3594), 0), HOSIDIUS_FRUIT_STALLS("Hosidius Fruit Stalls", new Location(1790, 3614, 1806, 3603), 0), HOSIDIUS_KITCHEN("Hosidius Kitchen (Bank)", new Location(1671, 3625, 1687, 3610), 0), @@ -236,8 +235,8 @@ public enum WorldLocation HOSIDIUS_POH_PORTAL("Hosidius POH Portal", new Location(1735, 3522, 1747, 3511), 0), HOSIDIUS_SQUARE("Hosidius Square", new Location(1754, 3607, 1772, 3589), 0), HOSIDIUS_VINERY("Hosidius Vinery", new Location(1799, 3573, 1816, 3537), 0), + HOSIDIUS_ZONE("Hosidius", new Location(1737, 3627, 1789, 3582), 0), KOUREND_CASTLE("Kourend Castle", new Location(1592, 3700, 1692, 3646), 0), - KOUREND_CATACOMBS("Kourend Catacombs", new Location(1595, 10106, 1735, 9984), 0), KOUREND_CATACOMBS_ABYSSAL_DEMONS("Kourend Catacombs - Abyssal Demons", new Location(1667, 10101, 1683, 10082), 0), KOUREND_CATACOMBS_BLACK_DEMONS("Kourend Catacombs - Black Demons", new Location(1713, 10073, 1724, 10086), 0), KOUREND_CATACOMBS_BRUTAL_BLACK_DRAGONS("Kourend Catacombs - Brutal Black Dragons", new Location(1604, 10105, 1635, 10068), 0), @@ -248,24 +247,25 @@ public enum WorldLocation KOUREND_CATACOMBS_SOUTH("Kourend Catacombs - South", new Location(1639, 10014, 1702, 9985), 0), KOUREND_CATACOMBS_SOUTH_WEST("Kourend Catacombs South-West Corner", new Location(1596, 10028, 1634, 9984), 0), KOUREND_CATACOMBS_STEEL_DRAGONS("Kourend Catacombs - Steel Dragons", new Location(1599, 10066, 1630, 10029), 0), + KOUREND_CATACOMBS_ZONE("Kourend Catacombs", new Location(1595, 10106, 1735, 9984), 0), LANDS_END("Land's End", new Location(1481, 3448, 1527, 3396), 0), LAKE_MOLCH("Lake Molch", new Location(1357, 3643, 1377, 3624), 0), LIZARDMAN_SHAMANS("Lizardman Shamans", new Location(1414, 3726, 1461, 3688), 0), LOVAKENGJ("Lovakengj", new Location(1425, 3810, 1520, 3730), 0), MOUNT_KARUULM("Mount Karuulm", new Location(1287, 3829, 1331, 3787), 0), - PISCARILIUS("Piscarilius", new Location(1740, 3814, 1854, 3713), 0), PISCARILIUS_ANGLERFISH("Piscarilius Angler Fishing Spot", new Location(1807, 3779, 1842, 3766), 0), PISCARILIUS_BANK("Piscarilius Bank", new Location(1793, 3794, 1812, 3782), 0), PISCARILIUS_PORT("Port Piscarilius", new Location(1788, 3712, 1849, 3673), 0), + PISCARILIUS_ZONE("Piscarilius", new Location(1740, 3814, 1854, 3713), 0), SANDCRABS_BANK("Sandcrabs Bank", new Location(1706, 3475, 1730, 3455), 0), SANDCRABS_NORTH("Sandcrabs (East of Vinery)", new Location(1848, 3572, 1884, 3532), 0), SANDCRABS_SOUTH_1("Sandcrabs (South of Tithe Farm)", new Location(1796, 3468, 1849, 3436), 0), SANDCRABS_SOUTH_2("Sandcrabs (South Coast)", new Location(1745, 3474, 1795, 3450), 0), SANDCRABS_SOUTH_EAST("Sandcrabs (East of Tithe Farm)", new Location(1850, 3529, 1884, 3465), 0), - SHAYZIEN("Shayzien", new Location(1472, 3644, 1591, 3521), 0), SHAYZIEN_BANK("Shayzien Bank", new Location(1494, 3622, 1515, 3611), 0), SHAYZIEN_CRYPTS_ENTRANCE("Shayzien Crypts Entrance", new Location(1474, 3570, 1502, 3535), 0), SHAYZIEN_INFIRMARY("Shayzien Infirmary", new Location(1565, 3574, 1590, 3604), 0), + SHAYZIEN_ZONE("Shayzien", new Location(1472, 3644, 1591, 3521), 0), SOUL_ALTAR("Soul Altar", new Location(1804, 3869, 1834, 3841), 0), SULPHUR_MINE("Lovakengj Sulphur Mine", new Location(1415, 3888, 1466, 3840), 0), SULPHUR_MINE_BANK("Lovakengj Sulphur Mine Bank", new Location(1430, 3838, 1443, 3817), 0), @@ -276,10 +276,10 @@ public enum WorldLocation WINTERTODT_NORTHWEST("Wintertodt NorthWest", new Location(1608, 4028, 1629, 4008), 0), WINDERTODT_SOUTH_EAST("Windertodt South East", new Location(1630, 4007, 1651, 3987), 0), WINTERTODT_SOUTHWEST("Wintertodt SouthWest", new Location(1608, 4007, 1629, 3987), 0), - WOODCUTTING_GUILD("Woodcutting Guild", new Location(1560, 3520, 1659, 3471), 0), WOODCUTTING_GUILD_BANK("Woodcutting Guild Bank", new Location(1588, 3481, 1594, 3473), 0), WOODCUTTING_GUILD_EAST("Woodcutting Guild (East Portion)", new Location(1623, 3519, 1657, 3488), 0), WOODCUTTING_GUILD_WEST("Woodcutting Guild (Redwoods)", new Location(1562, 3503, 1586, 3476), 0), + WOODCUTTING_GUILD_ZONE("Woodcutting Guild", new Location(1560, 3520, 1659, 3471), 0), /*- * Kandarin @@ -304,12 +304,12 @@ public enum WorldLocation ARDOUGNE_NORTH_BANK("Ardy North Bank", new Location(2611, 3336, 2622, 3329), 0), ARDOUGNE_SOUTH_BANK("Ardy South Bank", new Location(2645, 3288, 2659, 3279), 0), ARDOUGNE_STALLS("Ardy Stalls", new Location(2651, 3318, 2673, 3293), 0), - ARDOUGNE_ZOO("Ardy Zoo", new Location(2598, 3288, 2640, 3261), 0), + ARDOUGNE_ZOO("Ardy Zoo", new Location(2598, 3288, 2636, 3265), 0), BARBARIAN_OUTPOST("Barbarian Outpost", new Location(2517, 3580, 2557, 3540), 0), BAXTORIAN_WATERFALL_DUNGEON("Waterfall Dungeon (Baxtorian Falls)", new Location(2556, 9861, 2594, 9918), 0), CAMELOT_CASTLE("Camelot Castle", new Location(2743, 3481, 2775, 3468), 0), - CASTLE_WARS("Castle Wars", new Location(2435, 3127, 2474, 3074), 0), CASTLE_WARS_BANK("Castle Wars Bank", new Location(2435, 3100, 2448, 3078), 0), + CASTLE_WARS_ZONE("Castle Wars", new Location(2435, 3127, 2474, 3074), 0), CATHERBY("Catherby", new Location(2791, 3457, 2833, 3436), 0), CATHERBY_DOCKS("Catherby Docks", new Location(2790, 3432, 2808, 3409), 0), CATHERBY_FISHING_SPOTS("Catherby Fishing Spots", new Location(2834, 3441, 2862, 3425), 0), @@ -353,7 +353,7 @@ public enum WorldLocation YANILLE_AGILITY_DUNGEON("Yanille Agilty Dungeon", new Location(2559, 9536, 2624, 9475), 0), YANILE_BANK("Yanile Bank", new Location(2608, 3097, 2616, 3087), 0), YANILLE_EAST("Yanille East", new Location(2576, 3110, 2621, 3071), 0), - YANILLE_PORTAL("Yanille Portal", new Location(2537, 3108, 2551, 3091), 0), + YANILLE_POH_PORTAL("Yanille POH Portal", new Location(2537, 3108, 2551, 3091), 0), YANILLE_WEST("Yanille West", new Location(2532, 3110, 2575, 3071), 0), /*- @@ -435,8 +435,8 @@ public enum WorldLocation DUEL_ARENA_TELEPORT("Duel Arena Tele", new Location(3308, 3246, 3326, 3225), 0), FIRE_ALTAR("Fire Altar", new Location(3301, 3256, 3307, 3250), 0), KALPHITE_LAIR("Kalphite Lair Entrance", new Location(3205, 3124, 3253, 3082), 0), - NARDAH("Nardah", new Location(3397, 2942, 3453, 2882), 0), NARDAH_BANK("Nardah Bank", new Location(3417, 2902, 3437, 2883), 0), + NARDAH_ZONE("Nardah", new Location(3397, 2942, 3453, 2882), 0), POLLNIVNEACH("Pollnivneach", new Location(3331, 2990, 3379, 2945), 0), POLLNIVNEACH_POH_PORTAL("Pollnivneach POH Portal", new Location(3333, 3008, 3346, 2995), 0), POLLNIVNEACH_SMOKE_DUNGEON("Pollnivneach Smoke Dungeon", new Location(3199, 9404, 3327, 9345), 0), @@ -523,8 +523,8 @@ public enum WorldLocation BARROWS("Barrows", new Location(3546, 3314, 3583, 3268), 0), BARROWS_CRYPT("Barrows Crypt", new Location(3523, 9723, 3580, 9666), 0), BURGH_DE_ROTT("Burgh de Rott", new Location(3474, 3247, 3535, 3189), 0), - CANIFIS("Canifis", new Location(3472, 3506, 3519, 3467), 0), CANIFIS_BANK("Canifis Bank", new Location(3508, 3483, 3516, 3474), 0), + CANIFIS_ZONE("Canifis", new Location(3472, 3506, 3519, 3467), 0), CROMBWICK_MANOR("Crombwick Manor in Slepe", new Location(3710, 3377, 3742, 3341), 0), DARKMEYER("Darkmeyer", new Location(3592, 3392, 3662, 3331), 0), DARKMEYER_BANK("Darkmeyer Bank", new Location(3600, 3370, 3610, 3364), 0),