Exemplo n.º 1
0
        public Habbo(uint Id, string Username, string RealName, string AuthTicket, uint Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, Double LastActivityPointsUpdate, bool Muted, uint HomeRoom, int Respect, int DailyRespectPoints, int DailyPetRespectPoints, int NewbieStatus, bool MutantPenalty, bool BlockNewFriends)
        {
            this.Id = Id;
            this.Username = Username;
            this.RealName = RealName;
            this.AuthTicket = AuthTicket;
            this.Rank = Rank;
            this.Motto = Motto;
            this.Look = Look.ToLower();
            this.Gender = Gender.ToLower();
            this.Credits = Credits;
            this.ActivityPoints = ActivityPoints;
            this.LastActivityPointsUpdate = LastActivityPointsUpdate;
            this.Muted = Muted;
            this.LoadingRoom = 0;
            this.LoadingChecksPassed = 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.Respect = Respect;
            this.DailyRespectPoints = DailyRespectPoints;
            this.DailyPetRespectPoints = DailyPetRespectPoints;
            this.NewbieStatus = NewbieStatus;
            this.CalledGuideBot = false;
            this.MutantPenalty = MutantPenalty;
            this.BlockNewFriends = BlockNewFriends;

            this.IsTeleporting = false;
            this.TeleporterId = 0;

            SubscriptionManager = new SubscriptionManager(Id);
            BadgeComponent = new BadgeComponent(Id);
            InventoryComponent = new InventoryComponent(Id);
            AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id);

            this.SpectatorMode = false;
            this.Disconnected = false;
            UberEnvironment.GetLogging().WriteLine(Username + " has logged in.", Core.LogLevel.Debug);
        }
Exemplo n.º 2
0
        public void OnDisconnect()
        {
            if (this.Disconnected)
            {
                return;
            }

            UberEnvironment.GetLogging().WriteLine(Username + " has logged out.", Core.LogLevel.Debug);

            this.Disconnected = true;
            DateTime Now = DateTime.Now;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE users SET last_online = '" + Now.ToString() + "', online = '0' WHERE id = '" + Id + "' LIMIT 1");
            }

            if (InRoom)
            {
                UberEnvironment.GetGame().GetRoomManager().GetRoom(CurrentRoomId).RemoveUserFromRoom(GetClient(), false, false);
            }

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

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

            // todo: drop events, kick bots, etc
        }