Difference between revisions of "Template:SkillRow"

From ChatWars Wiki
Jump to: navigation, search
 
(156 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{#vardefine: startRange | 0 }} {{#vardefine: endRange | 0 }}
 +
{{#vardefine: i | 4 }}
 +
{{#vardefine: firstOutput | 1 }}
 +
{{#vardefine: backgroundColorModifier | }}
 +
{{#vardefine: strLen | 0 }}
 +
{{#vardefine: subStr | }}
 
<includeonly>
 
<includeonly>
  | {{{1|}}}
+
<!-- write and style skill name and description-->
  | {{{2|}}}
+
  |style="{{#if: {{{2}}} | background-color: lightgrey; }} text-align: left"| {{{1|}}}
 +
  |style="text-align: left"| {{{3|}}}
 +
<!-- iterate through entire skill cap range given by the #ask-->
 +
{{#while:
 +
  | {{#if: {{{ {{#var: i}} |}}} | true }}
 +
    <!-- iterate over a range (same numbers in skill caps-->
 +
  | {{#vardefine: startRange | {{#var: i}} }}
 +
    {{#while:
 +
      | {{#if: {{{ {{#expr: {{#var: i}} }} |}}} | {{#ifeq: {{{ {{#expr: {{#var: i}} }} |}}} | {{{ {{#expr: {{#var: i}} + 1}} |}}} | true}} }}
 +
      | {{#vardefine: i | {{#expr: {{#var: i}} + 1}} }}
 +
    }}
 +
    {{#vardefine: endRange | {{#var: i}} }}
  
 +
    <!-- mark "unknown" and "?" as red-->
 +
    {{#switch: {{{ {{#var: i}} |}}}
 +
      | Unknown | ? = {{#vardefine: backgroundColorModifier | style="background-color: red" }}
 +
      | #default = {{#vardefine: backgroundColorModifier | }}
 +
    }}
  
{{#vardefine: nrLevels | 20 }}
+
    <!-- check if there's a number and a "*" in the skill cap string and mark it as blue-->
{{#vardefine: initialOffset | 3 }}
+
    {{#vardefine: strLen | {{#len:{{{ {{#var: i}} |}}} }} }}
{{#vardefine: offset | initialOffset }}
+
    {{#ifexpr: {{#var: strLen}} > 1 | {{#vardefine: subStr | {{#sub:{{{ {{#var: i}} |}}}|-1}} }} }}
{{#vardefine: i | 0 }}{{#while:
+
     {{#ifeq: {{#var: subStr}} | * | {{#vardefine: backgroundColorModifier | style="background-color: lightblue" }} }}
  | {{#ifexpr: i < nrLevels | true | false}}
 
  <!--| {{#while:
 
      | <{{#ifeq: {{{ #expr:{{ {{#var: i}} + {{#var: offset}} }}} | {{{ {{#expr: {{#var: i}} + {{#var: offset}} + 1}} }}} | true | false}}
 
      |
 
     }}-->
 
  | {{!}}colspan="{{#expr: {{#var: i}} + 0}}"{{!}} {{{ {{#expr:{{#var: i}} + offset}} |}}}
 
  {{#vardefine: offset | i }}
 
  {{#vardefine: i | {{#expr: {{#var: i}} + 1}} }}
 
}}
 
  
 +
    <!-- 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}} {{!}} {{{ {{#expr: {{#var: i}} }} |}}} | {{!}}{{!}} colspan="{{#expr: {{#var: endRange}} - {{#var: startRange}} + 1 }}" {{#var: backgroundColorModifier}} {{!}} {{{ {{#expr: {{#var: i}} }} |}}} }}
  
<!--
+
    <!-- reset some variables and increment i-->
{{#vardefine: initialOffset | 3 }}
+
    {{#vardefine: backgroundColorModifier | }}
{{#vardefine: offset | initialOffset }}
+
    {{#vardefine: subStr | }}
{{#vardefine: i | 0 }}{{#while:
+
    {{#vardefine: firstOutput | 0 }}
  | {{#ifeq: {{{ #expr:{{ {{#var: i}} + {{#var: offset}} }}} | {{{ #expr:{{ {{#var: i}} + {{#var: offset}} + 1}} }}} | true | false}}
+
    {{#vardefine: i | {{#expr: {{#var: i}} + 1}} }}
  |
 
 
}}
 
}}
| {{!}} colspan="{{{ {{#expr: {{#var: i}} - offset}} |}}}" {{!}} {{{ {{#var: i}} |}}}
 
| {{#vardefine: offset | i }}
 
-->
 
 
<!--
 
| {{#ifeq: {{{3|}}}|{{{4|}}} | {{#ifeq: {{{4|}}}|{{{5|}}} | {{#ifeq: {{{5|}}}|{{{6|}}} | {{#ifeq: {{{6|}}}|{{{7|}}} |  | colspan="4" }} | colspan="3" }} | colspan="2" }} | colspan="1" {{!}} {{{3|}}} }}| 
 
| {{{4|}}}
 
| {{{5|}}}
 
| {{{6|}}}
 
| {{{7|}}}
 
| {{{8|}}}
 
| {{{9|}}}
 
| {{{10|}}}
 
| {{{11|}}}
 
| {{{12|}}}
 
| {{{13|}}}
 
| {{{14|}}}
 
| {{{15|}}}
 
| {{{16|}}}
 
| {{{17|}}}
 
| {{{18|}}}
 
| {{{19|}}}
 
| {{{20|}}}
 
| {{{21|}}}
 
| {{{22|}}}
 
-->
 
 
  |-
 
  |-
 
</includeonly>
 
</includeonly>

Latest revision as of 12:55, 17 July 2018





This is a template for formatting one row (skill) of the skill cap table