Terraria Wiki
Terraria Wiki
(sync :: en revid:928232::)
 
K (sync :: en revid:959740::)
 
Zeile 1: Zeile 1:
<includeonly><!--
+
<includeonly>{{#invoke:Coin expr|go|sell=true}}</includeonly><!--
   
 
--><noinclude>{{lua|Coin expr}}{{doc}}</noinclude>
-->{{#vardefine:sellexpr|{{#expr:<!--
 
 
-->{{#fornumargs:k|v|<!--
 
-->{{#ifexpr:({{#var:k}} mod 2)=0|<!--
 
-->{{#var:v}}<!--
 
-->|{{#if:{{#var:v}}|({{iteminfo|{{#var:v}}|value|raw=y}}/5)}}<!--
 
-->}}<!--
 
-->}}<!--
 
 
-->}}}}<!--
 
 
// output:
 
-->{{#if:{{{raw|}}}|{{#var:sellexpr}}|{{coin|{{#var:sellexpr}}|round={{{round|999}}}}}}}<!--
 
 
--></includeonly><!--
 
 
--><noinclude>{{doc}}</noinclude>
 

Aktuelle Version vom 2. April 2020, 14:08 Uhr

Diese Vorlage verwendet Lua.
Diese Vorlage verwendet Modul:Coin expr, ein Skript, das in der Programmiersprache Lua verfasst wurde. Siehe Terraria Wiki:Lua, um mehr über Lua zu erfahren.
Template-info Dokumentation Die folgende Dokumentation stammt von der Seite Vorlage:Sell expr/Dokumentation. (bearbeiten | Versionsgeschichte)
Siehe auch die englische Vorlagenseite: Template:Sell expr. Sie enthält möglicherweise umfassendere oder aktuellere Informationen.
Important Diese Seite ist nicht oder unvollständig übersetzt.
Hilf mit, indem du den Text übersetzt und anschließend diesen Hinweis entfernst. Dies entfernt diese Seite auch aus der Liste von Seiten mit unzureichender Übersetzung.

This template can be used to handle elaborate expressions in conjunction with item sell values. The sell values are generated using {{iteminfo}}, hence they are dynamic and are adjusted accordingly should they be altered in a future Terraria update.

It aims at simplifying the convoluted syntax that is required for displaying sell value expressions: {{coin|{{#expr:{{iteminfo|Pixie Dust|value|raw=y}}/5*99+{{iteminfo|Crystal Shard|value|raw=y}}/5*33}}}} can be shortened to {{sell expr|Pixie Dust|*99+|Crystal Shard|*33}} using this template.

For handling buy prices instead of sell values, use {{buy expr}}. The syntax and usage is exactly the same.

Verwendung

{{ sell expr | <item name or ID 1> | <expression operators/constants/etc. 1> | ... | ... | <item name or ID n> | <expression operators/constants/etc. n> | raw = y/yes (optional) | round = <digit to round to> (optional) }}

1st, 3rd, 5th, 7th, ..., nth unnamed parameter

Name or ID of an item whose sell value is to be inserted at that part of the expression. Can be empty.

2nd, 4th, 6th, 8th, ..., (n+1)-th unnamed parameter

Operators, constants, etc. – valid {{#expr:}} syntax. Can be empty.

raw

Suppress the {{coin}} wrapping and instead display the numerical value, e.g. for use in other expressions.

round

Rounding functionality of {{coin}}, see Template:Coin for documentation and examples. Has no effect when using raw=y.

Concept

Example: Multiply the sum of the sell values of 3 Pixie Dust and 1 Crystal Shard by 5 and add the sell value of 7 Souls of Light.

Think of writing the expression normally:

{{#expr: 5*( <Pixie Dust sell value>*3 + <Crystal Shard sell value> ) + <Soul of Light sell value>*7 }}

For this template, simply replace the <item name sell value> parts with |<item name>|:

{{sell expr| 5*( |Pixie Dust|*3 + |Crystal Shard| ) + |Soul of Light|*7 }}

Now check if the first unnamed parameter is still an item name or ID. If it is not, add an empty parameter to fix that:

{{sell expr| | 5*( |Pixie Dust|*3 + |Crystal Shard| ) + |Soul of Light|*7 }}

Result:

19

Proof: 5*( 1 *3 + 16 ) + 2 *7   =   5*( 19 ) + 14   =   95 + 14   =   19

Hinweise

  • The template will not return anything if the first, third, etc. unnamed parameters are not names or IDs of items or if the second, fourth, etc. unnamed parameters are not valid {{#expr:}} syntax.
  • {{iteminfo}} can only handle items that are present in Desktopversion Desktop 1.4.4.9. The sell value of items exclusive to non-Desktop platforms will evaluate to 0.

Beispiele

Code Result
{{sell expr| Terra Blade }} 20
{{sell expr| Terraklinge }} 20
{{sell expr| True Excalibur|+|True Night's Edge }} 20
{{sell expr|| (|Excalibur|+|Broken Hero Sword|) + (|Night's Edge|+|Broken Hero Sword|) }} 2360
{{sell expr|| (12*|Hallowed Bar|+|Broken Hero Sword|) + ((|Blade of Grass|+|Fiery Greatsword|+|Light's Bane|+|Muramasa|)+|Broken Hero Sword|) }} 2290
{{sell expr| Wood|*5 }} 0
{{sell expr| 12*|Terra Blade }} (1st parameter not an item name or ID, 2nd parameter an item name) (template error)
{{sell expr|| 12*|Terra Blade }} (fixed the above) 240
{{sell expr||||     |||  ||| 6*||||| Terra Blade |||||*2 ||}} (parameters can be empty) 240
{{sell expr| Terra Blade|*|12 }} (typo: 12 is treated as an item ID here) 10
{{sell expr| Tizona|+|Sharanga }} (items not available on Desktop 1.4.4.9) (template error)
{{sell expr| Terra Blade|×12 }} (not valid syntax) 0
{{sell expr| Terra Blade |raw=y}} 200000