BlueGit

timfa questward

Files

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

generate-skill-icons.mjs

generate-skill-icons.mjs 1.5 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};
26
27const colors = {
28 clubfighting: "#8b6914",
29 swordfighting: "#7a8a9a",
30 axefighting: "#9a5030",
31 archery: "#4a7a40",
32 unarmed: "#6a6050",
33 magic: "#6050a0",
34 strength: "#a04040",
35 dexterity: "#4080a0",
36 mind: "#8060a0",
37 defence: "#506080",
38 health: "#a03030",
39 stamina: "#408060",
40 woodcutting: "#5a7040",
41 mining: "#606060",
42 fishing: "#3070a0",
43 smithing: "#806040",
44 crafting: "#806080",
45 leatherworking: "#8a6040",
46 tailoring: "#7070a0",
47 cooking: "#a06030"
48};
49
50mkdirSync(new URL("../assets/skills/", import.meta.url), { recursive: true });
51const dir = new URL("../assets/skills/", import.meta.url);
52
53for (const id of ALL_SKILL_IDS)
54{
55 const svg = [
56 "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">",
57 `<rect width="32" height="32" rx="6" fill="${colors[id] ?? "#2a3344"}"/>`,
58 `<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>`,
59 "</svg>"
60 ].join("");
61 writeFileSync(new URL(`${id}.svg`, dir), svg);
62}