Template:Infobox Bonuses/doc

From Old School Near-Reality Wiki
Jump to navigation Jump to search
Information icon-grey.png
This is a documentation subpage for Template:Infobox Bonuses.
It contains usage information, categories, and other content that is not part of the original template page.
Template:Infobox Bonuses invokes function main in Module:Infobox Bonuses using Lua.

Template used to insert Infobox Bonuses on a page.

Where to use:

  • Items that are equipable and obtainable (or have been). This means discontinued items are fine. Equippable fun weapons are also fine.

Unobtainable items]]; that's items that have been proposed or only exists in the game's cache and never made it into the game. You are encouraged to add the 'smw = No' parameter here.

Where not to use:

  • Fun weapons that can not be equipped, like for instance Diango's claws.


Standard infobox parameters

This infobox uses Module:Infobox, which provides a number of standard parameters.

Versioning

This infobox supports switching between multiple versions. Each version needs to have a name defined in a parameter called version#, numbered sequentially starting from 1. For all parameters that have different values, a number can be appended to the end of each parameter name to define the value for each version. Parameters without a version number will be shared between all versions.

For example, if the name of version 2 is called "Bob", you should define |name2 = Bob.

Linking

You can link to a page and have an alternative infobox appear by using a hash value, as if you were linking to a section. The hash value is the version name, as defined by the relevant version# parameter. For example, to link to the variant of a switch infobox with |version3 = Quest, you can use [[Example#Quest]].

Alternative versions are not visible or accessible when Javascript is disabled.

defver

If defver is defined, the infobox will switch to the specified version when the page is loaded. For example, |defver = 4 will automatically select the 4th infobox version.

smwname

This overrides the name of the Semantic MediaWiki subobject that the infobox will set the parameters into. By default, an infobox with multiple versions will save properties into subobjects with the same name as the version name. This parameter only needs to be set if the version name is different from the desired subobject name, or if an unversioned infobox needs to set properties of a specific subobject (for example, when versioned and unversioned infoboxes of different types, like Item and Bonuses, are used on the same page).

This is necessary when a version name would otherwise be an invalid SMW subobject name. The value of smwname is also not permitted to be an invalid subobject name. A subobject name must not violate the following rules:

  • The first 5 characters of the name must not contain a period (.).
  • The name must not be the number zero (0).
  • The name must not be the empty string.


If the infobox does not have multiple versions, SMW properties would normally be set on the page itself. Setting smwname overrides this default behaviour and the properties will be only be set to the specified subobjects and not the page itself.

Multiple subobjects can be specified by separating the subobject names with the broken bar character (¦). The properties will be set in all of the subobjects specified.

For example, if the infobox has |version2 = H.A.M. member, this would cause an invalid subobject name due to having a period within the first 5 characters. The infobox should therefore override the smwname using |smwname2 = HAM member or something similar.

Suppressing SMW

Setting |smw = No will suppress all SMW output for the infobox.

Setting |smwX = No will suppress all SMW output for version number X.

__dump__

This parameter is used only for debugging an infobox. If __dump__ is present with any value then a string version of the infobox object is dumped to the page, rather than displaying the infobox as normal. This should only be used when previewing the page and must never be saved in a mainspace page. Setting this adds Category:Dumping infoboxes to the page.

Specifically, this shows the result at the time the infobox is converted to a string. This will always occur when the module finally returns, but may instead occur earlier in the code. The object is dumped using mw.dumpObject(box). Dumping will not prevent a script error occurring.


Usage

{{Infobox Bonuses
|astab = 
|aslash = 
|acrush = 
|amagic = 
|arange = 
|dstab = 
|dslash = 
|dcrush = 
|dmagic = 
|drange = 
|str = 
|rstr = 
|mdmg = 
|prayer = 
|slot = 
|speed = 
|attackrange = 
|combatstyle = 
|image = 
|caption = 
}}

Example

Attack icon.png Attack bonusesERRERR
White dagger.pngWhite scimitar.pngWhite warhammer.pngMagic icon.pngRanged icon.png
+7+45-2+0+0
Defence icon.png Defence bonuses
White dagger.pngWhite scimitar.pngWhite warhammer.pngMagic icon.pngRanged icon.png
+0+1+0+0+0
File:Melee.png Other bonusesSlot
Strength icon.pngRanged Strength icon.pngMagic Damage icon.pngPrayer icon.pngFile:Weapon slot.png
+44+0+0%+0List
Attack speedRange
File:Monster attack speed 4.png1
square

Parameters

Parameter Description Required
astab Stab attack yes
aslash Slash attack yes
acrush Crush attack yes
amagic Magic attack yes
arange Ranged attack yes
dstab Stab defence yes
dslash Slash defence yes
dcrush Crush defence yes
dmagic Magic defence yes
drange Ranged defence yes
str Strength bonus yes
rstr Ranged strength (ranged ammo) yes
mdmg Magic damage bonus yes
prayer Prayer bonus yes
slot Slot the item is worn in. Must be one of [head, weapon, body, legs, shield, cape, 2h, hands, feet, neck, ammo, ring]. yes
speed Speed of the weapon. Omit if not a weapon, or set to 'N/A' if the weapon can not attack. no
attackrange Attack range of the weapon. Omit if not a weapon, or set to 'No' if the weapon can not attack. Set to 'staff' for weapons with melee attack range 1 but spell cast range 10. no
combatstyle Combat style of the weapon. Required if item is a weapon. See Template:CombatStyles for a list of possible values. no
image Image of a player wielding the item. no
caption Caption for the image. no
altimage Alternate image, used for items that vary on male/female character models or items that need multiple angles to show all detail. no
altcaption Caption for the alternate image. no