Template:ItemCard: Difference between revisions

From Blue Archive Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
(Support quantity)
Line 10: Line 10:
|format=list
|format=list
|no html
|no html
}} }} }}{{#vardefine:Icon | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|0}} }}{{#vardefine:Name | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|1}} }}{{#vardefine:Category | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|2}} }}{{#vardefine:Rarity | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|3}} }}{{#vardefine:Page | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|4}} }}{{#ifeq:{{{text|+}}}|{{{text|-}}} | {{#vardefine:DisplayName | {{{text|}}} }} | {{#vardefine:DisplayName | {{#var:Name}} }} }}{{#if: {{#var:block_output}} | <span class="itemcard-block {{#if: {{{quantity|}}} | quantity}}" style="width:{{{2|32px}}}"><span> }}{{#if: {{{quantity|}}} | <span class="item-quantity">{{#ifexpr: {{{quantity|}}} < 10000 | {{{quantity|}}} | {{#ifexpr: {{{quantity|}}} < 1000000 | {{#expr: {{{quantity|}}}/1000 round 0 }}k | {{#expr: {{{quantity|}}}/1000000 round 1 }}M }} }}</span> }}{{#if: {{#var:block_output}} | {{#ifeq: {{#var:Category}} | Oopart | <span class="item-tier">T{{#expr: {{#var:Rarity}} + 1 }}</span> |}} }}[[File:{{#var:Icon}}|{{{2|32px}}}|{{#if: {{#var:DisplayName}} | {{#var:DisplayName}} | {{#var:Name}} }}|link={{#var:Page}}|class=itemcard]]{{#if: {{#var:block_output}} | </span> }}{{#if: {{#var:DisplayName}} | [[{{#var:Page}}|{{#var:DisplayName}}]] }}{{#if: {{#var:block_output}} | </span> }}{{#vardefine:block_output | }}{{#vardefine:Name | }}{{#vardefine:Icon | }}{{#vardefine:Category | }}{{#vardefine:Rarity | }}{{#vardefine:Page | }}{{#vardefine:DisplayName | }}</includeonly><noinclude>
}} }} }}{{#vardefine:Icon | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|0}} }}{{#vardefine:Name | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|1}} }}{{#vardefine:Category | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|2}} }}{{#vardefine:Rarity | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|3}} }}{{#vardefine:Page | {{#explode:{{#var:itemdata_{{{1|}}}}}|{{!}}|4}} }}{{#ifeq:{{{text|+}}}|{{{text|-}}} | {{#vardefine:DisplayName | {{{text|}}} }} | {{#vardefine:DisplayName | {{#var:Name}} }} }}{{#if: {{#var:block_output}} | <span class="itemcard-block {{#if: {{{quantity|}}} | quantity}} {{#if: {{{probability|}}} | probability}}" style="width:{{{2|32px}}}"><span> }}{{#if: {{{quantity|}}} | <span class="item-quantity">{{#ifexpr: {{{quantity|}}} < 10000 | {{{quantity|}}} | {{#ifexpr: {{{quantity|}}} < 1000000 | {{#expr: {{{quantity|}}}/1000 round 0 }}k | {{#expr: {{{quantity|}}}/1000000 round 1 }}M }} }}</span> }}{{#if: {{{probability|}}} | <span class="item-probability {{#ifexpr: {{{probability|}}} > 30 and {{{probability|}}} <= 50 | opacity-90 }}{{#ifexpr: {{{probability|}}} <= 30 | opacity-70 }}">{{{probability|}}}%</span> }}{{#if: {{#var:block_output}} | {{#ifeq: {{#var:Category}} | Oopart | <span class="item-tier">T{{#expr: {{#var:Rarity}} + 1 }}</span> |}} }}[[File:{{#var:Icon}}|{{{2|32px}}}|{{#if: {{#var:DisplayName}} | {{#var:DisplayName}} | {{#var:Name}} }}|link={{#var:Page}}|class=itemcard]]{{#if: {{#var:block_output}} | </span> }}{{#if: {{#var:DisplayName}} | [[{{#var:Page}}|{{#var:DisplayName}}]] }}{{#if: {{#var:block_output}} | </span> }}{{#vardefine:block_output | }}{{#vardefine:Name | }}{{#vardefine:Icon | }}{{#vardefine:Category | }}{{#vardefine:Rarity | }}{{#vardefine:Page | }}{{#vardefine:DisplayName | }}</includeonly><noinclude>
Outputs an image of the item that links back to its page.
Outputs an image of the item that links back to its page.
==Usage==
==Usage==
Line 17: Line 17:
*<code>32px</code>: image size with statement format corresponding to MediaWiki File size style (''32px'' for set width, ''x32px'' for set height, ''32x32px'' for arbitrary scaling); should be a width only value if using <code>block</code> output
*<code>32px</code>: image size with statement format corresponding to MediaWiki File size style (''32px'' for set width, ''x32px'' for set height, ''32x32px'' for arbitrary scaling); should be a width only value if using <code>block</code> output
*<code>text</code>: alternative item name to display. Use <code>text=</code> to disable text output entirely
*<code>text</code>: alternative item name to display. Use <code>text=</code> to disable text output entirely
*<code>quantity</code>: ''EXPERIMENTAL'' prefix the item icon with a quantity, intended for inline use with default size
*<code>quantity</code>: display quantity
*<code>probability</code>: ''EXPERIMENTAL'' display probability, intended for block use
*<code>block</code>: display card as a block element the width of the icon, with item name underneath
*<code>block</code>: display card as a block element the width of the icon, with item name underneath
==Examples==
==Examples==

Revision as of 16:53, 19 November 2022

Outputs an image of the item that links back to its page.

Usage

{{ItemCard|Name[|32px[|text=AltName][|block]][|quantity=1]}}

Options

  • 32px: image size with statement format corresponding to MediaWiki File size style (32px for set width, x32px for set height, 32x32px for arbitrary scaling); should be a width only value if using block output
  • text: alternative item name to display. Use text= to disable text output entirely
  • quantity: display quantity
  • probability: EXPERIMENTAL display probability, intended for block use
  • block: display card as a block element the width of the icon, with item name underneath

Examples

Teddy Bear with BowTeddy Bear with Bow

Wavecat PillowWavecat Pillow

AltNameAltName

Wavecat PillowWavecat Pillow

95Teddy Bear with BowTeddy Bear with Bow