Difference between revisions of "Template:Consumable test"
Jump to navigation
Jump to search
(fix for shovel damage and damage type variables spillover) |
|||
| (10 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
--- | --- If item name is provided as parameter, use the parameter instead of root page. --- | ||
-->{{#vardefine:Page|{{#if:{{{1|}}}|{{{1|}}}|{{ROOTPAGENAME}}}}}}<!-- | -->{{#vardefine:Page|{{#if:{{{1|}}}|{{{1|}}}|{{ROOTPAGENAME}}}}}}<!-- | ||
--- Load complete datastring into a variable - to only load from the Armor data page once. --- | |||
-->{{#vardefine:Datastring|{{:Consumable_data|{{#var:Page}}}}}}<!-- | |||
--- Separate values from datastring into individual variables. --- | |||
-->{{#vardefine:SubPage|{{#if:{{SUBPAGENAME}}|{{SUBPAGENAME}}|{{#var:Page}}}}}}<!-- | -->{{#vardefine:SubPage|{{#if:{{SUBPAGENAME}}|{{SUBPAGENAME}}|{{#var:Page}}}}}}<!-- | ||
-->{{#vardefine:BasePage|{{#if:{{BASEPAGENAME}}|{{BASEPAGENAME}}|{{#var:Page}}}}}}<!-- | -->{{#vardefine:BasePage|{{#if:{{BASEPAGENAME}}|{{BASEPAGENAME}}|{{#var:Page}}}}}}<!-- | ||
-->{{#vardefine:OtherPage|{{#if:{{PAGENAME}}|{{PAGENAME}}|{{#var:Page}}}}}}<!-- | -->{{#vardefine:OtherPage|{{#if:{{PAGENAME}}|{{PAGENAME}}|{{#var:Page}}}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|§|0}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Tier|{{#explode: {{#var:Datastring}}|§|2}}}}<!-- | ||
-->{{#vardefine:Freshness|{{: | -->{{#vardefine:Category|{{#explode: {{#var:Datastring}}|§|3}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Subcategory|{{#explode: {{#var:Datastring}}|§|4}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:MiddleText|{{#explode: {{#var:Datastring}}|§|-1}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Freshness|{{#explode: {{#var:Datastring}}|§|7}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Fodder|{{#explode: {{#var:Datastring}}|§|78}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:NoProperties|{{#ifeq: {{#var:Category}}|junk|1|}}}}<!-- | ||
-->{{#vardefine: | -->{{#vardefine:Uses|{{#ifeq: {{#var:Category}}|ingredient||{{#explode: {{#var:Datastring}}|§|9}}}}}}<!-- | ||
-->{{#vardefine:Description|{{#explode: {{#var:Datastring}}|§|-2}}}}<!-- | |||
-->{{#vardefine:Name|{{#explode: {{#var:Datastring}}|§|-3}}}}<!-- | |||
--- Some items from Consumable data table have hardcoded stats, we define them here --- | |||
--- Durability --- | |||
-->{{#vardefine:Durability|{{#switch: {{#var:Page}} | |||
|Surgeon Toolkit = 20 | |||
|Shovel = 100 | |||
|}}}}<!-- | |||
--- Damage and Damage Type --- | |||
-->{{#switch: {{#var:Page}} | |||
|Shovel = {{#vardefine:Damage|16}}{{#vardefine:DamageType|Crushing}} | |||
|}}<!-- | |||
--- Consumable Tooltip start. --- | --- Consumable Tooltip start. --- | ||
-->{| width=300px; | -->{| width=300px; | ||
|style="text-align:center;"|<!-- | |style="text-align:center;"|<!-- | ||
--- | --><span style="font-size: 20px;">{{#if:{{#var:Name}}|{{Translate|{{#var:Name}}|ConsumableNames}}|{{Translate|{{#var:Page}}|ConsumableNames}}}}</span><br /><!-- | ||
--><span style="color:#9d9a9a;">{{Translate|{{#var:Category}}|Properties}}</span><!-- | |||
-- | |- | ||
|style="text-align:center;"|<!-- | |||
-- | --- If the item has damage value, show it --- | ||
-->{{#if:{{#var:Damage}}{{#var:DamageType}}|{{Tooltip rule}}{{#var:Damage}} {{Translate|{{#var:DamageType}}|Properties}} {{Translate|Damage|Properties}}<!-- | |||
--- Then set damage variables back to empty string --- | |||
-->{{#vardefine:Damage|}}{{#vardefine:DamageType|}}<!-- end damage if -->|}}<!-- | |||
--- Check if item has no Properties at all, if yes, then don't add a horizontal rule, otherwise add it. --- | --- Check if item has no Properties at all, if yes, then don't add a horizontal rule, otherwise add it. --- | ||
-->{{#if: | --> {{#if: {{#var:NoProperties}}||{{Tooltip rule}}}} | ||
|- | |- | ||
|<div style="width:100%;color:white;">{{Test|{{#var:Page}}}}<!-- | |<div style="width:100%;color: white;">{{Test|{{#var:Page}}}}<!-- | ||
-->{{#if: {{#var: | -->{{#if: {{#var:MiddleText}} | <div>{{#if: {{#titleparts: {{#var:OtherPage}} | 1 | 2}} | {{#ifeq: {{#var:OtherPage}} | {{#var:Page}}/Tooltip | {{#var:MiddleText}} | {{Translate|{{#var:Page}}|ConsumableDescriptions}}}} | {{#var:MiddleText}}}}</div>{{#if: {{#var:Freshness}}{{#var:Uses}}{{#var:Durability}}|<br>}}|}}</div><!-- | ||
-->{{#if: {{#var:Freshness}} | {{#ifeq: {{#var:Freshness}}|0|<div><span style="color:white;">Does not spoil over time.</span></div>{{#if: {{#var:Uses}}|<br>}}|<div style="color:#9d9a9a;">{{Translate|Will spoil in|Properties}} <span style="color:white;">{{#iferror: {{#expr: ceil({{#var:Freshness}}/24) }}|error}} {{#iferror: {{#ifexpr: {{#var:Freshness}} > 24 |days|day}}|error}}.</span></div>}}}}<!-- | -->{{#if: {{#var:Freshness}} | {{#ifeq: {{#var:Freshness}}|0|<div><span style="color:white;">Does not spoil over time.</span></div>{{#if: {{#var:Uses}}|<br>}}|<div style="color:#9d9a9a;">{{Translate|Will spoil in|Properties}} <span style="color:white;">{{#iferror: {{#expr: ceil({{#var:Freshness}}/24) }}|error}} {{#iferror: {{#ifexpr: {{#var:Freshness}} > 24 |days|day}}|error}}.</span></div>{{#if: {{#var:Uses}}|<br>}}}}}}<!-- | ||
---USES START--- | |||
-->{{#if: {{#switch:{{#var:Uses}}|0|1=|{{#var:Uses}}}} |<div style="color:#9d9a9a;">{{Translate|Uses|Properties}}: <span style="color:white;">{{#var:Uses}}/{{#var:Uses}}</span></div>{{#if: {{#var:Durability}}|<br>}}| }}<!-- | -->{{#if: {{#switch:{{#var:Uses}}|0|1=|{{#var:Uses}}}} |<div style="color:#9d9a9a;">{{Translate|Uses|Properties}}: <span style="color:white;">{{#var:Uses}}/{{#var:Uses}}</span></div>{{#if: {{#var:Durability}}|<br>}}| }}<!-- | ||
-->{{#if: {{#var:Durability}} |<div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{#var:Durability}}/{{#var:Durability}}</span></div> | }} | -->{{#if: {{#var:Durability}} |<div style="color:#9d9a9a;">{{Translate|Durability|Properties}}: <span style="color:white;">{{#var:Durability}}/{{#var:Durability}}</span></div>}}<!-- | ||
---USES END--- | |||
--- FODDER, only for herbs --- | |||
-->{{#if: {{#var:Fodder}} |{{#ifeq: {{#var:Category}}|ingredient|<span style="color:white;">Can be used for crafting {{C|Light Brown|Fodder}}.</span>|}}|}} | |||
|- | |- | ||
|style="color:#9d7969;"|{{Tooltip rule}}{{#if: {{#titleparts: {{#var:OtherPage}} | 1 | 2}} | {{#ifeq: {{#var:OtherPage}} | {{#var:Page}}/Tooltip | {{#var:Description}} | {{Translate|{{#var:Page}}|ConsumableDescriptions}}}} | {{#var:Description}}}}{{#if:{{#var:Price}}|<div style="float:right">[[File:Gold_Icon.png|18px|alt={{Translate|Price|Properties}}|link=|{{Translate|Price|Properties}}]]{{W|{{#var:Price}}}}</div>}} <br /> | |style="color:#9d7969;"|{{Tooltip rule}}{{#if: {{#titleparts: {{#var:OtherPage}} | 1 | 2}} | {{#ifeq: {{#var:OtherPage}} | {{#var:Page}}/Tooltip | {{#var:Description}} | {{Translate|{{#var:Page}}|ConsumableDescriptions}}}} | {{#var:Description}}}}{{#if:{{#var:Price}}|<div style="float:right">[[File:Gold_Icon.png|18px|alt={{Translate|Price|Properties}}|link=|{{Translate|Price|Properties}}]]{{W|{{#var:Price}}}}</div>}} <br /> | ||
Latest revision as of 03:42, 3 September 2025
This is item template created for use together with the Template:Tooltip hover box template to display tooltip with item attributes for Consumables.
Usage: Copy this code to any page where you want to display the item tooltip:
{{{{{1|Tooltip hover box}}}|title={{Consumable_test}}}}
You can provide the item name as first parameter, otherwise the pagename is used.
By default, the page is also labelled with a category corresponding to the item type (ie. Bread will receive the Category: Food).
If you don't want to add this category to a page, add the category parameter:
{{{{{1|Tooltip hover box}}}|title={{Consumable_test|Bread|category=no}}}}
Examples with properties
| Vivifying Essence medicine |
Healing Efficiency: -25% (60 t) Sanity: -3% Health Replenishment: +40% |
When asked about its recipe, alchemists prefer to maintain mysterious silence. |
Examples without properties
| Herbalist Satchel backpack |
Can be used to store items, with dedicated compartments for herbs, bottles, and large flasks. Must be equipped before use. |
The plentiful pouches make it possible to store an entire collection of flasks and herbs in an orderly, easy-to-find manner. |
| Herbalist Satchel |
| Boar Banner flag |
When raised at the Caravan Camp, grants +5% Reputation Gain and +5% Pain Resistance. |
A heraldic symbol of courage in the face of death. |
|
| Fodder resource |
A resource required for Caravan travels. Grain and some other types of food and herbs can be transformed into fodder in the crafting menu. |
A filling mix of multiple grains and herbs. |
| Fodder |
| Map of Osbrook Outskirts scroll |
Using it reveals the terrain and certain locations within a specific area on the global map. |
A lot has transpired over the last few years, but this old pre-war map might still contain some useful information. |
| Map of Osbrook Outskirts |
| Foldable Flagpole upgrade |
Required for the Caravan upgrade, "Caravan Banner". |
When the future lacks certainty, symbols become more important than ever. |
| "Hunting Net" schematic |
Required materials: • Rope • Rope • Wire |
A list of materials complete with concise but informative instructions for achieving the intended result. |
Some special cases
| Surgeon Toolkit medicine |
Health Restoration: +10% (360 t) Healing Efficiency: +30% (360 t) Injury Treatment: +100% The lower the Condition of a selected bodypart, the more painful the operation. Durability: 20/20
|
The very case when expertise and courage are equally important. |
| Surgeon Toolkit |
| Shovel tool 16 Crushing Damage |
Allows for some digging. Durability: 100/100
|
Be careful not to dig too greedily and too deep. |
| Nonexistant Item |
Data does not exist. |
| Nonexistant Item |




