public void OnDisconnect() { if (!this.Disconnected) { this.Disconnected = true; PhoenixEnvironment.GetGame().GetClientManager().NullClientShit(this.Id, this.Username); if (!this.HabboInfoSaved) { this.HabboInfoSaved = true; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET last_online = UNIX_TIMESTAMP(), users.online = '0', activity_points = '", this.ActivityPoints, "', activity_points_lastupdate = '", this.LastActivityPointsUpdate, "', credits = '", this.Credits, "' WHERE Id = '", this.Id, "' LIMIT 1;" })); int num = (int)PhoenixEnvironment.GetUnixTimestamp() - this.Stat_LoginTime; adapter.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, "' WHERE Id = '", this.Id, "' LIMIT 1; " })); } } if (this.InRoom && this.CurrentRoom != null) { this.CurrentRoom.RemoveUserFromRoom(this.Session, false, false); } if (this.Messenger != null) { this.Messenger.AppearOffline = true; this.Messenger.OnStatusChanged(true); this.Messenger = null; } if (this.SubscriptionManager != null) { this.SubscriptionManager.Clear(); this.SubscriptionManager = null; } this.InventoryComponent.RunDBUpdate(); } }
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)); } } }