Module:ProfessionList/doc: Difference between revisions

(Created page with "{{documentation}} {{Helper module|name=ProfessionList |fname1= |ftype1= |fuse1= }}")
 
m (what it is for)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{documentation}}
{{documentation}}
This module provides functions that are commonly used among all of the modules to greate tables of profession activities, such as AlchemistList, DetectivePassiveList, BlacksmithSmeltingList, and so on.
{{Helper module|name=ProfessionList
{{Helper module|name=ProfessionList
|fname1=
|fname1=currency_cell(amount)
|ftype1=<code>amount</code>: number, or nil
|ftype1=
|fuse1=Returns the HTML to create a table currency cell using <code>module:currency._cell</code>.<br>
|fuse1=
If instead it is supplied with nil then a 10x1 cell is created with the text "unknown".<br>
Use within :node()
|fname2=unknown_value_cell(size)
|ftype2=<code>size</code>: integer
|fuse2=Returns the HTML to create a <code>size</code>x1 cell with the text "unknown".<br>
Use within :node()
|fname3=unknown_value_edit_cell(page,size)
|ftype3=<code>page</code>: string (or table of strings), names of pages<br>
<code>size</code>: integer
|fuse3=Returns the HTML to create a <code>size</code>x1 cell with a link to edit the specified pages.<br>
Use within :node()
|fname4=generate_recipe_table(queryString)
|ftype4=<code>queryString</code>: string, SMW query<br>
<code>screenFunction</code>: function, <code>table > boolean</code>
|fuse4=Generates a table of recipes and activities from a Semantic MediaWiki query string and a screening function.<br>
<code>queryString</code> is an SMW query, but it only needs to be the selection of pages. Parameters to be returned are chosen by the function.<br>
<code>screenFunction</code> is a function which takes one recipe from the search and returns true if that recipe is to be kept, or false if it is to be discarded. Parameters available to the screening function are those present in the Recipe JSON or Activity JSON, as well as the name and image of the page that held the JSON.<br>
Pages with multiple recipes or activities will make one entry into the results table for each JSON.<br>
The results table entries are the decoded recipe/activity JSONs, parsed through <code>Module:RecipeTreeSearch|main</code> to get the full recipe materials, xp, kp, duration, and costs. Added to these are the name and image of the page that held the JSON.<br>
The results table is sorted by recipe/activity level, independent of profession.
|fname5=one_column_image_text(materials)
|ftype5=<code>materials</code>: table, each entry is a name/quantity pair for an item to display
|fuse5=Produces 1x1 cell with multiple lines of text in a standard format to display a list of materials for a recipe.<br>
Includes the quantity of each material.<br>
Requires that the image of each item is exactly the same as the item name itself.<br>
For example: the reagents and bottle to produce a potion.
|fname6=two_column_image_text(sort,image,text,link)
|ftype6=<code>sort</code>: string, to sort the multicolumn cell by<br>
<code>image</code>: string, image name to use, including '''File:''' and '''.png'''<br>
<code>text</code>: string, text to display<br>
<code>link</code>: string, page to link the image and text to
|fuse6=Produces 2 cells in a standard format to display an image and some text, which link to the same page.<br>
For example: the image and name of a skill node, but linking to the item they make.
|fname7=three_column_image_text(sort,quantity,image,text,link)
|ftype7=<code>sort</code>: string, to sort the multicolumn cell by<br>
<code>quantity</code>: number, will be displayed with "&times;" after it<br>
<code>image</code>: string, image name to use, including <code>File:</code> and <code>.png</code><br>
<code>text</code>: string, text to display<br>
<code>link</code>: string, page to link the image and text to
|fuse7=Produces 3 cells in a standard format to display a quantity, an image, and some text, which link to the same page.<br>
For example: the quantity, image, and name of a recipe product.
}}
}}

Latest revision as of 14:26, 27 December 2024

This is a documentation subpage for Module:ProfessionList.
It contains usage information, categories, and other content that is not part of the original module page.
Module:ProfessionList requires Module:Currency.
Module:ProfessionList requires Module:RecipeTreeSearch.

This module provides functions that are commonly used among all of the modules to greate tables of profession activities, such as AlchemistList, DetectivePassiveList, BlacksmithSmeltingList, and so on. 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
currency_cell(amount)amount: number, or nilReturns the HTML to create a table currency cell using module:currency._cell.

If instead it is supplied with nil then a 10x1 cell is created with the text "unknown".

Use within :node()
unknown_value_cell(size)size: integerReturns the HTML to create a sizex1 cell with the text "unknown".
Use within :node()
unknown_value_edit_cell(page,size)page: string (or table of strings), names of pages
size: integer
Returns the HTML to create a sizex1 cell with a link to edit the specified pages.
Use within :node()
generate_recipe_table(queryString)queryString: string, SMW query
screenFunction: function, table > boolean
Generates a table of recipes and activities from a Semantic MediaWiki query string and a screening function.

queryString is an SMW query, but it only needs to be the selection of pages. Parameters to be returned are chosen by the function.
screenFunction is a function which takes one recipe from the search and returns true if that recipe is to be kept, or false if it is to be discarded. Parameters available to the screening function are those present in the Recipe JSON or Activity JSON, as well as the name and image of the page that held the JSON.
Pages with multiple recipes or activities will make one entry into the results table for each JSON.

The results table entries are the decoded recipe/activity JSONs, parsed through Module:RecipeTreeSearch
one_column_image_text(materials)materials: table, each entry is a name/quantity pair for an item to displayProduces 1x1 cell with multiple lines of text in a standard format to display a list of materials for a recipe.

Includes the quantity of each material.
Requires that the image of each item is exactly the same as the item name itself.

For example: the reagents and bottle to produce a potion.
two_column_image_text(sort,image,text,link)sort: string, to sort the multicolumn cell by

image: string, image name to use, including File: and .png
text: string, text to display

link: string, page to link the image and text to
Produces 2 cells in a standard format to display an image and some text, which link to the same page.
For example: the image and name of a skill node, but linking to the item they make.
three_column_image_text(sort,quantity,image,text,link)sort: string, to sort the multicolumn cell by

quantity: number, will be displayed with "×" after it
image: string, image name to use, including File: and .png
text: string, text to display

link: string, page to link the image and text to
Produces 3 cells in a standard format to display a quantity, an image, and some text, which link to the same page.
For example: the quantity, image, and name of a recipe product.