Replaced all event names with numbers for less bandwidth usage

This commit is contained in:
2025-02-11 23:13:15 +01:00
parent 5f2c7a09b1
commit dd1cc795de
26 changed files with 191 additions and 197 deletions

View File

@ -29,6 +29,7 @@
</template>
<script setup lang="ts">
import { SocketEvent } from '@/application/enums';
import type { Item } from '@/application/types'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'
@ -48,13 +49,13 @@ const handleSearch = () => {
}
const createNewItem = () => {
gameStore.connection?.emit('gm:item:create', {}, (response: boolean) => {
gameStore.connection?.emit(SocketEvent.GM_ITEM_CREATE, {}, (response: boolean) => {
if (!response) {
console.error('Failed to create new item')
return
}
gameStore.connection?.emit('gm:item:list', {}, (response: Item[]) => {
gameStore.connection?.emit(SocketEvent.GM_ITEM_LIST, {}, (response: Item[]) => {
assetManagerStore.setItemList(response)
})
})
@ -88,7 +89,7 @@ function toTop() {
}
onMounted(() => {
gameStore.connection?.emit('gm:item:list', {}, (response: Item[]) => {
gameStore.connection?.emit(SocketEvent.GM_ITEM_LIST, {}, (response: Item[]) => {
assetManagerStore.setItemList(response)
})
})