Class TrainingArea
java.lang.Object
games.stendhal.server.util.Area
games.stendhal.server.maps.nalwor.forest.TrainingArea
- All Implemented Interfaces:
LoginListener
,LogoutListener
Representation of an area where a player can train.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
NPC class that manages access to training area. -
Constructor Summary
ConstructorDescriptionTrainingArea(String slot, StendhalRPZone zone, int x, int y, int width, int height, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom)
TrainingArea(String slot, StendhalRPZone zone, Rectangle shape, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom)
-
Method Summary
Modifier and TypeMethodDescriptionint
calculateFee(int statLevel)
Calculates a fee to use the area.boolean
Checks whether an entity is in this area (e.void
endSession(Player player)
Teleports player out of archery range training area.int
Retrieves the maximum number of players that can occupy the training area at one time.boolean
Checks if the entity is exiting the training area.boolean
isFull()
Checks if the area is full.boolean
meetsLevelCap(Player player, int statLevel)
Checks if a player qualifies for training.void
onLoggedIn(Player player)
Is called after a player logged into the game.void
onLoggedOut(Player player)
Called when a player has logged out.void
setCapacity(int capacity)
Sets the maximum number of players allow to occupy the area at a single time.void
startSession(Player player, int trainTime)
Sets quest slot state & starts timer for session.
-
Constructor Details
-
TrainingArea
public TrainingArea(String slot, StendhalRPZone zone, Rectangle shape, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom) -
TrainingArea
public TrainingArea(String slot, StendhalRPZone zone, int x, int y, int width, int height, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom)
-
-
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
Description copied from class:Area
Checks whether an entity is in this area (e. g. on this zone and inside of the shape) -
meetsLevelCap
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
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
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
Teleports player out of archery range training area. -
onLoggedIn
Description copied from interface:LoginListener
Is called after a player logged into the game.- Specified by:
onLoggedIn
in interfaceLoginListener
- Parameters:
player
- the player who has logged in
-
onLoggedOut
Description copied from interface:LogoutListener
Called when a player has logged out.- Specified by:
onLoggedOut
in interfaceLogoutListener
- Parameters:
player
- The player having logged out.
-