Difference between revisions of "Template:Properties"

From Stoneshard wiki
Jump to navigation Jump to search
old>Realpsojed
(Very not happy with how this is done but it should work. Needs to be lightened.)
old>Realpsojed
(removed redundant #if:, removed unwated spaces)
Line 7: Line 7:
Calls Template:Properties_sort to evaluate all Properties from item's page and compare them with a single Propertygrp. Then another Propertygrp
Calls Template:Properties_sort to evaluate all Properties from item's page and compare them with a single Propertygrp. Then another Propertygrp
If match is found, returns the Property's name. If no match, returns empty string.
If match is found, returns the Property's name. If no match, returns empty string.
-->{{#if: {{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties1}}}} | {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties1}}}} | }}
-->{{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties1}}}} | {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties1}}}} | }}<!--
{{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties2}}}} | {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties2}}}} | }}
-->{{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties2}}}} | {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties2}}}} | }}<!--
{{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties3}}}} | {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties3}}}}
-->{{#if: {{Properties_sort|Propertygrp1={{:{{{1}}}|Properties3}}}} | {{Properties_sort|Propertygrp1={{:{{{
Only one parameter used - item page name - to load all properties from the item's page (ie. Wooden Sword).
Only one parameter used - item page name - to load all properties from the item's page (ie. Wooden Sword).
Call Template:Properties_sort to evaluate all Properties from item's page and compare them with a single Propertygrp.
Call Template:Properties_sort to evaluate all Properties from item's page and compare them with a single Propertygrp.

Revision as of 15:39, 8 May 2020

Template-info.png Documentation

This template needs optimizing. Function is as follows:

1) Calls for Template:Properties sort and provides Properties from the Weapon's page one by one.
2) Then checks the returned PropertygrpX values against all 10 Property groups. Empty Propertygrps are evaluated as empty strings and don't affect the result.
3) Only when matched, calls for Properties' Values from the Weapon's page and colors them white.
4) Also checks the name of the page where you used this Template. If the name is the Weapon's page (or a subpage of the Weapon's page, like Templar Sword/Tooltip), it applies float:right to all the values (since that's how the values are ingame in the tooltips - floated to the right). If the name is not the Weapon's page (like "Swords"), it doesn't apply float:right to the Values.

Only one parameter is used - Weapon's page name.


This template requires that the Weapon's page name has the weapon's data entered as parameters. Example using a switch:

<includeonly>{{#switch: {{{1}}}
|WeaponType = Sword
|Damage1 = 30
|DamageType1 = Slashing
|Damage2 = {{Sacred|2}}
|DamageType2 = {{Sacred|Sacred}}
|Properties1 = Armor Penetration
|Values1 = {{Positive|+20%}}
|Properties2 = Accuracy
|Values2 = {{Positive|+3%}}
|Properties3 = Magic Power
|Values3 = {{Positive|+5%}}
|Properties4 = Block Chance
|Values4 = {{Positive|+5%}}
|Properties5 = Skills Energy Cost
|Values5 = {{Negative|+15%}}
|Durability = 400
|Description = There is a faint etching on the surface of the blade, pledging loyalty to the Host and the court... the common kind of court.
|Price = 7200
|#default = 
}}</includeonly>


This template is used within Template:Weapon, but can also be used to simply load Properties and their Values. For example, here's a simple div with border and we load the Properties of Templar Sword:

<div style="width:fit-content;color:#9d9a9a;border:1px solid blue;">{{Properties|Templar Sword}}</div>