コード例 #1
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal void CreateGroup(string Name, string Desc, uint RoomId, string Badge, GameClient Session, int Colour1, int Colour2, out Guild Group)
		{
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery(string.Concat(new object[]
				{
					"INSERT INTO groups (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name, @desc, @badge, ",
					Session.GetHabbo().Id,
					", UNIX_TIMESTAMP(), ",
					RoomId,
					",'",
					Colour1,
					"','",
					Colour2,
					"')"
				}));
				queryreactor.addParameter("name", Name);
				queryreactor.addParameter("desc", Desc);
				queryreactor.addParameter("badge", Badge);
				uint num = checked((uint)queryreactor.insertQuery());
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE rooms SET group_id=",
					num,
					" WHERE id=",
					RoomId,
					" LIMIT 1"
				}));
				Dictionary<uint, GroupUser> dictionary = new Dictionary<uint, GroupUser>();
				dictionary.Add(Session.GetHabbo().Id, new GroupUser(Session.GetHabbo().Id, num, 2));
				this.Groups.Add(num, new Guild(num, Name, Desc, RoomId, Badge, CyberEnvironment.GetUnixTimestamp(), Session.GetHabbo().Id, Colour1, Colour2, dictionary, new List<uint>(), new Dictionary<uint, GroupUser>(), 0u, 1u, false, Name, Desc, 0, 0.0, 0, "", 0));

				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"INSERT INTO group_memberships (group_id, user_id, rank) VALUES (",
					num,
					", ",
					Session.GetHabbo().Id,
					", '2')"
				}));
				Group = this.GetGroup(num);
                GroupUser User = new GroupUser(Session.GetHabbo().Id, num, 2);
                Session.GetHabbo().UserGroups.Add(User);
                Group.Admins.Add(Session.GetHabbo().Id, User);
				queryreactor.runFastQuery(string.Concat(new object[]
				{
					"UPDATE user_stats SET favourite_group=",
					num,
					" WHERE id= ",
					Session.GetHabbo().Id,
					" LIMIT 1"
				}));
				queryreactor.runFastQuery("DELETE FROM room_rights WHERE room_id=" + RoomId);
			}
		}
コード例 #2
0
ファイル: RoomData.cs プロジェクト: kessiler/habboServer
		internal void FillNull(uint pId)
		{
			this.Id = pId;
			this.Name = "Unknown Room";
			this.Description = "-";
			this.Type = "private";
			this.Owner = "-";
			this.Category = 0;
			this.UsersNow = 0;
			this.UsersMax = 0;
			this.ModelName = "NO_MODEL";
			this.CCTs = "";
			this.Score = 0;
			this.Tags = new List<string>();
			this.AllowPets = 1;
			this.AllowPetsEating = 0;
			this.AllowWalkthrough = 1;
			this.Hidewall = 0;
			this.Password = "";
			this.Wallpaper = "0.0";
			this.Floor = "0.0";
			this.Landscape = "0.0";
			this.WallThickness = 0;
			this.FloorThickness = 0;
			this.Group = null;
			this.AllowRightsOverride = false;
			this.Event = null;
			this.GameId = 0;
			this.WhoCanBan = 0;
			this.WhoCanKick = 0;
			this.WhoCanMute = 0;
			this.TradeState = 2;
			this.State = 0;
			this.RoomChat = new HashSet<Chatlog>();
			this.WordFilter = new List<string>();
			this.WallHeight = -1;
			this.mModel = CyberEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName);
		}
コード例 #3
0
ファイル: RoomData.cs プロジェクト: kessiler/habboServer
		internal void Fill(Room Room)
		{
			this.Id = Room.RoomId;
			this.Name = Room.Name;
			this.Description = Room.Description;
			this.Type = Room.Type;
			this.Owner = Room.Owner;
			this.Category = Room.Category;
			this.State = Room.State;
			this.UsersNow = Room.UsersNow;
			this.UsersMax = Room.UsersMax;
			this.ModelName = Room.ModelName;
            this.WallHeight = Room.WallHeight;
			this.Score = Room.Score;
			this.Tags = new List<string>();
			object[] array = Room.Tags.ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				string item = (string)array[i];
				this.Tags.Add(item);
			}
			this.AllowPets = Room.AllowPets;
			this.AllowPetsEating = Room.AllowPetsEating;
			this.AllowWalkthrough = Room.AllowWalkthrough;
			this.Hidewall = Room.Hidewall;
			this.Password = Room.Password;
			this.Wallpaper = Room.Wallpaper;
			this.Floor = Room.Floor;
			this.Landscape = Room.Landscape;
			this.FloorThickness = Room.FloorThickness;
			this.WallThickness = Room.WallThickness;
			this.Group = Room.Group;
			this.Event = Room.Event;
			this.ChatType = Room.ChatType;
			this.ChatBalloon = Room.ChatBalloon;
			this.ChatSpeed = Room.ChatSpeed;
			this.ChatMaxDistance = Room.ChatMaxDistance;
			this.ChatFloodProtection = Room.ChatFloodProtection;
			this.WhoCanMute = Room.WhoCanMute;
			this.WhoCanKick = Room.WhoCanKick;
			this.WhoCanBan = Room.WhoCanBan;
			this.RoomChat = Room.RoomChat;
			this.WordFilter = Room.WordFilter;
			this.mModel = CyberEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName);
		}
コード例 #4
0
ファイル: RoomData.cs プロジェクト: kessiler/habboServer
		internal void Fill(DataRow Row)
		{
			this.Id = Convert.ToUInt32(Row["id"]);
			this.Name = (string)Row["caption"];
			this.Description = (string)Row["description"];
			this.Type = (string)Row["roomtype"];
			this.Owner = (string)Row["owner"];
			this.OwnerId = 0;
            this.RoomChat = new HashSet<Chatlog>();
			this.WordFilter = new List<string>();
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT id FROM users WHERE username = @owner");
				queryreactor.addParameter("owner", this.Owner);
				int integer = queryreactor.getInteger();
				if (integer > 0)
				{
					this.OwnerId = integer;
				}
				queryreactor.setQuery("SELECT user_id, message, timestamp FROM chatlogs WHERE room_id=@id ORDER BY timestamp DESC LIMIT 150");
				queryreactor.addParameter("id", this.Id);
				DataTable table = queryreactor.getTable();
				foreach (DataRow dataRow in table.Rows)
				{
					this.RoomChat.Add(new Chatlog((uint)dataRow[0], (string)dataRow[1], Convert.ToDouble(dataRow[2]), false));
				}
				queryreactor.setQuery("SELECT word FROM room_wordfilter WHERE room_id = @id");
				queryreactor.addParameter("id", this.Id);
				DataTable table2 = queryreactor.getTable();
				foreach (DataRow dataRow2 in table2.Rows)
				{
					this.WordFilter.Add(dataRow2["word"].ToString());
				}
			}
			string a;
			if ((a = Row["state"].ToString().ToLower()) != null)
			{
				if (a == "open")
				{
					this.State = 0;
					goto IL_24B;
				}
				if (a == "password")
				{
					this.State = 2;
					goto IL_24B;
				}
				if (!(a == "locked"))
				{
				}
			}
			this.State = 1;
			IL_24B:
			this.TradeState = int.Parse(Row["trade_state"].ToString());
			this.Category = (int)Row["category"];
			if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
			{
				this.UsersNow = (int)Row["users_now"];
			}
			else
			{
				this.UsersNow = 0;
			}
			this.UsersMax = (int)Row["users_max"];
			this.ModelName = (string)Row["model_name"];
            this.WallHeight = int.Parse(Row["walls_height"].ToString());
			this.CCTs = (string)Row["public_ccts"];
			this.Score = (int)Row["score"];
			this.Tags = new List<string>();
			this.AllowPets = Convert.ToInt32(Row["allow_pets"].ToString());
			this.AllowPetsEating = Convert.ToInt32(Row["allow_pets_eat"].ToString());
			this.AllowWalkthrough = Convert.ToInt32(Row["allow_walkthrough"].ToString());
			this.AllowRightsOverride = false;
			this.Hidewall = Convert.ToInt32(Row["allow_hidewall"].ToString());
			this.Password = (string)Row["password"];
			this.Wallpaper = (string)Row["wallpaper"];
			this.Floor = (string)Row["floor"];
			this.Landscape = (string)Row["landscape"];
			this.FloorThickness = (int)Row["floorthick"];
			this.WallThickness = (int)Row["wallthick"];
			this.ChatType = (int)Row["chat_type"];
			this.ChatBalloon = (int)Row["chat_balloon"];
			this.ChatSpeed = (int)Row["chat_speed"];
			this.ChatMaxDistance = (int)Row["chat_max_distance"];
			this.ChatFloodProtection = (int)Row["chat_flood_protection"];
			this.GameId = (int)Row["game_id"];
			this.WhoCanMute = Convert.ToInt32(Row["mute_settings"]);
			this.WhoCanKick = Convert.ToInt32(Row["kick_settings"]);
			this.WhoCanBan = Convert.ToInt32(Row["ban_settings"]);
			this.GroupId = (uint)Row["group_id"];
			this.Group = CyberEnvironment.GetGame().GetGroupManager().GetGroup(this.GroupId);
			this.Event = CyberEnvironment.GetGame().GetRoomEvents().GetEvent(this.Id);
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			if (!string.IsNullOrEmpty(Row["icon_items"].ToString()))
			{
				string[] array = Row["icon_items"].ToString().Split(new char[]
				{
					'|'
				});
				for (int i = 0; i < array.Length; i++)
				{
					string text = array[i];
					if (!string.IsNullOrEmpty(text))
					{
						string[] array2 = text.Replace('.', ',').Split(new char[]
						{
							','
						});
						int key = 0;
						int value = 0;
						int.TryParse(array2[0], out key);
						if (array2.Length > 1)
						{
							int.TryParse(array2[1], out value);
						}
						try
						{
							if (!dictionary.ContainsKey(key))
							{
								dictionary.Add(key, value);
							}
						}
						catch (Exception ex)
						{
							Logging.LogException(string.Concat(new string[]
							{
								"Exception: ",
								ex.ToString(),
								"[",
								text,
								"]"
							}));
						}
					}
				}
			}
            if (Row["tags"].ToString() != "")
            {
                string[] array3 = Row["tags"].ToString().Split(new char[]
			{
				','
			});
                for (int j = 0; j < array3.Length; j++)
                {
                    string item = array3[j];
                    this.Tags.Add(item);
                }
            }
			this.mModel = CyberEnvironment.GetGame().GetRoomManager().GetModel(this.ModelName);
		}
コード例 #5
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal List<uint> GetGroupRequestsByString(Guild Group, string SearchVal, uint Req)
		{
			if (string.IsNullOrWhiteSpace(SearchVal))
			{
				return Group.Requests;
			}
			List<uint> list = new List<uint>();
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT id FROM users WHERE username LIKE @query");
				queryreactor.addParameter("query", "%" + SearchVal + "%");
				DataTable table = queryreactor.getTable();
				if (table != null)
				{
					foreach (DataRow dataRow in table.Rows)
					{
						if (Group.Requests.Contains((uint)dataRow[0]))
						{
							list.Add((uint)dataRow[0]);
						}
					}
				}
			}
			return list;
		}
コード例 #6
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal void SerializeGroupInfo(Guild Group, ServerMessage Response, GameClient Session, Room Room, bool NewWindow = false)
		{
            if (Room == null) { return; }
			DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
			DateTime dateTime2 = dateTime.AddSeconds((double)Group.CreateTime);
			Response.Init(Outgoing.GroupDataMessageComposer);
			Response.AppendUInt(Group.Id);
			Response.AppendBoolean(true);
			Response.AppendUInt(Group.State);
			Response.AppendString(Group.Name);
			Response.AppendString(Group.Description);
			Response.AppendString(Group.Badge);
			Response.AppendUInt(Group.RoomId);
			Response.AppendString((CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId) == null) ? "No room found.." : CyberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Group.RoomId).Name);
			Response.AppendInt32((Group.CreatorId == Session.GetHabbo().Id) ? 3 : (Group.Requests.Contains(Session.GetHabbo().Id) ? 2 : (Group.Members.ContainsKey(Session.GetHabbo().Id) ? 1 : 0)));
			Response.AppendInt32(Group.Members.Count);
			Response.AppendBoolean(Session.GetHabbo().FavouriteGroup == Group.Id);
			Response.AppendString(string.Concat(new object[]
			{
				dateTime2.Day,
				"-",
				dateTime2.Month,
				"-",
				dateTime2.Year
			}));
			Response.AppendBoolean(Group.CreatorId == Session.GetHabbo().Id);
			Response.AppendBoolean(Group.Admins.ContainsKey(Session.GetHabbo().Id));
			Response.AppendString((CyberEnvironment.getHabboForId(Group.CreatorId) == null) ? "" : CyberEnvironment.getHabboForId(Group.CreatorId).Username);
			Response.AppendBoolean(NewWindow);
			Response.AppendBoolean(Group.AdminOnlyDeco == 0u);
			Response.AppendInt32(Group.Requests.Count);
			Response.AppendBoolean(Group.HasForum);
			if (Room != null)
			{
				Room.SendMessage(Response);
				return;
			}
			if (Session != null)
			{
				Session.SendMessage(Response);
			}
		}
コード例 #7
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal ServerMessage SerializeGroupMembers(ServerMessage Response, Guild Group, uint ReqType, GameClient Session, string SearchVal = "", int Page = 0)
		{
			if (Group == null || Session == null)
			{
				return null;
			}
			if (Page < 1)
			{
				Page = 0;
			}
			List<List<GroupUser>> list = GroupManager.Split(this.GetGroupUsersByString(Group, SearchVal, ReqType));
			Response.AppendUInt(Group.Id);
			Response.AppendString(Group.Name);
			Response.AppendUInt(Group.RoomId);
			Response.AppendString(Group.Badge);
			switch (ReqType)
			{
			case 0u:
				Response.AppendInt32(Group.Members.Count);
				Response.AppendInt32(list[Page].Count);
				using (List<GroupUser>.Enumerator enumerator = list[Page].GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						GroupUser current = enumerator.Current;
						Habbo habboForId = CyberEnvironment.getHabboForId(current.Id);
						if (habboForId == null)
						{
							Response.AppendInt32(0);
							Response.AppendInt32(0);
							Response.AppendString("");
							Response.AppendString("");
							Response.AppendString("");
						}
						else
						{
							Response.AppendInt32((current.Rank == 2) ? 0 : ((current.Rank == 1) ? 1 : 2));
							Response.AppendUInt(habboForId.Id);
							Response.AppendString(habboForId.Username);
							Response.AppendString(habboForId.Look);
							Response.AppendString("");
						}
					}
					goto IL_367;
				}
			case 1u:
				break;
			case 2u:
			{
				List<List<uint>> list2 = GroupManager.Split(this.GetGroupRequestsByString(Group, SearchVal, ReqType));
				Response.AppendInt32(Group.Requests.Count);
				if (Group.Requests.Count > 0)
				{
					Response.AppendInt32(list2[Page].Count);
					using (List<uint>.Enumerator enumerator2 = list2[Page].GetEnumerator())
					{
						while (enumerator2.MoveNext())
						{
							uint current2 = enumerator2.Current;
							Habbo habboForId2 = CyberEnvironment.getHabboForId(current2);
							if (habboForId2 == null)
							{
								Response.AppendInt32(0);
								Response.AppendInt32(0);
								Response.AppendString("");
								Response.AppendString("");
								Response.AppendString("");
							}
							else
							{
								Response.AppendInt32(3);
								Response.AppendUInt(habboForId2.Id);
								Response.AppendString(habboForId2.Username);
								Response.AppendString(habboForId2.Look);
								Response.AppendString("");
							}
						}
						goto IL_367;
					}
				}
				Response.AppendInt32(0);
				goto IL_367;
			}
			default:
				goto IL_367;
			}
			Response.AppendInt32(Group.Admins.Count);
			if (Group.Admins.Count > 0)
			{
				Response.AppendInt32(list[Page].Count);
				using (List<GroupUser>.Enumerator enumerator3 = list[Page].GetEnumerator())
				{
					while (enumerator3.MoveNext())
					{
						GroupUser current3 = enumerator3.Current;
						Habbo habboForId3 = CyberEnvironment.getHabboForId(current3.Id);
						if (habboForId3 == null)
						{
							Response.AppendInt32(0);
							Response.AppendInt32(0);
							Response.AppendString("");
							Response.AppendString("");
							Response.AppendString("");
						}
						else
						{
							Response.AppendInt32((current3.Rank == 2) ? 0 : ((current3.Rank == 1) ? 1 : 2));
							Response.AppendUInt(habboForId3.Id);
							Response.AppendString(habboForId3.Username);
							Response.AppendString(habboForId3.Look);
							Response.AppendString("");
						}
					}
					goto IL_367;
				}
			}
			Response.AppendInt32(0);
			IL_367:
			Response.AppendBoolean(Session.GetHabbo().Id == Group.CreatorId);
			Response.AppendInt32(14);
			Response.AppendInt32(Page);
			Response.AppendUInt(ReqType);
			Response.AppendString(SearchVal);
			return Response;
		}
コード例 #8
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal List<GroupUser> GetGroupUsersByString(Guild Group, string SearchVal, uint Req)
		{
			List<GroupUser> list = new List<GroupUser>();
			if (string.IsNullOrWhiteSpace(SearchVal))
			{
				if (Req == 0u)
				{
					using (Dictionary<uint, GroupUser>.ValueCollection.Enumerator enumerator = Group.Members.Values.GetEnumerator())
					{
						while (enumerator.MoveNext())
						{
							GroupUser current = enumerator.Current;
							list.Add(current);
						}
						return list;
					}
				}
				using (Dictionary<uint, GroupUser>.ValueCollection.Enumerator enumerator2 = Group.Admins.Values.GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						GroupUser current2 = enumerator2.Current;
						list.Add(current2);
					}
					return list;
				}
			}
			using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
			{
				queryreactor.setQuery("SELECT id FROM users WHERE username LIKE @query");
				queryreactor.addParameter("query", "%" + SearchVal + "%");
				DataTable table = queryreactor.getTable();
				if (table == null)
				{
					if (Req == 0u)
					{
						using (Dictionary<uint, GroupUser>.ValueCollection.Enumerator enumerator3 = Group.Members.Values.GetEnumerator())
						{
							while (enumerator3.MoveNext())
							{
								GroupUser current3 = enumerator3.Current;
								list.Add(current3);
							}
							goto IL_1CD;
						}
					}
					using (Dictionary<uint, GroupUser>.ValueCollection.Enumerator enumerator4 = Group.Admins.Values.GetEnumerator())
					{
						while (enumerator4.MoveNext())
						{
							GroupUser current4 = enumerator4.Current;
							list.Add(current4);
						}
						goto IL_1CD;
					}
				}
				foreach (DataRow dataRow in table.Rows)
				{
					if (Group.Members.ContainsKey((uint)dataRow[0]))
					{
						list.Add(Group.Members[(uint)dataRow[0]]);
					}
				}
				IL_1CD:;
			}
			return list;
		}
コード例 #9
0
ファイル: GroupManager.cs プロジェクト: kessiler/habboServer
		internal Guild GetGroup(uint GroupId)
		{
			if (this.Groups != null)
			{
                if (this.Groups.Contains(GroupId))
				{
					return (Guild)this.Groups[GroupId];
				}
				using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
				{
					queryreactor.setQuery("SELECT * FROM groups WHERE id=" + GroupId + " LIMIT 1");
					DataRow row = queryreactor.getRow();
					Guild result;
					if (row == null)
					{
						result = null;
						return result;
					}
					queryreactor.setQuery("SELECT user_id, rank FROM group_memberships WHERE group_id=" + GroupId);
					DataTable table = queryreactor.getTable();
					queryreactor.setQuery("SELECT user_id FROM group_requests WHERE group_id=" + GroupId);
					DataTable table2 = queryreactor.getTable();
					Dictionary<uint, GroupUser> dictionary = new Dictionary<uint, GroupUser>();
					Dictionary<uint, GroupUser> dictionary2 = new Dictionary<uint, GroupUser>();
					List<uint> list = new List<uint>();
					foreach (DataRow dataRow in table.Rows)
					{
						dictionary.Add((uint)dataRow[0], new GroupUser((uint)dataRow[0], GroupId, int.Parse(dataRow[1].ToString())));
						if (int.Parse(dataRow[1].ToString()) >= 1)
						{
							dictionary2.Add((uint)dataRow[0], new GroupUser((uint)dataRow[0], GroupId, int.Parse(dataRow[1].ToString())));
						}
					}
					foreach (DataRow dataRow2 in table2.Rows)
					{
						list.Add((uint)dataRow2[0]);
					}
					Guild group = new Guild((uint)row[0], row[1].ToString(), row[2].ToString(), (uint)row[6], row[3].ToString(), (int)row[5], (uint)row[4], (int)row[8], (int)row[9], dictionary, list, dictionary2, (uint)Convert.ToUInt16(row[7]), (uint)Convert.ToUInt16(row[10]), row["has_forum"].ToString() == "1", row["forum_name"].ToString(), row["forum_description"].ToString(), uint.Parse(row["forum_messages_count"].ToString()), double.Parse(row["forum_score"].ToString()), uint.Parse(row["forum_lastposter_id"].ToString()), row["forum_lastposter_name"].ToString(), int.Parse(row["forum_lastposter_timestamp"].ToString()));
					this.Groups.Add((uint)row[0], group);
					result = group;
					return result;
				}
			}
			return null;
		}
コード例 #10
0
ファイル: Room.cs プロジェクト: kessiler/habboServer
        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);
        }
コード例 #11
0
        internal void CreateGroup(string Name, string Desc, uint RoomId, string Badge, GameClient Session, int Colour1, int Colour2, out Guild Group)
        {
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery(string.Concat(new object[]
                {
                    "INSERT INTO groups (`name`, `desc`,`badge`,`owner_id`,`created`,`room_id`,`colour1`,`colour2`) VALUES(@name, @desc, @badge, ",
                    Session.GetHabbo().Id,
                    ", UNIX_TIMESTAMP(), ",
                    RoomId,
                    ",'",
                    Colour1,
                    "','",
                    Colour2,
                    "')"
                }));
                queryreactor.addParameter("name", Name);
                queryreactor.addParameter("desc", Desc);
                queryreactor.addParameter("badge", Badge);
                uint num = checked ((uint)queryreactor.insertQuery());
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE rooms SET group_id=",
                    num,
                    " WHERE id=",
                    RoomId,
                    " LIMIT 1"
                }));
                Dictionary <uint, GroupUser> dictionary = new Dictionary <uint, GroupUser>();
                dictionary.Add(Session.GetHabbo().Id, new GroupUser(Session.GetHabbo().Id, num, 2));
                this.Groups.Add(num, new Guild(num, Name, Desc, RoomId, Badge, CyberEnvironment.GetUnixTimestamp(), Session.GetHabbo().Id, Colour1, Colour2, dictionary, new List <uint>(), new Dictionary <uint, GroupUser>(), 0u, 1u, false, Name, Desc, 0, 0.0, 0, "", 0));

                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "INSERT INTO group_memberships (group_id, user_id, rank) VALUES (",
                    num,
                    ", ",
                    Session.GetHabbo().Id,
                    ", '2')"
                }));
                Group = this.GetGroup(num);
                GroupUser User = new GroupUser(Session.GetHabbo().Id, num, 2);
                Session.GetHabbo().UserGroups.Add(User);
                Group.Admins.Add(Session.GetHabbo().Id, User);
                queryreactor.runFastQuery(string.Concat(new object[]
                {
                    "UPDATE user_stats SET favourite_group=",
                    num,
                    " WHERE id= ",
                    Session.GetHabbo().Id,
                    " LIMIT 1"
                }));
                queryreactor.runFastQuery("DELETE FROM room_rights WHERE room_id=" + RoomId);
            }
        }
コード例 #12
0
        internal List <GroupUser> GetGroupUsersByString(Guild Group, string SearchVal, uint Req)
        {
            List <GroupUser> list = new List <GroupUser>();

            if (string.IsNullOrWhiteSpace(SearchVal))
            {
                if (Req == 0u)
                {
                    using (Dictionary <uint, GroupUser> .ValueCollection.Enumerator enumerator = Group.Members.Values.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            GroupUser current = enumerator.Current;
                            list.Add(current);
                        }
                        return(list);
                    }
                }
                using (Dictionary <uint, GroupUser> .ValueCollection.Enumerator enumerator2 = Group.Admins.Values.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        GroupUser current2 = enumerator2.Current;
                        list.Add(current2);
                    }
                    return(list);
                }
            }
            using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                queryreactor.setQuery("SELECT id FROM users WHERE username LIKE @query");
                queryreactor.addParameter("query", "%" + SearchVal + "%");
                DataTable table = queryreactor.getTable();
                if (table == null)
                {
                    if (Req == 0u)
                    {
                        using (Dictionary <uint, GroupUser> .ValueCollection.Enumerator enumerator3 = Group.Members.Values.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                GroupUser current3 = enumerator3.Current;
                                list.Add(current3);
                            }
                            goto IL_1CD;
                        }
                    }
                    using (Dictionary <uint, GroupUser> .ValueCollection.Enumerator enumerator4 = Group.Admins.Values.GetEnumerator())
                    {
                        while (enumerator4.MoveNext())
                        {
                            GroupUser current4 = enumerator4.Current;
                            list.Add(current4);
                        }
                        goto IL_1CD;
                    }
                }
                foreach (DataRow dataRow in table.Rows)
                {
                    if (Group.Members.ContainsKey((uint)dataRow[0]))
                    {
                        list.Add(Group.Members[(uint)dataRow[0]]);
                    }
                }
                IL_1CD :;
            }
            return(list);
        }
コード例 #13
0
        internal ServerMessage SerializeGroupMembers(ServerMessage Response, Guild Group, uint ReqType, GameClient Session, string SearchVal = "", int Page = 0)
        {
            if (Group == null || Session == null)
            {
                return(null);
            }
            if (Page < 1)
            {
                Page = 0;
            }
            List <List <GroupUser> > list = GroupManager.Split(this.GetGroupUsersByString(Group, SearchVal, ReqType));

            Response.AppendUInt(Group.Id);
            Response.AppendString(Group.Name);
            Response.AppendUInt(Group.RoomId);
            Response.AppendString(Group.Badge);
            switch (ReqType)
            {
            case 0u:
                Response.AppendInt32(Group.Members.Count);
                Response.AppendInt32(list[Page].Count);
                using (List <GroupUser> .Enumerator enumerator = list[Page].GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        GroupUser current    = enumerator.Current;
                        Habbo     habboForId = CyberEnvironment.getHabboForId(current.Id);
                        if (habboForId == null)
                        {
                            Response.AppendInt32(0);
                            Response.AppendInt32(0);
                            Response.AppendString("");
                            Response.AppendString("");
                            Response.AppendString("");
                        }
                        else
                        {
                            Response.AppendInt32((current.Rank == 2) ? 0 : ((current.Rank == 1) ? 1 : 2));
                            Response.AppendUInt(habboForId.Id);
                            Response.AppendString(habboForId.Username);
                            Response.AppendString(habboForId.Look);
                            Response.AppendString("");
                        }
                    }
                    goto IL_367;
                }

            case 1u:
                break;

            case 2u:
            {
                List <List <uint> > list2 = GroupManager.Split(this.GetGroupRequestsByString(Group, SearchVal, ReqType));
                Response.AppendInt32(Group.Requests.Count);
                if (Group.Requests.Count > 0)
                {
                    Response.AppendInt32(list2[Page].Count);
                    using (List <uint> .Enumerator enumerator2 = list2[Page].GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            uint  current2    = enumerator2.Current;
                            Habbo habboForId2 = CyberEnvironment.getHabboForId(current2);
                            if (habboForId2 == null)
                            {
                                Response.AppendInt32(0);
                                Response.AppendInt32(0);
                                Response.AppendString("");
                                Response.AppendString("");
                                Response.AppendString("");
                            }
                            else
                            {
                                Response.AppendInt32(3);
                                Response.AppendUInt(habboForId2.Id);
                                Response.AppendString(habboForId2.Username);
                                Response.AppendString(habboForId2.Look);
                                Response.AppendString("");
                            }
                        }
                        goto IL_367;
                    }
                }
                Response.AppendInt32(0);
                goto IL_367;
            }

            default:
                goto IL_367;
            }
            Response.AppendInt32(Group.Admins.Count);
            if (Group.Admins.Count > 0)
            {
                Response.AppendInt32(list[Page].Count);
                using (List <GroupUser> .Enumerator enumerator3 = list[Page].GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        GroupUser current3    = enumerator3.Current;
                        Habbo     habboForId3 = CyberEnvironment.getHabboForId(current3.Id);
                        if (habboForId3 == null)
                        {
                            Response.AppendInt32(0);
                            Response.AppendInt32(0);
                            Response.AppendString("");
                            Response.AppendString("");
                            Response.AppendString("");
                        }
                        else
                        {
                            Response.AppendInt32((current3.Rank == 2) ? 0 : ((current3.Rank == 1) ? 1 : 2));
                            Response.AppendUInt(habboForId3.Id);
                            Response.AppendString(habboForId3.Username);
                            Response.AppendString(habboForId3.Look);
                            Response.AppendString("");
                        }
                    }
                    goto IL_367;
                }
            }
            Response.AppendInt32(0);
IL_367:
            Response.AppendBoolean(Session.GetHabbo().Id == Group.CreatorId);
            Response.AppendInt32(14);
            Response.AppendInt32(Page);
            Response.AppendUInt(ReqType);
            Response.AppendString(SearchVal);
            return(Response);
        }