StendhalScripting/LuaAPI: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>AntumDeluge
imported>AntumDeluge
quests: add descriptions
Line 186: Line 186:


Methods:
Methods:

* ''<span style="color:green">quests:createQuest</span>(slotName, name)''
* ''<span style="color:green">quests:load</span>(quest)''
; ''<span style="color:green">quests:create</span>(slotName, name)''
: Creates a new quest.
* ''<span style="color:green">quests:unload</span>(questName)''
: '''''slotName:''''' (optional) The string identifier for the quest.
* ''<span style="color:green">quests:cache</span>(quest)''
: '''''name:''''' (optional) The human-readable name that can be shown in travel log.
* ''<span style="color:green">quests:register</span>(quest)'' Alias for ''<span style="color:green;">quests:cache</span></span>(quest)''.
: ''returns:'' New {{StendhalFile|master|src/games/stendhal/server/core/scripting/lua/QuestHelper.java|games.stendhal.server.core.scripting.lua.QuestHelper.LuaQuest}} instance.
* ''<span style="color:green">quests:isLoaded</span>(quest)''

* ''<span style="color:green">quests:listAll</span>(player)''
* ''<span style="color:green">quests:list</span>(player, questName)''
; ''<span style="color:green">quests:load</span>(quest)''
: Adds a quest to the world.
* ''<span style="color:green">quests:listStates</span>(player)''
: '''''quest:''''' The {{StendhalFile|master|src/games/stendhal/server/maps/quests/IQuest.java|IQuest}} instance to be loaded.
* ''<span style="color:green">quests:getQuest</span>()''

* ''<span style="color:green">quests:getQuestFromSlot</span>(questSlot)''
* ''<span style="color:green">quests:getOpen</span>(player)''
; ''<span style="color:green">quests:unload</span>(questName)''
: Removes a quest from the world.
* ''<span style="color:green">quests:getCompleted</span>(player)''
: '''''questName:''''' String name of the quest to be removed.
* ''<span style="color:green">quests:getIncomplete</span>(player, region)''

* ''<span style="color:green">quests:getRepeatable</span>(player)''
* ''<span style="color:green">quests:getDescription</span>(player, questName)''
; ''<span style="color:green">quests:cache</span>(quest)''
: Caches a quest for loading at server startup.
* ''<span style="color:green">quests:getLevelWarning</span>(player, questeName)''
: '''''quest:''''' {{StendhalFile|master|src/games/stendhal/server/maps/quests/IQuest.java|IQuest}} instance to be loaded.
* ''<span style="color:green">quests:getProgressDetails</span>(player, questeName)''
:; ''aliases:''
* ''<span style="color:green">quests:getNPCNamesForUnstartedInRegionForLevel</span>(player, region)''
* ''<span style="color:green">quests:getDescriptionForUnstartedInRegionFromNPCName</span>(player, region, name)''
:: ''<span style="color:green">quests:register</span>''

; ''<span style="color:green">quests:isLoaded</span>(quest)''
: Checks if a quest has been loaded.
: '''''quest:''''' {{StendhalFile|master|src/games/stendhal/server/maps/quests/IQuest.java|IQuest}} instance to check.
: ''returns:'' <code>true</code> if the instance matches stored quests.

; ''<span style="color:green">quests:listAll</span>(player)''
: List all quests the player knows about.
: '''''player:''''' Player to create the report for.
: ''returns:'' String report.

; ''<span style="color:green">quests:list</span>(player, questName)''
: Creates a report on a specified quest for a player.
: '''''player:''''' Player to create the report for.
: '''''questName:''''' Name of quest to be reported.
: ''returns:'' String report.

; ''<span style="color:green">quests:listStates</span>(player)''
: Dumps the internal quest states for the specified player. This is used for the {{StendhalFile|master|src/games/stendhal/server/action/admin/InspectAction.java|InspectAction}}.
: '''''player:''''' Player to create the report for.
: ''returns:'' String report.

; ''<span style="color:green">quests:getQuest</span>(questName)''
: Retrieves the {{StendhalFile|master|src/games/stendhal/server/maps/quests/IQuest.java|IQuest}} object for a named quest.
: '''''questName:''''' Name of quest.
: ''returns:'' <code>IQuest</code> or <code>null</code> if doesn't exist.

; ''<span style="color:green">quests:getQuestFromSlot</span>(questSlot)''
: Retrieves the {{StendhalFile|master|src/games/stendhal/server/maps/quests/IQuest.java|IQuest}} object for a quest.
: '''''questSlot:''''' Quest identifier string.
: ''returns:'' <code>IQuest</code> or <code>null</code> if doesn't exist.

; ''<span style="color:green">quests:getOpen</span>(player)''
: Retrieves a list of open quests from a player.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: ''returns:'' List of string identifiers for open quests.

; ''<span style="color:green">quests:getCompleted</span>(player)''
: Retrieves a list of completed quests from a player.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: ''returns:'' List of string identifiers for completed quests.

; ''<span style="color:green">quests:getIncomplete</span>(player, region)''
: Retrieves a list of incomplete quests in a specified region.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''region:''''' Region name/identifier.
: ''returns:'' List of string identifiers of incomplete quests in region.

; ''<span style="color:green">quests:getRepeatable</span>(player)''
: Retrieves a list of quests a player has completed, and can now do again.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: ''returns:''

; ''<span style="color:green">quests:getDescription</span>(player, questName)''
: Retrieves the description of a quest.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''questName:''''' Name of the quest.
: ''returns:'' <code>String</code> description.

; ''<span style="color:green">quests:getLevelWarning</span>(player, questName)''
: If the quest is too dangerous, add a warning unless the player has already completed it.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''questName:''''' Name of the quest.
: ''returns:'' <code>String</code>

; ''<span style="color:green">quests:getProgressDetails</span>(player, questeName)''
: Retrieves details on the progress of the quest.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''questName:''''' Name of the quest.
: ''returns:'' <code>List<String></code>

; ''<span style="color:green">quests:getNPCNamesForUnstartedInRegionForLevel</span>(player, region)''
: Retrieves a list of the unique npc names for unstarted quests in a specified region.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''region:''''' Region to check in.
: ''returns:'' <code>List<String></code>

; ''<span style="color:green">quests:getDescriptionForUnstartedInRegionFromNPCName</span>(player, region, name)''
: Retrieves quest descriptions for unstarted quests in a specified region matching a specific NPC name.
: '''''player:''''' {{StendhalFile|master|src/games/stendhal/server/entity/player/Player.java|Player}} instance to be checked.
: '''''region:''''' Region to check in.
: '''''name:''''' Name of NPC.
: ''returns:'' <code>List<String></code>


=== quests.simple ===
=== quests.simple ===
Line 212: Line 295:


Methods:
Methods:

* ''<span style="color:green">quests.simple:create</span></span>(slotName, properName, npcName)''
** <span style="color:darkblue; font-style:italic;">slotName:</span> (string)
; ''<span style="color:green">quests.simple:create</span></span>(slotName, properName, npcName)''
: '''''slotName:''''' <code>String</code> identifier to be used for quest.
** <span style="color:darkblue; font-style:italic;">properName:</span> (string)
: '''''properName:''''' Human-readable name to be displayed in travel log.
** <span style="color:darkblue; font-style:italic;">npcName:</span> (string)
: '''''npcName:''''' The NPC associated with the quest.
** returns: <code>games.stendhal.server.maps.quests.SimpleQuestCreator.SimpleQuest</code> instance.
: ''returns:'' <code>games.stendhal.server.maps.quests.SimpleQuestCreator.SimpleQuest</code> instance.


==== SimpleQuest Object ====
==== SimpleQuest Object ====