Class WorldMapService


  • public class WorldMapService
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      WorldMapService()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isWorldMapOpen()
      Determines whether the world map interface is currently open and visible.
      net.runelite.api.coords.WorldPoint mapClickToWorldPoint​(int clickX, int clickY)
      Converts the screen-space click coordinates on the world map interface to a corresponding WorldPoint in the game world.
      net.runelite.api.coords.WorldPoint mapClickToWorldPoint​(int clickX, int clickY, int plane)
      Maps the click coordinates on the world map to a WorldPoint in the game world, with a specified plane (altitude).
      java.lang.Integer worldPointToMapPointX​(net.runelite.api.coords.WorldPoint worldPoint)
      Converts a WorldPoint to its corresponding screen X coordinate on the world map.
      java.lang.Integer worldPointToMapPointY​(net.runelite.api.coords.WorldPoint worldPoint)
      Converts a WorldPoint in the game world to its corresponding screen Y coordinate on the world map interface.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WorldMapService

        public WorldMapService()
    • Method Detail

      • mapClickToWorldPoint

        public net.runelite.api.coords.WorldPoint mapClickToWorldPoint​(int clickX,
                                                                       int clickY)
        Converts the screen-space click coordinates on the world map interface to a corresponding WorldPoint in the game world.

        This method takes the x and y coordinates of a mouse click and determines the equivalent world map coordinates by accounting for the map's zoom level, current position, and bounds. If the click is outside the map's bounds or the world map is unavailable, the method returns null.

        Parameters:
        clickX - the x-coordinate of the mouse click on the world map interface
        clickY - the y-coordinate of the mouse click on the world map interface
        Returns:
        the WorldPoint corresponding to the clicked coordinates, or null if the conversion cannot be performed
      • mapClickToWorldPoint

        public net.runelite.api.coords.WorldPoint mapClickToWorldPoint​(int clickX,
                                                                       int clickY,
                                                                       int plane)
        Maps the click coordinates on the world map to a WorldPoint in the game world, with a specified plane (altitude).

        This method converts user interaction on the world map interface (e.g., clicking) into corresponding game world coordinates while ensuring the plane value is constrained between valid ranges (0 to 3). If the conversion fails (e.g., invalid input or map state), null is returned.

        Parameters:
        clickX - the x-coordinate of the mouse click on the world map interface
        clickY - the y-coordinate of the mouse click on the world map interface
        plane - the desired plane (altitude) for the resulting WorldPoint; values outside the range [0, 3] will be clamped
        Returns:
        the WorldPoint corresponding to the click coordinates and specified plane, or null if the conversion fails
      • worldPointToMapPointX

        public java.lang.Integer worldPointToMapPointX​(net.runelite.api.coords.WorldPoint worldPoint)
        Converts a WorldPoint to its corresponding screen X coordinate on the world map.

        This method calculates the X coordinate of a given WorldPoint relative to the world map interface, considering the map's zoom level, current position, and bounds. If the world map or any related components are unavailable, the method returns null.

        Parameters:
        worldPoint - the WorldPoint to convert; must not be null
        Returns:
        the screen X coordinate on the world map, or null if the conversion cannot be performed
      • worldPointToMapPointY

        public java.lang.Integer worldPointToMapPointY​(net.runelite.api.coords.WorldPoint worldPoint)
        Converts a WorldPoint in the game world to its corresponding screen Y coordinate on the world map interface.

        This method calculates the screen Y position of the given WorldPoint in relation to the world map widget, taking into account the map's zoom level, current position, and widget bounds. If the WorldPoint or world map components are unavailable, the method returns null.

        Parameters:
        worldPoint - the WorldPoint to convert; must not be null. If null, the method will return null.
        Returns:
        the screen Y coordinate on the world map corresponding to the given WorldPoint, or null if the conversion cannot be performed due to invalid input or unavailable map state.
      • isWorldMapOpen

        public boolean isWorldMapOpen()
        Determines whether the world map interface is currently open and visible.

        This method checks the state of the world map widget within the game client to assess its visibility. If the widget corresponding to the world map is not available or is hidden, it returns false, indicating that the world map is closed or inaccessible. Otherwise, it returns true.

        Returns:
        true if the world map interface is open and visible; false otherwise. This includes cases where the widget is absent or hidden.