Class TrainingArea

java.lang.Object
games.stendhal.server.util.Area
games.stendhal.server.maps.nalwor.forest.TrainingArea
All Implemented Interfaces:
LoginListener, LogoutListener

public class TrainingArea extends Area implements LoginListener, LogoutListener
Representation of an area where a player can train.
  • Constructor Details

  • Method Details

    • setCapacity

      public void setCapacity(int capacity)
      Sets the maximum number of players allow to occupy the area at a single time.
      Parameters:
      capacity - Capacity limit.
    • contains

      public boolean contains(Entity entity)
      Description copied from class: Area
      Checks whether an entity is in this area (e. g. on this zone and inside of the shape)
      Overrides:
      contains in class Area
      Parameters:
      entity - An entity to check
      Returns:
      true, if and only if the entity is in this area.
    • meetsLevelCap

      public boolean meetsLevelCap(Player player, int statLevel)
      Checks if a player qualifies for training.
      Parameters:
      player - Player to calculate cap for.
      statLevel - Stat to compare cap against.
      Returns:
      true if the player's stat/level is too high to train.
    • isFull

      public boolean isFull()
      Checks if the area is full.
      Returns:
      false if the number of players in area are less than maximum capacity or there is not maximum capacity.
    • isExiting

      public boolean isExiting(RPEntity trainee)
      Checks if the entity is exiting the training area.
      Parameters:
      trainee - Entity to check.
      Returns:
      true if the entity is traversing the gate in the direction away from training area.
    • getMaxCapacity

      public int getMaxCapacity()
      Retrieves the maximum number of players that can occupy the training area at one time.
      Returns:
      Max occupants.
    • calculateFee

      public int calculateFee(int statLevel)
      Calculates a fee to use the area. Base fee is 625 & doubles every 20 levels.
      Parameters:
      statLevel - Level of stat to be used as factor.
      Returns:
      Suggested fee.
    • startSession

      public void startSession(Player player, int trainTime)
      Sets quest slot state & starts timer for session.
      Parameters:
      player - Player starting training session.
      trainTime - Amount of time (in seconds) player is allowed to train.
    • endSession

      public void endSession(Player player)
      Teleports player out of archery range training area.
    • onLoggedIn

      public void onLoggedIn(Player player)
      Description copied from interface: LoginListener
      Is called after a player logged into the game.
      Specified by:
      onLoggedIn in interface LoginListener
      Parameters:
      player - the player who has logged in
    • onLoggedOut

      public void onLoggedOut(Player player)
      Description copied from interface: LogoutListener
      Called when a player has logged out.
      Specified by:
      onLoggedOut in interface LogoutListener
      Parameters:
      player - The player having logged out.