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 mind: "MN",
14 defence: "DF",
15 health: "HP",
16 stamina: "SM",
17 woodcutting: "WC",
18 mining: "MI",
19 fishing: "FS",
20 smithing: "SI",
21 crafting: "CR",
22 leatherworking: "LW",
23 tailoring: "TL",
24 cooking: "CK",
25 herbalism: "HB",
26 alchemy: "AL"
27};
28
29const colors = {
30 clubfighting: "#8b6914",
31 swordfighting: "#7a8a9a",
32 axefighting: "#9a5030",
33 archery: "#4a7a40",
34 unarmed: "#6a6050",
35 magic: "#6050a0",
36 strength: "#a04040",
37 dexterity: "#4080a0",
38 mind: "#8060a0",
39 defence: "#506080",
40 health: "#a03030",
41 stamina: "#408060",
42 woodcutting: "#5a7040",
43 mining: "#606060",
44 fishing: "#3070a0",
45 smithing: "#806040",
46 crafting: "#806080",
47 leatherworking: "#8a6040",
48 tailoring: "#7070a0",
49 cooking: "#a06030",
50 herbalism: "#3a8a48",
51 alchemy: "#6a40a0"
52};
53
54mkdirSync(new URL("../assets/skills/", import.meta.url), { recursive: true });
55const dir = new URL("../assets/skills/", import.meta.url);
56
57for (const id of ALL_SKILL_IDS)
58{
59 const svg = [
60 "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">",
61 `<rect width="32" height="32" rx="6" fill="${colors[id] ?? "#2a3344"}"/>`,
62 `<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>`,
63 "</svg>"
64 ].join("");
65 writeFileSync(new URL(`${id}.svg`, dir), svg);
66}