Difference between revisions of "Template:Trading Value Table"

From RimWorld Wiki
Jump to navigation Jump to search
(Test to combine both templates)
Line 18: Line 18:
 
}}
 
}}
  
{{#ifeq: {{#var:CreateRow}} | true | {{Trading Value Table Row | ?Name={{{?Name}}} | ?Type={{{?Type}}} | ?Material={{#var:material}} | ?Stuff={{#var:Stuff}} }} }}
+
{{#ifeq: {{#var:CreateRow}} | true |  
 +
 
 +
 
 +
{{#vardefine:multiplier | 1 }}
 +
{{#vardefine:skill | - }}
 +
{{#vardefine:sellable | false }}
 +
 
 +
{{#switch: {{{?Type}}}
 +
  | Art = {{#vardefine:multiplier | 1.1}} {{#vardefine:skill | [[Skills#Artistic|Artistic]]}}
 +
  | Furniture = {{#vardefine:multiplier | 0.7}} {{#vardefine:skill | [[Construction]]}}
 +
  | Gear = {{#vardefine:multiplier | 0.7}} {{#vardefine:skill | [[Crafting]]}}
 +
  | Equipment = {{#vardefine:multiplier | 0.2}} {{#vardefine:skill | [[Crafting]]}}
 +
  | Crafted Resources = {{#vardefine:multiplier | 0.6}} {{#vardefine:skill | [[Crafting]]}}
 +
  | Medical Items = {{#vardefine:skill | [[Crafting]]}}
 +
  | Structure | Production | Buildings | Security | Misc | Floor | Temperature | Power | Ship = {{#vardefine:skill | [[Construction]]}}
 +
}}
 +
 
 +
{{#switch: {{{?Type}}}
 +
  | Structure | Production | Buildings | Security | Misc | Floor | Temperature | Power | Ship =
 +
  | #default = {{#switch: {{{?Name}}}
 +
    | Peg leg | Wooden foot | Wooden hand | Torch lamp =
 +
    | #default = {{#vardefine:sellable | true }}
 +
  }}
 +
}}
 +
 
 +
{{#vardefine:R1 | {{Q|{{{?Name}}}|Resource 1}} }}
 +
{{#vardefine:R1a | {{Q|{{{?Name}}}|Resource 1 Amount}} }}
 +
{{#vardefine:R2 | {{Q|{{{?Name}}}|Resource 2}} }}
 +
{{#vardefine:R2a | {{Q|{{{?Name}}}|Resource 2 Amount}} }}
 +
{{#vardefine:R3 | {{Q|{{{?Name}}}|Resource 3}} }}
 +
{{#vardefine:R3a | {{Q|{{{?Name}}}|Resource 3 Amount}} }}
 +
{{#vardefine:R4 | {{Q|{{{?Name}}}|Resource 4}} }}
 +
{{#vardefine:R4a | {{Q|{{{?Name}}}|Resource 4 Amount}} }}
 +
{{#vardefine:R5 | {{Q|{{{?Name}}}|Resource 5}} }}
 +
{{#vardefine:R5a | {{Q|{{{?Name}}}|Resource 5 Amount}} }}
 +
{{#vardefine:R6 | {{Q|{{{?Name}}}|Resource 6}} }}
 +
{{#vardefine:R6a | {{Q|{{{?Name}}}|Resource 6 Amount}} }}
 +
 
 +
{{#vardefine:amount | {{#expr:
 +
  {{#ifeq: {{{#var:Stuff}}} | true
 +
    | {{#var:R1a}}
 +
    | {{#ifeq: {{#var:R1}}|{{{#var:material}}}|{{#var:R1a}}|0}}
 +
  }}
 +
  * {{#ifeq: {{{#var:material}}} | Gold | 10
 +
      | {{#ifeq: {{{#var:material}}} | Silver | 10 | 1 }}
 +
    }}
 +
  + {{#ifeq: {{#var:R2}} | {{{#var:material}}} | {{#var:R2a}} | 0 }}
 +
  + {{#ifeq: {{#var:R3}} | {{{#var:material}}} | {{#var:R3a}} | 0 }}
 +
  + {{#ifeq: {{#var:R4}} | {{{#var:material}}} | {{#var:R4a}} | 0 }}
 +
  + {{#ifeq: {{#var:R5}} | {{{#var:material}}} | {{#var:R5a}} | 0 }}
 +
  + {{#ifeq: {{#var:R6}} | {{{#var:material}}} | {{#var:R6a}} | 0 }}
 +
}} }}
 +
 
 +
{{#vardefine:others |
 +
  {{#ifeq: {{#var:R1}} | Stuff
 +
    | {{#ifeq: {{{#var:Stuff}}} | true || {{#var:R1a}} {{Icon Small|Stuff}} }}
 +
    | {{#ifeq: {{#var:R1}} | {{{#var:material}}} || {{#var:R1a}} {{Icon Small|{{#var:R1}} }} }}
 +
  }}<!---
 +
  --->{{#if: {{#var:R2}} | {{#ifeq: {{#var:R2}} | {{{#var:material}}} || &nbsp;{{#var:R2a}} {{Icon Small|{{#var:R2}} }} }} }}<!---
 +
  --->{{#if: {{#var:R3}} | {{#ifeq: {{#var:R3}} | {{{#var:material}}} || &nbsp;{{#var:R3a}} {{Icon Small|{{#var:R3}} }} }} }}<!---
 +
  --->{{#if: {{#var:R4}} | {{#ifeq: {{#var:R4}} | {{{#var:material}}} || &nbsp;{{#var:R4a}} {{Icon Small|{{#var:R4}} }} }} }}<!---
 +
  --->{{#if: {{#var:R5}} | {{#ifeq: {{#var:R5}} | {{{#var:material}}} || &nbsp;{{#var:R5a}} {{Icon Small|{{#var:R5}} }} }} }}<!---
 +
  --->{{#if: {{#var:R6}} | {{#ifeq: {{#var:R6}} | {{{#var:material}}} || &nbsp;{{#var:R6a}} {{Icon Small|{{#var:R6}} }} }} }}
 +
}}
 +
 
 +
{{#vardefine:workfactor | {{#if: {{Q|{{{#var:material}}}|Work To Build Factor}} | {{Q|{{{#var:material}}}|Work To Build Factor}} | 1 }} }}
 +
 
 +
! style="text-align: left" {{!}} [[{{{?Name}}}]] {{#ifeq: {{Q|{{{?Name}}}|From DLC}} | Royalty (DLC) | {{RoyaltyIcon}} | {{#ifeq: {{Q|{{{?Name}}}|From DLC}} | Ideology (DLC) | {{IdeologyIcon}} }} }}
 +
{{!}} {{#var:amount}} {{Icon Small|{{{#var:material}}} }} {{#ifeq: {{{#var:Stuff}}} | true | ({{#expr: {{#var:R1a}} * {{#ifeq: {{{#var:material}}} | Gold | 10 | {{#ifeq: {{{#var:material}}} | Silver | 10 | 1 }} }} }} {{Icon Small|Stuff}}) }}
 +
{{!}} {{#ifeq: {{#var:others}} || - | {{#var:others}} }}
 +
{{!}} {{ticks/minutes| {{Q|{{{?Name}}}|Work To Make}} * {{#var:workfactor}} }}
 +
{{!}} {{#var:skill}}
 +
{{!}} {{#ifeq: {{{#var:Stuff}}} | true | {{Market Value Calculator | {{{?Name}}} | {{{#var:material}}} }} | {{#ifeq: {{#var:R1}} | Stuff | {{Market Value Calculator|{{{?Name}}}|wood}}{{H:title|link=no|This value depends on the material and might therefore not be correct.|<sup>[Note]</sup>}} | {{Q|{{{?Name}}}|Market Value Base}} }} }} {{Icon Small|silver}}
 +
{{!}} {{#ifeq: {{#var:sellable}} | true | {{#var:multiplier}} | - }}
 +
{{!}} {{#ifeq: {{#var:sellable}} | true | {{ticks/seconds | {{#expr: {{formatnum: {{Q|{{{?Name}}}|Work To Make}}|R}}*{{#var:workfactor}}/({{#var:multiplier}}*{{Market Value Calculator | {{{?Name}}} | {{{#var:material}}} }})round2}} }} | - }}
 +
{{!}} {{#ifeq: {{#var:sellable}} | true | {{#expr: {{#var:R1a}}/({{#var:multiplier}}*{{Market Value Calculator | {{{?Name}}} | {{{#var:material}}} }})round2}} | - }}
 +
{{!}}-
 +
 
 +
 
 +
}}
  
 
</includeonly>
 
</includeonly>

Revision as of 20:05, 19 September 2021


Documentation icon Template documentation[view] [edit] [history] [purge]

Related Template

This template is dependant on Template:Trading Value Table Row.

Description

This template adds a full table of all items, buildings etc. that require a specific material. It is meant for everything in Template:Nav/materials but can be used for pretty much anything.

In order to use the template add the following line to the page of the material:

{{Trading Value Table}}

If you specify the material you can put the table on any page you want:

{{Trading Value Table | Uranium}}

Examples

Stony

Example for a stone. {{Trading Value Table | Granite blocks}}

Metallic

Normal

Example for a metal.








Small Volume

Example for a small volume material. {{Trading Value Table | Silver}}

Woody

Example for wood. {{Trading Value Table | Wood}}

Leathery

Example for a leather. {{Trading Value Table | Bluefur}}

Fabric

Example for a fabric. {{Trading Value Table | Cloth}}

Other

Example for a any other item. {{Trading Value Table | Component}}