internal void UpdateBadges() { Session.GetHabbo().GetBadgeComponent().ResetSlots(); using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.runFastQuery("UPDATE user_badges SET badge_slot = 0 WHERE user_id = " + Session.GetHabbo().Id); } if (Request.RemainingLength > 0) { while (Request.RemainingLength > 0) { int Slot = Request.PopWiredInt32(); string Badge = Request.PopFixedString(); if (Badge.Length == 0) { continue; } if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5) { return; } Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot; using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE user_badges SET badge_slot = " + Slot + " WHERE badge_id = @badge AND user_id = " + Session.GetHabbo().Id + ""); dbClient.addParameter("badge", Badge); dbClient.runQuery(); } } ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, HabboHotel.Quests.QuestType.PROFILE_BADGE); } ServerMessage Message = new ServerMessage(228); Message.AppendUInt(Session.GetHabbo().Id); Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount); foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList.Values) { if (Badge.Slot <= 0) { continue; } Message.AppendInt32(Badge.Slot); Message.AppendStringWithBreak(Badge.Code); } if (Session.GetHabbo().InRoom&& ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null) { ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message); } else { Session.SendMessage(Message); } }
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); } }