-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathAttackIconsScraper.js
More file actions
40 lines (35 loc) · 1.2 KB
/
AttackIconsScraper.js
File metadata and controls
40 lines (35 loc) · 1.2 KB
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
import { AttackIcons } from '/twcheese/src/Models/AttackIcons.js';
class AttackIconsScraper {
/**
* @param {HTMLImageElement} imgElements
* @return {AttackIcons}
*/
scrapeIcons(imgElements) {
let icons = new AttackIcons();
for (let img of imgElements) {
if (img.src.includes('command/farm.png')) {
icons.setSentViaFa();
}
else if (img.src.includes('command/snob.png')) {
icons.setContainsSnob();
}
else if (img.src.includes('command/spy.png')) {
icons.setContainsSpy();
}
else if (img.src.includes('command/knight.png')) {
icons.setContainsKnight();
}
else if (img.src.includes('command/attack_small.png')) {
icons.setSizeSmall();
}
else if (img.src.includes('command/attack_medium.png')) {
icons.setSizeMedium();
}
else if (img.src.includes('command/attack_large.png')) {
icons.setSizeLarge();
}
}
return icons;
}
}
export { AttackIconsScraper };