Package games.stendhal.server.entity.npc
Class SpeakerNPCFactory
java.lang.Object
games.stendhal.server.entity.npc.SpeakerNPCFactory
- All Implemented Interfaces:
ConfigurableFactory
A base factory for
SpeakerNPC objects.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a damaging area.voidcreateDialog(SpeakerNPC npc) protected StringExtract the NPC class (i.e.protected StringExtract the NPC description from a context.protected DirectionExtract the direction in which the NPC faces from a context.protected intExtract the NPC hitpoints from a context.protected intExtract the NPC level from a context.protected StringExtract the NPC name from a context.protected SpeakerNPCinstantiate(String name) Creates a new SpeakerNPC.
-
Constructor Details
-
SpeakerNPCFactory
public SpeakerNPCFactory()
-
-
Method Details
-
instantiate
Creates a new SpeakerNPC. Override this if you want to use a subclass of SpeakerNPC.- Parameters:
name- The NPC name.- Returns:
- An object of class SpeakerNPC or a subclass.
-
getName
Extract the NPC name from a context.- Parameters:
ctx- The configuration context.- Returns:
- The name
- Throws:
IllegalArgumentException- If the attribute is missing.
-
getClass
Extract the NPC class (i.e. its visual appearance) from a context.- Parameters:
ctx- The configuration context.- Returns:
- The class.
- Throws:
IllegalArgumentException- If the attribute is missing.
-
getHP
Extract the NPC hitpoints from a context.- Parameters:
ctx- The configuration context.- Returns:
- The hitpoints.
-
getLevel
Extract the NPC level from a context.- Parameters:
ctx- The configuration context.- Returns:
- The level of experience.
-
getDescription
Extract the NPC description from a context.- Parameters:
ctx- The configuration context.- Returns:
- The text that will be shown when a player looks at the NPC, or null if the default description should be used.
-
getDirection
Extract the direction in which the NPC faces from a context.- Parameters:
ctx- The configuration context.- Returns:
- The hitpoints.
-
createDialog
-
getPath
-
create
Create a damaging area.- Specified by:
createin interfaceConfigurableFactory- Parameters:
ctx- Configuration context.- Returns:
- A SpeakerNPC.
- Throws:
IllegalArgumentException- If there is a problem with the attributes. The exception message should be a value suitable for meaningful user interpretation.- See Also:
-