Class LuaQuestHelper.LuaQuest
java.lang.Object
games.stendhal.server.maps.quests.AbstractQuest
games.stendhal.server.core.scripting.lua.LuaQuestHelper.LuaQuest
- All Implemented Interfaces:
IQuest
- Enclosing class:
- LuaQuestHelper
Class to aid with quest manipulation in Lua.
-
Field Summary
FieldsModifier and TypeFieldDescriptionorg.luaj.vm2.LuaFunctionorg.luaj.vm2.LuaFunctionorg.luaj.vm2.LuaFunctionorg.luaj.vm2.LuaFunctionFunction executed whenStendhalQuestSystem.loadQuestis called.org.luaj.vm2.LuaFunctionorg.luaj.vm2.LuaFunctionorg.luaj.vm2.LuaFunctionFields inherited from class games.stendhal.server.maps.quests.AbstractQuest
npcs, questInfo -
Method Summary
Modifier and TypeMethodDescriptionvoidadds the quest to the game world (e.g.getFormattedHistory(Player player) getHistory(Player player) Gets a the quest history for the given player, written in the first person.intReturns the minimum level of player expected to start the quest.getName()Returns the name of the quest.Returns the starter NPC for the quest, or null if there is noneRetrieves unformatted quest name.Returns the region where the quest adventure takes place (or begins), or null for global questsThe slot-name in !quests.booleanisCompleted(Player player) Was the quest completed? Note: A quest can be completed without its status being "Done" (e.booleanisRepeatable(Player player) May the quest be repeated?booleanWas the quest started?booleanDenotes whether quest details should be included in travel log.voidregister()Registers quest to be added to world.voidregister(org.luaj.vm2.LuaFunction func) Registers quest to be added to world.booleanremoves a quest from the world.voidsetAddFunction(org.luaj.vm2.LuaFunction func) Deprecated.Set LuaQuest.init directly.voidsetCompletedCheckFunction(org.luaj.vm2.LuaFunction completedCheck) Sets the function for checking if the quest is completed.voidsetDescription(String desc) Sets the quest description string.voidsetFormattedHistoryFunction(org.luaj.vm2.LuaFunction formattedHistory) Sets the function for retrieving formatted history of quest state.voidsetHistoryFunction(org.luaj.vm2.LuaFunction history) Sets the function for retrieving history of quest state.voidsetMinLevel(Integer minLevel) Sets the recommended minimum level.voidSets the quest name string.voidsetNPCName(String npcName) Sets the NPC name.voidSets the quest region.voidsetRemoveFunction(org.luaj.vm2.LuaFunction func) Deprecated.Set LuaQuest.remove directly.voidsetRepeatable(boolean repeatable) Sets the repeatable status of the quest.voidsetRepeatableCheckFunction(org.luaj.vm2.LuaFunction repeatableCheck) Sets the function for checking if the quest is repeatable.voidsetSlotName(String slotName) Sets the quest identifier string.voidsetStartedCheckFunction(org.luaj.vm2.LuaFunction startedCheck) Sets the function for checking if the quest is started.voidsetVisibleOnQuestStatus(boolean visible) Sets whether or not the quest should be shown in the travel log.Methods inherited from class games.stendhal.server.maps.quests.AbstractQuest
fillQuestInfo, fillQuestInfo, fillQuestInfo, fillQuestInfo, getCompletedCount, getHint, getQuestInfo, isVisibleOnQuestStatus, updatePlayer
-
Field Details
-
init
public org.luaj.vm2.LuaFunction initFunction executed whenStendhalQuestSystem.loadQuestis called. -
remove
public org.luaj.vm2.LuaFunction remove -
history
public org.luaj.vm2.LuaFunction history -
formattedHistory
public org.luaj.vm2.LuaFunction formattedHistory -
startedCheck
public org.luaj.vm2.LuaFunction startedCheck -
repeatableCheck
public org.luaj.vm2.LuaFunction repeatableCheck -
completedCheck
public org.luaj.vm2.LuaFunction completedCheck
-
-
Method Details
-
register
public void register()Registers quest to be added to world.LuaQuest.initmust be set before this is called. (alternatively call questSystem:cacheQuest(LuaQuest)) -
register
public void register(org.luaj.vm2.LuaFunction func) Registers quest to be added to world.- Parameters:
func- Function to execute whenStendhalQuestSystem.loadQuestis called.
-
getName
Description copied from interface:IQuestReturns the name of the quest.- Specified by:
getNamein interfaceIQuest- Specified by:
getNamein classAbstractQuest- Returns:
- name
-
getOriginalName
Retrieves unformatted quest name.- Returns:
- Unmodified quest name string.
-
getSlotName
Description copied from class:AbstractQuestThe slot-name in !quests.- Specified by:
getSlotNamein interfaceIQuest- Specified by:
getSlotNamein classAbstractQuest- Returns:
- the slot's name
-
getHistory
Description copied from interface:IQuestGets a the quest history for the given player, written in the first person.- Parameters:
player- Player- Returns:
- list of history item-names
-
getFormattedHistory
- Specified by:
getFormattedHistoryin interfaceIQuest- Overrides:
getFormattedHistoryin classAbstractQuest
-
getMinLevel
public int getMinLevel()Description copied from interface:IQuestReturns the minimum level of player expected to start the quest. Used for choosing which hints to give. To set a hard minimum level requirement for doing the quest, use level related ChatConditions in the quest methods- Specified by:
getMinLevelin interfaceIQuest- Overrides:
getMinLevelin classAbstractQuest- Returns:
- level
-
getRegion
Description copied from class:AbstractQuestReturns the region where the quest adventure takes place (or begins), or null for global quests- Specified by:
getRegionin interfaceIQuest- Overrides:
getRegionin classAbstractQuest- Returns:
- region, or null for global quests
-
getNPCName
Description copied from class:AbstractQuestReturns the starter NPC for the quest, or null if there is none- Specified by:
getNPCNamein interfaceIQuest- Overrides:
getNPCNamein classAbstractQuest- Returns:
- NPC name, or null for quests with no starter NPC
-
isVisibleOnQuestStatus
public boolean isVisibleOnQuestStatus()Description copied from class:AbstractQuestDenotes whether quest details should be included in travel log. Override to create custom checks.- Specified by:
isVisibleOnQuestStatusin interfaceIQuest- Overrides:
isVisibleOnQuestStatusin classAbstractQuest- Returns:
- `true` if details should be included.
-
isStarted
Description copied from interface:IQuestWas the quest started?- Specified by:
isStartedin interfaceIQuest- Overrides:
isStartedin classAbstractQuest- Parameters:
player- Player- Returns:
- true, if it was started, false otherwise
-
addToWorld
public void addToWorld()Description copied from interface:IQuestadds the quest to the game world (e.g. by placing SpeakerNPCs there)- Specified by:
addToWorldin interfaceIQuest- Specified by:
addToWorldin classAbstractQuest
-
removeFromWorld
public boolean removeFromWorld()Description copied from class:AbstractQuestremoves a quest from the world.- Specified by:
removeFromWorldin interfaceIQuest- Overrides:
removeFromWorldin classAbstractQuest- Returns:
- true, if the quest could be removed; false otherwise.
-
isRepeatable
Description copied from interface:IQuestMay the quest be repeated?- Specified by:
isRepeatablein interfaceIQuest- Overrides:
isRepeatablein classAbstractQuest- Parameters:
player- Player- Returns:
- true, if it can be repeated, false otherwise
-
isCompleted
Description copied from interface:IQuestWas the quest completed? Note: A quest can be completed without its status being "Done" (e. g. rejected, failed).- Specified by:
isCompletedin interfaceIQuest- Overrides:
isCompletedin classAbstractQuest- Parameters:
player- Player- Returns:
- true, if it was completed, false otherwise
-
setName
Sets the quest name string.- Parameters:
name- Quest name string to be returned when getName() is called.
-
setDescription
Sets the quest description string.- Parameters:
desc- Quest description string.
-
setSlotName
Sets the quest identifier string.- Parameters:
slotName- Slot identifier string to be returned when getSlotName() is called.
-
setMinLevel
Sets the recommended minimum level.- Parameters:
minLevel- Level to return when getMinLevel() is called.
-
setRegion
Sets the quest region.- Parameters:
region- Region string to be returned when getRegion() is called.
-
setNPCName
Sets the NPC name.- Parameters:
npcName- NPC name to return when getNPCName() is called.
-
setVisibleOnQuestStatus
public void setVisibleOnQuestStatus(boolean visible) Sets whether or not the quest should be shown in the travel log.- Parameters:
visible- If `true`, quest will be displayed in travel log.
-
setRepeatable
public void setRepeatable(boolean repeatable) Sets the repeatable status of the quest. (overrides setCompletedCheckFunction)- Parameters:
repeatable- If `true`, the quest is repeatable.
-
setAddFunction
Deprecated.Set LuaQuest.init directly.Sets the function for adding the quest to the game.- Parameters:
func- Function to invoke when addToWorld() is called.
-
setRemoveFunction
Deprecated.Set LuaQuest.remove directly.Sets the function for removing the quest from the game.- Parameters:
func- Function to invoke when removeFromWorld() is called.
-
setHistoryFunction
public void setHistoryFunction(org.luaj.vm2.LuaFunction history) Sets the function for retrieving history of quest state.- Parameters:
history- Function to invoke when getHistory() is called.
-
setFormattedHistoryFunction
public void setFormattedHistoryFunction(org.luaj.vm2.LuaFunction formattedHistory) Sets the function for retrieving formatted history of quest state.- Parameters:
formattedHistory- Function to invoke when getFormattedHistory() is called.
-
setStartedCheckFunction
public void setStartedCheckFunction(org.luaj.vm2.LuaFunction startedCheck) Sets the function for checking if the quest is started.- Parameters:
startedCheck- Function to invoke when isStarted() is called.
-
setRepeatableCheckFunction
public void setRepeatableCheckFunction(org.luaj.vm2.LuaFunction repeatableCheck) Sets the function for checking if the quest is repeatable.- Parameters:
repeatableCheck- Function to invoke when isRepeatable() is called.
-
setCompletedCheckFunction
public void setCompletedCheckFunction(org.luaj.vm2.LuaFunction completedCheck) Sets the function for checking if the quest is completed.- Parameters:
completedCheck- Function to invoke when isCompleted() is called.
-