public Room(RoomData Data) { RolePlayerManager RPManager = ButterflyEnvironment.GetGame().GetRoleplayManager().GetRolePlay(Data.OwnerId); if (RPManager != null) { this.RpRoom = true; this.Pvp = true; this.RpCycleHourEffect = true; this.RpTimeSpeed = false; this.RpHour = -1; } this.SaveTimer = 0; this.Disposed = false; this.Bans = new Dictionary <int, double>(); this.Mutes = new Dictionary <int, double>(); this.ActiveTrades = new List <Trade>(); this.mCycleEnded = false; this.HeightMapLoaded = false; this.RoomData = Data; this.EveryoneGotRights = Data.AllowRightsOverride; this.IdleTime = 0; this.RoomMuted = false; this.PushPullAllowed = true; this.RoomIngameChat = false; this.gamemap = new Gamemap(this); this.roomItemHandling = new RoomItemHandling(this); this.roomUserManager = new RoomUserManager(this); this.wiredHandler = new WiredHandler(this); this.projecctileManager = new ProjectileManager(this); this.chatMessageManager = new ChatMessageManager(); this.chatMessageManager.LoadRoomChatlogs(this.Id); this.LoadRights(); this.GetRoomItemHandler().LoadFurniture(); if (this.RoomData.OwnerName == "WibboGame") { this.GetRoomItemHandler().LoadFurniture(5400713); } this.GetGameMap().GenerateMaps(); this.LoadBots(); this.InitPets(); this.lastTimerReset = DateTime.Now; }
private void Initialize(RoomData RoomData) { this.Id = RoomData.Id; this.mDisposed = false; this.RoomMuted = false; this.muteSignalEnabled = false; this.Bans = new Dictionary <UInt32, double>(); this.Mutes = new Dictionary <UInt32, MuteUser>(); this.FilterWords = new List <string>(); this.chatMessageManager = new ChatMessageManager(); this.lastTimerReset = DateTime.Now; this.IsRoomLoaded = false; this.mCycleEnded = false; this.HeightMapLoaded = false; this.mRoomData = RoomData; this.roomMessages = new Queue(); this.chatMessageQueue = new Queue(); this.roomMessages = new Queue(); this.roomAlerts = new Queue(); this.roomBadge = new Queue(); this.roomDiamonds = new Queue(); this.roomCredits = new Queue(); this.roomPiruletas = new Queue(); this.roomKick = new Queue(); this.roomServerMessages = new Queue(); this.roomChatServerMessages = new Queue(); this.groupAddQueue = new Queue(); this.groupRemoveQueue = new Queue(); this.groupsOnRoom = new Dictionary <uint, int>(); this.roomUserFloorItems = new Dictionary <uint, uint>(); this.roomUserWallItems = new Dictionary <uint, uint>(); this.gamemap = new Gamemap(this); this.roomUserManager = new RoomUserManager(this); this.roomItemHandling = new RoomItemHandling(this); this.wiredHandler = new WiredHandler(this); this.games = new GameManager(this); this.roomPoll = new RoomQuestionary(); if (!this.roomPoll.LoadQuestionary(this.Id)) { this.roomPoll = null; } this.LoadFilterWords(); this.LoadRights(); this.GetRoomItemHandler().LoadFurniture(); this.GetGameMap().GenerateMaps(); this.GetRoomUserManager().OnUserUpdateStatus(); // Update Bots State. this.LoadMusic(); if (this.RoomData.State != 3) { OtanixEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData); } }
private void Dispose() { if (!mDisposed) { try { mDisposed = true; mCycleEnded = true; OtanixEnvironment.GetGame().GetRoomManager().QueueActiveRoomRemove(mRoomData); using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { GetRoomItemHandler().SaveFurniture(dbClient); saveBots(); } WorkRoomServerMessageThread(); WorkRoomChatServerMessageThread(); ClearMute(); UsersWithRights.Clear(); Bans.Clear(); foreach (var item in GetRoomItemHandler().mFloorItems.Values) { item.Destroy(); } foreach (var item in GetRoomItemHandler().mWallItems.Values) { item.Destroy(); } roomUserManager.Destroy(); roomUserManager = null; chatMessageManager.Destroy(); chatMessageManager = null; roomItemHandling.Destroy(); roomItemHandling = null; if (GetGameManager() != null) { GetGameManager().Destroy(); games = null; } if (GotSoccer()) { GetSoccer().Destroy(); soccer = null; } if (GotWired()) { GetWiredHandler().Destroy(); wiredHandler = null; } if (GotMusicController()) { GetRoomMusicController().Destroy(); musicController = null; } if (GetGameMap() != null) { GetGameMap().Destroy(); gamemap = null; } } catch (Exception e) { Logging.LogCriticalException("Unload of room " + e); } } }
private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category, int State, int UsersMax, string ModelName, string CCTs, int Score, List<string> pTags, bool AllowPets, bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness) { this.mDisposed = false; this.Id = Id; this.Name = Name; this.Description = Description; this.Owner = Owner; this.Category = Category; this.Type = Type; this.State = State; this.UsersNow = 0; this.UsersMax = UsersMax; this.ModelName = ModelName; this.CCTs = CCTs; this.Score = Score; tagCount = 0; this.Tags = new ArrayList(); foreach (string tag in pTags) { tagCount++; Tags.Add(tag); } this.AllowPets = AllowPets; this.AllowPetsEating = AllowPetsEating; this.AllowWalkthrough = AllowWalkthrough; this.Hidewall = Hidewall; this.myIcon = Icon; this.Password = Password; this.Bans = new Dictionary<UInt32, double>(); this.Wallpaper = Wallpaper; this.Floor = Floor; this.Landscape = Landscape; this.chatMessageManager = new ChatMessageManager(); this.groups = new QueuedDictionary<int, Group>(); this.ActiveTrades = new ArrayList(); this.mCycleEnded = false; this.mRoomData = RoomData; this.EveryoneGotRights = RightOverride; this.roomMessages = new Queue(); this.chatMessageQueue = new Queue(); this.rnd = new Random(); this.roomMessages = new Queue(); this.roomAlerts = new Queue(); this.roomBadge = new Queue(); this.roomKick = new Queue(); this.roomServerMessages = new Queue(); this.IdleTime = 0; this.RoomMuted = false; this.WallThickness = walltickness; this.FloorThickness = floorthickness; this.gamemap = new Gamemap(this); this.roomItemHandling = new RoomItemHandling(this); this.roomUserManager = new RoomUserManager(this); this.wiredHandler = new WiredHandler(this); LoadRights(); GetRoomItemHandler().LoadFurniture(); wiredHandler.LoadWired(); GetGameMap().GenerateMaps(); LoadMusic(); //LoadBots(); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL) { dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)"); } else { dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " + "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " + "ELSE " + "INSERT INTO room_active VALUES (" + Id + ",1)"); } } ButterflyEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData); }
private void Initialize(UInt32 Id, string Name, string Description, string Type, string Owner, int Category, int State, int UsersMax, string ModelName, string CCTs, int Score, List <string> pTags, bool AllowPets, bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, RoomIcon Icon, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness) { this.mDisposed = false; this.Id = Id; this.Name = Name; this.Description = Description; this.Owner = Owner; this.Category = Category; this.Type = Type; this.State = State; this.UsersNow = 0; this.UsersMax = UsersMax; this.ModelName = ModelName; this.CCTs = CCTs; this.Score = Score; tagCount = 0; this.Tags = new ArrayList(); foreach (string tag in pTags) { tagCount++; Tags.Add(tag); } this.AllowPets = AllowPets; this.AllowPetsEating = AllowPetsEating; this.AllowWalkthrough = AllowWalkthrough; this.Hidewall = Hidewall; this.myIcon = Icon; this.Password = Password; this.Bans = new Dictionary <UInt32, double>(); this.Wallpaper = Wallpaper; this.Floor = Floor; this.Landscape = Landscape; this.chatMessageManager = new ChatMessageManager(); this.groups = new QueuedDictionary <int, Group>(); this.ActiveTrades = new ArrayList(); this.mCycleEnded = false; this.mRoomData = RoomData; this.EveryoneGotRights = RightOverride; this.roomMessages = new Queue(); this.chatMessageQueue = new Queue(); this.rnd = new Random(); this.roomMessages = new Queue(); this.roomAlerts = new Queue(); this.roomBadge = new Queue(); this.roomKick = new Queue(); this.roomServerMessages = new Queue(); this.IdleTime = 0; this.RoomMuted = false; this.WallThickness = walltickness; this.FloorThickness = floorthickness; this.gamemap = new Gamemap(this); this.roomItemHandling = new RoomItemHandling(this); this.roomUserManager = new RoomUserManager(this); this.wiredHandler = new WiredHandler(this); LoadRights(); GetRoomItemHandler().LoadFurniture(); wiredHandler.LoadWired(); GetGameMap().GenerateMaps(); LoadMusic(); //LoadBots(); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL) { dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)"); } else { dbClient.runFastQuery("IF EXISTS (SELECT roomid FROM room_active WHERE roomid = " + Id + ") " + "UPDATE room_active SET active_users = 1 WHERE roomid = " + Id + " " + "ELSE " + "INSERT INTO room_active VALUES (" + Id + ",1)"); } } ButterflyEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData); }