Ejemplo n.º 1
0
 public void LoadMutedUsers(HabboData UserData)
 {
     foreach (DataRow Row in UserData.GetUserIgnores.Rows)
     {
         MutedUsers.Add((uint)Row["ignore_id"]);
     }
 }
Ejemplo n.º 2
0
 public void LoadData(HabboData UserData)
 {
     this.LoadAchievements(UserData);
     this.LoadFavorites(UserData);
     this.LoadMutedUsers(UserData);
     this.LoadTags(UserData);
     this.LoadQuests();
 }
Ejemplo n.º 3
0
 public void LoadFavorites(HabboData UserData)
 {
     this.FavoriteRooms.Clear();
     foreach (DataRow dataRow in UserData.GetUserFavouriteRooms.Rows)
     {
         FavoriteRooms.Add((uint)dataRow["room_id"]);
     }
 }
Ejemplo n.º 4
0
        public void LoadAchievements(HabboData UserData)
        {
            DataTable getAchievementData = UserData.GetAchievementData;

            if (getAchievementData != null)
            {
                foreach (DataRow Row in getAchievementData.Rows)
                {
                    this.Achievements.Add((uint)Row["achievement_id"], (int)Row["achievement_level"]);
                }
            }
        }
Ejemplo n.º 5
0
 public void LoadTags(HabboData UserData)
 {
     this.Tags.Clear();
     foreach (DataRow Row in UserData.GetUserTags.Rows)
     {
         Tags.Add((string)Row["tag"]);
     }
     if (Tags.Count >= 5 && GetClient() != null)
     {
         PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(GetClient(), 7, 1);
     }
 }
Ejemplo n.º 6
0
 private static Habbo GenerateHabbo(DataRow Data, string AuthTicket, GameClient Client, HabboData UserData)
 {
     uint id = (uint)Data["id"];
     string username = (string)Data["username"];
     string realName = (string)Data["real_name"];
     uint rank = (uint)Data["rank"];
     string motto = (string)Data["motto"];
     string ip_last = (string)Data["ip_last"];
     string look = (string)Data["look"];
     string gender = (string)Data["gender"];
     int credits = (int)Data["credits"];
     int activityPoints = (int)Data["activity_points"];
     return new Habbo(id, username, realName, AuthTicket, rank, motto, look, gender, credits, activityPoints, (double)Data["activity_points_lastupdate"], PhoenixEnvironment.EnumToBool(Data["is_muted"].ToString()), (uint)Data["home_room"], (int)Data["newbie_status"], PhoenixEnvironment.EnumToBool(Data["block_newfriends"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_inroom"].ToString()), PhoenixEnvironment.EnumToBool(Data["hide_online"].ToString()), PhoenixEnvironment.EnumToBool(Data["vip"].ToString()), (int)Data["volume"], (int)Data["vip_points"], PhoenixEnvironment.EnumToBool(Data["accept_trading"].ToString()), ip_last, Client, UserData, PhoenixEnvironment.EnumToBool(Data["friend_stream_enabled"].ToString()));
 }
Ejemplo n.º 7
0
        internal void Login(string AuthTicket)
        {
            try
            {
                HabboData pData = new HabboData(AuthTicket, this.GetConnection().ipAddress, true);
                if (this.GetConnection().ipAddress == "127.0.0.1" && !pData.UserFound)
                {
                    pData = new HabboData(AuthTicket, "::1", true);
                }
                if (!pData.UserFound)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (GlobalClass.SecureSessions)
                    {
                        str = TextManager.GetText("emu_sso_wrong_secure") + "(" + this.GetConnection().ipAddress + ")";
                    }
                    ServerMessage Message = new ServerMessage(161);
                    Message.AppendStringWithBreak(TextManager.GetText("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.Disconnect();
                    return;
                }
                Habbo habbo = Authenticator.TryLoginHabbo(AuthTicket, this, pData, pData);
                PhoenixEnvironment.GetGame().GetClientManager().LogClonesOut(habbo.Id);
                this.Habbo = habbo;
                this.Habbo.LoadData(pData);
                using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                {
                    adapter.ReadString("SELECT ip_last FROM users WHERE Id = " + GetHabbo().Id + " LIMIT 1;");
                }
                this.Habbo.isAaron = false;
                if (Habbo.isAaron)
                {
                    Habbo.Rank = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount();
                    Habbo.Vip = true;
                }
            }
            catch (Exception ex)
            {
                this.SendNotif("Login error: " + ex.Message);
                this.Disconnect();
                return;
            }
            try
            {
                PhoenixEnvironment.GetGame().GetBanManager().CheckForBanConflicts(this);
            }
            catch (ModerationBanException gException)
            {
                this.SendBanMessage(gException.Message);
                this.Disconnect();
                return;
            }
            ServerMessage Message2 = new ServerMessage(2);
            if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers)
            {
                Message2.AppendInt32(2);
            }
            else if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                Message2.AppendInt32(1);
            }
            else
            {
                Message2.AppendInt32(0);
            }
            if (this.GetHabbo().HasRole("acc_anyroomowner"))
            {
                Message2.AppendInt32(7);
            }
            else if (this.GetHabbo().HasRole("acc_anyroomrights"))
            {
                Message2.AppendInt32(5);
            }
            else if (this.GetHabbo().HasRole("acc_supporttool"))
            {
                Message2.AppendInt32(4);
            }
            else if (this.GetHabbo().Vip || GlobalClass.VIPclothesforHCusers || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                Message2.AppendInt32(2);
            }
            else
            {
                Message2.AppendInt32(0);
            }
            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().GetAvatarEffectsInventoryComponent().Serialize());

            ServerMessage Message3 = new ServerMessage(290);
            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);

            ServerMessage message4 = new ServerMessage(3);
            this.SendMessage(message4);

            if (this.GetHabbo().HasRole("acc_supporttool"))
            {
                this.SendMessage(PhoenixEnvironment.GetGame().GetModerationTool().SerializeTool());
                PhoenixEnvironment.GetGame().GetModerationTool().SendOpenTickets(this);
            }

            ServerMessage Logging = new ServerMessage(517);
            Logging.AppendBoolean(true);
            this.SendMessage(Logging);
            if (PhoenixEnvironment.GetGame().GetPixelManager().NeedsUpdate(this))
            {
                PhoenixEnvironment.GetGame().GetPixelManager().GivePixels(this);
            }
            ServerMessage Message5 = new ServerMessage(455);
            Message5.AppendUInt(this.GetHabbo().HomeRoom);
            this.SendMessage(Message5);
            ServerMessage Message6 = new ServerMessage(458);
            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().FavoriteRooms.Count);
            foreach (uint current in this.GetHabbo().FavoriteRooms)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);
            if (this.GetHabbo().Stat_OnlineTime > 8294400)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 10);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 4147200)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 9);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 2073600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 8);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 1036800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 7);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 518400)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 6);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 172800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 5);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 57600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 4);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 28800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 3);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 10800)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 2);
            }
            else if (this.GetHabbo().Stat_OnlineTime > 3600)
            {
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, 16, 1);
            }
            if (GlobalClass.Motd != "")
            {
                this.SendNotif(GlobalClass.Motd, 2);
            }
            for (uint i = (uint)PhoenixEnvironment.GetGame().GetRoleManager().RankCount(); i > 1; i -= 1)
            {
                if (PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i).Length > 0)
                {
                    if (!GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank == i)
                    {
                        GetHabbo().GetBadgeComponent().GiveBadge(this, PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i), true);
                    }
                    else if (GetHabbo().GetBadgeComponent().HasBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i)) && GetHabbo().Rank < i)
                    {
                        GetHabbo().GetBadgeComponent().RemoveBadge(PhoenixEnvironment.GetGame().GetRoleManager().RanksBadge(i));
                    }
                }
            }
            if (GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !GetHabbo().GetBadgeComponent().HasBadge("HC1"))
            {
                GetHabbo().GetBadgeComponent().GiveBadge(this, "HC1", true);
            }
            else
            {
                if (!GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && GetHabbo().GetBadgeComponent().HasBadge("HC1"))
                {
                    GetHabbo().GetBadgeComponent().RemoveBadge("HC1");
                }
            }
            if (GetHabbo().Vip && !GetHabbo().GetBadgeComponent().HasBadge("VIP"))
            {
                this.GetHabbo().GetBadgeComponent().GiveBadge(this, "VIP", true);
            }
            else
            {
                if (!GetHabbo().Vip && GetHabbo().GetBadgeComponent().HasBadge("VIP"))
                {
                    GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
                }
            }
            if (GetHabbo().CurrentQuestId > 0)
            {
                PhoenixEnvironment.GetGame().GetQuestManager().HandleQuest(GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage message8 = new ServerMessage(573);
                this.SendMessage(message8);
            }
            this.GetHabbo().Motto = PhoenixEnvironment.FilterInjectionChars(this.GetHabbo().Motto);
            DataTable table = null;
            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                table = adapter.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (table != null)
            {
                foreach (DataRow row in table.Rows)
                {
                    PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(this, (uint)row["achievement"], (int)row["achlevel"]);
                    using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
                    {
                        adapter.ExecuteQuery(string.Concat(new object[]
						{
							"DELETE FROM achievements_owed WHERE achievement = '",
							(uint)row["achievement"],
							"' AND user = '******' LIMIT 1"
						}));
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public Habbo(uint Id, string Username, string RealName, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, HabboData HabboData, bool FriendStream)
        {
            if (Session != null)
            {
                PhoenixEnvironment.GetGame().GetClientManager().RegisterClientShit(Id, Username, Session);
            }
            this.Id                       = Id;
            this.Username                 = Username;
            this.RealName                 = RealName;
            this.isAaron                  = false;
            this.Visible                  = true;
            this.SSO                      = SSO;
            this.Rank                     = Rank;
            this.Motto                    = Motto;
            this.Look                     = PhoenixEnvironment.FilterInjectionChars(Look.ToLower());
            this.Gender                   = Gender.ToLower();
            this.Credits                  = Credits;
            this.shells                   = Points;
            this.ActivityPoints           = Pixels;
            this.LastActivityPointsUpdate = Activity_Points_LastUpdate;
            this.AcceptTrading            = AcceptTrading;
            this.Muted                    = Muted;
            this.LoadingRoom              = 0;
            this.LoadingChecksPassed      = false;
            this.Waitingfordoorbell       = false;
            this.CurrentRoomId            = 0;
            this.HomeRoom                 = HomeRoom;
            this.FavoriteRooms            = new List <uint>();
            this.MutedUsers               = new List <uint>();
            this.Tags                     = new List <string>();
            this.Achievements             = new Dictionary <uint, int>();
            this.RatedRooms               = new List <uint>();
            this.NewbieStatus             = NewbieStatus;
            this.CalledGuideBot           = false;
            this.BlockNewFriends          = BlockNewFriends;
            this.HideInRom                = HideInRoom;
            this.HideOnline               = HideOnline;
            this.Vip                      = Vip;
            this.Volume                   = Volume;
            this.Rigger                   = 0;
            this.BuyCount                 = 1;
            this.LastIp                   = LastIp;
            this.IsTeleporting            = false;
            this.TeleporterId             = 0;
            this.Session                  = Session;
            this.HabboData                = HabboData;
            this.UsersRooms               = new List <RoomData>();
            this.GroupReqs                = new List <int>();
            this.FriendStreamEnabled      = FriendStream;
            DataRow dataRow = null;

            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                adapter.AddParamWithValue("user_id", Id);
                dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
                if (dataRow == null)
                {
                    adapter.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + Id + "')");
                    dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
                }
                this.GroupMemberships = adapter.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id");
                IEnumerator enumerator;
                if (this.GroupMemberships != null)
                {
                    enumerator = this.GroupMemberships.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow2 = (DataRow)enumerator.Current;
                            Group   class2   = GroupManager.GetGroup((int)dataRow2["groupid"]);
                            if (class2 == null)
                            {
                                DataTable   dataTable   = adapter.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow2["groupid"] + " LIMIT 1;");
                                IEnumerator enumerator2 = dataTable.Rows.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        DataRow dataRow3 = (DataRow)enumerator2.Current;
                                        if (!GroupManager.GroupList.ContainsKey((int)dataRow3["Id"]))
                                        {
                                            GroupManager.GroupList.Add((int)dataRow3["Id"], new Group((int)dataRow3["Id"], dataRow3, adapter));
                                        }
                                    }
                                    continue;
                                }
                                finally
                                {
                                    IDisposable disposable = enumerator2 as IDisposable;
                                    if (disposable != null)
                                    {
                                        disposable.Dispose();
                                    }
                                }
                            }
                            if (!class2.List.Contains((int)Id))
                            {
                                class2.AddMember((int)Id);
                            }
                        }
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    int   num    = (int)dataRow["groupid"];
                    Group class3 = GroupManager.GetGroup(num);
                    if (class3 != null)
                    {
                        this.GroupID = num;
                    }
                    else
                    {
                        this.GroupID = 0;
                    }
                }
                else
                {
                    this.GroupID = 0;
                }
                DataTable dataTable2 = adapter.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + Id + "';");
                enumerator = dataTable2.Rows.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        DataRow dataRow2 = (DataRow)enumerator.Current;
                        this.GroupReqs.Add((int)dataRow2["groupid"]);
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            this.RoomVisits            = (int)dataRow["RoomVisits"];
            this.Stat_LoginTime        = (int)PhoenixEnvironment.GetUnixTimestamp();
            this.Stat_OnlineTime       = (int)dataRow["OnlineTime"];
            this.Respect               = (int)dataRow["Respect"];
            this.RespectGiven          = (int)dataRow["RespectGiven"];
            this.GiftsGiven            = (int)dataRow["GiftsGiven"];
            this.GiftsReceived         = (int)dataRow["GiftsReceived"];
            this.DailyRespectPoints    = (int)dataRow["DailyRespectPoints"];
            this.DailyPetRespectPoints = (int)dataRow["DailyPetRespectPoints"];
            this.AchievementScore      = (int)dataRow["AchievementScore"];
            this.CompletedQuests       = new List <uint>();
            this.LastQuestId           = 0u;
            this.CurrentQuestId        = (uint)dataRow["quest_id"];
            this.CurrentQuestProgress  = (int)dataRow["quest_progress"];
            this.LevelBuilder          = (int)dataRow["lev_builder"];
            this.LevelIdentity         = (int)dataRow["lev_identity"];
            this.LevelSocial           = (int)dataRow["lev_social"];
            this.LevelExplorer         = (int)dataRow["lev_explore"];
            if (Session != null)
            {
                this.SubscriptionManager             = new SubscriptionManager(Id, HabboData);
                this.BadgeComponent                  = new BadgeComponent(Id, HabboData);
                this.InventoryComponent              = new InventoryComponent(Id, Session, HabboData);
                this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, Session, HabboData);
                this.SpectatorMode = false;
                this.Disconnected  = false;
                foreach (DataRow dataRow3 in HabboData.GetUsersRooms.Rows)
                {
                    this.UsersRooms.Add(PhoenixEnvironment.GetGame().GetRoomManager().FetchRoomData((uint)dataRow3["Id"], dataRow3));
                }
            }
        }
Ejemplo n.º 9
0
 public void LoadData(HabboData UserData)
 {
     this.LoadAchievements(UserData);
     this.LoadFavorites(UserData);
     this.LoadMutedUsers(UserData);
     this.LoadTags(UserData);
     this.LoadQuests();
 }
Ejemplo n.º 10
0
		public void LoadAchievements(HabboData UserData)
		{
			DataTable getAchievementData = UserData.GetAchievementData;
			if (getAchievementData != null)
			{
				foreach (DataRow Row in getAchievementData.Rows)
				{
					this.Achievements.Add((uint)Row["achievement_id"], (int)Row["achievement_level"]);
				}
			}
		}
Ejemplo n.º 11
0
		public void LoadTags(HabboData UserData)
		{
			this.Tags.Clear();
			foreach (DataRow Row in UserData.GetUserTags.Rows)
			{
				Tags.Add((string)Row["tag"]);
			}
			if (Tags.Count >= 5 && GetClient() != null)
			{
                PhoenixEnvironment.GetGame().GetAchievementManager().UnlockAchievement(GetClient(), 7, 1);
			}
		}
Ejemplo n.º 12
0
		public void LoadMutedUsers(HabboData UserData)
		{
            foreach (DataRow Row in UserData.GetUserIgnores.Rows)
			{
				MutedUsers.Add((uint)Row["ignore_id"]);
			}
		}
Ejemplo n.º 13
0
		public void LoadFavorites(HabboData UserData)
		{
			this.FavoriteRooms.Clear();
            foreach (DataRow dataRow in UserData.GetUserFavouriteRooms.Rows)
			{
				FavoriteRooms.Add((uint)dataRow["room_id"]);
			}
		}
Ejemplo n.º 14
0
        public Habbo(uint Id, string Username, string RealName, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, HabboData HabboData, bool FriendStream)
		{
			if (Session != null)
			{
				PhoenixEnvironment.GetGame().GetClientManager().RegisterClientShit(Id, Username, Session);
			}
			this.Id = Id;
			this.Username = Username;
			this.RealName = RealName;
			this.isAaron = false;
            this.Visible = true;
			this.SSO = SSO;
			this.Rank = Rank;
			this.Motto = Motto;
			this.Look = PhoenixEnvironment.FilterInjectionChars(Look.ToLower());
			this.Gender = Gender.ToLower();
			this.Credits = Credits;
			this.shells = Points;
			this.ActivityPoints = Pixels;
			this.LastActivityPointsUpdate = Activity_Points_LastUpdate;
			this.AcceptTrading = AcceptTrading;
			this.Muted = Muted;
			this.LoadingRoom = 0;
			this.LoadingChecksPassed = false;
			this.Waitingfordoorbell = false;
			this.CurrentRoomId = 0;
			this.HomeRoom = HomeRoom;
			this.FavoriteRooms = new List<uint>();
			this.MutedUsers = new List<uint>();
			this.Tags = new List<string>();
			this.Achievements = new Dictionary<uint, int>();
			this.RatedRooms = new List<uint>();
			this.NewbieStatus = NewbieStatus;
			this.CalledGuideBot = false;
			this.BlockNewFriends = BlockNewFriends;
			this.HideInRom = HideInRoom;
			this.HideOnline = HideOnline;
			this.Vip = Vip;
			this.Volume = Volume;
			this.Rigger = 0;
			this.BuyCount = 1;
			this.LastIp = LastIp;
			this.IsTeleporting = false;
			this.TeleporterId = 0;
			this.Session = Session;
			this.HabboData = HabboData;
			this.UsersRooms = new List<RoomData>();
			this.GroupReqs = new List<int>();
            this.FriendStreamEnabled = FriendStream;
			DataRow dataRow = null;

			using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
			{
				adapter.AddParamWithValue("user_id", Id);
				dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
				if (dataRow == null)
				{
					adapter.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + Id + "')");
					dataRow = adapter.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
				}
				this.GroupMemberships = adapter.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id");
				IEnumerator enumerator;
				if (this.GroupMemberships != null)
				{
					enumerator = this.GroupMemberships.Rows.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							DataRow dataRow2 = (DataRow)enumerator.Current;
                            Group class2 = GroupManager.GetGroup((int)dataRow2["groupid"]);
							if (class2 == null)
							{
								DataTable dataTable = adapter.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow2["groupid"] + " LIMIT 1;");
								IEnumerator enumerator2 = dataTable.Rows.GetEnumerator();
								try
								{
									while (enumerator2.MoveNext())
									{
										DataRow dataRow3 = (DataRow)enumerator2.Current;
                                        if (!GroupManager.GroupList.ContainsKey((int)dataRow3["Id"]))
										{
                                            GroupManager.GroupList.Add((int)dataRow3["Id"], new Group((int)dataRow3["Id"], dataRow3, adapter));
										}
									}
									continue;
								}
								finally
								{
									IDisposable disposable = enumerator2 as IDisposable;
									if (disposable != null)
									{
										disposable.Dispose();
									}
								}
							}
							if (!class2.List.Contains((int)Id))
							{
								class2.AddMember((int)Id);
							}
						}
					}
					finally
					{
						IDisposable disposable = enumerator as IDisposable;
						if (disposable != null)
						{
							disposable.Dispose();
						}
					}
					int num = (int)dataRow["groupid"];
                    Group class3 = GroupManager.GetGroup(num);
					if (class3 != null)
					{
						this.GroupID = num;
					}
					else
					{
						this.GroupID = 0;
					}
				}
				else
				{
					this.GroupID = 0;
				}
				DataTable dataTable2 = adapter.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + Id + "';");
				enumerator = dataTable2.Rows.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						DataRow dataRow2 = (DataRow)enumerator.Current;
						this.GroupReqs.Add((int)dataRow2["groupid"]);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
			}
			this.RoomVisits = (int)dataRow["RoomVisits"];
			this.Stat_LoginTime = (int)PhoenixEnvironment.GetUnixTimestamp();
			this.Stat_OnlineTime = (int)dataRow["OnlineTime"];
			this.Respect = (int)dataRow["Respect"];
			this.RespectGiven = (int)dataRow["RespectGiven"];
			this.GiftsGiven = (int)dataRow["GiftsGiven"];
			this.GiftsReceived = (int)dataRow["GiftsReceived"];
			this.DailyRespectPoints = (int)dataRow["DailyRespectPoints"];
			this.DailyPetRespectPoints = (int)dataRow["DailyPetRespectPoints"];
			this.AchievementScore = (int)dataRow["AchievementScore"];
			this.CompletedQuests = new List<uint>();
			this.LastQuestId = 0u;
			this.CurrentQuestId = (uint)dataRow["quest_id"];
			this.CurrentQuestProgress = (int)dataRow["quest_progress"];
			this.LevelBuilder = (int)dataRow["lev_builder"];
			this.LevelIdentity = (int)dataRow["lev_identity"];
			this.LevelSocial = (int)dataRow["lev_social"];
			this.LevelExplorer = (int)dataRow["lev_explore"];
			if (Session != null)
			{
				this.SubscriptionManager = new SubscriptionManager(Id, HabboData);
				this.BadgeComponent = new BadgeComponent(Id, HabboData);
				this.InventoryComponent = new InventoryComponent(Id, Session, HabboData);
				this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, Session, HabboData);
				this.SpectatorMode = false;
				this.Disconnected = false;
				foreach (DataRow dataRow3 in HabboData.GetUsersRooms.Rows)
				{
					this.UsersRooms.Add(PhoenixEnvironment.GetGame().GetRoomManager().FetchRoomData((uint)dataRow3["Id"], dataRow3));
				}
			}
		}
Ejemplo n.º 15
0
		internal static Habbo TryLoginHabbo(string AuthTicket, GameClient Session, HabboData pData, HabboData UserData)
		{
			return GenerateHabbo(pData.GetHabboDataRow, AuthTicket, Session, UserData);
		}
Ejemplo n.º 16
0
		internal static Habbo GetHabboViaUsername(string Data)
		{
			HabboData userData = new HabboData(Data, false);
			return GenerateHabbo(userData.GetHabboDataRow, "", null, userData);
		}