From Dark and Darker Wiki

m (Adding parameter functionality.)
(Monster Data structure was changed. Fixed call.)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#arraydefine:all|{{Monster Data|{{{1}}}s}}}}<!--
<includeonly>{{#arraydefine:all|{{Monster Data|{{{1}}}}}}}<!--
-->{{#arraydefine:bosses}}<!--
-->{{#arraydefine:bosses}}<!--
-->{{#arraydefine:minibosses}}<!--
-->{{#arraydefine:minibosses}}<!--
-->{{#arraydefine:monsters}}<!--
-->{{#arraydefine:monsters}}<!--
Sieves the array "all" into three types  
Sieves the array "all" into three types  
-->{{#loop:i
-->{{
    #loop:i
     |0
     |0
     |{{#arraysize:all}}
     |{{#arraysize:all}}
     |{{#vardefine:current|{{ #arrayindex:all | {{ #var:i }}}}}}<!--
     |{{#vardefine:current|{{ #arrayindex:all | {{ #var:i }}}}}}<!--
     If is Boss, add to bosses array
     If is Boss, add to bosses array
     -->{{#if:{{Monster Data|{{#var:current}}|Boss}}|<!--
     -->{{#if:{{Monster Data|{{#var:current}}|Boss}}<!--
         -->{{#arraydefine:bosses|{{#arrayprint:bosses}},{{#var:current}}}}|<!--
         -->|{{#arraydefine:bosses|{{#arrayprint:bosses}},{{#var:current}}}}<!--
         If is not a Boss and is a Miniboss, add to the minibosses array
         If is not a Boss and is a Miniboss, add to the minibosses array
         -->{{#if:{{Monster Data|{{#var:current}}|MiniBoss}}|<!--
         -->|{{#if:{{Monster Data|{{#var:current}}|MiniBoss}}<!--
             -->{{#arraydefine:minibosses|{{#arrayprint:minibosses}},{{#var:current}}}}|<!--
             -->|{{#arraydefine:minibosses|{{#arrayprint:minibosses}},{{#var:current}}}}<!--
             If neither Boss nor Miniboss, add to monsters array
             If neither Boss nor Miniboss, add to monsters array
             -->{{#arraydefine:monsters|{{#arrayprint:monsters}},{{#var:current}}}}}}}}
             -->|{{#arraydefine:monsters|{{#arrayprint:monsters}},{{#var:current}}}}}}}}
}}
}}<!--
==Bosses==
-->{{#ifeq:{{#arraysize:bosses}}|0
<ul>{{#loop: i
    ||<h2>Bosses</h2>
    |1
    <ul>{{
    |{{#expr:{{#arraysize:bosses}}-1}}
        #loop: i
    |{{#vardefine:current|{{ #arrayindex:bosses | {{ #var:i }}}}}}<!--
        |1
    -->{{#if:{{#var:current}}|<li>[[{{#var:current}}]]</li>}}
        |{{#expr:{{#arraysize:bosses}}-1}}
}}</ul>
        |{{#vardefine:current|{{ #arrayindex:bosses | {{ #var:i }}}}}}<!--
==Mini Bosses==
        --><li>[[{{#var:current}}]]</li>
<ul>{{#loop: i
    }}</ul>}}<!--
    |1
-->{{#ifeq:{{#arraysize:minibosses}}|0
    |{{#expr:{{#arraysize:minibosses}}-1}}
    ||<h2>Mini Bosses</h2>
    |{{#vardefine:current|{{ #arrayindex:minibosses | {{ #var:i }}}}}}<!--
    <ul>{{
    -->{{#if:{{#var:current}}|<li>[[{{#var:current}}]]</li>}}
        #loop: i
}}</ul>
        |1
==Monsters==
        |{{#expr:{{#arraysize:minibosses}}-1}}
<ul>{{#loop: i
        |{{#vardefine:current|{{ #arrayindex:minibosses | {{ #var:i }}}}}}<!--
    |1
        --><li>[[{{#var:current}}]]</li>
    |{{#expr:{{#arraysize:monsters}}-1}}
    }}</ul>}}<!--
    |{{#vardefine:current|{{ #arrayindex:monsters | {{ #var:i }}}}}}<!--
-->{{#ifeq:{{#arraysize:monsters}}|0
    -->{{#if:{{#var:current}}|<li>[[{{#var:current}}]]</li>}}
    ||<h2>Monsters</h2>
}}</ul></includeonly>
    <ul>{{
 
        #loop: i
 
        |1
<noinclude>
        |{{#expr:{{#arraysize:monsters}}-1}}
        |{{#vardefine:current|{{ #arrayindex:monsters | {{ #var:i }}}}}}<!--
        --><li>[[{{#var:current}}]]</li>
    }}</ul>}}<!--
--></includeonly><noinclude>
Example: <pre> {{GenerateMonsterRace|Skeleton}} </pre>
Example: <pre> {{GenerateMonsterRace|Skeleton}} </pre>
{{GenerateRacePage|Skeleton}}
{{GenerateRacePage|Skeleton}}
</noinclude>
</noinclude>

Latest revision as of 21:33, 8 April 2024