Difference between revisions of "Template:ShowSkillCaps"
m (more formatting adjustments for unknown sections) |
|||
(35 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{#vardefine: class | {{{class|none}}} }}{{#vardefine: lowerBound | {{{ | + | {{#vardefine: skill | {{ReplaceNumericCharEncoding| string= {{{skill | {{PAGENAME}} }}} }} }}{{#vardefine: class | {{{class|none}}} }}{{#vardefine: lowerBound | {{{lowerBound|20}}} }}{{#vardefine: upperBound | {{{upperBound|39}}} }}{{#vardefine: i | 0 }}{{#vardefine: queryText | Level }}{{#vardefine: firstRun | 1}}<includeonly><!-- |
-->{{#switch: {{#var: class}} | -->{{#switch: {{#var: class}} | ||
| Ranger = {{#vardefine: queryText | RnLevel }} | | Ranger = {{#vardefine: queryText | RnLevel }} | ||
Line 7: | Line 7: | ||
| Blacksmith = {{#vardefine: queryText | BsLevel }} | | Blacksmith = {{#vardefine: queryText | BsLevel }} | ||
| Collector = {{#vardefine: queryText | ClLevel }} | | Collector = {{#vardefine: queryText | ClLevel }} | ||
− | }} | + | }}<!-- |
− | {{#ifeq: {{{standalone|true}}} | false | + | |
+ | Generates the header that's needed in case the skill caps are to be displayed standalone (as in, not integrated in another table) | ||
+ | -->{{#ifeq: {{{standalone|true}}} | false | ||
| | | | ||
| {{{!}}class="wikitable" style="width: 90%; text-align: center" | | {{{!}}class="wikitable" style="width: 90%; text-align: center" | ||
− | {{!}}+ Skill caps for levels | + | {{!}}+ Skill caps for levels {{#var: lowerBound}}-{{#var: upperBound}} |
− | {{!}}- | + | {{!}}- |
− | !scope="col" style="width: 10%; text-align: left"{{!}}Skill / Level | + | !scope="col" style="width: 10%; text-align: left"{{!}}Skill / Level |
− | !scope="col" style="width: 45%; text-align: left"{{!}}Description | + | !scope="col" style="width: 45%; text-align: left"{{!}}Description |
− | {{#vardefine: i | {{#var: lowerBound}} }}{{#while: <!-- generate level headers of table --> | + | {{#vardefine: i | {{#var: lowerBound}} }}{{#while: <!-- generate level headers of table --> |
− | + | | {{#ifexpr: {{#var: i}} < {{#expr: {{#var: upperBound}} + 1 }} | true }} | |
− | + | | {{#if: {{#var: firstRun}} | ! | !! }} {{#var: i}} {{#vardefine: i | {{#expr: {{#var: i}} + 1 }} }}{{#vardefine: firstRun|}} | |
− | }} | + | }} |
}} | }} | ||
|- | |- | ||
− | {{# | + | <!-- formatting and output --> |
− | | | + | {{#vardefine: startRange | 0 }} {{#vardefine: endRange | 0 }} |
− | | | + | {{#vardefine: i | {{#var: lowerBound}} }} |
− | | | + | {{#vardefine: firstOutput | 1 }} |
− | | | + | {{#vardefine: backgroundColorModifier | }} |
− | |? | + | {{#vardefine: strLen | 0 }} |
− | |? | + | {{#vardefine: subStr | }} |
+ | <!-- write and style skill name and description--> | ||
+ | |style="{{#ifeq: {{#show: {{#var: skill}} |?BoolSpecialSkill }} | true | ||
+ | | background-color: lightgrey; | ||
+ | }} text-align: left"| [[{{#var: skill}}]] | ||
+ | |style="text-align: left"| {{#show: {{#var: skill}} |?Description# }} | ||
+ | <!-- iterate through entire skill cap range--> | ||
+ | {{#while: | ||
+ | | {{#ifexpr: {{#if: {{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} | 1 | 0 }} and {{#expr: {{#var: i}} <= {{#var: upperBound}} }} | true }} | ||
+ | <!-- iterate over a range (same numbers in skill caps)--> | ||
+ | | {{#vardefine: startRange | {{#var: i}} }} | ||
+ | {{#while: | ||
+ | | {{#ifexpr: {{#expr: {{#var: i}} <= {{#var:upperBound}} }} and {{#if: {{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} | ||
+ | | {{#ifeq: {{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} | ||
+ | | {{#show: {{#var: skill}} |?{{#var: queryText}}{{#expr: {{#var: i}} + 1}}# }} | ||
+ | | 1 | ||
+ | | 0 | ||
+ | }} | ||
+ | | 0 | ||
+ | }} | ||
+ | | true | ||
+ | }} | ||
+ | | {{#vardefine: i | {{#expr: {{#var: i}} + 1}} }} | ||
+ | }} | ||
+ | {{#vardefine: endRange | {{#var: i}} }} | ||
− | |? | + | <!-- mark "unknown" and "?" as red--> |
+ | {{#switch: {{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} | ||
+ | | Unknown | ? = {{#vardefine: backgroundColorModifier | style="background-color: #b02b2b;font-weight:bold;color:white" }} | ||
+ | | #default = {{#vardefine: backgroundColorModifier | }} | ||
+ | }} | ||
− | |?{{#var: queryText}}{{#var:i}} | + | <!-- check if there's a number and a "*" in the skill cap string and mark it as blue--> |
− | {{#vardefine: | + | {{#vardefine: strLen | {{#len:{{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} }} }} |
− | + | {{#ifexpr: {{#var: strLen}} > 1 | |
− | + | | {{#vardefine: subStr | {{#sub:{{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} |-1}} }} | |
− | {{#vardefine: i | {{#expr: {{#var: i}} + 1 }} | + | }} |
− | }} | + | {{#ifeq: {{#var: subStr}} | * |
+ | | {{#vardefine: backgroundColorModifier | style="background-color: lightblue" }} | ||
+ | }} | ||
+ | |||
+ | <!-- check if it's the first cap range being displayed (in that case only write 1x "{{!}}", otherwise write 2x "{{!}}")--> | ||
+ | {{#ifeq: {{#var: firstOutput}} | 1 | ||
+ | | {{!}} | ||
+ | | {{!}}{{!}} | ||
+ | }} colspan="{{#expr: {{#var: endRange}} - {{#var: startRange}} + 1 }}" {{#var: backgroundColorModifier}} {{!}} {{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} | ||
+ | |||
+ | <!-- reset some variables and increment i--> | ||
+ | {{#vardefine: backgroundColorModifier | }} | ||
+ | {{#vardefine: subStr | }} | ||
+ | {{#vardefine: firstOutput | 0 }} | ||
+ | {{#vardefine: i | {{#expr: {{#var: i}} + 1}} }} | ||
}} | }} | ||
+ | |- | ||
{{#ifeq: {{{standalone|true}}} | false | {{#ifeq: {{{standalone|true}}} | false | ||
| | | | ||
| {{!}}} | | {{!}}} | ||
− | }} | + | }}</includeonly><noinclude> |
− | </includeonly> | ||
− | <noinclude> | ||
This template shows the skill caps of a skill within certain boundaries | This template shows the skill caps of a skill within certain boundaries | ||
If parameter "standalone" is set to true (default), it generates a table head to be used completely on its own, | If parameter "standalone" is set to true (default), it generates a table head to be used completely on its own, |
Latest revision as of 05:45, 8 December 2021
This template shows the skill caps of a skill within certain boundaries If parameter "standalone" is set to true (default), it generates a table head to be used completely on its own, if set to false it only shows the name, description and skill caps without adding wikitable beginnings and ends