Class TimedTeleportScroll

All Implemented Interfaces:
EquipListener, TurnListener, UseListener, Stackable<StackableItem>, Killer, Cloneable, Iterable<String>, Serializable
Direct Known Subclasses:
BalloonScroll, RainbowBeansScroll, TwilightMossScroll

public class TimedTeleportScroll extends TeleportScroll
Represents a teleport scroll that takes the player to a specified location for a specified time, after which it will teleport the player to given location.

infostring attribute in items.xml:

1_dreamscape 77 35 5400 0_semos_plains_s -1 -1

where

  • 1_dreamscape is the target zone name;
  • 77 and 35 are the target x and y position;
  • 5400 is the number of turns before return;
  • 0_semos_plains_s is the return zone;
  • -1 and -1 are the return x and y positions (negative value means a random position)
TODO: This class isn't fully self-containing as the LoginHandler (that handles the players logging in the target zone) must be implemented elsewhere, i.e. in a quest file.
  • Constructor Details

    • TimedTeleportScroll

      public TimedTeleportScroll(String name, String clazz, String subclass, Map<String,​String> attributes)
      Creates a new timed marked teleport scroll.
      Parameters:
      name -
      clazz -
      subclass -
      attributes -
    • TimedTeleportScroll

      public TimedTeleportScroll(TimedTeleportScroll item)
      Copy constructor.
      Parameters:
      item - item to copy
  • Method Details

    • teleportBack

      public boolean teleportBack(Player player)
      Teleport the player back from the target zone.
      Parameters:
      player -
      Returns:
      true if teleport was successful
    • useTeleportScroll

      protected boolean useTeleportScroll(Player player)
      Is invoked when a teleporting scroll is used. Tries to put the player on the scroll's destination, or near it.
      Specified by:
      useTeleportScroll in class TeleportScroll
      Parameters:
      player - The player who used the scroll and who will be teleported
      Returns:
      true if teleport was successful
    • useTeleportScroll

      protected boolean useTeleportScroll(Player player, String targetZoneName, int x, int y, int timeInTurns)
      Is invoked when a teleporting scroll is used. Tries to put the player on the destination, or near it.
      Parameters:
      player - The player who used the scroll
      targetZoneName - The name of the zone where the player tries to teleport
      x - x coordinate of the target location
      y - y coordinate of the target location
      timeInTurns - The time on turns that the player should spend on the the target zone unless she leaves by other means than the scrolls timeout feature
      Returns:
      true if teleport was succesful
    • getBeforeReturnMessage

      protected String getBeforeReturnMessage()
      override this to show a message before teleporting the player back.
      Returns:
      the message to shown or null for no message
    • getAfterReturnMessage

      protected String getAfterReturnMessage()
      override this to show a message after teleporting the player back.
      Returns:
      the message to shown or null for no message