/// <summary> /// Generates the room data. /// </summary> /// <param name="roomId">The room identifier.</param> /// <returns>RoomData.</returns> internal RoomData GenerateRoomData(uint roomId) { if (LoadedRoomData.ContainsKey(roomId)) { LoadedRoomData[roomId].LastUsed = DateTime.Now; return LoadedRoomData[roomId]; } var roomData = new RoomData(); if (LoadedRooms.ContainsKey(roomId)) return GetRoom(roomId).RoomData; using (var queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery(string.Format("SELECT * FROM rooms_data WHERE id = {0} LIMIT 1", roomId)); DataRow dataRow = queryReactor.GetRow(); if (dataRow == null) return null; roomData.Fill(dataRow); } LoadedRoomData.TryAdd(roomId, roomData); return roomData; }
/// <summary> /// Queues the active room add. /// </summary> /// <param name="data">The data.</param> internal void QueueActiveRoomAdd(RoomData data) { lock (_activeRoomsAddQueue.SyncRoot) { _activeRoomsAddQueue.Enqueue(data); } }
/// <summary> /// Fetches the room data. /// </summary> /// <param name="roomId">The room identifier.</param> /// <param name="dRow">The d row.</param> /// <returns>RoomData.</returns> internal RoomData FetchRoomData(uint roomId, DataRow dRow) { if (LoadedRoomData.ContainsKey(roomId)) { LoadedRoomData[roomId].LastUsed = DateTime.Now; return LoadedRoomData[roomId]; } var roomData = new RoomData(); roomData.Fill(dRow); LoadedRoomData.TryAdd(roomId, roomData); return roomData; }
/// <summary> /// Generates the nullable room data. /// </summary> /// <param name="roomId">The room identifier.</param> /// <returns>RoomData.</returns> internal RoomData GenerateNullableRoomData(uint roomId) { if (GenerateRoomData(roomId) != null) return GenerateRoomData(roomId); var roomData = new RoomData(); roomData.FillNull(roomId); return roomData; }
/// <summary> /// Initializes the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="roomData">The room data.</param> /// <param name="rightOverride">if set to <c>true</c> [right override].</param> /// <param name="wordFilter">The word filter.</param> private void Initialize(uint id, RoomData roomData, bool rightOverride, List<string> wordFilter) { RoomData = roomData; Disposed = false; RoomId = id; Bans = new Dictionary<long, double>(); MutedUsers = new Dictionary<uint, uint>(); ActiveTrades = new ArrayList(); MutedBots = false; MutedPets = false; _mCycleEnded = false; EveryoneGotRights = rightOverride; LoadedGroups = new Dictionary<int, string>(); UserRoomQueue = new Dictionary<uint, uint>(); _roomKick = new Queue(); _idleTime = 0; RoomMuted = false; _gameMap = new Gamemap(this); _roomItemHandling = new RoomItemHandling(this); _roomUserManager = new RoomUserManager(this); WordFilter = wordFilter; LoadRights(); LoadMusic(); LoadBans(); InitUserBots(); _roomThread = new Thread(StartRoomProcessing); _roomThread.Name = "Room Loader"; _roomThread.Start(); AzureEmulator.GetGame().GetRoomManager().QueueActiveRoomAdd(RoomData); }
/// <summary> /// Queues the add event. /// </summary> /// <param name="data">The data.</param> internal void QueueAddEvent(RoomData data) { lock (_addQueue.SyncRoot) _addQueue.Enqueue(data); }
/// <summary> /// Queues the add event. /// </summary> /// <param name="data">The data.</param> /// <param name="roomEventCategory">The room event category.</param> internal void QueueAddEvent(RoomData data, int roomEventCategory) { lock (_addQueue.SyncRoot) _addQueue.Enqueue(data); _eventCategories[roomEventCategory].QueueAddEvent(data); }
/// <summary> /// Queues the vote add. /// </summary> /// <param name="data">The data.</param> internal void QueueVoteAdd(RoomData data) { lock (_votedRoomsAddQueue.SyncRoot) { _votedRoomsAddQueue.Enqueue(data); } }
/// <summary> /// Serializes the ticket chatlog. /// </summary> /// <param name="ticket">The ticket.</param> /// <param name="roomData">The room data.</param> /// <param name="timestamp">The timestamp.</param> /// <returns>ServerMessage.</returns> /// <exception cref="System.NullReferenceException">No room found.</exception> internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp) { var message = new ServerMessage(); RoomData room = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId); //if (room == null) //{ // throw new NullReferenceException("No room found."); //} message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer")); message.AppendInteger(ticket.TicketId); message.AppendInteger(ticket.SenderId); message.AppendInteger(ticket.ReportedId); message.AppendInteger(ticket.RoomId); message.AppendByte(1); message.AppendShort(2); message.AppendString("roomName"); message.AppendByte(2); message.AppendString(ticket.RoomName); message.AppendString("roomId"); message.AppendByte(1); message.AppendInteger(ticket.RoomId); var tempChatlogs = room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList(); message.AppendShort(tempChatlogs.Count()); foreach (var chatLog in tempChatlogs) { chatLog.Serialize(ref message); } tempChatlogs = null; return message; }
/// <summary> /// Queues the remove event. /// </summary> /// <param name="data">The data.</param> /// <param name="roomEventCategory">The room event category.</param> internal void QueueRemoveEvent(RoomData data, int roomEventCategory) { lock (_removeQueue.SyncRoot) _removeQueue.Enqueue(data); _eventCategories[roomEventCategory].QueueRemoveEvent(data); }
/// <summary> /// Serializes the room tool. /// </summary> /// <param name="Data">The data.</param> /// <returns>ServerMessage.</returns> internal static ServerMessage SerializeRoomTool(RoomData Data) { Room room = AzureEmulator.GetGame().GetRoomManager().GetRoom(Data.Id); var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationRoomToolMessageComposer")); serverMessage.AppendInteger(Data.Id); serverMessage.AppendInteger(Data.UsersNow); if (room != null) { serverMessage.AppendBool(room.GetRoomUserManager().GetRoomUserByHabbo(Data.Owner) != null); } else { serverMessage.AppendBool(false); } serverMessage.AppendInteger(room != null ? room.RoomData.OwnerId : 0); serverMessage.AppendString(Data.Owner); serverMessage.AppendBool(room != null); serverMessage.AppendString(Data.Name); serverMessage.AppendString(Data.Description); serverMessage.AppendInteger(Data.TagCount); foreach (string current in Data.Tags) { serverMessage.AppendString(current); } serverMessage.AppendBool(false); return serverMessage; }
/// <summary> /// News the method. /// </summary> /// <param name="current2">The current2.</param> private void NewMethod(RoomData current2) { Response.AppendInteger(current2.Id); Response.AppendString(current2.Name); Response.AppendBool(false); }
/// <summary> /// Initializes from room data. /// </summary> /// <param name="data">The data.</param> private void InitializeFromRoomData(RoomData data) { Initialize(data.Id, data, data.AllowRightsOverride, data.WordFilter); }
/// <summary> /// Queues the active room remove. /// </summary> /// <param name="data">The data.</param> internal void QueueActiveRoomRemove(RoomData data) { lock (ActiveRoomsRemoveQueue.SyncRoot) { ActiveRoomsRemoveQueue.Enqueue(data); } }
/// <summary> /// Queues the remove event. /// </summary> /// <param name="data">The data.</param> internal void QueueRemoveEvent(RoomData data) { lock (_removeQueue.SyncRoot) _removeQueue.Enqueue(data); }
/// <summary> /// Queues the active room update. /// </summary> /// <param name="data">The data.</param> internal void QueueActiveRoomUpdate(RoomData data) { lock (_activeRoomsUpdateQueue.SyncRoot) { _activeRoomsUpdateQueue.Enqueue(data); } }
/// <summary> /// Queues the update event. /// </summary> /// <param name="data">The data.</param> internal void QueueUpdateEvent(RoomData data) { lock (_updateQueue.SyncRoot) _updateQueue.Enqueue(data); }
/// <summary> /// Queues the vote remove. /// </summary> /// <param name="data">The data.</param> internal void QueueVoteRemove(RoomData data) { lock (_votedRoomsRemoveQueue.SyncRoot) { _votedRoomsRemoveQueue.Enqueue(data); } }
internal void Start(RoomData data) { InitializeFromRoomData(data); GetRoomItemHandler().LoadFurniture(); GetGameMap().GenerateMaps(true); }