KF-MMO-Server/Classes/dungeonData.ts

25 lines
595 B
TypeScript
Raw Normal View History

2023-11-01 10:01:57 +08:00
import { game } from "../game"
import { levelState } from "./levelState"
export class dungeonData{
entranceId : string
rooms : levelState[] = []
playerCount : number = 0
constructor(id:string) {
this.entranceId = id
}
getRoom(roomId : string, create : boolean){
let room = this.rooms.find(r=>r.id == roomId)
if(room == null && create){
room = new levelState(roomId, -1)
room.isDungeon = true
this.rooms.push(room)
game.lobbyState.rooms.push(room)
}
return room
}
}