예제 #1
0
		internal RoomData GenerateRoomData(uint RoomId)
		{
            if (this.loadedRoomData.Contains(RoomId))
			{
				return (RoomData)this.loadedRoomData[RoomId];
			}
			RoomData roomData = new RoomData();
			if (this.IsRoomLoaded(RoomId))
			{
				return this.GetRoom(RoomId).RoomData;
			}
			DataRow dataRow = null;
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT * FROM rooms WHERE id = " + RoomId + " LIMIT 1");
				dataRow = queryreactor.getRow();
			}
			if (dataRow == null)
			{
				return null;
			}
			roomData.Fill(dataRow);
			this.loadedRoomData.Add(RoomId, roomData);
			return roomData;
		}
예제 #2
0
		internal RoomData GenerateNullableRoomData(uint RoomId)
		{
			if (this.GenerateRoomData(RoomId) != null)
			{
				return this.GenerateRoomData(RoomId);
			}
			RoomData roomData = new RoomData();
			roomData.FillNull(RoomId);
			return roomData;
		}
예제 #3
0
		internal static ServerMessage SerializeRoomTool(RoomData Data)
		{
			Room room = CyberEnvironment.GetGame().GetRoomManager().GetRoom(Data.Id);
			ServerMessage serverMessage = new ServerMessage(Outgoing.ModerationRoomToolMessageComposer);
			serverMessage.AppendUInt(Data.Id);
			serverMessage.AppendInt32(Data.UsersNow);
			if (room != null)
			{
				serverMessage.AppendBoolean(room.GetRoomUserManager().GetRoomUserByHabbo(Data.Owner) != null);
			}
			else
			{
				serverMessage.AppendBoolean(false);
			}
			serverMessage.AppendInt32(room.OwnerId);
			serverMessage.AppendString(Data.Owner);
			serverMessage.AppendBoolean(room != null);
			serverMessage.AppendString(Data.Name);
			serverMessage.AppendString(Data.Description);
			serverMessage.AppendInt32(Data.TagCount);
			foreach (string current in Data.Tags)
			{
				serverMessage.AppendString(current);
			}
			serverMessage.AppendBoolean(false);
			return serverMessage;
		}
예제 #4
0
		internal void QueueActiveRoomRemove(RoomData data)
		{
			lock (this.activeRoomsRemoveQueue.SyncRoot)
			{
				this.activeRoomsRemoveQueue.Enqueue(data);
			}
		}
예제 #5
0
		internal void QueueActiveRoomUpdate(RoomData data)
		{
			lock (this.activeRoomsUpdateQueue.SyncRoot)
			{
				this.activeRoomsUpdateQueue.Enqueue(data);
			}
		}
예제 #6
0
		internal void QueueActiveRoomAdd(RoomData data)
		{
			lock (this.activeRoomsAddQueue.SyncRoot)
			{
				this.activeRoomsAddQueue.Enqueue(data);
			}
		}
예제 #7
0
		internal void QueueVoteAdd(RoomData data)
		{
			lock (this.votedRoomsAddQueue.SyncRoot)
			{
				this.votedRoomsAddQueue.Enqueue(data);
			}
		}
예제 #8
0
		internal void QueueUpdateEvent(RoomData data)
		{
			lock (this.updateQueue.SyncRoot)
			{
				this.updateQueue.Enqueue(data);
			}
		}
예제 #9
0
        private void Initialize(uint Id, string Name, string Description, string Type, string Owner, int OwnerId, int Category, int State, int TradeState, int UsersMax, string ModelName, int Score, List<string> pTags, int AllowPets, int AllowPetsEating, int AllowWalkthrough, int Hidewall, string Password, string Wallpaper, string Floor, string Landscape, RoomData RoomData, bool RightOverride, int walltickness, int floorthickness, Guild group, int GameId, int chattype, int chatballoon, int chatspeed, int chatmaxdis, int chatprotection, int whomute, int whokick, int whoban, uint groupid, HashSet<Chatlog> Chat, List<string> WordFilter, int WallHeight)
        {
            this.mDisposed = false;
            this.Id = Id;
            this.Name = Name;
            this.Description = Description;
            this.Owner = Owner;
            this.OwnerId = OwnerId;
            this.Category = Category;
            this.Type = Type;
            this.State = State;
            this.TradeState = TradeState;
            this.UsersNow = 0;
            this.UsersMax = UsersMax;
            this.ModelName = ModelName;
            this.Score = Score;
            this.tagCount = 0;
            this.Tags = new ArrayList();
            foreach (string current in pTags)
            {
                this.tagCount++;
                this.Tags.Add(current);
            }
            this.ChatType = chattype;
            this.ChatBalloon = chatballoon;
            this.ChatSpeed = chatspeed;
            this.ChatMaxDistance = chatmaxdis;
            this.ChatFloodProtection = chatprotection;
            this.AllowPets = AllowPets;
            this.AllowPetsEating = AllowPetsEating;
            this.AllowWalkthrough = AllowWalkthrough;
            this.Hidewall = Hidewall;
            this.Group = group;
            this.Password = Password;
            this.Bans = new Dictionary<long, double>();
            this.MutedUsers = new Dictionary<uint, uint>();
            this.Wallpaper = Wallpaper;
            this.Floor = Floor;
            this.Landscape = Landscape;
            this.ActiveTrades = new ArrayList();
            this.MutedBots = false;
            this.mCycleEnded = false;
            this.mRoomData = RoomData;
            this.EveryoneGotRights = RightOverride;
            this.LoadedGroups = new Dictionary<uint, string>();
            this.roomKick = new Queue();
            this.IdleTime = 0;
            this.RoomMuted = false;
            this.WallThickness = walltickness;
            this.FloorThickness = floorthickness;
            this.WallHeight = WallHeight;
            this.gamemap = new Gamemap(this);
            this.roomItemHandling = new RoomItemHandling(this);
            this.roomUserManager = new RoomUserManager(this);
            this.RoomChat = Chat;
            this.WordFilter = WordFilter;
            this.Event = CyberEnvironment.GetGame().GetRoomEvents().GetEvent(Id);
            this.WhoCanBan = whoban;
            this.WhoCanKick = whokick;
            this.WhoCanBan = whoban;
            this.GroupId = groupid;
            this.LoadRights();
            this.LoadMusic();
            this.LoadBans();
            this.InitUserBots();

            this.RoomThread = new Thread(new ThreadStart(StartRoomProcessing));
            this.RoomThread.Start();
            CyberEnvironment.GetGame().GetRoomManager().QueueActiveRoomAdd(this.mRoomData);
        }
예제 #10
0
		internal RoomData FetchRoomData(uint RoomId, DataRow dRow)
		{
            if (this.loadedRoomData.Contains(RoomId))
			{
				return (RoomData)this.loadedRoomData[RoomId];
			}
			RoomData roomData = new RoomData();
			if (this.IsRoomLoaded(RoomId))
			{
				roomData.Fill(this.GetRoom(RoomId));
			}
			else
			{
				roomData.Fill(dRow);
			}
			this.loadedRoomData.Add(RoomId, roomData);
			return roomData;
		}
예제 #11
0
		private void InitializeFromRoomData(RoomData Data)
		{
			this.Initialize(Data.Id, Data.Name, Data.Description, Data.Type, Data.Owner, Data.OwnerId, Data.Category, Data.State, Data.TradeState, 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, Data.GameId, Data.ChatType, Data.ChatBalloon, Data.ChatSpeed, Data.ChatMaxDistance, Data.ChatFloodProtection, Data.WhoCanMute, Data.WhoCanKick, Data.WhoCanBan, Data.GroupId, Data.RoomChat, Data.WordFilter, Data.WallHeight);
		}
예제 #12
0
		internal Room(RoomData Data)
		{
			this.InitializeFromRoomData(Data);
			this.GetRoomItemHandler().LoadFurniture();
			this.GetGameMap().GenerateMaps(true);
            this.GetGameMap().lazyWalkablePoints();
		}
예제 #13
0
		internal void QueueAddEvent(RoomData data)
		{
			lock (this.addQueue.SyncRoot)
			{
				this.addQueue.Enqueue(data);
			}
		}
예제 #14
0
		internal static ServerMessage SerializeTicketChatlog(SupportTicket Ticket, RoomData RoomData, double Timestamp)
		{
			ServerMessage result;
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery(string.Concat(new object[]
				{
					"SELECT user_id,timestamp,message FROM chatlogs WHERE room_id = ",
					RoomData.Id,
					" AND (timestamp >= ",
					Timestamp - 300.0,
					" AND timestamp <= ",
					Timestamp,
					") OR (timestamp >= ",
					Timestamp - 300.0,
					" AND timestamp = 0) ORDER BY timestamp DESC LIMIT 150"
				}));
				DataTable table = queryreactor.getTable();
				ServerMessage serverMessage = new ServerMessage(Outgoing.ModerationToolIssueChatlogMessageComposer);
				serverMessage.AppendUInt(Ticket.TicketId);
				serverMessage.AppendUInt(Ticket.SenderId);
				serverMessage.AppendUInt(Ticket.ReportedId);
				serverMessage.AppendUInt(RoomData.Id);
				serverMessage.AppendBoolean(false);
				serverMessage.AppendUInt(RoomData.Id);
				serverMessage.AppendString(RoomData.Name);
				if (table != null)
				{
					serverMessage.AppendInt32(table.Rows.Count);
					IEnumerator enumerator = table.Rows.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							DataRow dataRow = (DataRow)enumerator.Current;
							Habbo habboForId = CyberEnvironment.getHabboForId(Convert.ToUInt32(dataRow["user_id"]));
							serverMessage.AppendInt32(CyberEnvironment.UnixToDateTime(Convert.ToDouble(dataRow["timestamp"])).Minute);
							serverMessage.AppendUInt(habboForId.Id);
							serverMessage.AppendString(habboForId.Username);
							serverMessage.AppendString((string)dataRow["message"]);
						}
						goto IL_1B8;
					}
					finally
					{
						IDisposable disposable = enumerator as IDisposable;
						if (disposable != null)
						{
							disposable.Dispose();
						}
					}
				}
				serverMessage.AppendInt32(0);
				IL_1B8:
				result = serverMessage;
			}
			return result;
		}
예제 #15
0
		internal void QueueVoteRemove(RoomData data)
		{
			lock (this.votedRoomsRemoveQueue.SyncRoot)
			{
				this.votedRoomsRemoveQueue.Enqueue(data);
			}
		}
예제 #16
0
		internal void QueueUpdateEvent(RoomData data, int roomEventCategory)
		{
			lock (this.updateQueue.SyncRoot)
			{
				this.updateQueue.Enqueue(data);
			}
			this.eventCategories[roomEventCategory].QueueUpdateEvent(data);
		}
예제 #17
0
		internal void QueueRemoveEvent(RoomData data)
		{
			lock (this.removeQueue.SyncRoot)
			{
				this.removeQueue.Enqueue(data);
			}
		}