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

            this.Gender                   = Gender.ToLower();
            this.Credits                  = Credits;
            this.VipPoints                = VipPoints;
            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.LastOnline                = LastOnline;

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

            //this.Groups = new List<int>();
            //if (groups != null)
            //{
            //    foreach (DataRow row in groups.Rows)
            //    {
            //        this.Groups.Add(Convert.ToInt32(row["id"]));
            //    }
            //}
            //this.FavouriteGroup = favouriteGroup;
        }
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.ReadString().ToUpper();
            string Look   = FirewindEnvironment.FilterInjectionChars(Request.ReadString());

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

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

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

            using (IQueryAdapter dbClient = FirewindEnvironment.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();
            }

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

            Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation);
            Session.GetMessageHandler().GetResponse().AppendInt32(-1);
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower());
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto);
            Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints);
            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(Outgoing.UpdateUserInformation);
                RoomUpdate.AppendInt32(User.VirtualId);
                RoomUpdate.AppendString(Session.GetHabbo().Look);
                RoomUpdate.AppendString(Session.GetHabbo().Gender.ToLower());
                RoomUpdate.AppendString(Session.GetHabbo().Motto);
                RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints);
                Room.SendMessage(RoomUpdate);
            }
        }