Jump to content

Template:Item block: Difference between revisions

From Stardew Valley Wiki
imported>Vg-tal
returned to a simple line; a whole box look odd when the items have different height
imported>Margotbean
remove script error
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{| style="display:inline-block; border-bottom:1px solid #8dcaf0; box-shadow: 0px 1px rgba(0,0,0,0.3);"
<includeonly>{| style="display:inline-block; border-bottom:1px solid #8dcaf0; margin:8px -1.5px -8px -1.5px; line-height: 1em;font-size:0.9em;"
|-
|-
| style="min-width:150px" |
| style="min-width:150px;" |
<span style="float:right;background-color:rgba(0,0,0,0.45);border-radius:4px;color:white;margin-left:-40px;padding:4px;padding-top: 6px;line-height: 1.2em;">
{{#ifeq:{{{3|}}}|furniture|
  0.68%
  |
  {{#if:{{{special|}}}|
    [[Traveling Cart#Special Stock|{{{special|}}}%*]]{{#if:{{{4|}}}|<br />{{#expr:trunc((1−((788-{{{4|1}}})/788)^10)*10000)/100}}%}}
    |
    {{#expr:trunc((1−((788-{{{4|1}}})/788)^10)*10000)/100}}%
  }}
}}
</span>
[[File:{{#if:{{{image|}}}|{{{image|}}}|{{#if:{{{1|}}}|{{{1|}}}.png}}}}|{{{2|}}}|link={{#if:{{{link|}}}|{{{link|}}}|{{{1|}}}}}]]
[[File:{{#if:{{{image|}}}|{{{image|}}}|{{#if:{{{1|}}}|{{{1|}}}.png}}}}|{{{2|}}}|link={{#if:{{{link|}}}|{{{link|}}}|{{{1|}}}}}]]
|-
|-
|[[{{#if:{{{link|}}}|{{{link|}}}|{{{1|}}}}}]]<br>
|[[{{#if:{{{link|}}}|{{{link|}}}|{{{1|}}}}}]]<br />
|-
|-
|{{#if:{{{3|}}}|{{price|{{{3|}}}}} {{#if:{{{4|}}}| -{{price|{{{4|}}}}}|}}| }}
|{{tprice|{{{3|0}}}|math={{{math|}}} }}
|}</includeonly>
<noinclude>
==Description==
 
Item block is a template for the [[Traveling Cart]] page. It's used to create a small table with picture/name/price range underlined by a white line.
 
==Use==
This template is called around 400 times on the [[Traveling Cart]] page. In a effort to keep it light, "text-align:center;" is only declared once in the parent table:
 
<nowiki> {| style="text-align:center;"
|{{Item block|corn|48px|50}}
|}</nowiki>
 
 
First argument: Item name
 
Second argument: Size of the image in pixel
 
Third argument: Base price or "furniture"
 
Fourth argument: Item probability out of 788, 1 if omitted (always 1/145 for furniture)
 
{| style="text-align:center;"
|{{Item block|corn|48px|50}}
|}
|}
</includeonly><noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude>
 
===Optional arguments===
 
====special====
 
If the stock do not respect normal probability:
 
<nowiki>{{Item block|corn|48px|1|special=40}}</nowiki>
 
{| style="text-align:center;"
|{{Item block|corn|48px|1|special=40}}
|}
 
If the stock do not respect normal probability:
 
<nowiki>{{Item block|Tulip|48px|100|92}}</nowiki>
 
{| style="text-align:center;"
|{{Item block|Tulip|48px|100|92}}
|}
 
====link====
 
If the link doesn't match the image name:
 
<nowiki>{{Item block|corn|48px|furniture|link=Abigail}}</nowiki>
 
{| style="text-align:center;"
|{{Item block|corn|48px|furniture|link=Abigail}}
|}
 
====image====
 
If the image is not a png/doesn't match the item name:
 
<nowiki>{{Item block|corn|48px|100|image=Bat Anim.gif}}</nowiki>
 
{| style="text-align:center;"
|{{Item block|corn|48px|100|image=Bat Anim.gif}}
|}
<!--
====Manual Entry====
 
<pre>{{Item block|Kale Seeds|48px|35-100|math=false}}</pre>
 
{{Item block|Kale Seeds|48px|35-100|math=false}}
-->
[[Category:Archived templates]]
</noinclude>

Latest revision as of 16:54, 25 July 2023


Description

Item block is a template for the Traveling Cart page. It's used to create a small table with picture/name/price range underlined by a white line.

Use

This template is called around 400 times on the Traveling Cart page. In a effort to keep it light, "text-align:center;" is only declared once in the parent table:

 {| style="text-align:center;"
 |{{Item block|corn|48px|50}}
 |}


First argument: Item name

Second argument: Size of the image in pixel

Third argument: Base price or "furniture"

Fourth argument: Item probability out of 788, 1 if omitted (always 1/145 for furniture)

1.26%

corn
data-sort-value="50"150–1,000g

Optional arguments

special

If the stock do not respect normal probability:

{{Item block|corn|48px|1|special=40}}

40%*

corn
data-sort-value="1"100–1,000g

If the stock do not respect normal probability:

{{Item block|Tulip|48px|100|92}}

71.1%

Tulip
data-sort-value="100"300–1,000g

link

If the link doesn't match the image name:

{{Item block|corn|48px|furniture|link=Abigail}}

0.68%

Abigail
data-sort-value="furniture"250–2,500g

image

If the image is not a png/doesn't match the item name:

{{Item block|corn|48px|100|image=Bat Anim.gif}}

1.26%

corn
data-sort-value="100"300–1,000g