1
0
forked from noxious/client
This commit is contained in:
Dennis Postma 2025-01-07 22:20:46 +01:00
parent c2db9b5469
commit 574777da80
19 changed files with 385 additions and 416 deletions

170
package-lock.json generated
View File

@ -1244,9 +1244,9 @@
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.1.tgz",
"integrity": "sha512-qFcFto9figFLz2g25DxJ1WWL9+c91fTxnGuwhToCl8BaqDsDYMl/kOnBXAyAqkkzAWimYMSWNPWEjt+ADAHuoQ==", "integrity": "sha512-pSWY+EVt3rJ9fQ3IqlrEUtXh3cGqGtPDH1FQlNZehO2yYxCHEX1SPsz1M//NXwYfbTlcKr9WObLnJX9FsS9K1Q==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -1258,9 +1258,9 @@
] ]
}, },
"node_modules/@rollup/rollup-android-arm64": { "node_modules/@rollup/rollup-android-arm64": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.1.tgz",
"integrity": "sha512-vqrQdusvVl7dthqNjWCL043qelBK+gv9v3ZiqdxgaJvmZyIAAXMjeGVSqZynKq69T7062T5VrVTuikKSAAVP6A==", "integrity": "sha512-/NA2qXxE3D/BRjOJM8wQblmArQq1YoBVJjrjoTSBS09jgUisq7bqxNHJ8kjCHeV21W/9WDGwJEWSN0KQ2mtD/w==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1272,9 +1272,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-arm64": { "node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.1.tgz",
"integrity": "sha512-617pd92LhdA9+wpixnzsyhVft3szYiN16aNUMzVkf2N+yAk8UXY226Bfp36LvxYTUt7MO/ycqGFjQgJ0wlMaWQ==", "integrity": "sha512-r7FQIXD7gB0WJ5mokTUgUWPl0eYIH0wnxqeSAhuIwvnnpjdVB8cRRClyKLQr7lgzjctkbp5KmswWszlwYln03Q==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1286,9 +1286,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.1.tgz",
"integrity": "sha512-Y3b4oDoaEhCypg8ajPqigKDcpi5ZZovemQl9Edpem0uNv6UUjXv7iySBpGIUTSs2ovWOzYpfw9EbFJXF/fJHWw==", "integrity": "sha512-x78BavIwSH6sqfP2xeI1hd1GpHL8J4W2BXcVM/5KYKoAD3nNsfitQhvWSw+TFtQTLZ9OmlF+FEInEHyubut2OA==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1300,9 +1300,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-arm64": { "node_modules/@rollup/rollup-freebsd-arm64": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.1.tgz",
"integrity": "sha512-3REQJ4f90sFIBfa0BUokiCdrV/E4uIjhkWe1bMgCkhFXbf4D8YN6C4zwJL881GM818qVYE9BO3dGwjKhpo2ABA==", "integrity": "sha512-HYTlUAjbO1z8ywxsDFWADfTRfTIIy/oUlfIDmlHYmjUP2QRDTzBuWXc9O4CXM+bo9qfiCclmHk1x4ogBjOUpUQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1314,9 +1314,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-x64": { "node_modules/@rollup/rollup-freebsd-x64": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.1.tgz",
"integrity": "sha512-ZtY3Y8icbe3Cc+uQicsXG5L+CRGUfLZjW6j2gn5ikpltt3Whqjfo5mkyZ86UiuHF9Q3ZsaQeW7YswlHnN+lAcg==", "integrity": "sha512-1MEdGqogQLccphhX5myCJqeGNYTNcmTyaic9S7CG3JhwuIByJ7J05vGbZxsizQthP1xpVx7kd3o31eOogfEirw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1328,9 +1328,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-gnueabihf": { "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.1.tgz",
"integrity": "sha512-bsPGGzfiHXMhQGuFGpmo2PyTwcrh2otL6ycSZAFTESviUoBOuxF7iBbAL5IJXc/69peXl5rAtbewBFeASZ9O0g==", "integrity": "sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -1342,9 +1342,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-musleabihf": { "node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.1.tgz",
"integrity": "sha512-kvyIECEhs2DrrdfQf++maCWJIQ974EI4txlz1nNSBaCdtf7i5Xf1AQCEJWOC5rEBisdaMFFnOWNLYt7KpFqy5A==", "integrity": "sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@ -1356,9 +1356,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.1.tgz",
"integrity": "sha512-CFE7zDNrokaotXu+shwIrmWrFxllg79vciH4E/zeK7NitVuWEaXRzS0mFfFvyhZfn8WfVOG/1E9u8/DFEgK7WQ==", "integrity": "sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1370,9 +1370,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-musl": { "node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.1.tgz",
"integrity": "sha512-MctNTBlvMcIBP0t8lV/NXiUwFg9oK5F79CxLU+a3xgrdJjfBLVIEHSAjQ9+ipofN2GKaMLnFFXLltg1HEEPaGQ==", "integrity": "sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1384,9 +1384,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-loongarch64-gnu": { "node_modules/@rollup/rollup-linux-loongarch64-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.1.tgz",
"integrity": "sha512-fBpoYwLEPivL3q368+gwn4qnYnr7GVwM6NnMo8rJ4wb0p/Y5lg88vQRRP077gf+tc25akuqd+1Sxbn9meODhwA==", "integrity": "sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@ -1398,9 +1398,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": { "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.1.tgz",
"integrity": "sha512-1hiHPV6dUaqIMXrIjN+vgJqtfkLpqHS1Xsg0oUfUVD98xGp1wX89PIXgDF2DWra1nxAd8dfE0Dk59MyeKaBVAw==", "integrity": "sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@ -1412,9 +1412,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-riscv64-gnu": { "node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.1.tgz",
"integrity": "sha512-U0xcC80SMpEbvvLw92emHrNjlS3OXjAM0aVzlWfar6PR0ODWCTQtKeeB+tlAPGfZQXicv1SpWwRz9Hyzq3Jx3g==", "integrity": "sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@ -1426,9 +1426,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-s390x-gnu": { "node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.1.tgz",
"integrity": "sha512-VU/P/IODrNPasgZDLIFJmMiLGez+BN11DQWfTVlViJVabyF3JaeaJkP6teI8760f18BMGCQOW9gOmuzFaI1pUw==", "integrity": "sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@ -1440,9 +1440,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.1.tgz",
"integrity": "sha512-laQVRvdbKmjXuFA3ZiZj7+U24FcmoPlXEi2OyLfbpY2MW1oxLt9Au8q9eHd0x6Pw/Kw4oe9gwVXWwIf2PVqblg==", "integrity": "sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1454,9 +1454,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-musl": { "node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.1.tgz",
"integrity": "sha512-3wzKzduS7jzxqcOvy/ocU/gMR3/QrHEFLge5CD7Si9fyHuoXcidyYZ6jyx8OPYmCcGm3uKTUl+9jUSAY74Ln5A==", "integrity": "sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1468,9 +1468,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-arm64-msvc": { "node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.1.tgz",
"integrity": "sha512-jROwnI1+wPyuv696rAFHp5+6RFhXGGwgmgSfzE8e4xfit6oLRg7GyMArVUoM3ChS045OwWr9aTnU+2c1UdBMyw==", "integrity": "sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@ -1482,9 +1482,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-ia32-msvc": { "node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.1.tgz",
"integrity": "sha512-duzweyup5WELhcXx5H1jokpr13i3BV9b48FMiikYAwk/MT1LrMYYk2TzenBd0jj4ivQIt58JWSxc19y4SvLP4g==", "integrity": "sha512-pxHAU+Zv39hLUTdQQHUVHf4P+0C47y/ZloorHpzs2SXMRqeAWmGghzAhfOlzFHHwjvgokdFAhC4V+6kC1lRRfw==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@ -1496,9 +1496,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.0.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.1.tgz",
"integrity": "sha512-DYvxS0M07PvgvavMIybCOBYheyrqlui6ZQBHJs6GqduVzHSZ06TPPvlfvnYstjODHQ8UUXFwt5YE+h0jFI8kwg==", "integrity": "sha512-D6qjsXGcvhTjv0kI4fU8tUuBDF/Ueee4SVX79VfNDXZa64TfCW1Slkb6Z7O1p7vflqZjcmOVdZlqf8gvJxc6og==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@ -1510,9 +1510,9 @@
] ]
}, },
"node_modules/@rushstack/eslint-patch": { "node_modules/@rushstack/eslint-patch": {
"version": "1.10.4", "version": "1.10.5",
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.4.tgz", "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.5.tgz",
"integrity": "sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==", "integrity": "sha512-kkKUDVlII2DQiKy7UstOR1ErJP8kUKAQ4oa+SQtM0K+lPdmmjj0YnnxBgtTVYH7mUKtbsxeFC9y0AmK7Yb78/A==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@ -2948,9 +2948,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.76", "version": "1.5.78",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.76.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.78.tgz",
"integrity": "sha512-CjVQyG7n7Sr+eBXE86HIulnL5N8xZY1sgmOPGuq/F0Rr0FJq63lg0kEtOIDfZBk44FnDLf6FUJ+dsJcuiUDdDQ==", "integrity": "sha512-UmwIt7HRKN1rsJfddG5UG7rCTCTAKoS9JeOy/R0zSenAyaZ8SU3RuXlwcratxhdxGRNpk03iq8O7BA3W7ibLVw==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@ -5425,9 +5425,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.30.0", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.0.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.1.tgz",
"integrity": "sha512-sDnr1pcjTgUT69qBksNF1N1anwfbyYG6TBQ22b03bII8EdiUQ7J0TlozVaTMjT/eEJAO49e1ndV7t+UZfL1+vA==", "integrity": "sha512-mlJ4glW020fPuLi7DkM/lN97mYEZGWeqBnrljzN0gs7GLctqX3lNWxKQ7Gl712UAX+6fog/L3jh4gb7R6aVi3w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -5441,25 +5441,25 @@
"npm": ">=8.0.0" "npm": ">=8.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.30.0", "@rollup/rollup-android-arm-eabi": "4.30.1",
"@rollup/rollup-android-arm64": "4.30.0", "@rollup/rollup-android-arm64": "4.30.1",
"@rollup/rollup-darwin-arm64": "4.30.0", "@rollup/rollup-darwin-arm64": "4.30.1",
"@rollup/rollup-darwin-x64": "4.30.0", "@rollup/rollup-darwin-x64": "4.30.1",
"@rollup/rollup-freebsd-arm64": "4.30.0", "@rollup/rollup-freebsd-arm64": "4.30.1",
"@rollup/rollup-freebsd-x64": "4.30.0", "@rollup/rollup-freebsd-x64": "4.30.1",
"@rollup/rollup-linux-arm-gnueabihf": "4.30.0", "@rollup/rollup-linux-arm-gnueabihf": "4.30.1",
"@rollup/rollup-linux-arm-musleabihf": "4.30.0", "@rollup/rollup-linux-arm-musleabihf": "4.30.1",
"@rollup/rollup-linux-arm64-gnu": "4.30.0", "@rollup/rollup-linux-arm64-gnu": "4.30.1",
"@rollup/rollup-linux-arm64-musl": "4.30.0", "@rollup/rollup-linux-arm64-musl": "4.30.1",
"@rollup/rollup-linux-loongarch64-gnu": "4.30.0", "@rollup/rollup-linux-loongarch64-gnu": "4.30.1",
"@rollup/rollup-linux-powerpc64le-gnu": "4.30.0", "@rollup/rollup-linux-powerpc64le-gnu": "4.30.1",
"@rollup/rollup-linux-riscv64-gnu": "4.30.0", "@rollup/rollup-linux-riscv64-gnu": "4.30.1",
"@rollup/rollup-linux-s390x-gnu": "4.30.0", "@rollup/rollup-linux-s390x-gnu": "4.30.1",
"@rollup/rollup-linux-x64-gnu": "4.30.0", "@rollup/rollup-linux-x64-gnu": "4.30.1",
"@rollup/rollup-linux-x64-musl": "4.30.0", "@rollup/rollup-linux-x64-musl": "4.30.1",
"@rollup/rollup-win32-arm64-msvc": "4.30.0", "@rollup/rollup-win32-arm64-msvc": "4.30.1",
"@rollup/rollup-win32-ia32-msvc": "4.30.0", "@rollup/rollup-win32-ia32-msvc": "4.30.1",
"@rollup/rollup-win32-x64-msvc": "4.30.0", "@rollup/rollup-win32-x64-msvc": "4.30.1",
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },

View File

@ -1,4 +1,5 @@
<template> <template>
<Debug />
<Notifications /> <Notifications />
<BackgroundImageLoader /> <BackgroundImageLoader />
<GmPanel v-if="gameStore.character?.role === 'gm'" /> <GmPanel v-if="gameStore.character?.role === 'gm'" />
@ -16,7 +17,8 @@ import BackgroundImageLoader from '@/components/utilities/BackgroundImageLoader.
import Notifications from '@/components/utilities/Notifications.vue' import Notifications from '@/components/utilities/Notifications.vue'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { useMapEditorStore } from '@/stores/mapEditorStore' import { useMapEditorStore } from '@/stores/mapEditorStore'
import { computed, watch } from 'vue' import { computed, onMounted, onUnmounted, watch } from 'vue'
import Debug from '@/components/utilities/Debug.vue'
const gameStore = useGameStore() const gameStore = useGameStore()
const mapEditorStore = useMapEditorStore() const mapEditorStore = useMapEditorStore()

View File

@ -174,10 +174,9 @@ export type Character = {
positionX: number positionX: number
positionY: number positionY: number
rotation: number rotation: number
characterType: CharacterType | null | string characterType: UUID | null
characterHair: CharacterHair | null characterHair: UUID | null
mapId: UUID map: UUID
map: Map
chats: Chat[] chats: Chat[]
items: CharacterItem[] items: CharacterItem[]
equipment: CharacterEquipment[] equipment: CharacterEquipment[]
@ -256,6 +255,6 @@ export type WeatherState = {
} }
export type mapLoadData = { export type mapLoadData = {
map: Map mapId: UUID
characters: MapCharacter[] characters: MapCharacter[]
} }

View File

@ -2,7 +2,7 @@
<ChatBubble :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" /> <ChatBubble :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" />
<Healthbar :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" /> <Healthbar :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" />
<Container ref="charContainer" :depth="isometricDepth" :x="currentX" :y="currentY"> <Container ref="charContainer" :depth="isometricDepth" :x="currentX" :y="currentY">
<CharacterHair :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" /> <!-- <CharacterHair :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" />-->
<!-- <CharacterChest :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" />--> <!-- <CharacterChest :mapCharacter="props.mapCharacter" :currentX="currentX" :currentY="currentY" />-->
<Sprite ref="charSprite" :origin-y="1" :flipX="isFlippedX" /> <Sprite ref="charSprite" :origin-y="1" :flipX="isFlippedX" />
</Container> </Container>
@ -109,7 +109,7 @@ const isFlippedX = computed(() => [6, 4].includes(props.mapCharacter.character.r
const charTexture = computed(() => { const charTexture = computed(() => {
const { rotation, characterType } = props.mapCharacter.character const { rotation, characterType } = props.mapCharacter.character
const spriteId = characterType?.sprite ?? 'idle_right_down' const spriteId = characterType ?? 'idle_right_down'
const action = props.mapCharacter.isMoving ? 'walk' : 'idle' const action = props.mapCharacter.isMoving ? 'walk' : 'idle'
const direction = [0, 6].includes(rotation) ? 'left_up' : 'right_down' const direction = [0, 6].includes(rotation) ? 'left_up' : 'right_down'
@ -152,7 +152,7 @@ watch(
watch(() => props.mapCharacter, updateSprite) watch(() => props.mapCharacter, updateSprite)
loadSpriteTextures(scene, props.mapCharacter.character.characterType?.sprite as string) loadSpriteTextures(scene, props.mapCharacter.character.characterType as string)
.then(() => { .then(() => {
charSprite.value!.setTexture(charTexture.value) charSprite.value!.setTexture(charTexture.value)
charSprite.value!.setFlipX(isFlippedX.value) charSprite.value!.setFlipX(isFlippedX.value)

View File

@ -1,11 +1,11 @@
<template> <template>
<MapTiles :key="mapStore.map?.id ?? 0" @tileMap:create="tileMap = $event" /> <MapTiles :key="mapStore.mapId" @tileMap:create="tileMap = $event" />
<MapObjects v-if="tileMap" :tilemap="tileMap as Phaser.Tilemaps.Tilemap" /> <MapObjects v-if="tileMap" :tilemap="tileMap as Phaser.Tilemaps.Tilemap" />
<Characters v-if="tileMap" :tilemap="tileMap as Phaser.Tilemaps.Tilemap" /> <Characters v-if="tileMap" :tilemap="tileMap as Phaser.Tilemaps.Tilemap" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { MapCharacter, mapLoadData, UUID } from '@/application/types' import type { MapCharacter, mapLoadData, UUID, Map } from '@/application/types'
import Characters from '@/components/game/map/Characters.vue' import Characters from '@/components/game/map/Characters.vue'
import MapTiles from '@/components/game/map/MapTiles.vue' import MapTiles from '@/components/game/map/MapTiles.vue'
import MapObjects from '@/components/game/map/PlacedMapObjects.vue' import MapObjects from '@/components/game/map/PlacedMapObjects.vue'
@ -14,10 +14,13 @@ import { useGameStore } from '@/stores/gameStore'
import { useMapStore } from '@/stores/mapStore' import { useMapStore } from '@/stores/mapStore'
import { useScene } from 'phavuer' import { useScene } from 'phavuer'
import { onUnmounted, ref, shallowRef } from 'vue' import { onUnmounted, ref, shallowRef } from 'vue'
import { MapStorage } from '@/storage/storages'
const scene = useScene() const scene = useScene()
const gameStore = useGameStore() const gameStore = useGameStore()
const mapStore = useMapStore() const mapStore = useMapStore()
const mapStorage = new MapStorage()
const mapData = ref<Map>()
const tileMap = shallowRef<Phaser.Tilemaps.Tilemap>() const tileMap = shallowRef<Phaser.Tilemaps.Tilemap>()
@ -31,8 +34,7 @@ onUnmounted(() => {
// Event listeners // Event listeners
gameStore.connection?.on('map:character:teleport', async (data: mapLoadData) => { gameStore.connection?.on('map:character:teleport', async (data: mapLoadData) => {
await loadMapTilesIntoScene(data.map.id, scene) mapStore.setMapId(data.mapId)
mapStore.setMap(data.map)
mapStore.setCharacters(data.characters) mapStore.setCharacters(data.characters)
}) })

View File

@ -1,57 +1,54 @@
<template> <template>
<Controls :layer="tileLayer" :depth="0" /> <Controls v-if="isInitialized" :layer="tileLayer" :depth="0" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import config from '@/application/config' import config from '@/application/config'
import { unduplicateArray } from '@/application/utilities' import { unduplicateArray } from '@/application/utilities'
import Controls from '@/components/utilities/Controls.vue' import Controls from '@/components/utilities/Controls.vue'
import { FlattenMapArray, setLayerTiles } from '@/composables/mapComposable' import { FlattenMapArray, loadMapTilesIntoScene, setLayerTiles } from '@/composables/mapComposable'
import { useMapStore } from '@/stores/mapStore' import { useMapStore } from '@/stores/mapStore'
import { useScene } from 'phavuer' import { useScene } from 'phavuer'
import { onBeforeUnmount } from 'vue' import { onBeforeUnmount, onMounted, ref } from 'vue'
import { MapStorage } from '@/storage/storages'
import type { UUID } from '@/application/types'
const emit = defineEmits(['tileMap:create']) const emit = defineEmits(['tileMap:create'])
const scene = useScene() const scene = useScene()
const mapStore = useMapStore() const mapStore = useMapStore()
const tileMap = createTileMap() const mapStorage = new MapStorage()
const tileLayer = createTileLayer()
/** let tileMap: Phaser.Tilemaps.Tilemap
* A Tilemap is a container for Tilemap data. let tileLayer: Phaser.Tilemaps.TilemapLayer
* This isn't a display object, rather, it holds data about the map and allows you to add tilesets and tilemap layers to it. let isInitialized = ref(false)
* A map can have one or more tilemap layers, which are the display objects that actually render the tiles.
*/ function createTileMap(mapData: any) {
function createTileMap() { const mapConfig = new Phaser.Tilemaps.MapData({
const mapData = new Phaser.Tilemaps.MapData({ width: mapData?.width,
width: mapStore.map?.width, height: mapData?.height,
height: mapStore.map?.height,
tileWidth: config.tile_size.x, tileWidth: config.tile_size.x,
tileHeight: config.tile_size.y, tileHeight: config.tile_size.y,
orientation: Phaser.Tilemaps.Orientation.ISOMETRIC, orientation: Phaser.Tilemaps.Orientation.ISOMETRIC,
format: Phaser.Tilemaps.Formats.ARRAY_2D format: Phaser.Tilemaps.Formats.ARRAY_2D
}) })
const newTileMap = new Phaser.Tilemaps.Tilemap(scene, mapData) const newTileMap = new Phaser.Tilemaps.Tilemap(scene, mapConfig)
emit('tileMap:create', newTileMap) emit('tileMap:create', newTileMap)
return newTileMap return newTileMap
} }
/** function createTileLayer(mapData: any) {
* A Tileset is a combination of a single image containing the tiles and a container for data about each tile. const tilesArray = unduplicateArray(FlattenMapArray(mapData?.tiles ?? []))
*/
function createTileLayer() {
const tilesArray = unduplicateArray(FlattenMapArray(mapStore.map?.tiles ?? []))
const tilesetImages = Array.from(tilesArray).map((tile: any, index: number) => { const tilesetImages = Array.from(tilesArray).map((tile: any, index: number) => {
return tileMap.addTilesetImage(tile, tile, config.tile_size.x, config.tile_size.y, 1, 2, index + 1, { x: 0, y: -config.tile_size.y }) return tileMap.addTilesetImage(tile, tile, config.tile_size.x, config.tile_size.y, 1, 2, index + 1, { x: 0, y: -config.tile_size.y })
}) as any })
// Add blank tile // Add blank tile
tilesetImages.push(tileMap.addTilesetImage('blank_tile', 'blank_tile', config.tile_size.x, config.tile_size.y, 1, 2, 0, { x: 0, y: -config.tile_size.y })) tilesetImages.push(tileMap.addTilesetImage('blank_tile', 'blank_tile', config.tile_size.x, config.tile_size.y, 1, 2, 0, { x: 0, y: -config.tile_size.y }))
const layer = tileMap.createBlankLayer('tiles', tilesetImages, 0, config.tile_size.y) as Phaser.Tilemaps.TilemapLayer const layer = tileMap.createBlankLayer('tiles', tilesetImages as any, 0, config.tile_size.y) as Phaser.Tilemaps.TilemapLayer
layer.setDepth(0) layer.setDepth(0)
layer.setCullPadding(2, 2) layer.setCullPadding(2, 2)
@ -59,11 +56,28 @@ function createTileLayer() {
return layer return layer
} }
setLayerTiles(tileMap, tileLayer, mapStore.map?.tiles) async function initialize() {
try {
await loadMapTilesIntoScene(mapStore.mapId as UUID, scene)
const mapData = await mapStorage.get(mapStore.mapId)
tileMap = createTileMap(mapData)
tileLayer = createTileLayer(mapData)
setLayerTiles(tileMap, tileLayer, mapData?.tiles)
isInitialized.value = true
} catch (error) {
console.error('Failed to initialize map:', error)
}
}
onMounted(() => {
initialize()
})
onBeforeUnmount(() => { onBeforeUnmount(() => {
tileMap.destroyLayer('tiles') if (tileMap) {
tileMap.removeAllLayers() tileMap.destroyLayer('tiles')
tileMap.destroy() tileMap.removeAllLayers()
tileMap.destroy()
}
}) })
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<Image v-if="gameStore.getLoadedAsset(props.placedMapObject.mapObject.id)" v-bind="imageProps" /> <Image v-if="gameStore.isAssetLoaded(props.placedMapObject.mapObject)" v-bind="imageProps" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -34,27 +34,23 @@
<button class="ml-6 w-4 h-8 p-0"> <button class="ml-6 w-4 h-8 p-0">
<img src="/assets/icons/triangle-icon.svg" class="w-3 h-3.5 m-auto" alt="Arrow left" /> <img src="/assets/icons/triangle-icon.svg" class="w-3 h-3.5 m-auto" alt="Arrow left" />
</button> </button>
<img class="w-24 object-contain mb-3.5" alt="Player avatar" :src="config.server_endpoint + '/avatar/s/' + characters.find((c) => c.id === selectedCharacterId)?.characterType?.id + '/' + (selectedHairId ?? 'default')" /> <img class="w-24 object-contain mb-3.5" alt="Player avatar" :src="config.server_endpoint + '/avatar/s/' + characters.find((c) => c.id === selectedCharacterId)?.characterType + '/' + (selectedHairId ?? 'default')" />
<button class="mr-6 w-4 h-8 p-0"> <button class="mr-6 w-4 h-8 p-0">
<img src="/assets/icons/triangle-icon.svg" class="w-3 h-3.5 -scale-x-100" alt="Arrow right" /> <img src="/assets/icons/triangle-icon.svg" class="w-3 h-3.5 -scale-x-100" alt="Arrow right" />
</button> </button>
</div> </div>
<!-- <div class="flex justify-between w-[190px]">-->
<!-- &lt;!&ndash; TODO: replace with color swatches &ndash;&gt;-->
<!-- <button v-for="n in 9" class="w-4 h-4 rounded-sm bg-white"></button>-->
<!-- </div>-->
</div> </div>
<!-- TODO: update gender on (selected) character --> <!-- TODO: update gender on (selected) character -->
<div class="flex justify-between w-[190px]"> <!-- <div class="flex justify-between w-[190px]">-->
<button class="btn-empty flex gap-2" :class="{ selected: characters.find((c) => c.id == selectedCharacterId)?.characterType?.gender === 'MALE' }"> <!-- <button class="btn-empty flex gap-2" :class="{ selected: characters.find((c) => c.id == selectedCharacterId)?.characterType?.gender === 'MALE' }">-->
<img src="/assets/icons/male-icon.svg" class="w-4 h-4 m-auto" alt="Male symbol" /> <!-- <img src="/assets/icons/male-icon.svg" class="w-4 h-4 m-auto" alt="Male symbol" />-->
<span class="text-white">Male</span> <!-- <span class="text-white">Male</span>-->
</button> <!-- </button>-->
<button class="btn-empty flex gap-2" :class="{ selected: characters.find((c) => c.id == selectedCharacterId)?.characterType?.gender === 'FEMALE' }"> <!-- <button class="btn-empty flex gap-2" :class="{ selected: characters.find((c) => c.id == selectedCharacterId)?.characterType?.gender === 'FEMALE' }">-->
<img src="/assets/icons/male-icon.svg" class="w-4 h-4 m-auto" alt="Male symbol" /> <!-- <img src="/assets/icons/male-icon.svg" class="w-4 h-4 m-auto" alt="Male symbol" />-->
<span class="text-white">Female</span> <!-- <span class="text-white">Female</span>-->
</button> <!-- </button>-->
</div> <!-- </div>-->
</div> </div>
</div> </div>
</div> </div>
@ -74,7 +70,7 @@
v-for="hair in characterHairs" v-for="hair in characterHairs"
class="relative flex justify-center items-center bg-gray default-border w-[18px] h-[18px] p-2 rounded-sm hover:bg-gray-500 hover:border-gray-400 focus-visible:outline-none focus-visible:border-gray-300 focus-visible:bg-gray-500 has-[:checked]:bg-cyan has-[:checked]:border-transparent" class="relative flex justify-center items-center bg-gray default-border w-[18px] h-[18px] p-2 rounded-sm hover:bg-gray-500 hover:border-gray-400 focus-visible:outline-none focus-visible:border-gray-300 focus-visible:bg-gray-500 has-[:checked]:bg-cyan has-[:checked]:border-transparent"
> >
<img class="h-4 object-contain" :src="config.server_endpoint + '/textures/sprites/' + hair.sprite?.id + '/front.png'" alt="Hair sprite" /> <img class="h-4 object-contain" :src="config.server_endpoint + '/textures/sprites/' + hair.sprite + '/front.png'" alt="Hair sprite" />
<input type="radio" name="hair" :value="hair.id" v-model="selectedHairId" class="h-full w-full absolute left-0 top-0 m-0 z-10 hover:cursor-pointer focus-visible:outline-offset-0 focus-visible:outline-white" /> <input type="radio" name="hair" :value="hair.id" v-model="selectedHairId" class="h-full w-full absolute left-0 top-0 m-0 z-10 hover:cursor-pointer focus-visible:outline-offset-0 focus-visible:outline-white" />
</div> </div>
</div> </div>
@ -129,7 +125,8 @@ import config from '@/application/config'
import { type CharacterHair, type Character as CharacterT, type Map } from '@/application/types' import { type CharacterHair, type Character as CharacterT, type Map } from '@/application/types'
import Modal from '@/components/utilities/Modal.vue' import Modal from '@/components/utilities/Modal.vue'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { onBeforeUnmount, ref, watch } from 'vue' import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { CharacterHairStorage } from '@/storage/storages'
const gameStore = useGameStore() const gameStore = useGameStore()
const isLoading = ref<boolean>(true) const isLoading = ref<boolean>(true)
@ -140,6 +137,7 @@ const newCharacterName = ref<string>('')
const characterHairs = ref<CharacterHair[]>([]) const characterHairs = ref<CharacterHair[]>([])
const selectedHairId = ref<number | null>(null) const selectedHairId = ref<number | null>(null)
// Fetch characters // Fetch characters
setTimeout(() => { setTimeout(() => {
gameStore.connection?.emit('character:list') gameStore.connection?.emit('character:list')
@ -148,12 +146,6 @@ setTimeout(() => {
gameStore.connection?.on('character:list', (data: any) => { gameStore.connection?.on('character:list', (data: any) => {
characters.value = data characters.value = data
isLoading.value = false isLoading.value = false
// Fetch hairs
// @TODO: This is hacky, we should have a better way to do this
gameStore.connection?.emit('character:hair:list', {}, (data: CharacterHair[]) => {
characterHairs.value = data
})
}) })
// Select character logics // Select character logics
@ -184,7 +176,13 @@ function createCharacter() {
// Watch changes for selected character and update hairs // Watch changes for selected character and update hairs
watch(selectedCharacterId, (characterId) => { watch(selectedCharacterId, (characterId) => {
if (!characterId) return if (!characterId) return
selectedHairId.value = characters.value.find((c) => c.id == characterId)?.characterHairId ?? null // selectedHairId.value = characters.value.find((c) => c.id == characterId)?.characterHairId ?? null
})
onMounted(async () => {
const characterHairStorage = new CharacterHairStorage()
characterHairs.value = await characterHairStorage.getAll()
console.log(characterHairs.value)
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {

View File

@ -17,63 +17,53 @@
<script setup lang="ts" async> <script setup lang="ts" async>
import config from '@/application/config' import config from '@/application/config'
import type { HttpResponse, MapObject } from '@/application/types' import type { HttpResponse, MapObject } from '@/application/types'
import { MapObjectStorage } from '@/dexie/mapObjects'
import { MapStorage } from '@/dexie/maps'
// import type { Map } from '@/application/types' // import type { Map } from '@/application/types'
import type { Map } from '@/dexie/maps'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { ref } from 'vue' import { ref } from 'vue'
import type { BaseStorage } from '@/storage/baseStorage'
import {
CharacterHairStorage,
CharacterTypeStorage,
MapObjectStorage,
MapStorage, SpriteStorage,
TileStorage
} from '@/storage/storages'
const gameStore = useGameStore() const gameStore = useGameStore()
const mapStorage = new MapStorage()
const mapObjectStorage = new MapObjectStorage()
const totalItems = ref(0) const totalItems = ref(0)
const currentItem = ref(0) const currentItem = ref(0)
/** async function downloadAndStore<T extends { id: string }>(
* Download map cache from the server and add them to the storage endpoint: string,
*/ storage: BaseStorage<T>
async function downloadMaps() { ) {
// Request to download maps const request = await fetch(`${config.server_endpoint}/cache/${endpoint}`)
const request = await fetch(config.server_endpoint + '/cache/maps') const response = (await request.json()) as HttpResponse<T[]>
const response = (await request.json()) as HttpResponse<Map[]>
if (!response.success) { if (!response.success) {
console.error('Failed to download maps:', response.message) console.error(`Failed to download ${endpoint}:`, response.message)
return return
} }
const maps = response.data ?? ([] as Map[]) const items = response.data ?? []
for (const item of items) {
// Add maps to storage await storage.add(item)
for (const map of maps) {
await mapStorage.add(map)
} }
} }
/** const tileStorage = new TileStorage()
* Download map objects cache from the server and add them to the storage const mapStorage = new MapStorage()
*/ const mapObjectStorage = new MapObjectStorage()
async function downloadMapObjects() {
// Request to download map objects
const request = await fetch(config.server_endpoint + '/cache/map_objects')
const response = (await request.json()) as HttpResponse<MapObject[]>
if (!response.success) {
console.error('Failed to download map objects:', response.message)
return
}
const mapObjects = response.data ?? ([] as MapObject[]) Promise.all([
downloadAndStore('tiles', tileStorage),
// Add map objects to storage downloadAndStore('maps', mapStorage),
for (const mapObject of mapObjects) { downloadAndStore('map_objects', mapObjectStorage),
await mapObjectStorage.add(mapObject) downloadAndStore('sprites', new SpriteStorage()),
} downloadAndStore('character_types', new CharacterTypeStorage()),
} downloadAndStore('character_hair', new CharacterHairStorage())
]).then(() => {
Promise.all([downloadMaps(), downloadMapObjects()]).then(() => {
// Set isLoaded to true
gameStore.game.isLoaded = true gameStore.game.isLoaded = true
}) })
</script> </script>

View File

@ -0,0 +1,55 @@
<template>
</template>
<script setup lang="ts">
import { onMounted, onUnmounted } from 'vue'
import {
CharacterHairStorage,
CharacterTypeStorage,
MapObjectStorage,
MapStorage, SpriteStorage,
TileStorage
} from '@/storage/storages'
import { TextureStorage } from '@/storage/textureStorage'
const mapStorage = new MapStorage()
const tileStorage = new TileStorage()
const mapObjectStorage = new MapObjectStorage()
const spriteStorage = new SpriteStorage()
const characterTypeStorage = new CharacterTypeStorage()
const characterHairStorage = new CharacterHairStorage()
const textureStorage = new TextureStorage()
let currentString = ''
async function handleKeyPress(event: KeyboardEvent) {
// Ignore if typing in input/textarea
if (document.activeElement?.tagName.toUpperCase() === 'INPUT' ||
document.activeElement?.tagName.toUpperCase() === 'TEXTAREA') {
return
}
currentString += event.key
// Do something when string matches
if (currentString.includes('reset')) {
await mapStorage.destroy()
await tileStorage.destroy()
await mapObjectStorage.destroy()
await spriteStorage.destroy()
await characterTypeStorage.destroy()
await characterHairStorage.destroy()
await textureStorage.destroy()
currentString = '' // Reset
}
// Reset string after a certain amount of time
setTimeout(() => {
currentString = ''
}, 60000)
}
onMounted(() => window.addEventListener('keydown', handleKeyPress))
onUnmounted(() => window.removeEventListener('keydown', handleKeyPress))
</script>

View File

@ -1,13 +1,14 @@
import config from '@/application/config' import config from '@/application/config'
import type { HttpResponse, Sprite, SpriteAction, TextureData } from '@/application/types' import type { HttpResponse, Sprite, SpriteAction, TextureData } from '@/application/types'
import { Textures } from '@/dexie/textures' import { TextureStorage } from '@/storage/textureStorage'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { SpriteStorage } from '@/storage/storages'
const textureLoadingPromises = new Map<string, Promise<boolean>>() const textureLoadingPromises = new Map<string, Promise<boolean>>()
export async function loadTexture(scene: Phaser.Scene, textureData: TextureData): Promise<boolean> { export async function loadTexture(scene: Phaser.Scene, textureData: TextureData): Promise<boolean> {
const gameStore = useGameStore() const gameStore = useGameStore()
const textures = new Textures() const textureStorage = new TextureStorage()
// Check if the texture is already loaded in Phaser // Check if the texture is already loaded in Phaser
if (gameStore.game.loadedAssets.find((asset) => asset.key === textureData.key)) { if (gameStore.game.loadedAssets.find((asset) => asset.key === textureData.key)) {
@ -22,12 +23,12 @@ export async function loadTexture(scene: Phaser.Scene, textureData: TextureData)
// Create new loading promise // Create new loading promise
const loadingPromise = (async () => { const loadingPromise = (async () => {
// Check if the asset is already cached // Check if the asset is already cached
let texture = await textures.get(textureData.key) let texture = await textureStorage.get(textureData.key)
// If asset is not found, download it // If asset is not found, download it
if (!texture) { if (!texture) {
await textures.download(textureData) await textureStorage.download(textureData)
texture = await textures.get(textureData.key) texture = await textureStorage.get(textureData.key)
} }
// If asset is found, add it to the scene // If asset is found, add it to the scene
@ -60,9 +61,12 @@ export async function loadSpriteTextures(scene: Phaser.Scene, sprite_id: string)
if (!sprite_id) return if (!sprite_id) return
// @TODO: Fix this // @TODO: Fix this
const sprite_actions: HttpResponse<any[]> = await fetch(config.server_endpoint + '/assets/list_sprite_actions/' + sprite_id).then((response) => response.json()) const spriteStorage = new SpriteStorage()
const sprite = await spriteStorage.get(sprite_id)
for await (const sprite_action of sprite_actions.data ?? []) { if (!sprite) return
for await (const sprite_action of sprite.spriteActions) {
await loadTexture(scene, { await loadTexture(scene, {
key: sprite_action.key, key: sprite_action.key,
data: sprite_action.data, data: sprite_action.data,

View File

@ -2,7 +2,7 @@ import config from '@/application/config'
import type { HttpResponse, TextureData, UUID } from '@/application/types' import type { HttpResponse, TextureData, UUID } from '@/application/types'
import { unduplicateArray } from '@/application/utilities' import { unduplicateArray } from '@/application/utilities'
import { loadTexture } from '@/composables/gameComposable' import { loadTexture } from '@/composables/gameComposable'
import { MapStorage } from '@/dexie/maps' import { MapStorage } from '@/storage/storages'
import Tilemap = Phaser.Tilemaps.Tilemap import Tilemap = Phaser.Tilemaps.Tilemap
import TilemapLayer = Phaser.Tilemaps.TilemapLayer import TilemapLayer = Phaser.Tilemaps.TilemapLayer
@ -94,8 +94,6 @@ export async function loadMapTilesIntoScene(map_id: UUID, scene: Phaser.Scene) {
const tileArray = unduplicateArray(FlattenMapArray(map.tiles)) const tileArray = unduplicateArray(FlattenMapArray(map.tiles))
console.log(tileArray)
// Load each tile into the scene // Load each tile into the scene
for (const tile of tileArray) { for (const tile of tileArray) {
const textureData = { const textureData = {

View File

@ -1,88 +0,0 @@
import type { MapObject } from '@/application/types'
import Dexie from 'dexie'
export class MapObjectStorage {
private dexie: Dexie
constructor() {
this.dexie = new Dexie('map_objects')
this.dexie.version(1).stores({
map_objects: 'id, name, createdAt, updatedAt'
})
}
async add(mapObject: MapObject, overwrite = false) {
try {
// Check if map object already exists, don't add if it does and overwrite is false
const existingMapObject = await this.get(mapObject.id)
if (existingMapObject && !overwrite) return
await this.dexie.table('map_objects').put({
...mapObject
})
} catch (error) {
console.error(`Failed to add map object ${mapObject.id}:`, error)
}
}
async get(id: string): Promise<MapObject | null> {
try {
const mapObject = await this.dexie.table('map_objects').get(id)
return mapObject || null
} catch (error) {
console.error(`Failed to retrieve map object ${id}:`, error)
return null
}
}
async getAll(): Promise<MapObject[]> {
try {
return await this.dexie.table('map_objects').toArray()
} catch (error) {
console.error('Failed to retrieve all map objects:', error)
return []
}
}
async getByName(name: string): Promise<MapObject[]> {
try {
return await this.dexie.table('map_objects').where('name').equals(name).toArray()
} catch (error) {
console.error(`Failed to retrieve map objects with name ${name}:`, error)
return []
}
}
async delete(id: string) {
try {
await this.dexie.table('map_objects').delete(id)
} catch (error) {
console.error(`Failed to delete map object ${id}:`, error)
}
}
async clear() {
try {
await this.dexie.table('map_objects').clear()
} catch (error) {
console.error('Failed to clear map objects storage:', error)
}
}
async update(id: string, updates: Partial<MapObject>) {
try {
const mapObject = await this.get(id)
if (!mapObject) return false
const updatedMapObject = {
...mapObject,
...updates
}
await this.add(updatedMapObject)
return true
} catch (error) {
console.error(`Failed to update map object ${id}:`, error)
return false
}
}
}

View File

@ -1,111 +0,0 @@
import Dexie from 'dexie'
// import type { Map } from '@/application/types'
export type Map = {
id: string // or string, depending on your ID type
name: string
width: number
height: number
tiles: any[] // You might want to be more specific about the tiles type
pvp: boolean
updatedAt: Date
placedMapObjects: {
id: string // or string
mapObject: string // or string
depth: number
isRotated: boolean
positionX: number
positionY: number
}[]
mapEffects: {
effect: string // or specific enum/type if available
strength: number
}[]
}
export class MapStorage {
private dexie: Dexie
constructor() {
this.dexie = new Dexie('maps')
this.dexie.version(1).stores({
maps: 'id, name, createdAt, updatedAt'
})
}
async add(map: Map, overwrite = false) {
try {
// Check if map already exists, don't add if it does and overwrite is false
const existingMap = await this.get(map.id)
if (existingMap && !overwrite) return
await this.dexie.table('maps').put({
...map
})
} catch (error) {
console.error(`Failed to add map ${map.id}:`, error)
}
}
async get(id: string): Promise<Map | null> {
try {
const map = await this.dexie.table('maps').get(id)
return map || null
} catch (error) {
console.error(`Failed to retrieve map ${id}:`, error)
return null
}
}
async getAll(): Promise<Map[]> {
try {
return await this.dexie.table('maps').toArray()
} catch (error) {
console.error('Failed to retrieve all maps:', error)
return []
}
}
async getByName(name: string): Promise<Map[]> {
try {
return await this.dexie.table('maps').where('name').equals(name).toArray()
} catch (error) {
console.error(`Failed to retrieve maps with name ${name}:`, error)
return []
}
}
async delete(id: string) {
try {
await this.dexie.table('maps').delete(id)
} catch (error) {
console.error(`Failed to delete map ${id}:`, error)
}
}
async clear() {
try {
await this.dexie.table('maps').clear()
} catch (error) {
console.error('Failed to clear maps storage:', error)
}
}
async update(id: string, updates: Partial<Map>) {
try {
const map = await this.get(id)
if (!map) return false
const updatedMap = {
...map,
...updates
}
await this.add(updatedMap)
return true
} catch (error) {
console.error(`Failed to update map ${id}:`, error)
return false
}
}
}

View File

@ -0,0 +1,60 @@
import Dexie from 'dexie'
export class BaseStorage<T extends { id: string }> {
protected dexie: Dexie
protected tableName: string
constructor(tableName: string, schema: string) {
this.tableName = tableName
this.dexie = new Dexie(tableName)
this.dexie.version(1).stores({
[tableName]: schema
})
}
async add(item: T, overwrite = false) {
try {
const existing = await this.get(item.id)
if (existing && !overwrite) return
await this.dexie.table(this.tableName).put({ ...item })
} catch (error) {
console.error(`Failed to add ${this.tableName} ${item.id}:`, error)
}
}
async get(id: string): Promise<T | null> {
try {
const item = await this.dexie.table(this.tableName).get(id)
return item || null
} catch (error) {
console.error(`Failed to retrieve ${this.tableName} ${id}:`, error)
return null
}
}
async getAll(): Promise<T[]> {
try {
return await this.dexie.table(this.tableName).toArray()
} catch (error) {
console.error(`Failed to retrieve all ${this.tableName}:`, error)
return []
}
}
async reset() {
try {
await this.dexie.table(this.tableName).clear()
} catch (error) {
console.error(`Failed to clear ${this.tableName}:`, error)
}
}
async destroy() {
try {
await this.dexie.delete()
} catch (error) {
console.error(`Failed to destroy ${this.tableName}:`, error)
}
}
}

39
src/storage/storages.ts Normal file
View File

@ -0,0 +1,39 @@
import type { Tile, Map, MapObject } from '@/application/types'
import { BaseStorage } from '@/storage/baseStorage'
export class MapStorage extends BaseStorage<Map> {
constructor() {
super('maps', 'id, name, createdAt, updatedAt')
}
}
export class TileStorage extends BaseStorage<Tile> {
constructor() {
super('tiles', 'id, name, createdAt, updatedAt')
}
}
export class MapObjectStorage extends BaseStorage<MapObject> {
constructor() {
super('mapObjects', 'id, name, createdAt, updatedAt')
}
}
export class SpriteStorage extends BaseStorage<any> {
constructor() {
super('sprites', 'id, name, createdAt, updatedAt')
}
}
export class CharacterTypeStorage extends BaseStorage<any> {
constructor() {
super('characterTypes', 'id, name, createdAt, updatedAt')
}
}
export class CharacterHairStorage extends BaseStorage<any> {
constructor() {
super('characterHairs', 'id, name, createdAt, updatedAt')
}
}

View File

@ -2,7 +2,7 @@ import config from '@/application/config'
import type { TextureData } from '@/application/types' import type { TextureData } from '@/application/types'
import Dexie from 'dexie' import Dexie from 'dexie'
export class Textures { export class TextureStorage {
private dexie: Dexie private dexie: Dexie
constructor() { constructor() {
@ -78,4 +78,20 @@ export class Textures {
console.error(`Failed to delete texture ${key}:`, error) console.error(`Failed to delete texture ${key}:`, error)
} }
} }
async reset() {
try {
await this.dexie.table('textures').clear()
} catch (error) {
console.error(`Failed to clear textures:`, error)
}
}
async destroy() {
try {
await this.dexie.delete()
} catch (error) {
console.error(`Failed to destroy textures:`, error)
}
}
} }

View File

@ -22,7 +22,7 @@ export const useGameStore = defineStore('game', {
game: { game: {
isLoading: false, isLoading: false,
isLoaded: false, // isLoaded is currently being used to determine if the player has interacted with the game isLoaded: false, // isLoaded is currently being used to determine if the player has interacted with the game
loadedAssets: [] as TextureData[], loadedAssets: [] as string[],
isPlayerDraggingCamera: false, isPlayerDraggingCamera: false,
isCameraFollowingCharacter: false isCameraFollowingCharacter: false
}, },
@ -37,15 +37,9 @@ export const useGameStore = defineStore('game', {
getLoadedAssets: (state) => { getLoadedAssets: (state) => {
return state.game.loadedAssets return state.game.loadedAssets
}, },
getLoadedAsset: (state) => { isAssetLoaded: (state) => {
return (key: string | undefined) => { return (key: string) => { return state.game.loadedAssets.includes(key)}
if (!key) return null
return state.game.loadedAssets.find((asset) => asset.key === key)
}
}, },
getLoadedAssetsByGroup: (state) => {
return (group: string) => state.game.loadedAssets.filter((asset) => asset.group === group)
}
}, },
actions: { actions: {
addNotification(notification: Notification) { addNotification(notification: Notification) {

View File

@ -4,7 +4,7 @@ import { defineStore } from 'pinia'
export const useMapStore = defineStore('map', { export const useMapStore = defineStore('map', {
state: () => { state: () => {
return { return {
map: null as Map | null, mapId: '',
characters: [] as MapCharacter[], characters: [] as MapCharacter[],
characterLoaded: false characterLoaded: false
} }
@ -16,13 +16,10 @@ export const useMapStore = defineStore('map', {
getCharacterCount: (state) => { getCharacterCount: (state) => {
return state.characters.length return state.characters.length
}, },
isMapSet: (state) => {
return state.map !== null
}
}, },
actions: { actions: {
setMap(map: Map | null) { setMapId(mapId: UUID) {
this.map = map this.mapId = mapId
}, },
setCharacters(characters: MapCharacter[]) { setCharacters(characters: MapCharacter[]) {
this.characters = characters this.characters = characters
@ -50,7 +47,7 @@ export const useMapStore = defineStore('map', {
} }
}, },
reset() { reset() {
this.map = null this.mapId = ''
this.characters = [] this.characters = []
this.characterLoaded = false this.characterLoaded = false
} }