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
Nested ClassesModifier and TypeClassDescriptionstatic classNPC class that manages access to training area. -
Constructor Summary
ConstructorsConstructorDescriptionTrainingArea(String slot, StendhalRPZone zone, int x, int y, int width, int height, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom) Creates a restricted area for training.TrainingArea(String slot, StendhalRPZone zone, Rectangle shape, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom) Creates a restricted area for training. -
Method Summary
Modifier and TypeMethodDescriptionintcalculateFee(int statLevel) Calculates a fee to use the area.booleanChecks whether an entity is in this area (e.voidendSession(Player player) Teleports player out of archery range training area.intRetrieves the maximum number of players that can occupy the training area at one time.booleanChecks if the entity is exiting the training area.booleanisFull()Checks if the area is full.booleanmeetsLevelCap(Player player, int statLevel) Checks if a player qualifies for training.voidonLoggedIn(Player player) Is called after a player logged into the game.voidonLoggedOut(Player player) Called when a player has logged out.voidsetCapacity(int capacity) Sets the maximum number of players allow to occupy the area at a single time.voidstartSession(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) Creates a restricted area for training.- Parameters:
slot- Quest slot identifier to track training session.zone- Zone where training area is located.shape- Training area boundaries.trainer- NPC that handles access to training area.endPos- Position where player is teleported after session.gatePos- Position of gate that manages access.entersFrom- Direction from which access is granted.
-
TrainingArea
public TrainingArea(String slot, StendhalRPZone zone, int x, int y, int width, int height, TrainingArea.TrainerNPC trainer, Point endPos, Point gatePos, Direction entersFrom) Creates a restricted area for training.- Parameters:
slot- Quest slot identifier to track training session.zone- Zone where training area is located.x- Training area boundaries X position.y- Training area boundaries Y position.width- Training area boundaries width.height- Training area boundaries height.trainer- NPC that handles access to training area.endPos- Position where player is teleported after session.gatePos- Position of gate that manages access.entersFrom- Direction from which access is granted.
-
-
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:AreaChecks 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:
trueif the player's stat/level is too high to train.
-
isFull
public boolean isFull()Checks if the area is full.- Returns:
falseif 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:
trueif 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:LoginListenerIs called after a player logged into the game.- Specified by:
onLoggedInin interfaceLoginListener- Parameters:
player- the player who has logged in
-
onLoggedOut
Description copied from interface:LogoutListenerCalled when a player has logged out.- Specified by:
onLoggedOutin interfaceLogoutListener- Parameters:
player- The player having logged out.
-