コード例 #1
0
        public static Habbo LoadHabbo(UserDataFactory userData, GameClient session)
        {
            DataRow habboData = userData.GetUserData();

            uint   id                       = (uint)habboData["id"];
            string username                 = (string)habboData["username"];
            string realName                 = (string)habboData["real_name"];
            string email                    = (string)habboData["mail"];
            string sso                      = (string)habboData["auth_ticket"];
            int    rank                     = (int)habboData["rank"];
            int    credits                  = (int)habboData["credits"];
            string activityPoints           = (string)habboData["activity_points"];
            double activityPointsLastUpdate = (double)habboData["activity_points_lastupdate"];
            string look                     = (string)habboData["look"];
            string gender                   = (string)habboData["gender"];
            string motto                    = (string)habboData["motto"];
            double accountCreated           = (double)habboData["account_created"];
            double lastOnline               = (double)habboData["last_online"];
            string ipLast                   = (string)habboData["ip_last"];
            string ipReg                    = (string)habboData["ip_reg"];
            uint   homeRoom                 = (uint)habboData["home_room"];
            int    dailyRespectPoints       = (int)habboData["daily_respect_points"];
            int    dailyPetRespectPoints    = (int)habboData["daily_pet_respect_points"];
            double muteExpires              = (double)habboData["mute_expires"];
            bool   blockNewFriends          = TextUtilies.StringToBool((string)habboData["block_newfriends"]);
            bool   hideOnline               = TextUtilies.StringToBool((string)habboData["hide_online"]);
            bool   hideInRoom               = TextUtilies.StringToBool((string)habboData["hide_inroom"]);

            int[] volume = ((string)habboData["volume"]).Split(new char[] { ',' }, 3, StringSplitOptions.RemoveEmptyEntries).Select(v => int.TryParse(v, out int i) ? i : 100).ToArray();
            if (volume.Length == 0)
            {
                volume = new int[] { 100, 100, 100 };
            }
            else if (volume.Length == 1)
            {
                volume = new int[] { volume[0], 100, 100 };
            }
            else if (volume.Length == 2)
            {
                volume = new int[] { volume[0], volume[1], 100 };
            }
            bool   acceptTrading     = TextUtilies.StringToBool((string)habboData["accept_trading"]);
            int    marketplaceTokens = (int)habboData["marketplace_tokens"];
            int    newbieStatus      = (int)habboData["newbie_status"];
            uint   newbieRoom        = (uint)habboData["newbie_room"];
            bool   friendStream      = TextUtilies.StringToBool((string)habboData["friend_stream"]);
            string twoFactoryAuthenicationSecretCode = (string)habboData["two_factory_authenication_secret_code"];
            bool   mailConfirmed            = TextUtilies.StringToBool((string)habboData["mail_confirmed"]);
            bool   preferOldChat            = TextUtilies.StringToBool((string)habboData["prefer_old_chat"]);
            bool   blockRoomInvites         = TextUtilies.StringToBool((string)habboData["block_room_invites"]);
            bool   blockCameraFollow        = TextUtilies.StringToBool((string)habboData["block_camera_follow"]);
            int    chatColor                = (int)habboData["chat_color"];
            double guideEnrollmentTimestamp = (double)habboData["guide_enrollment_timestamp"];

            return(new Habbo(session, userData, id, username, realName, email, sso, rank, credits, activityPoints, activityPointsLastUpdate, look, gender, motto, accountCreated, lastOnline, ipLast, ipReg, homeRoom, dailyRespectPoints, dailyPetRespectPoints, muteExpires, blockNewFriends, hideOnline, hideInRoom, volume, acceptTrading, marketplaceTokens, newbieStatus, newbieRoom, friendStream, twoFactoryAuthenicationSecretCode, mailConfirmed, preferOldChat, blockRoomInvites, blockCameraFollow, chatColor, guideEnrollmentTimestamp));
        }
コード例 #2
0
ファイル: Habbo.cs プロジェクト: aromaa/Skylight
        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;
                    }
                }
            }
        }