/// <summary>Check if player is legit to request access to the Dungeon, and if he is, send him to the Spawn Scene</summary> /// <param name="_clientID">The client ID requesting access to the Dungeon</param> /// <param name="_desiredDungeon">The desired Dungeon Name</param> /// UPDATED 13/06/2020 public void PlayerEnterDungeon(int _clientID, string _desiredDungeon) { Dungeon.Dungeon _dungeonFound = DungeonManager.FindDungeonByName(_desiredDungeon); if (_dungeonFound != null) { // Dungeon Exists if (_dungeonFound.playerCanAccessDungeon(level)) { //Player have the right level for this Dungeon if (_dungeonFound.playerCanAccessDesiredDungeonMap(_dungeonFound, currentScene.sceneName)) { // Dungeon Spawn Scene exist for this Dungeon & Player is on the Right CurrentScene to Access it ServerSend.SwitchToScene(_clientID, _dungeonFound.spawnScene, currentScene); // Update Current Scene currentScene = _dungeonFound.spawnScene; } else { NlogClass.target.WriteAsyncLogEvent(new AsyncLogEventInfo(new LogEventInfo(LogLevel.Warn, "PlayerEnterDungeon", "SpawnDungeonScene does not exist for this Dungeon OR Player [" + username + "] is trying to access to the Scene from a bad Entry Point. [CurrentScene : " + currentScene.sceneName + "]"), NlogClass.exceptions.Add)); } } else { NlogClass.target.WriteAsyncLogEvent(new AsyncLogEventInfo(new LogEventInfo(LogLevel.Warn, "PlayerEnterDungeon", "Player [" + username + "] dont have the level required to Access this Dungeon. [Lvl : " + level + "]"), NlogClass.exceptions.Add)); } } else { NlogClass.target.WriteAsyncLogEvent(new AsyncLogEventInfo(new LogEventInfo(LogLevel.Warn, "PlayerEnterDungeon", "Player [" + username + "] try to access to a Dungeon wich does not exist [" + _desiredDungeon + "]"), NlogClass.exceptions.Add)); } }