internal void QueueUpdateEvent(RoomData data) { lock (updateQueue.SyncRoot) { updateQueue.Enqueue(data); } }
internal void QueueRemoveEvent(RoomData data) { lock (removeQueue.SyncRoot) { removeQueue.Enqueue(data); } }
internal void QueueAddEvent(RoomData data) { lock (addQueue.SyncRoot) { addQueue.Enqueue(data); } }
internal void QueueRemoveEvent(RoomData data, int roomEventCategory) { lock (removeQueue.SyncRoot) { removeQueue.Enqueue(data); } eventCategories[roomEventCategory].QueueRemoveEvent(data); }
internal void QueueUpdateEvent(RoomData data, int roomEventCategory) { lock (updateQueue.SyncRoot) { updateQueue.Enqueue(data); } eventCategories[roomEventCategory].QueueUpdateEvent(data); }
internal void QueueAddEvent(RoomData data, int roomEventCategory) { lock (addQueue.SyncRoot) { addQueue.Enqueue(data); } eventCategories[roomEventCategory].QueueAddEvent(data); }
internal void SerializeTo(RoomData data, ServerMessage Message) { Message.AppendString(data.OwnerId + ""); Message.AppendString(data.Owner); Message.AppendString(RoomId + ""); Message.AppendInt32(Category); Message.AppendString(Name); Message.AppendString(Description); Message.AppendString(StartTime); Message.AppendInt32(Tags.Count); foreach (string Tag in Tags.ToArray()) { Message.AppendString(Tag); } }
internal void QueueVoteAdd(RoomData data) { lock (votedRoomsAddQueue.SyncRoot) { votedRoomsAddQueue.Enqueue(data); } }
private void InitializeFromRoomData(RoomData Data) { Initialize(Data.Id, Data.Name, Data.Description, Data.Owner, Data.OwnerId, Data.Category, Data.State, Data.UsersMax, Data.ModelName, Data.Score, Data.Tags, Data.AllowPets, Data.AllowPetsEating, Data.AllowWalkthrough, Data.Hidewall, Data.Password, Data.Wallpaper, Data.Floor, Data.Landscape, Data, Data.AllowRightsOverride, Data.WallThickness, Data.FloorThickness, Data.Group); }
private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category, int State, int UsersMax, string ModelName, int Score, List<string> pTags, bool AllowPets, bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group) { this.mDisposed = false; this.Id = Id; this.Name = Name; this.Description = Description; this.Owner = Owner; this.OwnerId = OwnerId; this.Category = Category; this.State = State; this.UsersNow = 0; this.UsersMax = UsersMax; this.ModelName = ModelName; 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.Password = Password; this.Bans = new Dictionary<int, double>(); this.Wallpaper = Wallpaper; this.Floor = Floor; this.Landscape = Landscape; this.chatMessageManager = new ChatMessageManager(); 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 RoomUnitManager(this); this.wiredHandler = new WiredHandler(this); this.Group = group; LoadRights(); GetRoomItemHandler().LoadFurniture(); wiredHandler.LoadWired(); GetGameMap().GenerateMaps(); LoadMusic(); //LoadBots(); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)"); } FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData); }
private void Initialize(UInt32 Id, string Name, string Description, string Owner, int OwnerId, int Category, int State, int UsersMax, string ModelName, int Score, List <string> pTags, bool AllowPets, bool AllowPetsEating, bool AllowWalkthrough, bool Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Group group) { this.mDisposed = false; this.Id = Id; this.Name = Name; this.Description = Description; this.Owner = Owner; this.OwnerId = OwnerId; this.Category = Category; this.State = State; this.UsersNow = 0; this.UsersMax = UsersMax; this.ModelName = ModelName; 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.Password = Password; this.Bans = new Dictionary <UInt32, double>(); this.Wallpaper = Wallpaper; this.Floor = Floor; this.Landscape = Landscape; this.chatMessageManager = new ChatMessageManager(); 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); this.Group = group; LoadRights(); GetRoomItemHandler().LoadFurniture(); wiredHandler.LoadWired(); GetGameMap().GenerateMaps(); LoadMusic(); //LoadBots(); using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("REPLACE INTO room_active VALUES (" + Id + ",1)"); } FirewindEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(mRoomData); }
internal Room(RoomData Data) { InitializeFromRoomData(Data); }
internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, Double Timestamp) { Room currentRoom = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(RoomData.Id); ServerMessage Message = new ServerMessage(Outgoing.IssueChatlog); Message.AppendUInt(Ticket.TicketId); Message.AppendUInt(Ticket.SenderId); Message.AppendUInt(Ticket.ReportedId); Message.AppendUInt(RoomData.Id); //maybe? Message.AppendBoolean(false); // is public Message.AppendUInt(RoomData.Id); Message.AppendString(RoomData.Name); if (currentRoom == null) { Message.AppendInt32(0); return Message; } else { ChatMessageManager manager = currentRoom.GetChatMessageManager(); Message.AppendInt32(manager.messageCount); manager.Serialize(ref Message); return Message; } //using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) //{ // dbClient.setQuery("SELECT user_id,user_name,hour,minute,message FROM chatlogs WHERE room_id = " + RoomData.Id + " AND timestamp >= " + (Timestamp - 300) + " AND timestamp <= " + Timestamp + " ORDER BY timestamp DESC"); // DataTable Data = dbClient.getTable(); // ServerMessage Message = new ServerMessage(534); // Message.AppendUInt(Ticket.TicketId); // Message.AppendUInt(Ticket.SenderId); // Message.AppendUInt(Ticket.ReportedId); // Message.AppendBoolean(RoomData.IsPublicRoom); // Message.AppendUInt(RoomData.Id); // Message.AppendString(RoomData.Name); // if (Data != null) // { // Message.AppendInt32(Data.Rows.Count); // foreach (DataRow Row in Data.Rows) // { // Message.AppendInt32((int)Row["hour"]); // Message.AppendInt32((int)Row["minute"]); // Message.AppendUInt((UInt32)Row["user_id"]); // Message.AppendString((String)Row["user_name"]); // Message.AppendString((String)Row["message"]); // } // } // else // { // Message.AppendInt32(0); // } // return Message; //} }
internal static ServerMessage SerializeRoomTool(RoomData Data) { Room Room = FirewindEnvironment.GetGame().GetRoomManager().GetRoom(Data.Id); UInt32 OwnerId = 0; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { try { dbClient.setQuery("SELECT id FROM users WHERE username = @owner"); dbClient.addParameter("owner", Data.Owner); OwnerId = Convert.ToUInt32(dbClient.getRow()[0]); } catch (Exception e) { Logging.HandleException(e, "ModerationTool.SerializeRoomTool"); } } ServerMessage Message = new ServerMessage(Outgoing.RoomTool); Message.AppendUInt(Data.Id); Message.AppendInt32(Data.UsersNow); // user count if (Room != null) { Message.AppendBoolean((Room.GetRoomUserManager().GetRoomUserByHabbo(Data.Owner) != null)); } else { Message.AppendBoolean(false); } Message.AppendUInt(OwnerId); Message.AppendString(Data.Owner); Message.AppendBoolean((Room != null)); // show data? Message.AppendString(Data.Name); Message.AppendString(Data.Description); Message.AppendInt32(Data.TagCount); foreach (string Tag in Data.Tags) { Message.AppendString(Tag); } Message.AppendBoolean((Room != null) ? Room.HasOngoingEvent : false); if (Room != null) { if (Room.Event != null) { Message.AppendString(Room.Event.Name); Message.AppendString(Room.Event.Description); Message.AppendInt32(Room.Event.Tags.Count); foreach (string Tag in Room.Event.Tags.ToArray()) { Message.AppendString(Tag); } } } return Message; }
internal void QueueVoteRemove(RoomData data) { lock (votedRoomsRemoveQueue.SyncRoot) { votedRoomsRemoveQueue.Enqueue(data); } }
internal RoomData FetchRoomData(UInt32 RoomId, DataRow dRow) { if (loadedRoomData.ContainsKey(RoomId)) return (RoomData)loadedRoomData[RoomId]; else { RoomData data = new RoomData(); if (IsRoomLoaded(RoomId)) data.Fill(GetRoom(RoomId)); else data.Fill(dRow); loadedRoomData.Add(RoomId, data); return data; } }
internal RoomData GenerateNullableRoomData(UInt32 RoomId) { if (GenerateRoomData(RoomId) != null) { return GenerateRoomData(RoomId); } RoomData Data = new RoomData(); Data.FillNull(RoomId); return Data; }
internal void QueueActiveRoomUpdate(RoomData data) { lock (activeRoomsUpdateQueue.SyncRoot) { activeRoomsUpdateQueue.Enqueue(data); } }
internal void QueueActiveRoomRemove(RoomData data) { //Logging.WriteLine("Removing from all rooms: " + data.Name + ";" + data.Category); lock (activeRoomsRemoveQueue.SyncRoot) { activeRoomsRemoveQueue.Enqueue(data); } }
internal void QueueActiveRoomAdd(RoomData data) { lock (activeRoomsAddQueue.SyncRoot) { activeRoomsAddQueue.Enqueue(data); } }
internal RoomData GenerateRoomData(UInt32 RoomId) { if (loadedRoomData.ContainsKey(RoomId)) return (RoomData)loadedRoomData[RoomId]; RoomData Data = new RoomData(); if (IsRoomLoaded(RoomId)) { return GetRoom(RoomId).RoomData; } else { DataRow Row = null; using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("SELECT rooms.*, room_active.active_users FROM rooms LEFT JOIN room_active ON (room_active.roomid = rooms.id) WHERE id = " + RoomId); Row = dbClient.getRow(); } if (Row == null) { return null; } Data.Fill(Row); loadedRoomData.Add(RoomId, Data); } return Data; }