Renamed zone > map
This commit is contained in:
@ -8,7 +8,7 @@ import { CharacterItem } from './characterItem'
|
||||
import { CharacterType } from './characterType'
|
||||
import { Chat } from './chat'
|
||||
import { User } from './user'
|
||||
import { Zone } from './zone'
|
||||
import { Map } from './map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
@ -35,7 +35,7 @@ export class Character extends BaseEntity {
|
||||
|
||||
// Position
|
||||
@ManyToOne()
|
||||
zone!: Zone // @TODO: Update to spawn point when current zone is not found
|
||||
map!: Map // @TODO: Update to spawn point when current map is not found
|
||||
|
||||
@Property()
|
||||
positionX = 0
|
||||
@ -142,13 +142,13 @@ export class Character extends BaseEntity {
|
||||
return this.chats
|
||||
}
|
||||
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getZone() {
|
||||
return this.zone
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setPositionX(positionX: number) {
|
||||
|
@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto'
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Character } from './character'
|
||||
import { Zone } from './zone'
|
||||
import { Map } from './map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
@ -17,7 +17,7 @@ export class Chat extends BaseEntity {
|
||||
character!: Character
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
zone!: Zone
|
||||
map!: Map
|
||||
|
||||
@Property()
|
||||
message!: string
|
||||
@ -43,13 +43,13 @@ export class Chat extends BaseEntity {
|
||||
return this.character
|
||||
}
|
||||
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getZone() {
|
||||
return this.zone
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setMessage(message: string) {
|
||||
|
@ -4,16 +4,16 @@ import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/
|
||||
|
||||
import { Character } from './character'
|
||||
import { Chat } from './chat'
|
||||
import { ZoneEffect } from './zoneEffect'
|
||||
import { ZoneEventTile } from './zoneEventTile'
|
||||
import { ZoneEventTileTeleport } from './zoneEventTileTeleport'
|
||||
import { ZoneObject } from './zoneObject'
|
||||
import { MapEffect } from './mapEffect'
|
||||
import { MapEventTile } from './mapEventTile'
|
||||
import { MapEventTileTeleport } from './mapEventTileTeleport'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
import { placedMapObject } from '#entities/placedMapObject'
|
||||
|
||||
@Entity()
|
||||
export class Zone extends BaseEntity {
|
||||
export class Map extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@ -38,22 +38,22 @@ export class Zone extends BaseEntity {
|
||||
@Property()
|
||||
updatedAt = new Date()
|
||||
|
||||
@OneToMany(() => ZoneEffect, (effect) => effect.zone)
|
||||
zoneEffects = new Collection<ZoneEffect>(this)
|
||||
@OneToMany(() => MapEffect, (effect) => effect.map)
|
||||
mapEffects = new Collection<MapEffect>(this)
|
||||
|
||||
@OneToMany(() => ZoneEventTile, (tile) => tile.zone)
|
||||
zoneEventTiles = new Collection<ZoneEventTile>(this)
|
||||
@OneToMany(() => MapEventTile, (tile) => tile.map)
|
||||
mapEventTiles = new Collection<MapEventTile>(this)
|
||||
|
||||
@OneToMany(() => ZoneEventTileTeleport, (teleport) => teleport.toZone)
|
||||
zoneEventTileTeleports = new Collection<ZoneEventTileTeleport>(this)
|
||||
@OneToMany(() => MapEventTileTeleport, (teleport) => teleport.toMap)
|
||||
mapEventTileTeleports = new Collection<MapEventTileTeleport>(this)
|
||||
|
||||
@OneToMany(() => ZoneObject, (object) => object.zone)
|
||||
zoneObjects = new Collection<ZoneObject>(this)
|
||||
@OneToMany(() => placedMapObject, (object) => object.map)
|
||||
placedMapObjects = new Collection<placedMapObject>(this)
|
||||
|
||||
@OneToMany(() => Character, (character) => character.zone)
|
||||
@OneToMany(() => Character, (character) => character.map)
|
||||
characters = new Collection<Character>(this)
|
||||
|
||||
@OneToMany(() => Chat, (chat) => chat.zone)
|
||||
@OneToMany(() => Chat, (chat) => chat.map)
|
||||
chats = new Collection<Chat>(this)
|
||||
|
||||
setId(id: UUID) {
|
||||
@ -128,40 +128,40 @@ export class Zone extends BaseEntity {
|
||||
return this.updatedAt
|
||||
}
|
||||
|
||||
setZoneEffects(zoneEffects: Collection<ZoneEffect>) {
|
||||
this.zoneEffects = zoneEffects
|
||||
setMapEffects(mapEffects: Collection<MapEffect>) {
|
||||
this.mapEffects = mapEffects
|
||||
return this
|
||||
}
|
||||
|
||||
getZoneEffects() {
|
||||
return this.zoneEffects
|
||||
getMapEffects() {
|
||||
return this.mapEffects
|
||||
}
|
||||
|
||||
setZoneEventTiles(zoneEventTiles: Collection<ZoneEventTile>) {
|
||||
this.zoneEventTiles = zoneEventTiles
|
||||
setMapEventTiles(mapEventTiles: Collection<MapEventTile>) {
|
||||
this.mapEventTiles = mapEventTiles
|
||||
return this
|
||||
}
|
||||
|
||||
getZoneEventTiles() {
|
||||
return this.zoneEventTiles
|
||||
getMapEventTiles() {
|
||||
return this.mapEventTiles
|
||||
}
|
||||
|
||||
setZoneEventTileTeleports(zoneEventTileTeleports: Collection<ZoneEventTileTeleport>) {
|
||||
this.zoneEventTileTeleports = zoneEventTileTeleports
|
||||
setMapEventTileTeleports(mapEventTileTeleports: Collection<MapEventTileTeleport>) {
|
||||
this.mapEventTileTeleports = mapEventTileTeleports
|
||||
return this
|
||||
}
|
||||
|
||||
getZoneEventTileTeleports() {
|
||||
return this.zoneEventTileTeleports
|
||||
getMapEventTileTeleports() {
|
||||
return this.mapEventTileTeleports
|
||||
}
|
||||
|
||||
setZoneObjects(zoneObjects: Collection<ZoneObject>) {
|
||||
this.zoneObjects = zoneObjects
|
||||
setPlacedMapObjects(placedMapObjects: Collection<placedMapObject>) {
|
||||
this.placedMapObjects = placedMapObjects
|
||||
return this
|
||||
}
|
||||
|
||||
getZoneObjects() {
|
||||
return this.zoneObjects
|
||||
getPlacedMapObjects() {
|
||||
return this.placedMapObjects
|
||||
}
|
||||
|
||||
setCharacters(characters: Collection<Character>) {
|
@ -2,18 +2,18 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Zone } from './zone'
|
||||
import { Map } from './map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
@Entity()
|
||||
export class ZoneEffect extends BaseEntity {
|
||||
export class MapEffect extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
zone!: Zone
|
||||
map!: Map
|
||||
|
||||
@Property()
|
||||
effect!: string
|
||||
@ -30,13 +30,13 @@ export class ZoneEffect extends BaseEntity {
|
||||
return this.id
|
||||
}
|
||||
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getZone() {
|
||||
return this.zone
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setEffect(effect: string) {
|
@ -2,23 +2,23 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, Enum, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Zone } from './zone'
|
||||
import { ZoneEventTileTeleport } from './zoneEventTileTeleport'
|
||||
import { Map } from './map'
|
||||
import { MapEventTileTeleport } from './mapEventTileTeleport'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { ZoneEventTileType } from '#application/enums'
|
||||
import { MapEventTileType } from '#application/enums'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
@Entity()
|
||||
export class ZoneEventTile extends BaseEntity {
|
||||
export class MapEventTile extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
zone!: Zone
|
||||
map!: Map
|
||||
|
||||
@Enum(() => ZoneEventTileType)
|
||||
type!: ZoneEventTileType
|
||||
@Enum(() => MapEventTileType)
|
||||
type!: MapEventTileType
|
||||
|
||||
@Property()
|
||||
positionX!: number
|
||||
@ -26,8 +26,8 @@ export class ZoneEventTile extends BaseEntity {
|
||||
@Property()
|
||||
positionY!: number
|
||||
|
||||
@OneToOne(() => ZoneEventTileTeleport, (teleport) => teleport.zoneEventTile)
|
||||
teleport?: ZoneEventTileTeleport
|
||||
@OneToOne(() => MapEventTileTeleport, (teleport) => teleport.mapEventTile)
|
||||
teleport?: MapEventTileTeleport
|
||||
|
||||
setId(id: UUID) {
|
||||
this.id = id
|
||||
@ -38,16 +38,16 @@ export class ZoneEventTile extends BaseEntity {
|
||||
return this.id
|
||||
}
|
||||
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getZone() {
|
||||
return this.zone
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setType(type: ZoneEventTileType) {
|
||||
setType(type: MapEventTileType) {
|
||||
this.type = type
|
||||
return this
|
||||
}
|
||||
@ -74,7 +74,7 @@ export class ZoneEventTile extends BaseEntity {
|
||||
return this.positionY
|
||||
}
|
||||
|
||||
setTeleport(teleport: ZoneEventTileTeleport) {
|
||||
setTeleport(teleport: MapEventTileTeleport) {
|
||||
this.teleport = teleport
|
||||
return this
|
||||
}
|
@ -2,22 +2,22 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Zone } from './zone'
|
||||
import { ZoneEventTile } from './zoneEventTile'
|
||||
import { Map } from './map'
|
||||
import { MapEventTile } from './mapEventTile'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
@Entity()
|
||||
export class ZoneEventTileTeleport extends BaseEntity {
|
||||
export class MapEventTileTeleport extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@OneToOne({ deleteRule: 'cascade' })
|
||||
zoneEventTile!: ZoneEventTile
|
||||
mapEventTile!: MapEventTile
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
toZone!: Zone
|
||||
toMap!: Map
|
||||
|
||||
@Property()
|
||||
toRotation!: number
|
||||
@ -37,22 +37,22 @@ export class ZoneEventTileTeleport extends BaseEntity {
|
||||
return this.id
|
||||
}
|
||||
|
||||
setZoneEventTile(zoneEventTile: ZoneEventTile) {
|
||||
this.zoneEventTile = zoneEventTile
|
||||
setMapEventTile(mapEventTile: MapEventTile) {
|
||||
this.mapEventTile = mapEventTile
|
||||
return this
|
||||
}
|
||||
|
||||
getZoneEventTile() {
|
||||
return this.zoneEventTile
|
||||
getMapEventTile() {
|
||||
return this.mapEventTile
|
||||
}
|
||||
|
||||
setToZone(toZone: Zone) {
|
||||
this.toZone = toZone
|
||||
setToMap(toMap: Map) {
|
||||
this.toMap = toMap
|
||||
return this
|
||||
}
|
||||
|
||||
getToZone() {
|
||||
return this.toZone
|
||||
getToMap() {
|
||||
return this.toMap
|
||||
}
|
||||
|
||||
setToRotation(toRotation: number) {
|
@ -1,8 +1,6 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { ZoneObject } from './zoneObject'
|
||||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
|
@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto'
|
||||
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
||||
|
||||
import { Zone } from './zone'
|
||||
import { Map } from './map'
|
||||
|
||||
import { BaseEntity } from '#application/base/baseEntity'
|
||||
import { UUID } from '#application/types'
|
||||
@ -10,12 +10,12 @@ import { MapObject } from '#entities/mapObject'
|
||||
|
||||
//@TODO : Rename mapObject
|
||||
@Entity()
|
||||
export class ZoneObject extends BaseEntity {
|
||||
export class placedMapObject extends BaseEntity {
|
||||
@PrimaryKey()
|
||||
id = randomUUID()
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
zone!: Zone
|
||||
map!: Map
|
||||
|
||||
@ManyToOne({ deleteRule: 'cascade' })
|
||||
mapObject!: MapObject
|
||||
@ -41,13 +41,13 @@ export class ZoneObject extends BaseEntity {
|
||||
return this.id
|
||||
}
|
||||
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
setMap(map: Map) {
|
||||
this.map = map
|
||||
return this
|
||||
}
|
||||
|
||||
getZone() {
|
||||
return this.zone
|
||||
getMap() {
|
||||
return this.map
|
||||
}
|
||||
|
||||
setMapObject(mapObject: MapObject) {
|
Reference in New Issue
Block a user