Template:Drop Rate: Difference between revisions

From Phantasy Star Universe Clementine
(add formatnum and error example)
Line 1: Line 1:
<includeonly>
<includeonly>
{{#ifexpr: {{{tickets}}} < 1
{{formatnum:{{#ifexpr: {{{tickets}}} < 1
|0  
|0  
|1/{{#ifexpr: {{{tickets}}} > {{{max tickets}}}  
|1/{{#ifexpr: {{{tickets}}} > {{{max tickets}}}  
|1  
|1  
|{{#expr: trunc {{#expr: {{{max tickets|100000}}}/{{{tickets}}}}}}}}}}}</includeonly><noinclude>
| {{#expr: trunc {{#expr: {{{max tickets|100000}}}/{{{tickets}}}
}}
}}
}}
}}
}}
</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 31: Line 37:
<pre>{{Drop Rate|tickets=0|max tickets=1}}</pre>
<pre>{{Drop Rate|tickets=0|max tickets=1}}</pre>
{{Drop Rate|tickets=0|max tickets=1}}
{{Drop Rate|tickets=0|max tickets=1}}
==="A" Tickets, 1 Max Ticket===
<pre>{{Drop Rate|tickets=A|max tickets=1}}</pre>
{{Drop Rate|tickets=A|max tickets=1}}
</noinclude>
</noinclude>

Revision as of 15:44, 20 December 2023

Purpose

Shortcut template for converting any ticket amount into a drop rate. All decimals in the output are truncated.

Parameter List

{{Drop Rate
|tickets       <!-- 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 tickets   <!-- An integer amount for the remaining ticket amount of a roll source. -->
}}

Examples

1 Ticket, 100k Max Tickets

{{Drop Rate|tickets=1|max tickets=100000}}

1/100,000

15 Tickets, 100k Max Tickets

{{Drop Rate|tickets=15|max tickets=100000}}

1/6,666

1 Ticket, 1 Max Ticket

{{Drop Rate|tickets=1|max tickets=1}}

1/1

100 Tickets, 1 Max Ticket

{{Drop Rate|tickets=100|max tickets=1}}

1/1

0 Tickets, 1 Max Ticket

{{Drop Rate|tickets=0|max tickets=1}}

0

"A" Tickets, 1 Max Ticket

{{Drop Rate|tickets=A|max tickets=1}}

Expression error: Unrecognised word "a".