From Arms of God Wiki

bot: universal template Iconbox
 
bot: Iconbox category-first signature; icons from source records
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div class="wm-iconbox" style="display:inline-block; text-align:center; vertical-align:top; margin:2px; padding:4px;{{#if:{{{maxwidth|}}}|max-width:{{{maxwidth}}};}}"><!--
<includeonly>{{#invoke:Iconbox|render|{{{1|}}}|{{{2|}}}|{{{3|}}}|mode={{{mode|}}}|size={{{size|24}}}}}</includeonly><noinclude>
IMAGE
-->{{#if:{{{nolink|}}}|<!--
no link wrap
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|48px}}}]]<!--
-->|<!--
linked
-->[[File:{{{image|{{{name|{{{1|}}}}}}}}}.png|{{{size|48px}}}|link={{{name|{{{1|}}}}}}]]<!--
-->}}{{#if:{{{amount|}}}|<sup class="wm-iconbox__amount" style="margin-left:-1em; background:rgba(0,0,0,0.6); color:#fff; padding:0 4px; border-radius:3px;">{{{amount}}}</sup>}}{{#if:{{{rarity|}}}|<span class="wm-iconbox__rarity cr-{{{rarity}}}"></span>}}<!--
CAPTION (default = name; "no" = hide; other = override)
-->{{#ifeq:{{{caption|}}}|no||<br/>{{#if:{{{nolink|}}}|<strong>{{{caption|{{{name|{{{1|}}}}}}}}}</strong>|[[{{{name|{{{1|}}}}}}|<strong>{{{caption|{{{name|{{{1|}}}}}}}}}</strong>]]}}}}<!--
--></div></includeonly><noinclude>
== Usage ==
== Usage ==
Atomic icon + caption + link cell. Cleaned generic version of the Brotato Iconbox pattern (see <code>library/Template_Iconbox.md</code>). The Brotato source has 200 lines of nested <code>#if</code> calling Brotato-specific helper templates (<code>GetRarity</code>, <code>GetDLCStatus</code>, <code>DLCBadge</code>); this version drops those and exposes their data as explicit params (<code>rarity</code>) instead.
Renders an entity's small icon plus its linked display name. Icons are read from the entity's own record in <code>Data:&lt;Category&gt;.json</code> at render time via [[Module:Iconbox]] (no icon lookup table).


<code><nowiki>{{Iconbox|Topaz_Brooch|size=32px|amount=3|rarity=common}}</nowiki></code>
'''Category-first form (preferred — single-category lookup, collision-safe):'''
* <code><nowiki>{{Iconbox|Weapon|Cutter}}</nowiki></code> — icon plus the linked display name.
* <code><nowiki>{{Iconbox|Weapon|Cutter|icononly}}</nowiki></code> — just the linked icon glyph (also <code>mode=icon</code>).
* <code><nowiki>{{Iconbox|Blessing|Sanctified Halo|size=32}}</nowiki></code> — bigger icon.
Category accepts singular or plural: Weapon, Character, Blessing, Upgrade, Crux, Passive, Enemy, Achievement, Codex, Tag.


Params:
'''Bare-name fallback (cross-category scan; first matching category wins):'''
* <code>1</code> / <code>name</code> — entity name (also used as image filename + link target by default).
* <code><nowiki>{{Iconbox|Cutter}}</nowiki></code> / <code><nowiki>{{Iconbox|Cutter|icononly}}</nowiki></code>
* <code>image</code> — override image filename (without .png extension).
 
* <code>size</code> — image size (default 48px).
Entities without staged art degrade gracefully: the default mode renders the plain page link, icon-only mode renders nothing.
* <code>amount</code> — small number overlay in the corner (e.g. stack count).
* <code>rarity</code> — slug matching a <code>.cr-{slug}</code> class from <code>MediaWiki:Common.css</code>. Renders a colored dot next to the icon.
* <code>caption</code> — override caption text. <code>no</code> hides the caption.
* <code>nolink</code> — set to <code>1</code> to suppress the wiki link.
* <code>maxwidth</code> — CSS max-width constraint.


<templatedata>
<templatedata>
{
{
   "description": "Atomic icon + caption + link cell. Inline gallery / list rendering.",
   "description": "Entity icon + linked display name, read from the entity's source record at render time.",
   "params": {
   "params": {
     "1": {"aliases": ["name"], "label": "Name (image + link target by default)", "required": true},
     "1": {"label": "Category (Weapon/Blessing/...) or bare entity name", "required": true},
     "image": {"label": "Override image filename (without .png)"},
     "2": {"label": "Entity name (category-first form), or mode for the bare form"},
    "size": {"label": "Image size", "example": "48px"},
     "3": {"label": "Mode: 'icononly' for just the glyph (category-first form)"},
     "amount": {"label": "Number overlay (stack count, quantity)", "type": "number"},
     "size": {"label": "Icon size in px", "default": "24"}
    "rarity": {"label": "Rarity slug (matches .cr-<slug> in Common.css)"},
     "caption": {"label": "Caption override ('no' to hide)"},
    "nolink": {"label": "Suppress wiki link (1 to enable)", "type": "boolean"},
    "maxwidth": {"label": "Max-width CSS constraint"}
   },
   },
   "paramOrder": ["1", "size", "amount", "rarity", "image", "caption", "nolink", "maxwidth"]
   "paramOrder": ["1", "2", "3", "size"]
}
}
</templatedata>
</templatedata>
[[Category:Universal templates]]
[[Category:Universal templates]]
</noinclude>
</noinclude>

Latest revision as of 08:29, 10 June 2026

Usage

Renders an entity's small icon plus its linked display name. Icons are read from the entity's own record in Data:<Category>.json at render time via Module:Iconbox (no icon lookup table).

Category-first form (preferred — single-category lookup, collision-safe):

  • {{Iconbox|Weapon|Cutter}} — icon plus the linked display name.
  • {{Iconbox|Weapon|Cutter|icononly}} — just the linked icon glyph (also mode=icon).
  • {{Iconbox|Blessing|Sanctified Halo|size=32}} — bigger icon.

Category accepts singular or plural: Weapon, Character, Blessing, Upgrade, Crux, Passive, Enemy, Achievement, Codex, Tag.

Bare-name fallback (cross-category scan; first matching category wins):

  • {{Iconbox|Cutter}} / {{Iconbox|Cutter|icononly}}

Entities without staged art degrade gracefully: the default mode renders the plain page link, icon-only mode renders nothing.

Entity icon + linked display name, read from the entity's source record at render time.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Category (Weapon/Blessing/...) or bare entity name1

no description

Unknownrequired
Entity name (category-first form), or mode for the bare form2

no description

Unknownoptional
Mode: 'icononly' for just the glyph (category-first form)3

no description

Unknownoptional
Icon size in pxsize

no description

Default
24
Unknownoptional