forked from UshiSushi/itemlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
449 lines (385 loc) · 19.3 KB
/
index.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
---
layout: page
title: Store
---
<link rel="stylesheet" href="{{- 'assets/css/core.css' | relative_url -}} "/>
<script src="{{- 'assets/js/tabs.js' | relative_url -}}"></script>
<script src="{{- 'assets/js/filter.js' | relative_url -}}"></script>
<script src="https://www.kryogenix.org/code/browser/sorttable/sorttable.js"></script>
{%- assign itemsForDisplay = site.data.StoreItems.items | where_exp: "item", "item.category != 'Animal'" | where_exp: "item", "item.price > 0" | sort: "abr" -%}
{%- assign eventsForDisplay = site.data.StoreIncidents.incitems | where_exp: "incident", "incident.price > 0" | sort: "abr" -%}
{%- assign animalsForDisplay = site.data.StoreItems.items | where: "category", "Animal" | where_exp: "animal", "animal.price > 0" | sort: "abr" -%}
{%- assign traitsForDisplay = site.data.ShopExt.traits | sort: "name" -%}
{%- assign kindsForDisplay = site.data.ShopExt.races | where: "enabled", "true" | sort: "name" -%}
{%- assign displayableTraitCount = 0 -%}
{%- for trait in traitsForDisplay -%}
{%- if trait.canAdd or trait.canRemove -%}
{%- assign displayableTraitCount = displayableTraitCount | plus: 1 -%}
{%- endif -%}
{%- endfor -%}
{%- assign buy = "" -%}
{%- for command in site.data.commands -%}
{%- if command.name == "Buy" -%}
{%- capture buy -%}
{{- command.usage | split: " " | first -}}
{%- endcapture -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
<div class="tab">
{%- if itemsForDisplay.size > 0 -%}
<button class="tabLinks" id="defaultOpen" onclick="changeTab(event, 'items')">{{- site.data.language.str_items-}}</button>
{%- endif -%}
{%- if eventsForDisplay.size > 0 -%}
<button class="tabLinks" onclick="changeTab(event, 'events')">{{- site.data.language.str_events -}}</button>
{%- endif -%}
{%- if animalsForDisplay.size > 0 -%}
<button class="tabLinks" onclick="changeTab(event, 'animals')">{{- site.data.language.str_animals -}}</button>
{%- endif -%}
{%- if displayableTraitCount > 0 -%}
<button class="tabLinks" onclick="changeTab(event, 'traits')">{{- site.data.language.str_traits -}}</button>
{%- endif -%}
{%- if kindsForDisplay.size > 0 -%}
<button class="tabLinks" onclick="changeTab(event, 'kinds')">{{- site.data.language.str_kinds -}}</button>
{%- endif -%}
</div>
{%- if itemsForDisplay.size > 0 -%}
<div class="tabContent" id="items">
<input type="text" aria-label="Item searchbox" class="search" id="itemsInput" onkeyup="filterTable('items')" placeholder="{{- site.data.language.str_items_search -}}">
<table class="sortable" style="display: table">
<thead>
<tr>
<th>Name</th>
<th class="priceWithData">Cost</th>
{%- if site.store.items.category -%}
<th>Category</th>
{%- endif -%}
</tr>
</thead>
<tbody>
{%- for item in itemsForDisplay -%}
<tr>
<td>
{%- if site.data.itemdata[item.defname].CustomName != nil -%}
{{- site.data.itemdata[item.defname].CustomName -}}
{%- else -%}
{{- item.abr -}}
{%- endif -%}
{%- if site.store.items.mod -%}
<span class="metadata">
{{- site.data.language.str_from -}} {{- site.data.itemdata[item.defname].Mod -}}
</span>
{%- endif -%}
{%- if site.store.items.usage -%}
<span class="metadata">
{{- site.data.language.str_usage -}}: {{- buy -}}
{%- if site.data.itemdata[item.defname].CustomName != nil -%}
{{- site.data.itemdata[item.defname].CustomName -}}
{%- else -%}
{{- item.abr -}}
{%- endif -%}
1
</span>
{%- endif -%}
</td>
<td>
{{- item.price -}}
{%- if site.store.items.weight and site.data.itemdata[item.defname].Weight != 1 -%}
<span class="metadata">
{{- site.data.language.str_weight -}}: {{- site.data.itemdata[item.defname].Weight -}}
</span>
{%- endif -%}
{%- if site.store.items.quantity and site.data.itemdata[item.defname].QuantityLimit > 0 -%}
<span class="metadata">
{{- site.data.language.str_quantity_limit -}}: {{-
site.data.itemdata[item.defname].QuantityLimit -}}
</span>
{%- endif -%}
{%- if site.store.items.karma and site.data.itemdata[item.defname].KarmaType != nil -%}
<span class="metadata">
{{- site.data.language.str_karma -}}: {{- site.data.itemdata[item.defname].KarmaType -}}
</span>
{%- endif -%}
</td>
{%- if site.store.items.category -%}
<td>{{- item.category -}}</td>
{%- endif -%}
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
{%- if eventsForDisplay.size > 0 -%}
<div class="tabContent" id="events">
<input type="text" aria-label="Event searchbox" class="search" id="eventsInput" onkeyup="filterTable('events')" placeholder="{{- site.data.language.str_events_search -}}">
<table class="sortable">
<thead>
<tr>
<th>Name</th>
<th class="price">Cost</th>
<th class="karmaType">Karma Type</th>
</tr>
</thead>
<tbody>
{%- for item in eventsForDisplay -%}
<tr>
<td>
{{- item.abr -}}
{%- if site.store.events.usage -%}
<span class="metadata">
{{- site.data.language.str_usage -}}: {{- buy -}}
{{- item.abr -}}
</span>
{%- endif -%}
</td>
<td>
{%- if site.store_redirects.trait contains item.abr -%}
<span class="eventRedirect" onclick="changeTab(event, 'traits')">{{- site.data.language.str_see_traits -}}</span>
{%- elsif site.store_redirects.kind contains item.abr -%}
<span class="eventRedirect" onclick="changeTab(event, 'kinds')">{{- site.data.language.str_see_kinds -}}</span>
{%- elsif site.store_redirects.item contains item.abr -%}
<span class="eventRedirect" onclick="changeTab(event, 'items')">{{- site.data.language.str_see_items -}}</span>
{%- else -%}
{{- item.price -}}
{%- endif -%}
</td>
<td>{{- item.karmatype -}}</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
{%- if animalsForDisplay.size > 0 -%}
<div class="tabContent" id="animals">
<input type="text" aria-label="Animal searchbox" class="search" id="animalsInput" onkeyup="filterTable('animals')" placeholder="{{- site.data.language.str_animals_search -}}">
<table class="sortable">
<thead>
<tr>
<th>Name</th>
<th class="priceWithData">Cost</th>
</tr>
</thead>
<tbody>
{%- for item in animalsForDisplay -%}
<tr>
<td>
{%- if site.data.itemdata[item.defname].CustomName != nil -%}
{{- site.data.itemdata[item.defname].CustomName -}}
{%- else -%}
{{- item.abr -}}
{%- endif -%}
{%- if site.store.items.mod -%}
<span class="metadata">
{{- site.data.language.str_from -}}
{{- site.data.itemdata[item.defname].Mod -}}
</span>
{%- endif -%}
{%- if site.store.animals.usage -%}
<span class="metadata">
<br/> {{- site.data.language.str_usage -}}: {{- buy -}}
{%- if site.data.itemdata[item.defname].CustomName != nil -%}
{{- site.data.itemdata[item.defname].CustomName -}}
{%- else -%}
{{- item.abr -}}
{%- endif -%}
1
</span>
{%- endif -%}
</td>
<td>
{{- item.price -}}
{%- if site.store.items.weight and site.data.itemdata[item.defname].Weight != 1 -%}
<span class="metadata">
{{- site.data.language.str_weight -}}: {{- site.data.itemdata[item.defname].Weight -}}
</span>
{%- endif -%}
{%- if site.store.items.quantity and site.data.itemdata[item.defname].QuantityLimit > 0 -%}
<span class="metadata">
{{- site.data.language.str_quantity_limit -}}: {{-site.data.itemdata[item.defname].QuantityLimit -}}
</span>
{%- endif -%}
{%- if site.store.items.karma and site.data.itemdata[item.defname].KarmaType != nil -%}
<span class="metadata">
{{- site.data.language.str_karma -}}: {{- site.data.itemdata[item.defname].KarmaType -}}
</span>
{%- endif -%}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
{%- if displayableTraitCount > 0 -%}
<div class="tabContent" id="traits">
<input type="text" aria-label="Trait searchbox" class="search" id="traitsInput" onkeyup="filterTable('traits')" placeholder="{{- site.data.language.str_traits_search -}}">
<table class="sortable">
<thead>
<tr>
<th>Name</th>
{%- if site.store.traits.description or site.store.traits.conflicts or site.store.traits.stats or site.store.traits.limit -%}
<th>Description</th>
{%- endif -%}
<th class="priceWithData">Add Cost</th>
<th class="priceWithData">Remove Cost</th>
</tr>
</thead>
<tbody>
{%- for trait in traitsForDisplay -%}
{%- if trait.canAdd == false and trait.canRemove == false -%}
{%- continue -%}
{%- endif -%}
<tr>
<td>
{{- trait.name -}}
{%- if site.store.traits.limit and trait.data.canBypassLimit -%}
<span class="metadata">
{{- site.data.language.str_bypasses_limit -}}
</span>
{%- endif -%}
{%- if site.store.traits.usage -%}
<span class="metadata">
{{- site.data.language.str_usage -}}: {{- buy -}} trait {{- trait.name -}} <br/> {{- site.data.language.str_usage -}}: {{- buy -}}
removetrait {{- trait.name -}}
</span>
{%- endif -%}
</td>
<td class="description">
{%- if site.store.traits.description -%}
{{- trait.description -}}
{%- endif -%}
{%- if site.store.traits.stats -%}
{%- capture temp -%}
{{- trait.stats | first -}}
{%- endcapture -%}
{%- if temp != "" -%}
<span class="metadata">
{{- site.data.language.str_trait_stats -}}
<ul>
{%- for stat in trait.stats -%}
<li>{{- stat -}}</li>
{%- endfor -%}
</ul>
</span>
{%- endif -%}
{%- endif -%}
{%- if site.store.traits.conflicts -%}
{%- capture nameTemp -%}
{{- trait.conflicts | first -}}
{%- endcapture -%}
{%- if nameTemp != "" -%}
<span class="metadata">
{{- site.data.language.str_trait_conflicts -}}
<ul>
{%- for c in trait.conflicts -%}
<li>{{- c -}}</li>
{%- endfor -%}
</ul>
</span>
{%- endif -%}
{%- endif -%}
</td>
{%- if trait.canAdd -%}
<td>
{{- trait.addPrice -}}
{%- if site.store.traits.karma and trait.data.karmaTypeForAdding != nil -%}
<span class="metadata">
{{- site.data.language.str_karma -}}: {{- trait.data.karmaTypeForAdding -}}
</span>
{%- endif -%}
</td>
{%- else -%}
<td>{{- site.data.language.str_disabled -}}</td>
{%- endif -%}
{%- if trait.canRemove -%}
<td>
{{- trait.removePrice -}}
{%- if site.store.traits.karma and trait.data.karmaTypeForRemoving != nil -%}
<span class="metadata">
{{- site.data.language.str_karma -}}: {{- trait.data.karmaTypeForRemoving -}}
</span>
{%- endif -%}
</td>
{%- else -%}
<td>{{- site.data.language.str_disabled -}}</td>
{%- endif -%}
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
{%- if kindsForDisplay.size > 0 -%}
<div class="tabContent" id="kinds">
<input type="text" aria-label="Pawn searchbox" class="search" id="kindsInput" onkeyup="filterTable('kinds')" placeholder="{{- site.data.language.str_kinds_search -}}">
<table class="sortable">
<thead>
<tr>
<th>Name</th>
<th class="price">Cost</th>
</tr>
</thead>
<tbody>
{%- for item in kindsForDisplay-%}
<tr>
<td>
{{- item.name -}}
{%- if site.store.kinds.usage -%}
<span class="metadata">
<br/>
{{- site.data.language.str_usage -}}: {{- buy -}} pawn {{- item.name -}}
</span>
{%- endif -%}
</td>
<td>
{{- item.price -}}
{%- if site.store.kinds.karma and item.data.karmaType != nil -%}
<span class="metadata">
<br/> {{- site.data.language.str_karma -}}: {{- item.data.karmaType -}}
</span>
{%- endif -%}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
</div>
{%- endif -%}
<script>
window.addEventListener("load", function (event) {
var query = "";
var queryStarted = false;
var tab = "items";
var url = document.URL;
for (var i = 0; i < url.length; i++) {
var e = url[i];
if (e == "?") {
queryStarted = true;
continue;
}
if (e == "#" || e == "/") {
queryStarted = false;
continue;
}
if (queryStarted) {
query = query + e;
}
}
if (query.length <= 0) {
return document.getElementById("defaultOpen").click();
}
var segments = query.split("&");
for (var i = 0; i < segments.length; i++) {
var e = segments[i].split('=');
if (e[1] == null || e[1] == "") {
continue;
}
if (e[0].toUpperCase() == "TAB") {
return changeTab({ currentTarget: document.getElementById(e[1]) }, e[1])
}
}
return document.getElementById("defaultOpen").click();
});
</script>