Difference between revisions of "Template:Meat range"

From TheKolWiki
Jump to: navigation, search
m (i meant to do that...)
m (handle mval < 5)
Line 1: Line 1:
<includeonly>{{#switch:{{{1|?}}}|!=Indeterminate|?=''unknown''|0|none|None=None|#default={{formatnum:{{#expr:ceil (.8*{{{1}}})}}}}-{{formatnum:{{#expr:floor (1.2*{{{1}}})}}}}}}</includeonly><noinclude>
+
<includeonly>{{#switch:{{{1|?}}}|!=Indeterminate|?=''unknown''|0|none|None=None|#default={{formatnum:{{min|{{#expr:{{{1}}}-1|{{#expr:ceil (.8*{{{1}}})}}}}}}-{{formatnum:{{max|{{#expr:{{{1}}}+1|{{#expr:floor (1.2*{{{1}}})}}}}}}}}</includeonly><noinclude>
 
{{Code2}}
 
{{Code2}}
 
Helper template for constructing a range of meat drops from the given average.  Can be used for other things, provided they are triangular and range from 80% to 120% of the average value (round up and down respectively).
 
Helper template for constructing a range of meat drops from the given average.  Can be used for other things, provided they are triangular and range from 80% to 120% of the average value (round up and down respectively).
Line 12: Line 12:
 
*<nowiki>{{meat range|1111}}</nowiki>
 
*<nowiki>{{meat range|1111}}</nowiki>
 
{{meat range|1111}}
 
{{meat range|1111}}
 +
*&#123;{meat range|3}}
 +
{{meat range|3}}
  
 
[[Category:Utility Templates|{{PAGENAME}}]]</noinclude>
 
[[Category:Utility Templates|{{PAGENAME}}]]</noinclude>

Revision as of 23:03, 11 August 2011

{{Meat range}}
{{#switch:{{{1|?}}}|!=Indeterminate|?|=''unknown''|0|none|None=None|#default={{formatnum:{{min|{{#expr:{{{1}}}-1}}|{{#expr:ceil (.8*{{{1}}})}}}}}}-{{formatnum:{{max|{{#expr:{{{1}}}+1}}|{{#expr:floor (1.2*{{{1}}})}}}}}}}}

Helper template for constructing a range of meat drops from the given average. Can be used for other things, provided they are triangular and range from 80% to 120% of the average value (round up and down respectively).

Examples

  • {{meat range|30}}

24-36

  • {{meat range}}

unknown

  • {{meat range|0}}

None

  • {{meat range|1111}}

889-1,333

  • {{meat range|3}}

2-4