BlueGit

timfa questward

Files

questward / client / scripts / generate-skill-icons.mjs

generate-skill-icons.mjs

generate-skill-icons.mjs 1.6 KiB Download Raw
1import { mkdirSync, writeFileSync } from "node:fs";
2import { ALL_SKILL_IDS } from "../../shared/definitions/skills.js";
3
4const labels = {
5 clubfighting: "CL",
6 swordfighting: "SW",
7 axefighting: "AX",
8 archery: "AR",
9 unarmed: "UN",
10 magic: "MG",
11 strength: "ST",
12 dexterity: "DX",
13 agility: "AG",
14 mind: "MN",
15 defence: "DF",
16 health: "HP",
17 stamina: "SM",
18 woodcutting: "WC",
19 mining: "MI",
20 fishing: "FS",
21 smithing: "SI",
22 crafting: "CR",
23 leatherworking: "LW",
24 tailoring: "TL",
25 cooking: "CK",
26 herbalism: "HB",
27 alchemy: "AL"
28};
29
30const colors = {
31 clubfighting: "#8b6914",
32 swordfighting: "#7a8a9a",
33 axefighting: "#9a5030",
34 archery: "#4a7a40",
35 unarmed: "#6a6050",
36 magic: "#6050a0",
37 strength: "#a04040",
38 dexterity: "#4080a0",
39 agility: "#50a080",
40 mind: "#8060a0",
41 defence: "#506080",
42 health: "#a03030",
43 stamina: "#408060",
44 woodcutting: "#5a7040",
45 mining: "#606060",
46 fishing: "#3070a0",
47 smithing: "#806040",
48 crafting: "#806080",
49 leatherworking: "#8a6040",
50 tailoring: "#7070a0",
51 cooking: "#a06030",
52 herbalism: "#3a8a48",
53 alchemy: "#6a40a0"
54};
55
56mkdirSync(new URL("../assets/skills/", import.meta.url), { recursive: true });
57const dir = new URL("../assets/skills/", import.meta.url);
58
59for (const id of ALL_SKILL_IDS)
60{
61 const svg = [
62 "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">",
63 `<rect width="32" height="32" rx="6" fill="${colors[id] ?? "#2a3344"}"/>`,
64 `<text x="16" y="21" text-anchor="middle" fill="#f0ece0" font-size="11" font-family="Segoe UI,sans-serif" font-weight="600">${labels[id] ?? "?"}</text>`,
65 "</svg>"
66 ].join("");
67 writeFileSync(new URL(`${id}.svg`, dir), svg);
68}