1
0
forked from noxious/client

Added characterChest component for chest equipment, moved some files

This commit is contained in:
Dennis Postma 2024-12-27 00:27:54 +01:00
parent 9c105d6df6
commit 231f19a30f
49 changed files with 156 additions and 70 deletions

View File

@ -4,6 +4,12 @@ export type Notification = {
message?: string
}
export type HttpResponse<T> = {
success: boolean
message?: string
data?: T
}
export type AssetDataT = {
key: string
data: string
@ -157,7 +163,6 @@ export type CharacterType = {
export type CharacterHair = {
id: number
name: string
spriteId: string
sprite: Sprite
gender: CharacterGender
isSelectable: boolean
@ -185,6 +190,7 @@ export type Character = {
zone: Zone
chats: Chat[]
items: CharacterItem[]
equipment: CharacterEquipment[]
}
export type ZoneCharacter = {
@ -201,6 +207,22 @@ export type CharacterItem = {
quantity: number
}
export type CharacterEquipment = {
id: number
slot: CharacterEquipmentSlotType
characterItemId: number
characterItem: CharacterItem
}
export enum CharacterEquipmentSlotType {
HEAD = 'HEAD',
BODY = 'BODY',
ARMS = 'ARMS',
LEGS = 'LEGS',
NECK = 'NECK',
RING = 'RING'
}
export type Sprite = {
id: string
name: string

View File

@ -7,7 +7,7 @@ import { Scene } from 'phavuer'
import { useZoneStore } from '@/stores/zoneStore'
import { useGameStore } from '@/stores/gameStore'
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
import type { WeatherState } from '@/types'
import type { WeatherState } from '@/application/types'
// Constants
const LIGHT_CONFIG = {

View File

@ -3,22 +3,24 @@
<Healthbar :zoneCharacter="props.zoneCharacter" :currentX="currentX" :currentY="currentY" />
<Container ref="charContainer" :depth="isometricDepth" :x="currentX" :y="currentY">
<CharacterHair :zoneCharacter="props.zoneCharacter" :currentX="currentX" :currentY="currentY" />
<!-- <CharacterChest :zoneCharacter="props.zoneCharacter" :currentX="currentX" :currentY="currentY" />-->
<Sprite ref="charSprite" :origin-y="1" :flipX="isFlippedX" />
</Container>
</template>
<script lang="ts" setup>
import config from '@/config'
import { type Sprite as SpriteT, type ZoneCharacter } from '@/types'
import config from '@/application/config'
import { type Sprite as SpriteT, type ZoneCharacter } from '@/application/types'
import { useGameStore } from '@/stores/gameStore'
import { useZoneStore } from '@/stores/zoneStore'
import { watch, computed, ref, onMounted, onUnmounted } from 'vue'
import { Container, Image, refObj, RoundRectangle, Sprite, Text, useGame, useScene } from 'phavuer'
import { Container, refObj, Sprite, useScene } from 'phavuer'
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
import { loadSpriteTextures } from '@/composables/gameComposable'
import ChatBubble from '@/components/game/character/partials/ChatBubble.vue'
import Healthbar from '@/components/game/character/partials/Healthbar.vue'
import CharacterHair from '@/components/game/character/partials/CharacterHair.vue'
// import CharacterChest from '@/components/game/character/partials/CharacterChest.vue'
enum Direction {
POSITIVE,

View File

@ -0,0 +1,53 @@
<template>
<Image v-bind="imageProps" v-if="gameStore.getLoadedAsset(texture)" />
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { Image, useScene } from 'phavuer'
import type { Sprite as SpriteT, ZoneCharacter } from '@/application/types'
import { loadSpriteTextures } from '@/composables/gameComposable'
import { useGameStore } from '@/stores/gameStore'
const props = defineProps<{
zoneCharacter: ZoneCharacter
currentX: number
currentY: number
}>()
const gameStore = useGameStore()
const scene = useScene()
const texture = computed(() => {
const { rotation, characterHair } = props.zoneCharacter.character
const spriteId = characterHair?.sprite?.id
const direction = [0, 6].includes(rotation) ? 'back' : 'front'
return `${spriteId}-${direction}`
})
const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.rotation ?? 0))
const imageProps = computed(() => {
// Get the current sprite action based on direction
const direction = [0, 6].includes(props.zoneCharacter.character.rotation ?? 0) ? 'back' : 'front'
const spriteAction = props.zoneCharacter.character.characterHair?.sprite?.spriteActions?.find(
spriteAction => spriteAction.action === direction
)
return {
depth: 1,
originX: Number(spriteAction?.originX) ?? 0,
originY: Number(spriteAction?.originY) ?? 0,
flipX: isFlippedX.value,
texture: texture.value,
// y: props.zoneCharacter.isMoving ? Math.floor(Date.now() / 250) % 2 : 0
}
})
loadSpriteTextures(scene, props.zoneCharacter.character.characterHair?.sprite as SpriteT)
.then(() => {})
.catch((error) => {
console.error('Error loading texture:', error)
})
</script>

View File

@ -5,7 +5,7 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { Image, useScene } from 'phavuer'
import type { Sprite as SpriteT, ZoneCharacter } from '@/types'
import type { Sprite as SpriteT, ZoneCharacter } from '@/application/types'
import { loadSpriteTextures } from '@/composables/gameComposable'
import { useGameStore } from '@/stores/gameStore'

View File

@ -7,7 +7,7 @@
<script setup lang="ts">
import { Container, refObj, RoundRectangle, Text, useGame } from 'phavuer'
import type { ZoneCharacter } from '@/types'
import type { ZoneCharacter } from '@/application/types'
import { onMounted } from 'vue'
const props = defineProps<{

View File

@ -8,7 +8,7 @@
<script setup lang="ts">
import { Container, RoundRectangle, Text, useGame } from 'phavuer'
import type { ZoneCharacter } from '@/types'
import type { ZoneCharacter } from '@/application/types'
const props = defineProps<{
zoneCharacter: ZoneCharacter

View File

@ -10,7 +10,7 @@ import { useScene } from 'phavuer'
import { useGameStore } from '@/stores/gameStore'
import { useZoneStore } from '@/stores/zoneStore'
import { loadZoneTilesIntoScene } from '@/composables/zoneComposable'
import type { Zone as ZoneT, ZoneCharacter } from '@/types'
import type { Zone as ZoneT, ZoneCharacter } from '@/application/types'
import ZoneTiles from '@/components/game/zone/ZoneTiles.vue'
import ZoneObjects from '@/components/game/zone/ZoneObjects.vue'
import Characters from '@/components/game/zone/Characters.vue'
@ -51,8 +51,8 @@ gameStore.connection!.on('zone:character:leave', (characterId: number) => {
zoneStore.removeCharacter(characterId)
})
gameStore.connection!.on('character:move', (data: ZoneCharacter) => {
zoneStore.updateCharacter(data)
gameStore.connection!.on('character:move', (data: { id: number, positionX: number, positionY: number, rotation: number, isMoving: boolean }) => {
zoneStore.updateCharacterPosition(data)
})
// Emit zone:character:join event to server and wait for response, then set zone and characters

View File

@ -3,13 +3,13 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useScene } from 'phavuer'
import { useZoneStore } from '@/stores/zoneStore'
import { onBeforeUnmount } from 'vue'
import { FlattenZoneArray, setLayerTiles } from '@/composables/zoneComposable'
import Controls from '@/components/utilities/Controls.vue'
import { unduplicateArray } from '@/utilities'
import { unduplicateArray } from '@/application/utilities'
const emit = defineEmits(['tileMap:create'])

View File

@ -7,7 +7,7 @@ import { computed } from 'vue'
import { Image, useScene } from 'phavuer'
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
import { loadTexture } from '@/composables/gameComposable'
import type { AssetDataT, ZoneObject } from '@/types'
import type { AssetDataT, ZoneObject } from '@/application/types'
import { useGameStore } from '@/stores/gameStore'
const props = defineProps<{

View File

@ -34,7 +34,7 @@
</template>
<script setup lang="ts">
import type { CharacterHair, CharacterGender, Sprite } from '@/types'
import type { CharacterHair, CharacterGender, Sprite } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'

View File

@ -29,7 +29,7 @@
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import type { CharacterHair } from '@/types'
import type { CharacterHair } from '@/application/types'
import { useVirtualList } from '@vueuse/core'
const gameStore = useGameStore()

View File

@ -40,7 +40,7 @@
</template>
<script setup lang="ts">
import type { CharacterType, CharacterGender, CharacterRace, Sprite } from '@/types'
import type { CharacterType, CharacterGender, CharacterRace, Sprite } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'

View File

@ -29,7 +29,7 @@
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import type { CharacterType } from '@/types'
import type { CharacterType } from '@/application/types'
import { useVirtualList } from '@vueuse/core'
const gameStore = useGameStore()

View File

@ -44,7 +44,7 @@
</template>
<script setup lang="ts">
import type { Item, ItemType, ItemRarity } from '@/types'
import type { Item, ItemType, ItemRarity } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'

View File

@ -32,7 +32,7 @@
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import type { Item } from '@/types'
import type { Item } from '@/application/types'
import { useVirtualList } from '@vueuse/core'
const gameStore = useGameStore()

View File

@ -50,12 +50,12 @@
</template>
<script setup lang="ts">
import type { Object } from '@/types'
import type { Object } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import config from '@/config'
import config from '@/application/config'
import ChipsInput from '@/components/forms/ChipsInput.vue'
const gameStore = useGameStore()

View File

@ -28,11 +28,11 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import type { Object } from '@/types'
import type { Object } from '@/application/types'
import { useVirtualList } from '@vueuse/core'
const gameStore = useGameStore()

View File

@ -69,13 +69,13 @@
</template>
<script setup lang="ts">
import type { Sprite, SpriteAction } from '@/types'
import type { Sprite, SpriteAction } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'
import Accordion from '@/components/utilities/Accordion.vue'
import SpriteActionsInput from '@/components/gameMaster/assetManager/partials/sprite/partials/SpriteImagesInput.vue'
import { uuidv4 } from '@/utilities'
import { uuidv4 } from '@/application/utilities'
const gameStore = useGameStore()
const assetManagerStore = useAssetManagerStore()

View File

@ -24,12 +24,12 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useVirtualList } from '@vueuse/core'
import type { Sprite } from '@/types'
import type { Sprite } from '@/application/types'
const gameStore = useGameStore()
const assetManagerStore = useAssetManagerStore()

View File

@ -23,12 +23,12 @@
</template>
<script setup lang="ts">
import type { Tile } from '@/types'
import type { Tile } from '@/application/types'
import { computed, onBeforeUnmount, onMounted, ref, toRaw, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import config from '@/config'
import config from '@/application/config'
import ChipsInput from '@/components/forms/ChipsInput.vue'
const gameStore = useGameStore()

View File

@ -28,11 +28,11 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useGameStore } from '@/stores/gameStore'
import { onMounted, ref, computed } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManagerStore'
import type { Tile } from '@/types'
import type { Tile } from '@/application/types'
import { useVirtualList } from '@vueuse/core'
const gameStore = useGameStore()

View File

@ -17,7 +17,7 @@
import { onUnmounted, ref } from 'vue'
import { useGameStore } from '@/stores/gameStore'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { type Zone } from '@/types'
import { type Zone } from '@/application/types'
// Components
import Toolbar from '@/components/gameMaster/zoneEditor/partials/Toolbar.vue'
import TileList from '@/components/gameMaster/zoneEditor/partials/TileList.vue'

View File

@ -40,7 +40,7 @@ import { ref } from 'vue'
import Modal from '@/components/utilities/Modal.vue'
import { useGameStore } from '@/stores/gameStore'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import type { Zone } from '@/types'
import type { Zone } from '@/application/types'
const gameStore = useGameStore()
const zoneEditorStore = useZoneEditorStore()

View File

@ -41,12 +41,12 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { ref, onMounted, computed } from 'vue'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import Modal from '@/components/utilities/Modal.vue'
import type { Object, ZoneObject } from '@/types'
import type { Object, ZoneObject } from '@/application/types'
const gameStore = useGameStore()
const isModalOpen = ref(false)

View File

@ -11,7 +11,7 @@
</template>
<script setup lang="ts">
import type { ZoneObject } from '@/types'
import type { ZoneObject } from '@/application/types'
const props = defineProps<{
zoneObject: ZoneObject

View File

@ -43,7 +43,7 @@ import { computed, onMounted, ref, watch } from 'vue'
import Modal from '@/components/utilities/Modal.vue'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import type { Zone } from '@/types'
import type { Zone } from '@/application/types'
const showTeleportModal = computed(() => zoneEditorStore.tool === 'pencil' && zoneEditorStore.drawMode === 'teleport')
const zoneEditorStore = useZoneEditorStore()

View File

@ -81,12 +81,12 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { ref, onMounted, computed } from 'vue'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import Modal from '@/components/utilities/Modal.vue'
import type { Tile } from '@/types'
import type { Tile } from '@/application/types'
const gameStore = useGameStore()
const isModalOpen = ref(false)

View File

@ -29,7 +29,7 @@
import { onMounted } from 'vue'
import { useGameStore } from '@/stores/gameStore'
import Modal from '@/components/utilities/Modal.vue'
import type { Zone } from '@/types'
import type { Zone } from '@/application/types'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import CreateZone from '@/components/gameMaster/zoneEditor/partials/CreateZone.vue'

View File

@ -3,11 +3,11 @@
</template>
<script setup lang="ts">
import { type ZoneEventTile, ZoneEventTileType } from '@/types'
import { type ZoneEventTile, ZoneEventTileType } from '@/application/types'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { Image, useScene } from 'phavuer'
import { getTile, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
import { uuidv4 } from '@/utilities'
import { uuidv4 } from '@/application/utilities'
import { onMounted, onUnmounted } from 'vue'
const scene = useScene()

View File

@ -7,7 +7,7 @@ import { computed } from 'vue'
import { Image, useScene } from 'phavuer'
import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
import { loadTexture } from '@/composables/gameComposable'
import type { AssetDataT, ZoneObject } from '@/types'
import type { AssetDataT, ZoneObject } from '@/application/types'
import { useGameStore } from '@/stores/gameStore'
const props = defineProps<{

View File

@ -4,14 +4,14 @@
</template>
<script setup lang="ts">
import { uuidv4 } from '@/utilities'
import { uuidv4 } from '@/application/utilities'
import { getTile } from '@/composables/zoneComposable'
import { useScene } from 'phavuer'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import SelectedZoneObject from '@/components/gameMaster/zoneEditor/partials/SelectedZoneObject.vue'
import { onMounted, onUnmounted, ref, watch } from 'vue'
import ZoneObject from '@/components/gameMaster/zoneEditor/zonePartials/ZoneObject.vue'
import type { ZoneObject as ZoneObjectT } from '@/types'
import type { ZoneObject as ZoneObjectT } from '@/application/types'
const scene = useScene()
const zoneEditorStore = useZoneEditorStore()

View File

@ -3,14 +3,14 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useScene } from 'phavuer'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { onMounted, onUnmounted, watch } from 'vue'
import { createTileArray, getTile, placeTile, setLayerTiles } from '@/composables/zoneComposable'
import Controls from '@/components/utilities/Controls.vue'
import { useGameStore } from '@/stores/gameStore'
import type { AssetDataT } from '@/types'
import type { AssetDataT } from '@/application/types'
const emit = defineEmits(['tileMap:create'])

View File

@ -24,7 +24,7 @@
import { onBeforeUnmount, ref, nextTick, onMounted } from 'vue'
import { onClickOutside, useFocus } from '@vueuse/core'
import { useGameStore } from '@/stores/gameStore'
import type { Chat } from '@/types'
import type { Chat } from '@/application/types'
import { useZoneStore } from '@/stores/zoneStore'
import { useScene } from 'phavuer'

View File

@ -143,11 +143,11 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import { useGameStore } from '@/stores/gameStore'
import { onBeforeUnmount, ref, watch } from 'vue'
import Modal from '@/components/utilities/Modal.vue'
import { type Character as CharacterT, type CharacterHair } from '@/types'
import { type Character as CharacterT, type CharacterHair } from '@/application/types'
import ConfirmationModal from '@/components/utilities/ConfirmationModal.vue'
const gameStore = useGameStore()

View File

@ -18,7 +18,7 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import 'phaser'
import { Game, Scene } from 'phavuer'
import { useGameStore } from '@/stores/gameStore'

View File

@ -9,7 +9,7 @@
</template>
<script setup lang="ts">
import config from '@/config'
import config from '@/application/config'
import 'phaser'
import { Game, Scene } from 'phavuer'
import { useGameStore } from '@/stores/gameStore'
@ -17,7 +17,7 @@ import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import ZoneEditor from '@/components/gameMaster/zoneEditor/ZoneEditor.vue'
import AwaitLoaderPlugin from 'phaser3-rex-plugins/plugins/awaitloader-plugin'
import { loadTexture } from '@/composables/gameComposable'
import type { AssetDataT } from '@/types'
import type { AssetDataT } from '@/application/types'
const gameStore = useGameStore()
const zoneEditorStore = useZoneEditorStore()

View File

@ -1,7 +1,7 @@
import type { AssetDataT, Sprite } from '@/types'
import type { AssetDataT, Sprite } from '@/application/types'
import { useGameStore } from '@/stores/gameStore'
import { AssetStorage } from '@/storage/assetStorage'
import config from '@/config'
import config from '@/application/config'
const textureLoadingPromises = new Map<string, Promise<boolean>>()

View File

@ -1,7 +1,7 @@
import { type Ref, ref } from 'vue'
import { getTile, tileToWorldXY } from '@/composables/zoneComposable'
import { useGameStore } from '@/stores/gameStore'
import config from '@/config'
import config from '@/application/config'
export function useGamePointerHandlers(scene: Phaser.Scene, layer: Phaser.Tilemaps.TilemapLayer, waypoint: Ref<{ visible: boolean; x: number; y: number }>, camera: Phaser.Cameras.Scene2D.Camera) {
const gameStore = useGameStore()

View File

@ -2,7 +2,7 @@ import { computed, type Ref } from 'vue'
import { getTile, tileToWorldXY } from '@/composables/zoneComposable'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import { useGameStore } from '@/stores/gameStore'
import config from '@/config'
import config from '@/application/config'
export function useZoneEditorPointerHandlers(scene: Phaser.Scene, layer: Phaser.Tilemaps.TilemapLayer, waypoint: Ref<{ visible: boolean; x: number; y: number }>, camera: Phaser.Cameras.Scene2D.Camera) {
const gameStore = useGameStore()

View File

@ -1,9 +1,9 @@
import config from '@/config'
import config from '@/application/config'
import Tilemap = Phaser.Tilemaps.Tilemap
import TilemapLayer = Phaser.Tilemaps.TilemapLayer
import Tileset = Phaser.Tilemaps.Tileset
import Tile = Phaser.Tilemaps.Tile
import type { AssetDataT, Zone as ZoneT } from '@/types'
import type { AssetDataT, Zone as ZoneT } from '@/application/types'
import { loadTexture } from '@/composables/gameComposable'
export function getTile(layer: TilemapLayer | Tilemap, x: number, y: number): Tile | undefined {

View File

@ -1,7 +1,7 @@
import axios from 'axios'
import config from '@/config'
import config from '@/application/config'
import { useCookies } from '@vueuse/integrations/useCookies'
import { getDomain } from '@/utilities'
import { getDomain } from '@/application/utilities'
export async function register(username: string, email: string, password: string) {
try {

View File

@ -1,6 +1,6 @@
import config from '@/config'
import config from '@/application/config'
import Dexie from 'dexie'
import type { AssetDataT } from '@/types'
import type { AssetDataT } from '@/application/types'
export class AssetStorage {
private db: Dexie

View File

@ -1,6 +1,6 @@
import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { Tile, Object, Sprite, CharacterType, CharacterHair, Item } from '@/types'
import type { Tile, Object, Sprite, CharacterType, CharacterHair, Item } from '@/application/types'
export const useAssetManagerStore = defineStore('assetManager', () => {
const tileList = ref<Tile[]>([])

View File

@ -1,9 +1,9 @@
import { defineStore } from 'pinia'
import { io, Socket } from 'socket.io-client'
import type { AssetDataT, Character, Notification, User, WorldSettings } from '@/types'
import config from '@/config'
import type { AssetDataT, Character, Notification, User, WorldSettings } from '@/application/types'
import config from '@/application/config'
import { useCookies } from '@vueuse/integrations/useCookies'
import { getDomain } from '@/utilities'
import { getDomain } from '@/application/utilities'
export const useGameStore = defineStore('game', {
state: () => {

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { useGameStore } from '@/stores/gameStore'
import type { Zone, Object, Tile, ZoneEffect, ZoneObject } from '@/types'
import type { Zone, Object, Tile, ZoneEffect, ZoneObject } from '@/application/types'
export type TeleportSettings = {
toZoneId: number

View File

@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import type { ZoneCharacter, Zone } from '@/types'
import type { ZoneCharacter, Zone } from '@/application/types'
export const useZoneStore = defineStore('zone', {
state: () => {
@ -40,6 +40,15 @@ export const useZoneStore = defineStore('zone', {
setCharacterLoaded(loaded: boolean) {
this.characterLoaded = loaded
},
updateCharacterPosition(data: { id: number, positionX: number, positionY: number, rotation: number, isMoving: boolean }) {
const character = this.characters.find(char => char.character.id === data.id)
if (character) {
character.character.positionX= data.positionX
character.character.positionY = data.positionY
character.character.rotation = data.rotation
character.isMoving = data.isMoving
}
},
reset() {
this.zone = null
this.characters = []