Class World

java.lang.Object
dev.twilite.game.wrapper.World

public class World extends Object
Loaded game world/scene wrapper.
  • Field Details

  • Constructor Details

    • World

      public World(dev.twilite.game.internal.memory.RSWorld memory)
      Wraps a native world provider.
  • Method Details

    • id

      public int id()
      Returns the world id.
    • origin

      public Coord origin()
      Returns the absolute origin of this loaded world area.
    • floor

      public int floor()
      Returns the current floor.
    • size

      public Dimension size()
      Returns the loaded world area size.
    • area

      public Rect area()
      Returns the loaded world area.
    • directWalk

      public void directWalk(int x, int y)
      Sets the next walk target in map-local coordinates.
    • directWalk

      public void directWalk(Coord coord)
      Sets the next walk target to the supplied world coordinate.

      Template coordinates are converted back to their loaded instance coordinate when available. This writes directly to the client's next-walk target and does not pathfind.

    • directHeading

      public void directHeading(Heading heading)
      Directs your sailing to the specified Heading
    • collision

      public int collision(Coord.Map map)
      Returns the collision flag at the specified Map coord.
    • collision

      public int[] collision()
      Returns all collision flags. Indexing is as follows: `flags[mapY * world.size().width() + mapX]`
    • localPlayer

      public Optional<Player> localPlayer()
      Returns the local player.
    • player

      public Optional<Player> player(int index)
      Returns a player by index.
    • players

      public PlayerView players()
      Returns a lazy view of loaded players.
    • npc

      public Optional<Npc> npc(int index)
      Returns an NPC by index.
    • npcs

      public NpcView npcs()
      Returns a lazy view of loaded NPCs.
    • effects

      public EffectView effects()
      Returns a lazy view of active spot effects.
    • entity

      public Optional<WorldEntity> entity(int id)
      Returns a transmitted world entity by id.
    • entities

      public View<WorldEntity> entities()
      Returns a lazy view of transmitted world entities.
    • tileItems

      public TileItemView tileItems()
      Returns tile items on the current floor.
    • tileItems

      public TileItemView tileItems(int floor)
      Returns tile items on a floor.
    • tileItems

      public TileItemView tileItems(Coord.Map map)
      Returns tile items at a map-local coordinate.
    • projectiles

      public ProjectileView projectiles()
      Returns active projectiles.
    • hintArrows

      public HintArrowView hintArrows()
      Returns active hint arrows.
    • collisionFlag

      public int collisionFlag(int mapX, int mapY)
      Returns the collision flag at a map-local coordinate.
    • collisionFlags

      public int[] collisionFlags()
      Returns collision flags for the current floor, indexed by mapY * width + mapX.
    • objects

      public SceneObjectView objects()
      Returns all scene objects on the current floor.
    • objects

      public SceneObjectView objects(int layer)
      Returns scene objects on this world's current floor whose layer matches the provided bitmask. Example: objects(SceneObject.WALL | SceneObject.WALL_DECOR). Use SceneObject.ALL to include every object layer.