Difference between revisions of "Template:ShowSkillCaps"

From ChatWars Wiki
Jump to: navigation, search
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 | {{{boundaryLow|20}}} }}{{#vardefine: upperBound | {{{boundaryUp|39}}} }}{{#vardefine: queryText | Level}}{{#vardefine: i | {{#var: lowerBound}} }}<includeonly><!--
+
{{#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 20-39
+
    {{!}}+ 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 }}
+
      | {{#ifexpr: {{#var: i}} < {{#expr: {{#var: upperBound}} + 1 }} | true }}
  | ! {{#var:i}}{{#vardefine: i | {{#expr: {{#var: i}} + 1 }} }}<br>
+
      | {{#if: {{#var: firstRun}} | ! | !! }} {{#var: i}} {{#vardefine: i | {{#expr: {{#var: i}} + 1 }} }}{{#vardefine: firstRun|}}
}}
+
    }}
 
}}
 
}}
 
|-
 
|-
{{#ask: [[{{{source|{{PAGENAME}} }}}]]
+
<!-- formatting and output -->
|link=none
+
{{#vardefine: startRange | 0 }} {{#vardefine: endRange | 0 }}
|headers=hide
+
{{#vardefine: i | {{#var: lowerBound}} }}
|format=template
+
{{#vardefine: firstOutput | 1 }}
|template=SkillRow
+
{{#vardefine: backgroundColorModifier | }}
|?BoolSpecialSkill
+
{{#vardefine: strLen | 0 }}
|?Description#
+
{{#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}} }}
  
|?Level20#
+
    <!-- 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}}<br>
+
    <!-- check if there's a number and a "*" in the skill cap string and mark it as blue-->
{{#vardefine: i | {{#var: lowerBound}} }}{{#while:
+
    {{#vardefine: strLen | {{#len:{{#show: {{#var: skill}} |?{{#var: queryText}}{{#var: i}}# }} }} }}
  | {{#ifexpr: {{#var: i}} < {{#expr: {{#var: upperBound}} + 1 }} | true }}
+
    {{#ifexpr: {{#var: strLen}} > 1
  | {{!}}?{{#var: queryText}}{{#var:i}}<br>
+
      | {{#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