Module:FetchItemStats/doc

This is an old revision of this page, as edited by Eq (talk | contribs) at 13:38, 12 October 2024 (Created page with "{{documentation}} This module provides three functions that make obtaining an item's information easier. {{Helper module |name = FetchItemStats |fname1 = defaultVersion(pagename) |ftype1 = String, String |fuse1 = Returns a string of the default version (format: <code>Pagename#Versionname</code>) that can be used for further SMW searches. Also returns a wikilink to the matched page name (following redirects from the given <code>pagename</code>, as the second return valu..."). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the documentation page for Module:FetchItemStats

This is a documentation subpage for Module:FetchItemStats.
It contains usage information, categories, and other content that is not part of the original module page.
Module:FetchItemStats requires Module:Exchange.
Module:FetchItemStats requires Module:Yesno.
Module:FetchItemStats is required by Module:Equipment.

This module provides three functions that make obtaining an item's information easier.

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

FunctionTypeUse
defaultVersion(pagename)String, StringReturns a string of the default version (format: Pagename#Versionname) that can be used for further SMW searches. Also returns a wikilink to the matched page name (following redirects from the given pagename, as the second return value.
value(item_smwname)NumberReturns the item value for either the specified SMW version (if the given name links to a specific item), or the version that is shown on the page by default (the same version as returned by defaultVersion.
equipmentStats(
{item1_smwname, ...},
{sort_key1, ...},
{sort_order1, ...}
)
{ Table1, Table2, ... }Fetches all item stats for a list of given SMW names. If an ambiguous item name is given anywhere in this list (i.e. one that has different versions), this function will not automatically pick the one that would otherwise be chosen by defaultVersion. A specific SMW name needs to be entered for this function.

Sort keys and sort orders may be provided as optional second and third arguments. No custom sorting will be applied if these arrays are empty or nil. Note that Semantic MediaWiki queries automatically sort the output pages based on alphabetical pagename order. If no sorting should be applied whatsoever, set sort_key1 to something recognised as being falsy (e.g. {'no'}).

Possible sorting orders are: 'ascending', 'asc', 'descending', 'desc', 'reverse', 'random' and 'rand'.

The returned stats are formatted as a Table containing a single Table for each of the items, in the order given by the sort keys, or the default SMW sorting. The stats that are returned in each of these Tables are:

{
    astab  = 'Stab attack bonus',
    aslash = 'Slash attack bonus',
    acrush = 'Crush attack bonus',
    amagic = 'Magic attack bonus',
    arange = 'Range attack bonus',
    dstab  = 'Stab defence bonus',
    dslash = 'Slash defence bonus',
    dcrush = 'Crush defence bonus',
    dmagic = 'Magic defence bonus',
    drange = 'Range defence bonus',
    str    = 'Strength bonus',
    mdmg   = 'Magic Damage bonus',
    rstr   = 'Ranged Strength bonus',
    prayer = 'Prayer bonus',
    weight = 'Weight',
    image  = 'Image',
    subobj = 'Has subobject'
}