Template:Drop Rate: Difference between revisions
(add formatnum and error example) |
(clean up and prettify a bit) |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly>{{formatnum:{{#ifexpr: {{{1}}} < 1 | ||
{{formatnum:{{#ifexpr: {{{ | |||
|0 | |0 | ||
|1/{{#ifexpr: {{{ | |1/{{#ifexpr: {{{1}}} > {{{max|100000}}} | ||
|1 | |1 | ||
| {{#expr: trunc {{#expr: {{{max | | {{#expr: trunc {{#expr: {{{max|100000}}}/{{{1}}} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
}} | }}</includeonly><noinclude> | ||
</includeonly><noinclude> | |||
==Purpose== | ==Purpose== | ||
Shortcut template for converting any ticket amount into a drop rate. All decimals in the output are truncated. | Shortcut template for converting any ticket amount into a drop rate. All decimals in the output are truncated. | ||
Line 16: | Line 14: | ||
<pre> | <pre> | ||
{{Drop Rate | {{Drop Rate | ||
| | | <!-- Anonymous param. An integer amount for how many tickets an item has. If it is larger than the max ticket amount, calculation will be skipped and the output will say 1/1. --> | ||
|max | |max <!-- An integer amount for the remaining ticket amount of a roll source. If omitted, this value is treated as 100000. --> | ||
}} | }} | ||
</pre> | </pre> | ||
==Examples== | ==Examples== | ||
===1 Ticket, Undefined Max Tickets=== | |||
<pre>{{Drop Rate|1}}</pre> | |||
{{Drop Rate|1}} | |||
===1 Ticket, 100k Max Tickets=== | ===1 Ticket, 100k Max Tickets=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|1|max=100000}}</pre> | ||
{{Drop Rate| | {{Drop Rate|1|max=100000}} | ||
===15 Tickets, 100k Max Tickets=== | ===15 Tickets, 100k Max Tickets=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|15|max=100000}}</pre> | ||
{{Drop Rate| | {{Drop Rate|15|max=100000}} | ||
===1 Ticket, 1 Max Ticket=== | ===1 Ticket, 1 Max Ticket=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|1|max=1}}</pre> | ||
{{Drop Rate| | {{Drop Rate|1|max=1}} | ||
===100 Tickets, 1 Max Ticket=== | ===100 Tickets, 1 Max Ticket=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|100|max=1}}</pre> | ||
{{Drop Rate| | {{Drop Rate|100|max=1}} | ||
===0 Tickets, 1 Max Ticket=== | ===0 Tickets, 1 Max Ticket=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|0|max=1}}</pre> | ||
{{Drop Rate| | {{Drop Rate|0|max=1}} | ||
==="A" Tickets, 1 Max Ticket=== | ==="A" Tickets, 1 Max Ticket=== | ||
<pre>{{Drop Rate| | <pre>{{Drop Rate|A|max=1}}</pre> | ||
{{Drop Rate| | {{Drop Rate|A|max=1}} | ||
</noinclude> | </noinclude> |
Revision as of 08:18, 8 January 2024
Purpose
Shortcut template for converting any ticket amount into a drop rate. All decimals in the output are truncated.
Parameter List
{{Drop Rate | <!-- Anonymous param. An integer amount for how many tickets an item has. If it is larger than the max ticket amount, calculation will be skipped and the output will say 1/1. --> |max <!-- An integer amount for the remaining ticket amount of a roll source. If omitted, this value is treated as 100000. --> }}
Examples
1 Ticket, Undefined Max Tickets
{{Drop Rate|1}}
1/100,000
1 Ticket, 100k Max Tickets
{{Drop Rate|1|max=100000}}
1/100,000
15 Tickets, 100k Max Tickets
{{Drop Rate|15|max=100000}}
1/6,666
1 Ticket, 1 Max Ticket
{{Drop Rate|1|max=1}}
1/1
100 Tickets, 1 Max Ticket
{{Drop Rate|100|max=1}}
1/1
0 Tickets, 1 Max Ticket
{{Drop Rate|0|max=1}}
0
"A" Tickets, 1 Max Ticket
{{Drop Rate|A|max=1}}
Expression error: Unrecognised word "a".