#174: Refactor character manager into zoneManager for better DX, major refactor of time and weather system (data is stored in DB now instead of JSON file), npm update, npm format, many other improvements
This commit is contained in:
25
src/models/zoneCharacter.ts
Normal file
25
src/models/zoneCharacter.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Character } from '@prisma/client'
|
||||
import prisma from '../utilities/prisma'
|
||||
|
||||
class ZoneCharacter {
|
||||
public readonly character: Character
|
||||
public isMoving: boolean = false
|
||||
|
||||
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
|
Reference in New Issue
Block a user