root/veekun/trunk/templates/dex/common.tt @ 411

Revision 411, 6.7 KB (checked in by eevee, 22 months ago)

Broke move table descriptions. Oops. (#58)

Line 
1[% FILTER null %]
2
3[%# prints a compacted TM name %]
4[% MACRO tm_short_name(tm) BLOCK %]
5[% IF tm > 100 %]<em>H[% tm - 100 %]</em>[% ELSE %][% tm | format('%02d') %][% END %]
6[% END %]
7
8[%# creates a link for a type name %]
9[% MACRO type_name(type, nolink) BLOCK %][% IF TypeData.$type AND NOT nolink %]<a href="[% dex_uri('types', type) %]">[% END %]<img src="/dex-images/gameui/[% type %].png" alt="[% type %]" title="[% type %]"/>[% IF TypeData.$type AND NOT nolink %]</a>[% END %][% END %]
10
11[% move_header = BLOCK %]
12    <th class="name"> Move </th> <th class="type"> Type </th> <th class="type"> Dmg </th> <th class="pp"> PP </th>
13    <th class="power"> Power </th> <th class="acc" title="RBY accuracy is about 0.4% lower"> Acc.* </th> <th class="priority"> Pri. </th> <th class="blurb"> Description </th>
14[% END %]
15
16[%# creates most of the columns in the move table %]
17[% MACRO move_cells(move_id) BLOCK %]
18[%     type = MoveData.$move_id.type %]
19[%     type_bg = (type == '?????') ? 'none' : type %]
20[%     power = MoveData.$move_id.power %]
21[%     kind = MoveData.$move_id.kind %]
22[%     IF power == 1 %]
23[%         power = 'varies' %]
24[%     ELSIF power == 0 %]
25[%         power = '--' %]
26[%     END %]
27    <td class="name"> <a href="[% dex_uri('moves', MoveData.$move_id.name) %]">[% MoveData.$move_id.name %]</a> </td>
28[%     IF type == '?????' %]
29    <td class="type"><img src="/dex-images/gameui/iiam.png" alt="?????" title="?????"/></td>
30[%     ELSE %]
31    <td class="type">[% type_name(type) %]</td>
32[%     END %]
33    <td class="type"> <img src="/dex-images/gameui/[% MoveData.$move_id.class %].png" alt="[% MoveData.$move_id.class %]" title="[% MoveData.$move_id.class %]"/> </td>
34    <td class="pp"> [% MoveData.$move_id.pp %] </td> <td class="power"> [% power %] </td> <td class="acc"> [% MoveData.$move_id.accuracy %]%</td> <td class="priority"> [% MoveData.$move_id.priority || '' %]</td>
35    <td class="blurb"> [% MoveData.$move_id.short_description %] </td>
36[%+ END %]
37
38
39[% contest_header = BLOCK %]
40 <th class="name"> Move </th> <th class="type"> Type </th> <th class="contest"> Appeal </th> <th class="contest"> Jam </th>
41 <th class="blurb"> Contest effect </th>
42[% END %]
43
44[%# creates most of the columns in the move table %]
45[% MACRO contest_cells(move) BLOCK %]
46[%     move_id = move.id %]
47[%     power = MoveData.$move_id.power %]
48[%     kind = MoveData.$move_id.kind %]
49[%     IF power < 2 %]
50[%         FOREACH flag IN PowerLabels %]
51[%             IF kind.match(flag.pattern); power = flag.label; LAST; END %]
52[%         END %]
53[%         SET power = '?! (error!)' IF !power %]
54[%     END %]
55    <td> <a href="[% dex_uri('moves', MoveData.$move_id.name) %]">[% MoveData.$move_id.name %]</a> </td>
56    <td class="type"><img src="/dex-images/gameui/[% move.contest_type %].png" alt="[% move.contest_type %]" title="[% move.contest_type %]"/></td>
57    <td class="contest">
58        [% move.contest.appeal %]
59[% FOR x IN [ 1 .. move.contest.appeal ] %]
60        <img src="/dex-images/gameui/appeal.png" alt="[% this.contest.appeal %]" title="[% this.contest.appeal %]"/>
61[% END %]
62    </td>
63    <td class="contest">
64        [% move.contest.jam %]
65[% FOR x IN [ 1 .. move.contest.jam ] %]
66        <img src="/dex-images/gameui/jam.png" alt="[% this.contest.jam %]" title="[% this.contest.jam %]"/>
67[% END %]
68    </td>
69    <td class="blurb"> [% move.contest.effect %] </td>
70[%+ END %]
71
72
73[% pokemon_header = BLOCK %]
74 <th class="size"> Height </th> <th class="size"> Weight </th>
75 <th colspan="2"> Type </th> <th class="gender"> <img src="/dex-images/gender/x.png" alt="Gender" title="Gender"/> </th>
76 <th class="breeds"> Egg groups </th> <th class="abilities"> Abilities </th>
77 <th class="stat"> HP </th> <th class="stat"> Atk </th> <th class="stat"> Def </th> <th class="stat"> SpA </th>
78 <th class="stat"> SpD </th> <th class="stat"> Spd </th> <th class="stat"> Avg </th>
79[% END %]
80
81[%# same but for pokemon table; requires a full row though since we don't cache all this %]
82[% MACRO pokemon_cells(pokemon) BLOCK %]
83    <td title="[% height_metric(pokemon.height) %]"> [% height_imperial(pokemon.height) %] </td> <td title="[% weight_metric(pokemon.weight) %]"> [% weight_imperial(pokemon.weight) %] </td>
84    <td class="type"> [% type_name(pokemon.type1) %] </td>
85    <td class="type"> [% type_name(pokemon.type2) IF pokemon.type2 %] </td>
86    </td>
87    <td class="gender">[% gender_text(pokemon.gender_rate, 1) %]</td>
88    <td class="breeds">
89[%     FOREACH b IN pokemon.breeds %]
90        <a href="[% c.uri('Dex::Search', 'pokemon_search', { breed => b.breed }) %]">[% BreedingGroups.${b.breed} %]</a>
91[%         '<br/>' UNLESS loop.last %]
92[%     END %]
93    </td>
94    <td class="abilities">
95[%     FOREACH a IN pokemon.pokemon_abilities %]
96  <a href="[% dex_uri('abilities', a.ability.name) %]">[% a.ability.name %]</a>
97[%         '<br/>' UNLESS loop.last %]
98[%     END %]
99    </td>
100[%     stat_avg = 0 %]
101[%     FOREACH column IN StatColumns %]
102    <td class="stat">[% pokemon.$column %]</td>
103[%         stat_avg = stat_avg + pokemon.$column %]
104[%     END %]
105    <td class="stat">[% stat_avg / 6 | format('%.01f') %]</td>
106[%+ END %]
107
108[% MACRO item_sprite(item_name, big) BLOCK %]
109[%     IF ( matches = item_name.match('^(TM|HM)(\d\d)$') ) %]
110[%         tm_num = matches.1 %]
111[%         SET tm_num = tm_num + 100 IF matches.0 == 'HM' %]
112[%         item_file = matches.0 _ "-" _ MoveData.${TMs.3.$tm_num}.type | lower %]
113[%     ELSE %]
114[% matches.join %]
115[%         item_file = item_name.replace(' ', '-').replace('[^-a-zA-Z0-9]', '') | lower %]
116[%     END -%]
117<img src="/dex-images/items/[% 'big/' IF big %][% item_file %].png" alt=""/>
118[%- END %]
119
120[%# n.b.: this takes the structure returned from EncSet->simplest_method %]
121[% MACRO simple_method_cells(simple_method) BLOCK %]
122    <td> [% simple_method.level.0 %][% IF simple_method.level.0 != simple_method.level.1; ' - '; simple_method.level.1; END %] </td>
123[%     category = simple_method.category %]
124<td>
125[%     FOR hashref IN simple_method.rarities %]
126[%         FOR bucket IN hashref.buckets %]
127[%             SWITCH category %]
128[%             CASE 'time' %]<img src="/dex-images/gameui/[% bucket %].png" alt="[% bucket | ucfirst %]" title="[% bucket | ucfirst %]"/>
129[%             CASE 'swarm' %]<img src="/dex-images/items/teachy-tv.png" alt="Swarm" title="Swarm"/>
130[%             CASE 'water' %]<img src="/dex-images/items/[% bucket == 'surfing' ? 'hm-water' : bucket %].png" alt="[% bucket %]" title="[% bucket %]"/>
131[%             CASE 'pokeradar' %]<img src="/dex-images/items/poke-radar.png" alt="Pok&eacute; Radar" title="Pok&eacute; Radar"/>
132[%             CASE 'dualslot' %][% Icons.$bucket %]
133[%             END %]
134[%             ' ' %]
135[%         END %]
136[%         hashref.rarity %]%
137[%         '; ' UNLESS loop.last %]
138[%     END %]
139</td>
140[% END %]
141
142[% END %]
Note: See TracBrowser for help on using the browser.