forked from rspeer/dominionstats
-
Notifications
You must be signed in to change notification settings - Fork 17
/
openings_template.html
96 lines (96 loc) · 3.2 KB
/
openings_template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
$def with ( openings, card_list, selected_card )
<html><head>
<title>Best and Worst Openings</title>
<style>
body { font-family: sans-serif; color: #222; }
table { border-collapse: collapse; }
td { padding: 3px 15px; }
tr.level td { border-top: 1px solid #ccc; }
tr.level td.level { font-weight: bold; color: #000; }
.lremind { color: #ccc; }
.c { text-align: center; }
.up { color: #0c0; font-size: 84%; text-align: center; padding-left: 2ex; }
.down { color: #c00; font-size: 84%; text-align: center; padding-left: 2ex; }
b { font-weight: bold; color: #000; }
.sm { font-size: 70.7%; }
.c2 { text-align: center; font-size: 70.7%; color: #339; }
.indeterminate { background-color: #ccc; }
</style>
</head>
<body>
<h1>Best and Worst Openings</h1>
<p>This page is meant to be reminiscent of the
<a href="http://dominion.isotropic.org/leaderboard">Isotropic leaderboard</a>.
We consider the <i>openings</i> -- the cards you buy on the first two turns --
as if they were players whose skill adds to yours. The "level" of an opening
then indicates the minimum amount it should add, or subtract, from your
effective level, rounded up.</p>
<p>
There are many openings of average or unknown effectiveness in level 0.
They're hidden by default, but they will show up when you search for a
particular card or "All cards".
</p>
<form action="/openings" method="get">
<label for="card">Filter for card:</label>
<select name="card">
<option>All cards</option>
$for card in card_list:
$if card == selected_card:
<option selected>$card</option>
$else:
<option>$card</option>
</select>
<input type="submit" value="Go">
</form>
$ samelevel = 0
$ prevlevel = '-'
$ rank = 0
<table>
<tr><th></th><th>skill range</th><th>rank</th><th>cards</th><th>cost</th></tr>
$for opening in openings:
$code:
level = opening['level_str']
if level == prevlevel:
samelevel += 1
else:
samelevel = 0
rank += 1
$if (level == '0'):
$if (prevlevel.startswith('+')):
<tr class='blank'>
<td></td> <td> </td> <td></td> <td></td> <td></td>
</tr>
$if selected_card == '':
<tr class='indeterminate'>
<td></td> <td></td> <td></td> <td>...</td> <td></td>
</tr>
$if (samelevel == 0):
<tr class='indeterminate level'><td class='level'>Level 0</td>
$else:
<tr class='indeterminate'><td></td>
$elif (samelevel == 0):
$if (level.startswith('-') and prevlevel == '0'):
$if selected_card == '':
<tr class='indeterminate'>
<td></td> <td></td> <td></td> <td>...</td> <td></td>
</tr>
<tr class='blank'>
<td></td> <td> </td> <td></td> <td></td> <td></td>
</tr>
<tr class='level'><td class='level'>Level $level</td>
$elif (samelevel % 10 == 0):
<tr><td class='lremind'>Level $level</td>
$else:
<tr><td></td>
$ prevlevel = level
<td>$:opening['skill_str']</td>
<td class='c2'>
$if level.startswith('+'):
$rank
</td>
<td>$(' / '.join(opening['cards']))</td>
<td>$opening['cost']</td>
</tr>
</table>
</body>
</html>