Difference between revisions of "Template:Market Value Calculator"
(Undo revision 123754 by Ickputzdirwech (talk)) Tag: Undo |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{# | + | <includeonly>{{#if: {{#vardefineecho:baseValue|{{Q|{{#vardefineecho:name | {{{1 | {{PAGENAME}} }}} }}|Market Value Base #}}}} || {{#vardefine:buildOrMake | {{lc: {{{4 | {{#switch: {{lc: {{Q|{{#var:name}}|Type}} }} |
− | + | | buildings | building | furniture | structure | floor | misc | miscellaneous | production | security | ship | temperature = build | |
+ | | #default = make | ||
+ | }} }}} }} }}<!-- | ||
− | {{#vardefine: | + | -->{{#vardefine:stuff | {{ucfirst:{{{2|}}} }} }}<!-- |
− | {{ | ||
− | + | -->{{#vardefine:workValue | {{#expr: ({{formatnum: {{Q|{{#var:name|}}|Work To Make}}|R}} {{#ifeq: {{#vardefineecho:R1|{{Q|{{#var:name|}}|Resource 1}} }} | Stuff | {{#ifeq: {{#var:buildOrMake|}}|build|{{#if: {{#vardefineecho: buildFactor | {{Q|{{#var:stuff|}}|Work To Build Factor}} }} | * {{#var:buildFactor}}|}} {{#if: {{#vardefineecho: buildOffset | {{Q|{{#var:stuff|}}|Work To Build Offset}} }} | + {{#var:buildOffset}}|}} | {{#if: {{#vardefineecho: makeFactor | {{Q|{{#var:stuff|}}|Work To Make Factor}} }} | * {{#var:makeFactor}}| }} }}| }})* 0.0036 round 1}} }}<!-- | |
− | --> | + | |
− | {{# | + | -->{{#vardefine:ingredientValue | {{formatnum: {{#expr: 0 |
− | + | {{#if: {{#var:R1}} | + {{formatnum:{{#ifeq: {{#var:R1}} | Stuff | {{Q|{{#var:stuff|}}|Market Value Base}} {{#if: {{Q|{{#var:stuff|}}|Small Volume}}|*10}} | {{Q|{{#var:R1}}|Market Value Base}} }}|R}} * {{Q|{{#var:name|}}|Resource 1 Amount}} }} | |
− | + | {{#if: {{#vardefineecho:R2|{{Q|{{#var:name|}}|Resource 2}} }} | + {{Q|{{#var:R2}}|Market Value Base #}} * {{Q|{{#var:name|}}|Resource 2 Amount}} }} | |
− | + | {{#if: {{#vardefineecho:R3|{{Q|{{#var:name|}}|Resource 3}} }} | + {{Q|{{#var:R3}}|Market Value Base #}} * {{Q|{{#var:name|}}|Resource 3 Amount}} }} | |
− | | | + | {{#if: {{#vardefineecho:R4|{{Q|{{#var:name|}}|Resource 4}} }} | + {{Q|{{#var:R4}}|Market Value Base #}} * {{Q|{{#var:name|}}|Resource 4 Amount}} }} |
− | | | + | {{#if: {{#vardefineecho:R5|{{Q|{{#var:name|}}|Resource 5}} }} | + {{Q|{{#var:R5}}|Market Value Base #}} * {{Q|{{#var:name|}}|Resource 5 Amount}} }} |
− | + | {{#if: {{#vardefineecho:R6|{{Q|{{#var:name|}}|Resource 6}} }} | + {{Q|{{#var:R6}}|Market Value Base #}} * {{Q|{{#var:name|}}|Resource 6 Amount}} }} | |
− | | | + | }}|R}}}} {{#vardefine:baseValue|{{#expr: {{#var:ingredientValue|}} + {{#var:workValue|}} }} }} }}<!-- |
− | + | ||
− | + | -->{{Market Value | {{#expr: {{#var:baseValue|}} {{#switch: {{lc: {{{3|normal}}} }} | |
− | + | | awful = * 0.5 | |
− | | | + | | poor = * 0.75 |
− | + | | #default = | |
− | + | | good = {{#ifexpr: {{#var:baseValue|}} * 0.25 < 500 | * 1.25 | + 500 }} | |
− | -->{{#vardefine:ingredientValue | {{formatnum:{{ #expr: 0 | + | | excellent = {{#ifexpr: {{#var:baseValue|}} * 0.5 < 1000 | * 1.5 | + 1000 }} |
− | {{#if: | + | | masterwork = {{#ifexpr: {{#var:baseValue|}} * 1.5 < 2000 | * 2.5 | + 2000 }} |
− | {{#if: {{Q|{{#var:name|}}|Resource 2}}| + | + | | legendary = {{#ifexpr: {{#var:baseValue|}} * 4 < 3000 | * 5 | + 3000 }} |
− | {{#if: {{Q|{{#var:name|}}|Resource 3}}| + | + | }} }} }}</includeonly><noinclude>{{Documentation}}</noinclude> |
− | {{#if: {{Q|{{#var:name|}}|Resource 4}}| + | ||
− | {{#if: {{Q|{{#var:name|}}|Resource 5}}| + | ||
− | {{#if: {{Q|{{#var:name|}}|Resource 6}}| + | ||
− | }}|R}}}} | ||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |good = {{#ifexpr: | ||
− | |excellent = {{#ifexpr: | ||
− | |masterwork = {{#ifexpr: | ||
− | |legendary = {{#ifexpr: | ||
− |
Latest revision as of 21:05, 30 December 2022
Automatically calculates the Market Value of the item from the resources and work to make properties of the item, as set by Template:Infobox main
It outputs a plain number.
Parameters[edit]
The item can be manually chosen by the first argument, otherwise it automatically uses the page the template is used on.
For stuffable items, the stuff ingredient can and must be defined in the second argument of the template and the page must correctly have "Stuff" as its Resource 1. It does not prevent selection of options not allowed by the item's Stuff Tags property. Where needed, this must be handled outside of this template.
The third argument is optional and sets the Quality of the item in question. The Quality must be entered by a capitalized string. E.g. "Awful", with no quotes. It does not prevent selection of qualities for items that do not have quality. Where needed, this must be handled outside of this template.
The fourth argument is optional and sets whether a stuffable item uses the Work To Make Factor or Work To Build Factor of the material used. It will attempt to uses the Type property to select the right option, and will default to Make when type is either not set, or isn't recongised. However, it can also be manually set to either Build or Make by having "make" or "build" as the argument.
Example usage[edit]
On the page about a non-stuffable item in question:
{{Market Value Calculator}}
On tool cabinet, it would output: 385
On a different page than the non-stuffable item.
{{Market Value Calculator|Flak vest}}
It would output: 225
On a different page than the stuffable item.
{{Market Value Calculator|Duster|Devilstrand}}
It would output: 475
On a page about the stuffable item.
{{Market Value Calculator||Gold|Legendary}}
On Plate armor, it would output: 20125
On a different page than the stuffable built item.
{{Market Value Calculator|Bed|Granite blocks||build}}
It would output: 58
On a different page than an item with a set market value.
{{Market Value Calculator|Persona monosword||Legendary}}
It would output: 6000
The above documentation is transcluded from Template:Market Value Calculator/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |