Module:FetchItemStats/doc: Difference between revisions
(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...") |
No edit summary Tag: Manual revert |
(One intermediate revision by the same user not shown) | |
(No difference)
|
Latest revision as of 11:22, 17 October 2024
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.
Function | Type | Use |
---|---|---|
defaultVersion(pagename) | String, String | Returns 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) | Number | Returns 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( | { 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 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' } |