Template:Infobox: Difference between revisions
Appearance
imported>Nebulous Maestress Option#2 for edibility calls: switch to better format using new template feature |
imported>Nebulous Maestress Option #3: full revamp with most processing moved to Infosection_price |
||
| Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
-->{{#arraydefine: | // TRANSLATIONS | ||
-->{{#arraydefine: | // Essentially any text that gets displayed on the page should be defined here to make it easier to | ||
// port this template to other languages | |||
| | // If the text should be a link, provide entire link as part of the definition | ||
// NOTE: text displayed in infobox that is NOT defined here is generated by subtemplate | |||
-->{{#arraydefine:$lang_information | Information }}<!-- | |||
-->{{#arraydefine:$lang_source | Source }}<!-- | |||
-->{{# | -->{{#arraydefine:$lang_foundin | Found in }}<!-- | ||
-->{{# | -->{{#arraydefine:$lang_seed | Seed }}<!-- | ||
-->{{#switch: {{NAMESPACE}} | -->{{#arraydefine:$lang_growthtime | Growth Time }}<!-- | ||
|{{ns:User}}|{{ns:User talk}}= | -->{{#arraydefine:$lang_buffs | Buff(s) }}<!-- | ||
-->{{#arraydefine:$lang_buffduration | Buff Duration }}<!-- | |||
-->{{#arraydefine:$lang_fishingxp | Fishing XP }}<!-- | |||
-->{{#arraydefine:$lang_season | Season }}<!-- | |||
-->{{#arraydefine:$lang_healingeffect | Healing Effect }}<!-- | |||
-->{{#arraydefine:$lang_artisangoods | Artisan Goods }}<!-- | |||
-->{{#arraydefine:$lang_crafting | Crafting }}<!-- | |||
-->{{#arraydefine:$lang_recipesource | Recipe Source }}<!-- | |||
-->{{#arraydefine:$lang_equipment | Equipment }}<!-- | |||
-->{{#arraydefine:$lang_processingtime| Processing Time }}<!-- | |||
-->{{#arraydefine:$lang_timetocraft | Time to Craft }}<!-- | |||
-->{{#arraydefine:$lang_ingredients | Ingredients }}<!-- | |||
-->{{#arraydefine:$lang_trapper_ingredients | Trapper Profession Ingredients }}<!-- | |||
-->{{#arraydefine:$lang_produces | Produces }}<!-- | |||
-->{{#arraydefine:$engl_artisangoods | Artisan Goods }}<!-- | |||
// TODO: finalize how to handle test "does {{{source}}} contain artisan good"? | |||
// Primarily need to check whether it's OK that the english test now looks at plural (artisan goods) -- because that's | |||
// a term that's already being translated. If necessary, switch some pages to explicitly set is_artisan flag | |||
-->{{#arraydefine:$is_artisan|{{#if:{{{is_artisan|}}} | |||
| {{#ifeq:{{{is_artisan|}}}|0|{{{is_artisan}}}}} | |||
| {{#ifexpr: {{#pos:{{lc:{{{source|}}}}}|{{lc:{{#arrayprint:$lang_artisangoods}}}}|1}} or {{#pos:{{lc:{{{source|}}}}}|{{lc:{{#arrayprint:$engl_artisangoods}}}}|1}} |1}} | |||
}}}}<!-- | |||
// END of translations | |||
// Initialize array variables | |||
-->{{#arraydefine:$image_list|{{{image|}}}, {{{image2|}}}, {{{image3|}}}, {{{image4|}}}|,|unique}}<!-- | |||
// If no images provided, fill in default names -- but default is different on english wiki than other wikis | |||
-->{{#ifexpr:{{#arraysize:$image_list}}<1|{{#arraydefine:$image_list|{{#ifeq:{{CONTENTLANG}}|en|{{PAGENAME}}|{{{eng|}}}}}}}}}<!-- | |||
-->{{#arraydefine:$quality|{{ParseInputQuality|quality={{{quality|}}}|iridium={{{iridium|}}}|hide={{{hide|}}}}}}}<!-- | |||
-->{{#switch: {{NAMESPACE}} | |||
|{{ns:User}}|{{ns:User talk}}= | |||
|#default=<div id="infoboxborder"> | |#default=<div id="infoboxborder"> | ||
{{{!}} id="infoboxtable" | {{{!}} id="infoboxtable" | ||
{{!}}colspan="2" id="infoboxheader"{{!}}{{{name|{{PAGENAME}}}}} | {{!}}colspan="2" id="infoboxheader"{{!}}{{{name|{{PAGENAME}}}}} | ||
{{!}}- | {{!}}- | ||
{{!}}colspan="2" style="padding-bottom:5px; text-align: center;"{{!}}{{# | {{!}}colspan="2" style="padding-bottom:5px; text-align: center;"{{!}}<!-- | ||
// Print all images by looping through all entries in $image_list array | |||
-->{{#arrayprint:$image_list||@image@|<!-- | |||
// Add spacing after first image if requested | |||
-->{{#ifexpr:{{#iferror:{{#expr:{{#arraysearch:@image@}}>0}}|0}} and {{#if:{{{image2spacing|}}}|1|0}} |   }}<!-- | |||
// If image appears to already have a .png/.gif/.jpg/etc extension (i.e., if 4th-last character is .), don't want to add .png extension | |||
-->{{#ifeq:{{#sub:@image@|-4|1}}|. | |||
| {{#ifexist:Media:@image@|[[File:@image@]]}} | |||
| {{#ifexist:Media:@image@_{{uc:{{CONTENTLANG}}}}.png | |||
| [[File:@image@_{{uc:{{CONTENTLANG}}}}.png]] | |||
| {{#ifexist:Media:@image@.png| [[File:@image@.png]]}} | |||
}}}}}}<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}colspan="2" id="infoboxdetail" style="text-align: center; font-style: italic;"{{!}}{{#if:{{{description|}}}|{{{description|}}}|{{Description|{{PAGENAME}}}}}} | {{!}}colspan="2" id="infoboxdetail" style="text-align: center; font-style: italic;" {{!}} {{#if:{{{description|}}}|{{{description|}}}|{{Description|{{PAGENAME}}}}}} | ||
{{!}}- | {{!}}- | ||
{{!}}colspan="2" id="infoboxsection" style="text-align:center;"{{!}} | {{!}}colspan="2" id="infoboxsection" style="text-align:center;" {{!}} {{#arrayprint:$lang_information}} {{#if:{{{source|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_source}}: | ||
{{!}}id="infoboxdetail"{{!}}{{#ifexist:{{{source|}}}|[[{{{source|}}}]]|{{{source|}}}}} | {{!}} id="infoboxdetail" {{!}} {{#ifexist:{{{source|}}}|[[{{{source|}}}]]|{{{source|}}}}} | ||
}}{{#if:{{{location|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_foundin}}: | ||
{{!}}id="infoboxdetail"{{!}}{{#ifexist:{{{location|}}}|[[{{{location|}}}]]|{{{location|}}}}} | {{!}} id="infoboxdetail" {{!}} {{#ifexist:{{{location|}}}|[[{{{location|}}}]]|{{{location|}}}}} | ||
}}{{#if:{{{seed|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_seed}}: | ||
{{!}}id="infoboxdetail"{{!}}{{#ifexist:{{{seed|}}}|[[{{{seed|}}}]]|{{{seed|}}}}} | {{!}} id="infoboxdetail" {{!}} {{#ifexist:{{{seed|}}}|[[{{{seed|}}}]]|{{{seed|}}}}} | ||
}}{{#if:{{{growth|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_growthtime}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{growth|}}} | {{!}} id="infoboxdetail" {{!}} {{{growth|}}} | ||
}}{{#if:{{{buff|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_buffs}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{buff|}}} | {{!}} id="infoboxdetail" {{!}} {{{buff|}}} | ||
}}{{#if:{{{buffduration|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_buffduration}}: | ||
{{!}}id="infoboxdetail"{{!}}{{duration|{{{buffduration|}}}}} | {{!}} id="infoboxdetail" {{!}} {{duration|{{{buffduration|}}}}} | ||
}}{{#if:{{{season|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_season}}: | ||
{{!}}id="infoboxdetail"{{!}}{{ | {{!}} id="infoboxdetail" {{!}} {{Season|{{{season}}}}} | ||
}}{{#if:{{{fishingxp|}}}|<nowiki /> | |||
{{!}}- | |||
{{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_fishingxp}}: | |||
{{!}} id="infoboxdetail" {{!}} {{{fishingxp|}}} | |||
}}{{#if:{{{edibility|}}}|<nowiki/> | |||
{{!}}- | |||
<!-- | |||
// Display edibility. Use two-column format when many values: only if multiple qualities requested. But not if poison/inedible/0 | |||
-->{{#ifexpr:{{#arraysize:$quality}}>1 and {{#iferror:{{#expr:{{{edibility|0}}}>0|0|1}}|0}} |<nowiki/> | |||
{{!}} id="infoboxsection" colspan="2" style="text-align: center;" {{!}} {{#arrayprint:$lang_healingeffect}} | |||
{{!}}- | |||
{{!}} id="infoboxdetail" {{!}} {{Edibility |{{{edibility|}}} |quality={{#arrayprint:$quality}} |statistics=Energy}} | |||
{{!}} id="infoboxdetail" {{!}} {{Edibility |{{{edibility|}}} |quality={{#arrayprint:$quality}} |statistics=Health}} | |||
|<nowiki/> | |||
{{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_healingeffect}}: | |||
{{!}} id="infoboxdetail" {{!}} {{Edibility |{{{edibility|}}} |quality={{#arrayprint:$quality}}}} | |||
}}}}<!-- | }}}}<!-- | ||
-->{{#if:{{{ | |||
{{ | // Display all item prices: Base price plus all professions listed in {{{profession}}} | ||
// Subtemplate automatically decides how to handle multiple columns, etc. | |||
{{ | -->{{Infosection price | ||
| profession = Base {{#if:{{{profession|}}} |, {{{profession|}}}}} | |||
| sellitem = {{{eng|{{{name|{{PAGENAME}}}}}}}} | |||
{{ | | alt_sellitem = {{{name|{{PAGENAME}}}}} | ||
| sellprice = {{{sellprice|}}} | |||
{{ | | quality = {{#arrayprint:$quality}} | ||
{{ | }}<!-- | ||
{{ | // Add display of products and their prices. | ||
// artisanitem is new parameter, that eventually should be able to move alot of the single-item-case data | |||
{{ | // onto the individual article pags. | ||
{{ | // If artisanitem provided, use it to generate the infosection. Otherwise, fallback to old-style manual switch | ||
{{ | -->{{#if:{{{artisanitem|}}} | ||
| {{Infosection price | |||
| profession = {{#if:{{{artisanprofession|}}}| {{{artisanprofession}}} | Base,Artisan}} | |||
}} | | artisan = true | ||
{{ | | sourceprice = {{{sellprice|}}} | ||
| | | sellitem = {{{artisanitem}}} | ||
| lang_sellitem = {{{lang_artisanitem|}}} | |||
| sellprice = {{{artisanprice|}}} | |||
| quality = {{{artisanquality|}}} | |||
}}<-- | |||
// Manually define various artisanitem sections | |||
// One key reason to move these details onto the individual infobox pages is for sake of translation -- so that language-specific | |||
// translations of sellitem can be provided outside of template namespace. | |||
// (Infosection price will recognize some key item names, such as Wine, Juice, Jelly, Pickles, but doing more than that is insane) | |||
--> | |||
| | | {{#switch:{{lc:{{{type|{{{eng|{{PAGENAME}}}}}}}}}} | ||
|sunflower = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Oil |sellprice=100 |quality=normal}} | |||
|hops = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Pale Ale,Pickles |sellprice=300,}} | |||
|wheat = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Beer,Pickles |sellprice=200,}} | |||
|honey = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Mead |sellprice=200 |iridium=true}} | |||
|corn = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Juice,Pickles,Oil|sellprice=,,100|quality=normal}} | |||
|tea leaves={{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Green Tea,Pickles|sellprice=100, |quality=normal}} | |||
|fruit | |||
|fruits = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Wine,Jelly | iridium=true}} | |||
|vegetables | |||
|vegetable = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Juice,Pickles | iridium=true}} | |||
| | |truffle = {{Infosection price|profession=base,artisan|artisan=true|sourceprice={{{sellprice|}}}|sellitem=Truffle Oil|sellprice=1065|quality=normal}} | ||
|milk = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Cheese |sellprice=230|iridium=true}} | |||
|large milk= {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Cheese |sellprice=230|iridium=true|hide=normal,silver}} | |||
|goat milk = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Goat Cheese |sellprice=400|iridium=true}} | |||
|large goat milk = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Goat Cheese |sellprice=400|iridium=true|hide=normal,silver}} | |||
|wool = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Cloth |sellprice=470|quality=normal}} | |||
|duck egg = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Duck Mayonnaise |sellprice=375|quality=normal}} | |||
|egg = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Mayonnaise |sellprice=190|quality=normal}} | |||
|dinosaur egg= {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Dinosaur Mayonnaise |sellprice=800|quality=normal}} | |||
|large egg = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Mayonnaise |sellprice=190|hide=normal,silver}} | |||
|void egg = {{Infosection price|profession=base,rancher,artisan|artisan=true|sellitem=Void Mayonnaise |sellprice=275|quality=normal}}<!-- | |||
// Add artisan sections to generic item pages. Again, shouldn't be necessary any more once profession is added to original article | |||
--> | |||
|wine | |||
|juice = {{#if:{{{profession|}}}||{{Infosection price|profession=artisan|sellitem={{{name|{{PAGENAME}}}}}|sellprice={{{sellprice|}}}|quality=normal}}}} | |||
|aged roe = {{#if:{{{profession|}}}||{{Infosection price|profession=artisan|sellitem={{{name|{{PAGENAME}}}}}|sellprice={{{sellprice|}}}|quality=normal}} | |||
}}}}}}{{#if:{{{ingredients|}}}|<nowiki/> | |||
{{!}}- | {{!}}- | ||
{{!}} | {{!}} colspan="2" id="infoboxsection" style="text-align: center;" {{!}} {{#if:{{#arrayprint:$is_artisan}} | {{#arrayprint:$lang_artisangoods}} | {{#arrayprint:$lang_crafting}} }} | ||
{{ | |||
| | |||
}}{{#if:{{{recipe|}}}|<nowiki/> | }}{{#if:{{{recipe|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_recipesource}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{recipe|}}} | {{!}} id="infoboxdetail" {{!}} {{{recipe|}}} | ||
}}{{#if:{{{craftingstation|}}}|<nowiki/> | }}{{#if:{{{craftingstation|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_equipment}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{craftingstation|}}} | {{!}} id="infoboxdetail" {{!}} {{{craftingstation|}}} | ||
}}{{#if:{{{crafttime|}}}|<nowiki/> | }}{{#if:{{{crafttime|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection" class="no-wrap"{{!}}{{#if:{{# | {{!}} id="infoboxsection" class="no-wrap" {{!}} {{#if:{{#arrayprint:$is_artisan}} | {{#arrayprint:$lang_processingtime}} | {{#arrayprint:$lang_timetocraft}} }} | ||
{{!}}id="infoboxdetail"{{!}}{{duration|{{{crafttime|}}}}} | {{!}} id="infoboxdetail" {{!}} {{duration|{{{crafttime|}}}}} | ||
}}{{#if:{{{ingredients|}}}|<nowiki/> | }}{{#if:{{{ingredients|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_ingredients}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{ingredients|}}} | {{!}} id="infoboxdetail" {{!}} {{{ingredients|}}} | ||
}} | }}{{#if:{{{tingredients|}}}|<!-- | ||
{{!}}- | |||
{{!}}id="infoboxsection"{{!}}[[File:Trapper.png|24px|link=]] | //Trapper Profession ingredients for Crab Pot | ||
{{!}}id="infoboxdetail"{{!}}{{{tingredients|}}} | --><nowiki/> | ||
{{!}}- | |||
{{!}} id="infoboxsection" {{!}} [[File:Trapper.png|24px|link=]] {{#arrayprint:$lang_trapper_ingredients}}: | |||
{{!}} id="infoboxdetail" {{!}} {{{tingredients|}}} | |||
}}{{#if:{{{produces|}}}|<nowiki/> | }}{{#if:{{{produces|}}}|<nowiki/> | ||
{{!}}- | {{!}}- | ||
{{!}}id="infoboxsection"{{!}} | {{!}} id="infoboxsection" {{!}} {{#arrayprint:$lang_produces}}: | ||
{{!}}id="infoboxdetail"{{!}}{{{produces|}}} | {{!}} id="infoboxdetail" {{!}} {{{produces|}}} | ||
}} | }}<nowiki/> | ||
{{!}}}{{InfoboxSEO}}{{#seo: | {{!}}}{{InfoboxSEO}}{{#seo: | ||
|og:image={{#if:{{{image|}}}|{{filepath:{{{image|}}}}}}} | |og:image={{#if:{{{image|}}}|{{filepath:{{{image|}}}}}}} | ||
}}</div>}}</includeonly><noinclude>< | }}</div>}}</includeonly><noinclude>{{Englishdoc}}{{#ifexist:{{FULLPAGENAME}}/doc |<nowiki/> | ||
{{{{FULLPAGENAME}}/doc}} }}</noinclude> | |||
Revision as of 04:42, 4 September 2020
Description
This template displays a generic infobox for a wide variety of items. Do not use this on your user page. It is reserved for content pages.
Parameters
All parameters are optional. If omitted, nothing will display.
| Parameter | Notes |
|---|---|
| eng | Name of the image to display, in English, without the ".png" extension. If the image has an extension other than ".png", then the "ext" parameter must be used. |
| ext | Extension of image specified in "eng" parameter, without the period (e.g., "gif", "jpg", etc.) |
| name | Name of item (Page name if omitted) For use on pages like Trash (item) where the name of the item is different from the page name. |
| image2 image3 image4 image5 |
Name of additional images to display Must be of type ".png" Omit the extension (e.g., Tiger Slime Egg) |
| image2spacing | Set to "true" to add extra space between the images specified in "eng" and "image2" |
| color | Color of artisan goods produced (Jelly, Pickles, Wine, Dehydrator product, etc.) Color name must correspond to an image located in Category:Artisan good images If omitted, color will be the default color for the item (green juice, red jelly, purple wine, etc.) |
| description | In-game item description (Populated by Template:Description if omitted). It is preferable to omit this parameter and update Template:Description instead. |
| source | How to obtain the item (e.g., [[Crafting]], [[Artisan Goods]], [[Slime Egg-Press]]) |
| location | Location(s) of item (e.g., [[Cindersap Forest]], [[The Beach]], Bushes throughout the valley, etc.) |
| seed | Name of seed (e.g., {{Name|Corn Seeds}}) |
| growth | Number of days the crop takes to grow to maturity (e.g., 4 days) |
| buff | Name of buff(s) given by the item (e.g., {{Name|Farming|+4}}) |
| buffduration | Length of time buff(s) are active |
| season | Name of season when the item can be obtained or grown Can be plain text (e.g., Spring, Summer, All, etc.) or can use Template:Season (e.g., {{Season|Summer}} • {{Season|Winter}}) |
| weather | Weather required to obtain the item Can use plain text (e.g., Rain) and this template will automatically apply Template:Weather inline formatting |
| xp | Experience points gained for harvesting or otherwise obtaining the item |
| edibility | Found in Data\ObjectInformation.xnb Note that inedible items have an edibility of -300, and poisonous items have a negative edibility greater than -300 |
| sellprice | Found in Data\ObjectInformation.xnb If the item cannot be sold, then "N/A" and "Cannot be sold" are valid values |
| quality | Set to "false" to suppress silver, gold, and iridium qualities |
| recipe | How to obtain the recipe to craft the item (e.g., [[Farming]] Level 7) |
| craftingstation | Equipment used to craft the item (e.g., {{Name|Preserves Jar}}) |
| crafttime | How long does the item process in its equipment (e.g., 4 hours) |
| ingredients | Ingredients needed to craft the item (e.g., {{Name|Copper Bar|2}}{{Name|Sap|10}}) |
| tingredients | Ingredients with the Trapper profession Used on the Crab Pot page |
| produces | Item produced via crafting, artisan goods, or harvesting (e.g., 5 Deluxe Fertilizer per craft) |