diff --git a/package-lock.json b/package-lock.json
index 5a8258f..d2f4d88 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2535,9 +2535,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.5.96",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.96.tgz",
- "integrity": "sha512-8AJUW6dh75Fm/ny8+kZKJzI1pgoE8bKLZlzDU2W1ENd+DXKJrx7I7l9hb8UWR4ojlnb5OlixMt00QWiYJoVw1w==",
+ "version": "1.5.97",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.97.tgz",
+ "integrity": "sha512-HKLtaH02augM7ZOdYRuO19rWDeY+QSJ1VxnXFa/XDFLf07HvM90pALIJFgrO+UVaajI3+aJMMpojoUTLZyQ7JQ==",
"dev": true,
"license": "ISC"
},
@@ -2881,25 +2881,22 @@
}
},
"node_modules/glob": {
- "version": "11.0.1",
- "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.1.tgz",
- "integrity": "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==",
+ "version": "10.4.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
"license": "ISC",
"dependencies": {
"foreground-child": "^3.1.0",
- "jackspeak": "^4.0.1",
- "minimatch": "^10.0.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
- "path-scurry": "^2.0.0"
+ "path-scurry": "^1.11.1"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
- "engines": {
- "node": "20 || >=22"
- },
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
@@ -2918,16 +2915,16 @@
}
},
"node_modules/glob/node_modules/minimatch": {
- "version": "10.0.1",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz",
- "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==",
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
- "node": "20 || >=22"
+ "node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
@@ -3204,19 +3201,19 @@
"license": "ISC"
},
"node_modules/jackspeak": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz",
- "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==",
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"@isaacs/cliui": "^8.0.2"
},
- "engines": {
- "node": "20 || >=22"
- },
"funding": {
"url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
}
},
"node_modules/jiti": {
@@ -3230,15 +3227,15 @@
}
},
"node_modules/js-beautify": {
- "version": "1.15.2",
- "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.15.2.tgz",
- "integrity": "sha512-mcG6CHJxxih+EFAbd5NEBwrosIs6MoJmiNLFYN6kj5SeJMf7n29Ii/H4lt6zGTvmdB9AApuj5cs4zydjuLeqjw==",
+ "version": "1.15.3",
+ "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.15.3.tgz",
+ "integrity": "sha512-rKKGuyTxGNlyN4EQKWzNndzXpi0bOl8Gl8YQAW1as/oMz0XhD6sHJO1hTvoBDOSzKuJb9WkwoAb34FfdkKMv2A==",
"dev": true,
"license": "MIT",
"dependencies": {
"config-chain": "^1.1.13",
"editorconfig": "^1.0.4",
- "glob": "^11.0.0",
+ "glob": "^10.4.2",
"js-cookie": "^3.0.5",
"nopt": "^8.0.0"
},
@@ -3787,32 +3784,22 @@
"license": "MIT"
},
"node_modules/path-scurry": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
- "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
- "lru-cache": "^11.0.0",
- "minipass": "^7.1.2"
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
},
"engines": {
- "node": "20 || >=22"
+ "node": ">=16 || 14 >=14.18"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/path-scurry/node_modules/lru-cache": {
- "version": "11.0.2",
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz",
- "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==",
- "dev": true,
- "license": "ISC",
- "engines": {
- "node": "20 || >=22"
- }
- },
"node_modules/pathe": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
@@ -3831,9 +3818,9 @@
}
},
"node_modules/phaser": {
- "version": "3.87.0",
- "resolved": "https://registry.npmjs.org/phaser/-/phaser-3.87.0.tgz",
- "integrity": "sha512-AyI1b3T5fp05gzf6WUmu2FNqaZL+Y7w88yBRLf7YZXF9bncUSHpnDrupnTGoPqy/RKHRLBcay7zWeqQ2wiMWcw==",
+ "version": "3.88.0",
+ "resolved": "https://registry.npmjs.org/phaser/-/phaser-3.88.0.tgz",
+ "integrity": "sha512-VLhKMjFBaoSQQU2Q9tqic7gfIrRjX9xqWi1BooFNB2pO2ssTzU4nNOirW8oUXrM/GPgtIR8xNoXmdYmqeKcZrw==",
"license": "MIT",
"dependencies": {
"eventemitter3": "^5.0.1"
@@ -3950,9 +3937,9 @@
}
},
"node_modules/postcss": {
- "version": "8.5.1",
- "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.1.tgz",
- "integrity": "sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==",
+ "version": "8.5.2",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.2.tgz",
+ "integrity": "sha512-MjOadfU3Ys9KYoX0AdkBlFEF1Vx37uCCeN4ZHnmwm9FfpbsGWMZeBLMmmpY+6Ocqod7mkdZ0DT31OlbsFrLlkA==",
"funding": [
{
"type": "opencollective",
@@ -4664,76 +4651,6 @@
"node": ">= 6"
}
},
- "node_modules/sucrase/node_modules/glob": {
- "version": "10.4.5",
- "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
- "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
- "dev": true,
- "license": "ISC",
- "dependencies": {
- "foreground-child": "^3.1.0",
- "jackspeak": "^3.1.2",
- "minimatch": "^9.0.4",
- "minipass": "^7.1.2",
- "package-json-from-dist": "^1.0.0",
- "path-scurry": "^1.11.1"
- },
- "bin": {
- "glob": "dist/esm/bin.mjs"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/sucrase/node_modules/jackspeak": {
- "version": "3.4.3",
- "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
- "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "@isaacs/cliui": "^8.0.2"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- },
- "optionalDependencies": {
- "@pkgjs/parseargs": "^0.11.0"
- }
- },
- "node_modules/sucrase/node_modules/minimatch": {
- "version": "9.0.5",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
- "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
- "dev": true,
- "license": "ISC",
- "dependencies": {
- "brace-expansion": "^2.0.1"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
- "node_modules/sucrase/node_modules/path-scurry": {
- "version": "1.11.1",
- "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
- "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
- "dev": true,
- "license": "BlueOak-1.0.0",
- "dependencies": {
- "lru-cache": "^10.2.0",
- "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
- },
- "engines": {
- "node": ">=16 || 14 >=14.18"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@@ -5363,9 +5280,9 @@
}
},
"node_modules/whatwg-url": {
- "version": "14.1.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.1.0.tgz",
- "integrity": "sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==",
+ "version": "14.1.1",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.1.1.tgz",
+ "integrity": "sha512-mDGf9diDad/giZ/Sm9Xi2YcyzaFpbdLpJPr+E9fSkyQ7KpQD4SdFcugkRQYzhmfI4KeV4Qpnn2sKPdo+kmsgRQ==",
"dev": true,
"license": "MIT",
"dependencies": {
diff --git a/src/application/enums.ts b/src/application/enums.ts
index 8dd4620..85a412c 100644
--- a/src/application/enums.ts
+++ b/src/application/enums.ts
@@ -3,3 +3,59 @@ export enum Direction {
NEGATIVE,
UNCHANGED
}
+
+export enum SocketEvent {
+ CLOSE = '52',
+ DATA = '51',
+ CHARACTER_CONNECT = '50',
+ CHARACTER_CREATE = '49',
+ CHARACTER_DELETE = '48',
+ CHARACTER_LIST = '47',
+ GM_CHARACTERHAIR_CREATE = '46',
+ GM_CHARACTERHAIR_REMOVE = '45',
+ GM_CHARACTERHAIR_LIST = '44',
+ GM_CHARACTERHAIR_UPDATE = '43',
+ GM_CHARACTERTYPE_CREATE = '42',
+ GM_CHARACTERTYPE_REMOVE = '41',
+ GM_CHARACTERTYPE_LIST = '40',
+ GM_CHARACTERTYPE_UPDATE = '39',
+ GM_ITEM_CREATE = '38',
+ GM_ITEM_REMOVE = '37',
+ GM_ITEM_LIST = '36',
+ GM_ITEM_UPDATE = '35',
+ GM_MAPOBJECT_LIST = '34',
+ GM_MAPOBJECT_REMOVE = '33',
+ GM_MAPOBJECT_UPDATE = '32',
+ GM_MAPOBJECT_UPLOAD = '31',
+ GM_SPRITE_COPY = '30',
+ GM_SPRITE_CREATE = '29',
+ GM_SPRITE_DELETE = '28',
+ GM_SPRITE_LIST = '27',
+ GM_SPRITE_UPDATE = '26',
+ GM_TILE_DELETE = '25',
+ GM_TILE_LIST = '24',
+ GM_TILE_UPDATE = '23',
+ GM_TILE_UPLOAD = '22',
+ GM_MAP_CREATE = '21',
+ GM_MAP_DELETE = '20',
+ GM_MAP_REQUEST = '19',
+ GM_MAP_UPDATE = '18',
+ MAP_CHARACTER_MOVEERROR = '17',
+ DISCONNECT = '16',
+ USER_DISCONNECT = '15',
+ LOGIN = '14',
+ LOGGED_IN = '13',
+ NOTIFICATION = '12',
+ DATE = '11',
+ FAILED = '10',
+ COMPLETED = '9',
+ CONNECTION = '8',
+ WEATHER = '7',
+ CHARACTER_DISCONNECT = '6',
+ MAP_CHARACTER_ATTACK = '5',
+ MAP_CHARACTER_TELEPORT = '4',
+ MAP_CHARACTER_JOIN = '3',
+ MAP_CHARACTER_LEAVE = '2',
+ MAP_CHARACTER_MOVE = '1',
+ CHAT_MESSAGE = '0',
+}
\ No newline at end of file
diff --git a/src/components/game/gui/Chat.vue b/src/components/game/gui/Chat.vue
index 5c50f35..8c19584 100644
--- a/src/components/game/gui/Chat.vue
+++ b/src/components/game/gui/Chat.vue
@@ -27,6 +27,7 @@ import { useMapStore } from '@/stores/mapStore'
import { onClickOutside, useFocus } from '@vueuse/core'
import { useScene } from 'phavuer'
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
+import { SocketEvent } from '@/application/enums'
const scene = useScene()
const gameStore = useGameStore()
@@ -79,7 +80,7 @@ const scrollToBottom = () => {
})
}
-gameStore.connection?.on('chat:message', (data: Chat) => {
+gameStore.connection?.on(SocketEvent.CHAT_MESSAGE, (data: Chat) => {
chats.value.push(data)
scrollToBottom()
@@ -144,7 +145,7 @@ onMounted(() => {
})
onBeforeUnmount(() => {
- gameStore.connection?.off('chat:message')
+ gameStore.connection?.off(SocketEvent.CHAT_MESSAGE)
removeEventListener('keydown', focusChat)
})
diff --git a/src/components/game/gui/Clock.vue b/src/components/game/gui/Clock.vue
index 5d97111..55c20db 100644
--- a/src/components/game/gui/Clock.vue
+++ b/src/components/game/gui/Clock.vue
@@ -10,10 +10,11 @@
import { useGameStore } from '@/stores/gameStore'
import { useDateFormat } from '@vueuse/core'
import { onUnmounted } from 'vue'
+import { SocketEvent } from '@/application/enums'
const gameStore = useGameStore()
onUnmounted(() => {
- gameStore.connection?.off('date')
+ gameStore.connection?.off(SocketEvent.DATE)
})
diff --git a/src/components/game/map/Characters.vue b/src/components/game/map/Characters.vue
index 611cc88..d40c115 100644
--- a/src/components/game/map/Characters.vue
+++ b/src/components/game/map/Characters.vue
@@ -3,6 +3,7 @@
diff --git a/src/components/game/map/Map.vue b/src/components/game/map/Map.vue
index cb38a11..8916d82 100644
--- a/src/components/game/map/Map.vue
+++ b/src/components/game/map/Map.vue
@@ -16,6 +16,7 @@ import { useGameStore } from '@/stores/gameStore'
import { useMapStore } from '@/stores/mapStore'
import { useScene } from 'phavuer'
import { onMounted, onUnmounted, shallowRef, watch } from 'vue'
+import { SocketEvent } from '@/application/enums'
const scene = useScene()
@@ -28,7 +29,7 @@ const tileMap = shallowRef()
const tileMapLayer = shallowRef()
// Event listeners
-gameStore.connection?.on('map:character:teleport', async (data: mapLoadData) => {
+gameStore.connection?.on(SocketEvent.MAP_CHARACTER_TELEPORT, (data: mapLoadData) => {
mapStore.setMapId(data.mapId)
mapStore.setCharacters(data.characters)
})
@@ -64,6 +65,6 @@ onUnmounted(() => {
tileMap.value.destroy()
}
- gameStore.connection?.off('map:character:teleport')
+ gameStore.connection?.off(SocketEvent.MAP_CHARACTER_TELEPORT)
})
diff --git a/src/components/gameMaster/assetManager/partials/characterHair/CharacterHairDetails.vue b/src/components/gameMaster/assetManager/partials/characterHair/CharacterHairDetails.vue
index 71f5501..2cf4b52 100644
--- a/src/components/gameMaster/assetManager/partials/characterHair/CharacterHairDetails.vue
+++ b/src/components/gameMaster/assetManager/partials/characterHair/CharacterHairDetails.vue
@@ -34,6 +34,7 @@
diff --git a/src/components/screens/MapEditor.vue b/src/components/screens/MapEditor.vue
index 0f5bbdf..feccfad 100644
--- a/src/components/screens/MapEditor.vue
+++ b/src/components/screens/MapEditor.vue
@@ -18,6 +18,7 @@
diff --git a/src/composables/controls/useGameControlsComposable.ts b/src/composables/controls/useGameControlsComposable.ts
index 3325997..38dad7b 100644
--- a/src/composables/controls/useGameControlsComposable.ts
+++ b/src/composables/controls/useGameControlsComposable.ts
@@ -1,3 +1,4 @@
+import { SocketEvent } from '@/application/enums';
import { getTile } from '@/services/mapService'
import { useGameStore } from '@/stores/gameStore'
import type { Ref } from 'vue'
@@ -22,7 +23,7 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
const pointerTile = getTile(layer, pointer.worldX, pointer.worldY)
if (!pointerTile) return
- gameStore.connection?.emit('map:character:move', {
+ gameStore.connection?.emit(SocketEvent.MAP_CHARACTER_MOVE, {
positionX: pointerTile.x,
positionY: pointerTile.y
})
@@ -49,7 +50,7 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
// Attack on CTRL
if (event.key === 'Control') {
- gameStore.connection?.emit('map:character:attack')
+ gameStore.connection?.emit(SocketEvent.MAP_CHARACTER_ATTACK)
}
}
@@ -65,9 +66,6 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
function moveCharacter() {
if (!gameStore.character) return
-
- // Don't allow movement while attacking
- if (gameStore.character.isAttacking) return
const { positionX, positionY } = gameStore.character
let newX = positionX
@@ -81,7 +79,7 @@ export function useGameControlsComposable(scene: Phaser.Scene, layer: Phaser.Til
// Only emit if position changed
if (newX !== positionX || newY !== positionY) {
- gameStore.connection?.emit('map:character:move', {
+ gameStore.connection?.emit(SocketEvent.MAP_CHARACTER_MOVE, {
positionX: newX,
positionY: newY
})
diff --git a/src/stores/gameStore.ts b/src/stores/gameStore.ts
index 75fb55e..1c88d18 100644
--- a/src/stores/gameStore.ts
+++ b/src/stores/gameStore.ts
@@ -1,3 +1,4 @@
+import { SocketEvent } from '@/application/enums';
import config from '@/application/config'
import type { Character, Notification, User, WorldSettings } from '@/application/types'
import { useCookies } from '@vueuse/integrations/useCookies'
@@ -85,10 +86,10 @@ export const useGameStore = defineStore('game', {
})
// Let the server know the user is logged in
- this.connection.emit('login')
+ this.connection.emit(SocketEvent.LOGIN)
// set user
- this.connection.on('logged_in', (user: User) => {
+ this.connection.on(SocketEvent.LOGGED_IN, (user: User) => {
this.setUser(user)
})
@@ -98,7 +99,7 @@ export const useGameStore = defineStore('game', {
})
// Listen for new date from socket
- this.connection.on('date', (data: Date) => {
+ this.connection.on(SocketEvent.DATE, (data: Date) => {
this.world.date = new Date(data)
})
},
@@ -106,7 +107,7 @@ export const useGameStore = defineStore('game', {
// Remove event listeners
this.connection?.off('connect_error')
this.connection?.off('reconnect_failed')
- this.connection?.off('date')
+ this.connection?.off(SocketEvent.DATE)
this.connection?.disconnect()
useCookies().remove('token', {