Module:ItemList/doc

From Fallen London Wiki

This is the documentation page for Module:ItemList

This module creates a list of Items belonging to a certain equip-able Class (e.g. "Hat"), and with specific effects (e.g. "Persuasive"). The qualities can be a comma-separated list (without spaces, e.g. "Bizarre,Dreaded,Respectable"), in which case their effects are combined.

Exposed functions[edit]

  • items_exist(class, quality, neg): check if at least one such item exists on the wiki.
 Returns the number of items that belong to the given class and modify the given quality. If no match, return an empty string.
 
 Both class and quality are optional, although at least one should be given. If either are omitted, then items are filtered only for their class or for the quality they modify. By default items are counted if they either increase or decrease the given quality, but if neg is truthy, then only items with negative modifiers are considered.
   
 Example usage:
     {{#invoke:ItemList|items_exist|name=Overgoat|class=Companion}}
     {{#invoke:ItemList|items_exist|class=Hat|quality=Scandal}}
     {{#invoke:ItemList|items_exist|quality=Watchful}}


  • create_list(class, quality, fancy, neg): returns the formated and sorted list of all items with the specified class and quality effect.
 If the specified quality is "Other", then the list is made of all items in the class which have no "regular" effects (main attributes/menaces/BDR).
 If fancy is true, then the result is a table instead of a list, with fancier formatting.
 If neg is true, then only items with negative stats will be returned, sorted with the most negative stats first.
   
 Example usage:
     {{#invoke:ItemList|create_list|class=Hat|quality=Persuasive}}
     {{#invoke:ItemList|create_list|class=Companion|quality=Other}}


  • best_in_slot(Quality): returns a best-in-slot items table for the specified quality.
 The following optional parameters can be set to "no" to exclude from the results items with certain properties: "Fate", "Mood", "Seasonal", "Profession", "Faction", "Ambition," "SMEN", "Retired".
   
 Example usage:
     {{#invoke:ItemList|best_in_slot|Quality=Persuasive}}
     {{#invoke:ItemList|best_in_slot|Quality=Dangerous|Fate=no|Retired=no}}
  • find_minmax(class, quality, minmax, name): Returns information about the best-in-slot bonus for a given class and quality.
 The minmax parameter must be either "max" or "min," and directs whether to return the best-in-slot or worst-in-slot values. The name parameter is the name of the item being compared against, which will be excluded from the returned results. 
 
 The function returns a table with the following keys:
   * value = max (or min) effect value possible for the specified quality in this item class
   * count = number of items found with this value
   * no_mood = max (or min) value possible when disregarding Moods
   * no_mood_count = number of non-Mood items found with this value
   * no_fate = max (or min) value possible when disregarding both Fate and Mood items
   * no_fate_count = number of non-Fate non-Mood items found with this value

Using the Module[edit]

Modules are not called directly from Wiki pages, but are invoked indirectly via a Template. In this case, the Module is invoked via {{ItemList}}.

The Module creates the desired list by parsing arguments passed to the {{Item}} on the pages for individual available equip-able items.

Module table structure[edit]

Lists of items returned by this Module contains a list of items, each in the format:

 ["item name"] = { <item info> },
   

Each <item info> is itself a table, which can hold two types of key/value pairs:

  • effects = { <effects table> }
  • qualifiers = { <qualifiers list> }
 * Both of the above are optional, e.g. if an item has no effects and no qualifiers.
 * The order of items, effects, and qualifiers is not guaranteed.


If the item has effects, the <effects table> will list them all, each with its own key/value pairs. For example:

  • effects = { ["Persuasive"] = 2, ["Scandal"] = -1 }

Notes:

 * Quality names are case-sensitive.
 * The order of effects is irrelevant. For each item, the selected quality will be printed
   first, followed by all the others, sorted according to their effect level (menaces last).

If the item has qualifiers, the <qualifiers list> will list them as a flat list. For example:

  • qualifiers = { "Rose", "Retired", "Fate" }

Notes:

 * Qualifier names are also case-sensitive.
 * "Fate" and "Retired" will always be printed last. 
 * If the qualifier is not of a value known by the module, it will be printed as-is.
 * Known qualifiers will be printed with special formatting. The list is below,
   under "local display_qualifier". The values basically include all Profession names,
   all Ambition names, all Faction names, all Seasonal event names, all Kickstarter
   reward names, as well as "Fate", "Retired", "Mood", "Protege", "Connected Pet",
   "Knife & Candle", "SMEN", and "Mysteries".