示例#1
0
        public void Init(GameClient client, UserData.UserData data)
        {
            Achievements = data.achievements;

            FavoriteRooms = new ArrayList();
            foreach (int id in data.favouritedRooms)
            {
                FavoriteRooms.Add(id);
            }

            _client            = client;
            BadgeComponent     = new BadgeComponent(this, data);
            InventoryComponent = new InventoryComponent(Id, client);

            quests = data.quests;

            Messenger = new HabboMessenger(Id);
            Messenger.Init(data.friends, data.requests);
            _friendCount  = Convert.ToInt32(data.friends.Count);
            _disconnected = false;
            Relationships = data.Relations;

            InitSearches();
            InitFX();
            InitClothing();
            InitIgnores();
        }
示例#2
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            _badges.Clear();

            if (!string.IsNullOrWhiteSpace(ComponentGuids))
            {
                var guids = new List <Guid>();
                ComponentGuids.SplitDelimitedValues().ToList().ForEach(g => guids.Add(Guid.Parse(g)));

                foreach (var component in BadgeContainer.Instance.Components)
                {
                    BadgeComponent badge = component.Value.Value;
                    if (guids.Contains(badge.TypeGuid))
                    {
                        var badgeControl = new PersonProfileBadge();
                        badgeControl.BadgeEntityTypeName = badge.EntityType.Name;
                        _badges.Add(badgeControl);
                    }
                }
            }

            base.CreateChildControls();
            Controls.Clear();

            _badges.ForEach(b => Controls.Add(b));
        }
示例#3
0
 internal void InitInformation(UserData data)
 {
     this.SubscriptionManager = new SubscriptionManager(this.Id, data);
     this.BadgeComponent      = new BadgeComponent(this.Id, data);
     this.quests    = data.quests;
     this.Messenger = new HabboMessenger(this.Id);
     this.Messenger.Init(data.friends, data.requests);
     this.SpectatorMode = false;
     this.Disconnected  = false;
     this.UsersRooms    = data.rooms;
     this.Relationships = data.Relations;
     this.AnsweredPolls = data.suggestedPolls;
 }
示例#4
0
文件: Habbo.cs 项目: Mereos/HabboEMU
 /// <summary>
 /// Initializes the information.
 /// </summary>
 /// <param name="data">The data.</param>
 internal void InitInformation(UserData data)
 {
     _subscriptionManager = new SubscriptionManager(Id, data);
     _badgeComponent      = new BadgeComponent(Id, data);
     Quests     = data.Quests;
     _messenger = new HabboMessenger(Id);
     _messenger.Init(data.Friends, data.Requests);
     SpectatorMode = false;
     Disconnected  = false;
     UsersRooms    = data.Rooms;
     Relationships = data.Relations;
     AnsweredPolls = data.SuggestedPolls;
 }
示例#5
0
        internal void InitInformation(UserData data)
        {
            this.SubscriptionManager = new SubscriptionManager(Id, data);
            this.BadgeComponent      = new BadgeComponent(Id, data);
            this.quests             = data.quests;
            this.chatMessageManager = new ChatMessageManager();

            this.Messenger = new HabboMessenger(Id);
            this.Messenger.Init(data.friends, data.requests);

            this.SpectatorMode = false;
            this.Disconnected  = false;
            this.UsersRooms    = data.rooms;
        }
示例#6
0
 public void Init(GameClient client, UserData.UserData data)
 {
     this.mClient            = client;
     this.BadgeComponent     = new BadgeComponent(this.Id, data.badges);
     this.InventoryComponent = new InventoryComponent(this.Id, client);
     this.InventoryComponent.SetActiveState(client);
     this.quests             = data.quests;
     this.chatMessageManager = new ChatMessageManager();
     this.chatMessageManager.LoadUserChatlogs(this.Id);
     this.Messenger = new HabboMessenger(this.Id);
     this.Messenger.AppearOffline = this.HideOnline;
     this.Messenger.Init(data.friends, data.requests, data.Relationships);
     this.MyGroups = data.MyGroups;
     this.UpdateRooms();
 }
示例#7
0
文件: Habbo.cs 项目: nightwolf93/Bfly
        internal void Init(GameClient client, UserData data)
        {
            this.mClient = client;

            this.SubscriptionManager = new SubscriptionManager(Id, data);
            this.BadgeComponent      = new BadgeComponent(Id, data);
            this.InventoryComponent  = InventoryGlobal.GetInventory(Id, client, data);
            this.InventoryComponent.SetActiveState(client);
            this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, client, data);
            this.quests             = data.quests;
            this.chatMessageManager = new ChatMessageManager();

            this.Messenger = new HabboMessenger(Id);
            this.Messenger.Init(data.friends, data.requests);

            this.SpectatorMode = false;
            this.Disconnected  = false;
            this.UsersRooms    = data.rooms;
        }
示例#8
0
 internal void Init(GameClient client, UserData data)
 {
     this.mClient             = client;
     this.SubscriptionManager = new SubscriptionManager(this.Id, data);
     this.BadgeComponent      = new BadgeComponent(this.Id, data);
     this.InventoryComponent  = InventoryGlobal.GetInventory(this.Id, client, data);
     this.InventoryComponent.SetActiveState(client);
     this.CommandHandler = new ChatCommandHandler(client);
     this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(this.Id, client, data);
     this.quests    = data.quests;
     this.Messenger = new HabboMessenger(this.Id);
     this.Messenger.Init(data.friends, data.requests);
     this.FriendCount            = Convert.ToUInt32(data.friends.Count);
     this.SpectatorMode          = false;
     this.Disconnected           = false;
     this.UsersRooms             = data.rooms;
     this.MinimailUnreadMessages = data.miniMailCount;
     this.Relationships          = data.Relations;
     this.AnsweredPolls          = data.suggestedPolls;
 }
示例#9
0
        internal void _LoadBadgeComponent()
        {
            DataTable dTable;

            using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("SELECT * FROM user_badges WHERE user_id = " + Id);
                dTable = dbClient.getTable();
            }

            List <Badge> badges = new List <Badge>();

            foreach (DataRow dRow in dTable.Rows)
            {
                badges.Add(new Badge((string)dRow["badge_id"], (string)dRow["badge_level"], (int)dRow["badge_slot"]));
            }

            BadgeComponent       = new BadgeComponent(Id, badges);
            BadgeComponentLoaded = true;
        }
示例#10
0
文件: Habbo.cs 项目: Mereos/HabboEMU
 /// <summary>
 /// Initializes the specified client.
 /// </summary>
 /// <param name="client">The client.</param>
 /// <param name="data">The data.</param>
 internal void Init(GameClient client, UserData data)
 {
     _mClient             = client;
     _subscriptionManager = new SubscriptionManager(Id, data);
     _badgeComponent      = new BadgeComponent(Id, data);
     _inventoryComponent  = InventoryGlobal.GetInventory(Id, client, data);
     _inventoryComponent.SetActiveState(client);
     _avatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, client, data);
     Quests     = data.Quests;
     _messenger = new HabboMessenger(Id);
     _messenger.Init(data.Friends, data.Requests);
     FriendCount            = Convert.ToUInt32(data.Friends.Count);
     SpectatorMode          = false;
     Disconnected           = false;
     UsersRooms             = data.Rooms;
     MinimailUnreadMessages = data.MiniMailCount;
     Relationships          = data.Relations;
     AnsweredPolls          = data.SuggestedPolls;
     _clothingManager       = new UserClothing(Id);
     Preferences            = new UserPreferences(Id);
     _youtubeManager        = new YoutubeManager(Id);
 }
示例#11
0
 public void InitInformation(UserData.UserData data)
 {
     BadgeComponent = new BadgeComponent(this, data);
     Relationships  = data.Relations;
 }
示例#12
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));
                }
            }
        }
示例#13
0
        internal void OnDisconnect()
        {
            try
            {
                if (Disconnected)
                {
                    return;
                }

                Disconnected = true;

                if (Messenger != null)
                {
                    Messenger.AppearOffline = true;
                    Messenger.Destroy();
                    Messenger = null;
                }

                if (IsPremium())
                {
                    GetPremiumManager().Destroy();
                }

                saveWardrobe();
                SaveBadges();
                //HabboEnvironment.GetGame().GetMuteManager().RemoveUserMute(Id);

                var pollParticipation = "";
                if (this.PollParticipation.Count > 0)
                {
                    foreach (UInt32 value in this.PollParticipation)
                    {
                        pollParticipation += value + ";";
                    }
                    pollParticipation = pollParticipation.Remove(pollParticipation.Length - 1);
                }

                var votedRooms = "";
                if (this.RatedRooms.Count > 0)
                {
                    foreach (UInt32 value in this.RatedRooms)
                    {
                        votedRooms += value + ";";
                    }
                    votedRooms = votedRooms.Remove(votedRooms.Length - 1);
                }

                var actrewards = "";
                if (this.WiredRewards.Count > 0)
                {
                    foreach (WiredActReward wrd in this.WiredRewards.Values)
                    {
                        actrewards += wrd.ItemId + "," + wrd.LastUpdate + "," + wrd.ActualRewards + "," + wrd.OriginalInt + ";";
                    }
                    actrewards = actrewards.Remove(actrewards.Length - 1);
                }

                var navilogs = "";
                if (this.navigatorLogs.Count > 0)
                {
                    foreach (NaviLogs navi in this.navigatorLogs.Values)
                    {
                        navilogs += navi.Id + "," + navi.Value1 + "," + navi.Value2 + ";";
                    }
                    navilogs = navilogs.Remove(navilogs.Length - 1);
                }

                var targetedoffers = "";
                if (this.TargetedOffers.Count > 0)
                {
                    foreach (KeyValuePair <uint, uint> k in this.TargetedOffers)
                    {
                        targetedoffers += k.Key + "-" + k.Value + ";";
                    }
                    targetedoffers = targetedoffers.Remove(targetedoffers.Length - 1);
                }

                using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("UPDATE users SET namechanges = '" + NameChanges + "', respect = '" + Respect +
                                      "', daily_respect_points = '" + DailyRespectPoints +
                                      "', daily_pet_respect_points = '" + DailyPetRespectPoints + "'," +
                                      " diamonds = '" + Diamonds + "',  machine_last = @machineLast, currentquestid = '" + CurrentQuestId +
                                      "', block_trade = '" + ((BlockTrade) ? "1" : "0") + "'," +
                                      " block_newfriends = '" + ((HasFriendRequestsDisabled) ? "1" : "0") +
                                      "', look = @look, motto = @motto, gender = @gender, last_online = '" + LastOnline.ToString() + "'," +
                                      " achievement_points = '" + AchievementPoints + "', home_room = '" + HomeRoom + "', volumenSystem = '" +
                                      volumenSystem + "', prefer_old_chat = '" + ((preferOldChat) ? "1" : "0") + "'," +
                                      " last_purchase = '" + LastPurchase + "'," +
                                      " poll_participation = '" + pollParticipation + "', voted_rooms = '" + votedRooms + "'," +
                                      " lastfollowinglogin = '******', ignoreRoomInvitations = '" + ((IgnoreRoomInvitations) ? "1" : "0") + "'," +
                                      " citizenship_level = '" + CitizenshipLevel + "', helper_level = '" + HelperLevel + "', actrewards = '" + actrewards + "', dontfocususers = '" + ((DontFocusUser) ? "1" : "0") + "'," +
                                      " navilogs = @navilogs, targeted_offers = @targetedoffers, alertasAtivados = '" + ((alertasAtivados) ? "1" : "0") + "', frankJaApareceu = '" + ((frankJaApareceu) ? "1" : "0") + "', FavoriteGroup = '" + FavoriteGroup + "', moedas = '" + Moedas + "', corAtual = @coratual, coresjaTenho  = '" + coresjaTenho + "', new_identity = '" + NewIdentity + "', new_bot = '" + NewBot + "', coins_purchased = '" + CoinsPurchased + "' WHERE id = " + Id);
                    dbClient.addParameter("look", Look);
                    dbClient.addParameter("coratual", corAtual);
                    dbClient.addParameter("motto", Motto);
                    dbClient.addParameter("gender", Gender);
                    dbClient.addParameter("machineLast", MachineId);
                    dbClient.addParameter("navilogs", navilogs);
                    dbClient.addParameter("targetedoffers", targetedoffers);
                    dbClient.runQuery();

                    dbClient.runFastQuery("DELETE FROM users_online WHERE user_id = '" + Id + "'");
                }

                if (this.AlfaServiceEnabled)
                {
                    if (this.AlfaGuideEnabled)
                    {
                        OtanixEnvironment.GetGame().GetAlfaManager().GetTourManager().RemoveAlfa(this.Id);
                        this.AlfaGuideEnabled = false;
                    }
                    if (this.AlfaHelperEnabled)
                    {
                        Help help = null;
                        if (OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps.ContainsKey(AlfaServiceId))
                        {
                            help = OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps[AlfaServiceId];
                        }

                        if (help != null)
                        {
                            if (help.helpState == HelpState.TALKING)
                            {
                                help.helpState = HelpState.FINISHED;
                            }
                            else if (help.helpState == HelpState.SEARCHING_USER)
                            {
                                help.NeedUpdate = true;
                            }
                        }

                        OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().RemoveAlfa(this.Id);
                        this.AlfaHelperEnabled = false;
                    }
                    if (this.AlfaGuardianEnabled)
                    {
                        Bully bully = null;
                        if (OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies.ContainsKey(AlfaServiceId))
                        {
                            bully = OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies[AlfaServiceId];
                        }

                        if (bully != null)
                        {
                            if (bully.bullyState == BullyState.WAITING_RESPONSE)
                            {
                                bully.bullySolution = BullySolution.EXIT;
                                bully.bullyState    = BullyState.FINISHED;
                            }
                            else if (bully.bullyState == BullyState.SEARCHING_USER)
                            {
                                bully.NeedUpdate = true;
                            }
                        }

                        OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveGuardian(this.Id);
                        this.AlfaGuardianEnabled = false;
                    }
                }

                if (InRoom && CurrentRoom != null && CurrentRoom.GetRoomUserManager() != null)
                {
                    CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(mClient, false, false, false);
                }

                if (AvatarEffectsInventoryComponent != null)
                {
                    AvatarEffectsInventoryComponent.Dispose();
                    AvatarEffectsInventoryComponent = null;
                }

                if (InventoryComponent != null)
                {
                    InventoryComponent.SetIdleState();
                    InventoryComponent.RunDBUpdate();
                    InventoryComponent.Destroy();
                    InventoryComponent = null;
                }

                if (BadgeComponent != null)
                {
                    BadgeComponentLoaded = false;
                    BadgeComponent.Destroy();
                    BadgeComponent = null;
                }

                if (RelationshipComposer != null)
                {
                    RelationsLoaded = false;
                    RelationshipComposer.Destroy();
                    RelationshipComposer = null;
                }

                if (Achievements != null && Achievements.Count > 0)
                {
                    AchievementsLoaded = false;
                    Achievements.Clear();
                    Achievements = null;
                }

                if (quests != null && quests.Count > 0)
                {
                    QuestsLoaded = false;
                    quests.Clear();
                    quests = null;
                }

                if (wardrobes != null && wardrobes.Count > 0)
                {
                    WardrobeLoaded = false;
                    wardrobes.Clear();
                    wardrobes = null;
                }

                if (clubManager != null)
                {
                    clubManager.Clear();
                    clubManager = null;
                }

                if (sanctionManager != null)
                {
                    sanctionManager.Clear();
                    sanctionManager = null;
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException("Disconnecting user " + e);
            }
            finally
            {
                OtanixEnvironment.GetGame().GetClientManager().UnregisterClient(Id, Username);
                Logging.WriteLine(Username + " has logged out.");
            }
        }
示例#14
0
        public void OnDisconnect()
        {
            if (this.Disconnected)
            {
                return;
            }

            this.Disconnected = true;

            ButterflyEnvironment.GetGame().GetClientManager().UnregisterClient(this.Id, this.Username);

            if (this.Langue == Language.FRANCAIS)
            {
                ButterflyEnvironment.onlineUsersFr--;
            }
            else if (this.Langue == Language.ANGLAIS)
            {
                ButterflyEnvironment.onlineUsersEn--;
            }
            else if (this.Langue == Language.PORTUGAIS)
            {
                ButterflyEnvironment.onlineUsersBr--;
            }

            if (this.HasFuse("fuse_mod"))
            {
                ButterflyEnvironment.GetGame().GetClientManager().RemoveUserStaff(this.Id);
            }

            Logging.WriteLine(this.Username + " has logged out.");

            if (!this.HabboinfoSaved)
            {
                this.HabboinfoSaved = true;
                TimeSpan TimeOnline    = DateTime.Now - this.OnlineTime;
                int      TimeOnlineSec = (int)TimeOnline.TotalSeconds;
                using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    queryreactor.RunQuery("UPDATE users SET online = '0', last_online = '" + ButterflyEnvironment.GetUnixTimestamp() + "', activity_points = " + this.Duckets + ", activity_points_lastupdate = '" + this.LastActivityPointsUpdate + "', credits = " + this.Credits + " WHERE id = " + this.Id + " ;");
                    queryreactor.RunQuery("UPDATE user_stats SET groupid = " + this.FavouriteGroupId + ",  OnlineTime = OnlineTime + " + TimeOnlineSec + ", quest_id = '" + this.CurrentQuestId + "', Respect = '" + this.Respect + "', DailyRespectPoints = '" + this.DailyRespectPoints + "', DailyPetRespectPoints = '" + this.DailyPetRespectPoints + "' WHERE id = " + this.Id + " ;");
                }
            }

            if (this.InRoom && this.CurrentRoom != null)
            {
                this.CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(this.mClient, false, false);
            }

            if (this.RolePlayId > 0)
            {
                RolePlayerManager RPManager = ButterflyEnvironment.GetGame().GetRoleplayManager().GetRolePlay(this.RolePlayId);
                if (RPManager != null)
                {
                    RolePlayer Rp = RPManager.GetPlayer(this.Id);
                    if (Rp != null)
                    {
                        RPManager.RemovePlayer(this.Id);
                    }
                }
                this.RolePlayId = 0;
            }

            if (this.GuideOtherUserId != 0)
            {
                GameClient requester = ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(this.GuideOtherUserId);
                if (requester != null)
                {
                    ServerPacket message = new ServerPacket(ServerPacketHeader.OnGuideSessionEnded);
                    message.WriteInteger(1);
                    requester.SendPacket(message);

                    requester.GetHabbo().GuideOtherUserId = 0;
                }
            }
            if (this.OnDuty)
            {
                ButterflyEnvironment.GetGame().GetGuideManager().RemoveGuide(this.Id);
            }

            if (this.Messenger != null)
            {
                this.Messenger.AppearOffline = true;
                this.Messenger.Destroy();
            }

            if (this.InventoryComponent != null)
            {
                this.InventoryComponent.Destroy();
                this.InventoryComponent = null;
            }

            if (this.BadgeComponent != null)
            {
                this.BadgeComponent.Destroy();
                this.BadgeComponent = null;
            }

            if (this.UsersRooms != null)
            {
                this.UsersRooms.Clear();
            }

            if (this.RoomRightsList != null)
            {
                this.RoomRightsList.Clear();
            }

            if (this.FavoriteRooms != null)
            {
                this.FavoriteRooms.Clear();
            }

            this.mClient = (GameClient)null;
        }