27 lines
669 B
TypeScript
27 lines
669 B
TypeScript
import { Character } from '@prisma/client'
|
|
import prisma from '../utilities/prisma'
|
|
|
|
class ZoneCharacter {
|
|
public readonly character: Character
|
|
public isMoving: boolean = false
|
|
public currentPath: Array<{ x: number; y: number }> | null = null;
|
|
|
|
constructor(character: Character) {
|
|
this.character = character
|
|
}
|
|
|
|
public async savePosition() {
|
|
await prisma.character.update({
|
|
where: { id: this.character.id },
|
|
data: {
|
|
positionX: this.character.positionX,
|
|
positionY: this.character.positionY,
|
|
rotation: this.character.rotation,
|
|
zoneId: this.character.zoneId
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
export default ZoneCharacter
|