public void Dispose() { if (!this.bool_9) { this.bool_9 = true; Essential.GetGame().GetClientManager().RemoveClient(this.Id, this.Username); if (!this.bool_16) { this.bool_16 = true; this.Online = false; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET last_online = UNIX_TIMESTAMP(), online = '0', activity_points = '", this.ActivityPoints, "', activity_points_lastupdate = '", this.LastActivityPointsUpdate.ToString().Replace(",", "."), "', credits = '", this.Credits, "' WHERE Id = '", this.Id, "' LIMIT 1;" })); dbClient.ExecuteQuery("UPDATE user_clientsessions SET logout_timestamp='" + Essential.GetUnixTimestamp() + "' WHERE userId = " + this.Id + " AND login_timestamp='" + this.GetUserDataFactory().LoginTime + "'"); int num = (int)Essential.GetUnixTimestamp() - this.LoginTimestamp; dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET RoomVisits = '", this.RoomVisits, "', OnlineTime = OnlineTime + ", num, ", Respect = '", this.Respect, "', RespectGiven = '", this.RespectGiven, "', GiftsGiven = '", this.GiftsGiven, "', GiftsReceived = '", this.GiftsReceived, "', FootballGoalScorer = '", this.FootballGoalScorer, "', FootballGoalHost = '", this.FootballGoalHost, "', TilesLocked = '", this.TilesLocked, "', staff_picks = '", this.StaffPicks, "' WHERE Id = '", this.Id, "' LIMIT 1; " })); dbClient.ExecuteQuery("DELETE FROM user_currentroom WHERE userid=" + this.Id); } } try { Essential.GetGame().GetGuideManager().ToggleState(false, this.Id); GuideTicket gt = Essential.GetGame().GetGuideManager().GetTicket(this.Id); Essential.GetGame().GetGuideManager().RemoveTicket(this.Id); gt.SendToTicket(Essential.GetGame().GetGuideManager().DetachedMessage); } catch { } if (this.InRoom && this.CurrentRoom != null) this.CurrentRoom.RemoveUserFromRoom(this.Session, false, false); if (this.Messenger != null) { this.Messenger.bool_0 = true; this.Messenger.method_5(true); this.Messenger = null; } if (this.SubscriptionManager != null) { this.SubscriptionManager.GetSubscriptions().Clear(); this.SubscriptionManager = null; } this.InventoryComponent.SavePets(); } }
public Habbo(uint UserId, string Username, string Name, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, string DataCadastro, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, UserDataFactory userDataFactory, string last_online, int daily_respect_points, int daily_pet_respect_points, double vipha_last, double viphal_last, bool FriendStream,bool quizpassed, bool passedsafety, int muteTime, double ewl) { if (Session != null) Essential.GetGame().GetClientManager().AddClient(UserId, Username, Session); this.Id = UserId; this.Username = Username; this.RealName = Name; this.IsJuniori = false; this.IsVisible = true; this.SSO = SSO; this.Rank = Rank; this.Motto = Motto; this.Figure = Essential.FilterString(Look.ToLower()); this.Gender = Gender.ToLower(); this.Credits = Credits; this.VipPoints = Points; this.ActivityPoints = Pixels; this.LastActivityPointsUpdate = Activity_Points_LastUpdate; this.stream = new Stream.Stream(); this.TradingDisabled = AcceptTrading; this.IsMuted = Muted; this.uint_2 = 0u; this.bool_5 = false; this.bool_6 = false; this.EventWinLast = ewl; this.CurrentRoomId = 0u; this.HomeRoomId = HomeRoom; this.list_1 = new List<uint>(); this.list_2 = new List<uint>(); this.list_3 = new List<string>(); this.dictionary_0 = new Dictionary<uint, int>(); this.list_4 = new List<uint>(); this.NewbieStatus = NewbieStatus; this.bool_10 = false; this.BlockNewFriends = BlockNewFriends; this.HideInRom = HideInRoom; this.HideOnline = HideOnline; this.IsVIP = Vip; this.Volume = Volume; this.int_1 = 0; this.int_24 = 1; this.LastIp = LastIp; this.bool_7 = false; this.uint_5 = 0u; this.PassedHabboWayQuiz = quizpassed; this.PassedSafetyQuiz = passedsafety; this.Session = Session; this.UserDataFactory = userDataFactory; this.OwnedRooms = new List<RoomData>(); this.list_0 = new List<int>(); this.DataCadastro = DataCadastro; this.LastOnline = last_online; this.Online = true; this.RespectPoints = daily_respect_points; this.PetRespectPoints = daily_pet_respect_points; this.LastVipAlert = vipha_last; this.LastVipAlertLink = viphal_last; this.UnmuteTime = muteTime; DataRow dataRow = null; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.AddParamWithValue("user_id", UserId); dataRow = dbClient.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); if (dataRow == null) { dbClient.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + UserId + "')"); dataRow = dbClient.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1"); } this.dataTable_0 = dbClient.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id"); dbClient.ExecuteQuery("INSERT INTO user_currentroom (`userid`) VALUES (" + UserId + ")"); IEnumerator enumerator; if (this.dataTable_0 != null) { enumerator = this.dataTable_0.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; GroupsManager class2 = Groups.GetGroupById((int)dataRow2["groupid"]); if (class2 == null) { DataTable dataTable = dbClient.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 (!Groups.GroupsManager.ContainsKey((int)dataRow3["Id"])) { Groups.GroupsManager.Add((int)dataRow3["Id"], new GroupsManager((int)dataRow3["Id"], dataRow3, dbClient)); } } continue; } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable != null) { disposable.Dispose(); } } } if (!class2.Members.Contains((int)UserId)) { class2.JoinGroup((int)UserId); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } int num = (int)dataRow["groupid"]; GroupsManager class3 = Groups.GetGroupById(num); if (class3 != null) this.FavouriteGroup = num; else this.FavouriteGroup = 0; } else { this.FavouriteGroup = 0; } DataTable dataTable2 = dbClient.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + UserId + "';"); enumerator = dataTable2.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow2 = (DataRow)enumerator.Current; this.list_0.Add((int)dataRow2["groupid"]); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } this.RoomVisits = (int)dataRow["RoomVisits"]; this.LoginTimestamp = (int)Essential.GetUnixTimestamp(); this.OnlineTime = (int)dataRow["OnlineTime"]; this.Respect = (int)dataRow["Respect"]; this.RespectGiven = (int)dataRow["RespectGiven"]; this.GiftsGiven = (int)dataRow["GiftsGiven"]; this.FireworkPixelLoadedCount = (int)dataRow["fireworks"]; this.GiftsReceived = (int)dataRow["GiftsReceived"]; this.RespectPoints = (int)dataRow["DailyRespectPoints"]; this.PetRespectPoints = (int)dataRow["DailyPetRespectPoints"]; this.AchievementScore = (int)dataRow["AchievementScore"]; this.CompletedQuests = new List<uint>(); this.uint_7 = 0u; this.CurrentQuestId = (uint)dataRow["quest_id"]; this.CurrentQuestProgress = (int)dataRow["quest_progress"]; this.BuilderLevel = (int)dataRow["lev_builder"]; this.IdentityLevel = (int)dataRow["lev_identity"]; this.SocialLevel = (int)dataRow["lev_social"]; this.ExplorerLevel = (int)dataRow["lev_explore"]; this.RegularVisitor = (int)dataRow["RegularVisitor"]; this.FootballGoalScorer = (int)dataRow["FootballGoalScorer"]; this.FootballGoalHost = (int)dataRow["FootballGoalHost"]; this.TilesLocked = (int)dataRow["TilesLocked"]; this.StaffPicks = (int)dataRow["staff_picks"]; if (Session != null) { this.SubscriptionManager = new SubscriptionManager(UserId, userDataFactory); this.BadgeComponent = new BadgeComponent(UserId, userDataFactory); this.InventoryComponent = new InventoryComponent(UserId, Session, userDataFactory); this.EffectsInventoryComponent = new AvatarEffectsInventoryComponent(UserId, Session, userDataFactory); this.bool_8 = false; this.bool_9 = false; foreach (DataRow dataRow3 in userDataFactory.GetRooms().Rows) { this.OwnedRooms.Add(Essential.GetGame().GetRoomManager().method_17((uint)dataRow3["Id"], dataRow3)); } } this.RelationshipComposer = new HabboHotel.Users.Relationship.RelationshipComposer(this.Id, userDataFactory); }