public void UnloadRoom(Room Room, bool RemoveData = false) { if (Room == null) { return; } Room room = null; if (_rooms.TryRemove(Room.RoomId, out room)) { Room.Dispose(); if (RemoveData) { RoomData Data = null; _loadedRoomData.TryRemove(Room.Id, out Data); } } //Logging.WriteLine("[RoomMgr] Unloaded room: \"" + Room.Name + "\" (ID: " + Room.RoomId + ")"); }
public void UnloadRoom(Room Room, bool RemoveData = false) { if (Room == null) { return; } #region Roleplay Checks #region Turf Turf Turf = TurfManager.GetTurf(Room.RoomId); if (Turf != null) { Turf.Flag = null; Turf.FlagSpawned = false; } #endregion #region Texas Hold Em List <TexasHoldEm> Games = TexasHoldEmManager.GetGamesByRoomId(Room.Id); if (Games.Count > 0) { foreach (TexasHoldEm Game in Games) { if (Game != null) { #region PotSquare Check Game.PotSquare.Furni = null; #endregion #region JoinGate Check Game.JoinGate.Furni = null; #endregion #region Player1 Check foreach (TexasHoldEmItem Item in Game.Player1.Values) { Item.Furni = null; } #endregion #region Player2 Check foreach (TexasHoldEmItem Item in Game.Player2.Values) { Item.Furni = null; } #endregion #region Player3 Check foreach (TexasHoldEmItem Item in Game.Player3.Values) { Item.Furni = null; } #endregion #region Banker Check foreach (TexasHoldEmItem Item in Game.Banker.Values) { Item.Furni = null; } #endregion } } } #endregion #region Farming List <FarmingSpace> FarmingSpaces = FarmingManager.GetFarmingSpacesByRoomId(Room.Id); if (FarmingSpaces.Count > 0) { foreach (FarmingSpace Space in FarmingSpaces) { if (Space != null) { Space.Item = null; Space.Spawned = false; } } } #endregion #region Houses List <House> Houses = PlusEnvironment.GetGame().GetHouseManager().GetHousesBySignRoomId(Room.Id); if (Houses.Count > 0) { foreach (House House in Houses) { if (House.Sign != null) { House.Sign.Item = null; House.Sign.Spawned = false; } } } #endregion #region Bots RoleplayBotManager.EjectRoomsDeployedBots(Room); #endregion #endregion new Thread(() => { Thread.Sleep(200); Room room = null; if (this._rooms.TryRemove(Room.RoomId, out room)) { Room.Dispose(); if (RemoveData) { RoomData Data = null; this._loadedRoomData.TryRemove(Room.Id, out Data); } } }).Start(); }
public void UnloadRoom(Room Room, bool RemoveData = false) { if (Room == null) return; Room room = null; if (this._rooms.TryRemove(Room.RoomId, out room)) { Room.Dispose(); if (RemoveData) { RoomData Data = null; this._loadedRoomData.TryRemove(Room.Id, out Data); } } //Logging.WriteLine("[RoomMgr] Unloaded room: \"" + Room.Name + "\" (ID: " + Room.RoomId + ")"); }