Module:RecipeTreeSearch/doc

From Brighter Shores Wiki
Jump to navigation Jump to search

This is the documentation page for Module:RecipeTreeSearch

This is a documentation subpage for Module:RecipeTreeSearch.
It contains usage information, categories, and other content that is not part of the original module page.
Module:RecipeTreeSearch requires Module:Break Isolation.
Module:RecipeTreeSearch is required by Module:Infobox Recipe.
Module:RecipeTreeSearch is required by Module:LeatherworkerList.
Module:RecipeTreeSearch is required by Module:ProfessionList.

This module is a helper module to be used by other modules; it may not designed to be invoked directly. See Brighter Shores:Lua/Helper modules for a full list and more information.

FunctionTypeUse
main(item)item: string, name of an item pageReturns a Lua Table structured as a Recipe, but containing additional information about a multi-stage crafting process such including:

All base materials, including their buy price in shops

All intermediate materials, including both the number of materials and the number of times the crafting step needs to be performed

Total values for XP, KP, duration
treeSearch(inputs)inputs: table of name/quantity pairs, for the inputs to a recipeUse this function on the inputs to a recipe rather than the name of the output of a recipe. This allows the tree to be searched before the final recipe has been made.

IMPORTANT: within the Infobox Recipe that constructs a recipe, it is imporant to use this function instead of main(), so that this module will not attempt to use the recipe before it has been constructed.

Returns a the same structure Lua Table as main(), however it lacks any information on the final step.
getRecipe(item)item: string, name of an item pageReturns the Lua Table of the Recipe for the single step.

Will also find an activitiy which produce the item on the specified page.

Will only ever return one recipe/activity, the one it finds first.
getShopBuyPrice(item)item: string, name of an item pageReturns the value that the item can be bought at, or nil if it cannot be bought
getShopSellPrice(item)item: string, name of an item pageReturns the value that the item can be sold for, or nil if it cannot be sold