Example #1
0
        internal Habbo(UInt32 Id, string Username, string RealName,
                       uint Rank, string Motto, string Look, string Gender, Int32 Credits,
                       Int32 ActivityPoints, Double LastActivityPointsUpdate, bool Muted,
                       UInt32 HomeRoom, Int32 Respect, Int32 DailyRespectPoints, Int32 DailyPetRespectPoints,
                       bool MutantPenalty, bool HasFriendRequestsDisabled, uint currentQuestID, int currentQuestProgress, DataRow groupRow, int achievementPoints)
        {
            this.Id       = Id;
            this.Username = Username;
            this.RealName = RealName;
            this.Rank     = Rank;
            this.Motto    = Motto;
            this.Look     = ButterflyEnvironment.FilterFigure(Look.ToLower());

            this.Gender                   = Gender.ToLower();
            this.Credits                  = Credits;
            this.ActivityPoints           = ActivityPoints;
            this.AchievementPoints        = achievementPoints;
            this.LastActivityPointsUpdate = LastActivityPointsUpdate;
            this.Muted               = Muted;
            this.LoadingRoom         = 0;
            this.LoadingChecksPassed = false;
            this.CurrentRoomId       = 0;
            this.HomeRoom            = HomeRoom;
            this.FavoriteRooms       = new ArrayList();
            this.MutedUsers          = new List <uint>();
            this.Tags                      = new List <string>();
            this.Achievements              = new Dictionary <string, UserAchievement>();
            this.RatedRooms                = new List <uint>();
            this.Respect                   = Respect;
            this.DailyRespectPoints        = DailyRespectPoints;
            this.DailyPetRespectPoints     = DailyPetRespectPoints;
            this.CalledGuideBot            = false;
            this.MutantPenalty             = MutantPenalty;
            this.IsTeleporting             = false;
            this.TeleporterId              = 0;
            this.UsersRooms                = new List <RoomData>();
            this.HasFriendRequestsDisabled = HasFriendRequestsDisabled;

            this.LastQuestId          = 0;
            this.CurrentQuestId       = currentQuestID;
            this.CurrentQuestProgress = currentQuestProgress;

            if (this.DailyPetRespectPoints > 3)
            {
                this.DailyPetRespectPoints = 3;
            }
            if (this.DailyRespectPoints > 3)
            {
                this.DailyRespectPoints = 3;
            }

            if (groupRow != null)
            {
                int    groupID     = (int)groupRow["userid"];
                string description = (string)groupRow["description"];
                string badge       = (string)groupRow["badge"];

                userGroup = new Group(groupID, description, badge);
            }
            else
            {
                userGroup = null;
            }
        }
Example #2
0
        internal void ChangeLook()
        {
            if (Session.GetHabbo().MutantPenalty)
            {
                Session.SendNotif("Because of a penalty or restriction on your account, you are not allowed to change your look.");
                return;
            }

            string Gender = Request.PopFixedString().ToUpper();
            string Look   = ButterflyEnvironment.FilterInjectionChars(Request.PopFixedString());

            if (!AntiMutant.ValidateLook(Look, Gender))
            {
                return;
            }

            ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.PROFILE_CHANGE_LOOK);

            Session.GetHabbo().Look   = ButterflyEnvironment.FilterFigure(Look);
            Session.GetHabbo().Gender = Gender.ToLower();

            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                dbClient.setQuery("UPDATE users SET look = @look, gender = @gender WHERE id = " + Session.GetHabbo().Id);
                dbClient.addParameter("look", Look);
                dbClient.addParameter("gender", Gender);
                dbClient.runQuery();
            }

            ButterflyEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_AvatarLooks", 1);

            Session.GetMessageHandler().GetResponse().Init(266);
            Session.GetMessageHandler().GetResponse().AppendInt32(-1);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Look);
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            Session.GetMessageHandler().GetResponse().AppendStringWithBreak(Session.GetHabbo().Motto);
            Session.GetMessageHandler().SendResponse();

            if (Session.GetHabbo().InRoom)
            {
                Room Room = Session.GetHabbo().CurrentRoom;

                if (Room == null)
                {
                    return;
                }

                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User == null)
                {
                    return;
                }

                ServerMessage RoomUpdate = new ServerMessage(266);
                RoomUpdate.AppendInt32(User.VirtualId);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
                Room.SendMessage(RoomUpdate);
            }
        }