public void Parse(GameClient session, ClientPacket packet) { int slotId = packet.PopInt(); string look = packet.PopString(); string gender = packet.PopString(); look = PlusEnvironment.GetFigureManager().ProcessFigure(look, gender, session.GetHabbo().GetClothing().GetClothingParts, true); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT null FROM `user_wardrobe` WHERE `user_id` = @id AND `slot_id` = @slot"); dbClient.AddParameter("id", session.GetHabbo().Id); dbClient.AddParameter("slot", slotId); if (dbClient.GetRow() != null) { dbClient.SetQuery("UPDATE `user_wardrobe` SET `look` = @look, `gender` = @gender WHERE `user_id` = @id AND `slot_id` = @slot LIMIT 1"); dbClient.AddParameter("id", session.GetHabbo().Id); dbClient.AddParameter("slot", slotId); dbClient.AddParameter("look", look); dbClient.AddParameter("gender", gender.ToUpper()); dbClient.RunQuery(); } else { dbClient.SetQuery("INSERT INTO `user_wardrobe` (`user_id`,`slot_id`,`look`,`gender`) VALUES (@id,@slot,@look,@gender)"); dbClient.AddParameter("id", session.GetHabbo().Id); dbClient.AddParameter("slot", slotId); dbClient.AddParameter("look", look); dbClient.AddParameter("gender", gender.ToUpper()); dbClient.RunQuery(); } } }
public void Execute(GameClient session, Room room, string[] Params) { var user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id); if (user == null || user.GetClient() == null) { return; } string[] headParts; var figureParts = session.GetHabbo().Look.Split('.'); foreach (var part in figureParts) { if (part.StartsWith("hd")) { headParts = part.Split('-'); if (!headParts[1].Equals("99999")) { headParts[1] = "99999"; } else { return; } session.GetHabbo().Look = session.GetHabbo().Look.Replace(part, "hd-" + headParts[1] + "-" + headParts[2]); break; } } session.GetHabbo().Look = PlusEnvironment.GetFigureManager() .ProcessFigure(session.GetHabbo().Look, session.GetHabbo().Gender, session.GetHabbo().GetClothing().GetClothingParts, true); using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `look` = '" + session.GetHabbo().Look + "' WHERE `id` = '" + session.GetHabbo().Id + "' LIMIT 1"); } session.SendPacket(new UserChangeComposer(user, true)); session.GetHabbo().CurrentRoom.SendPacket(new UserChangeComposer(user, false)); }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null || User.GetClient() == null) { return; } string[] headParts; string[] figureParts = Session.GetHabbo().Look.Split('.'); foreach (string Part in figureParts) { if (Part.StartsWith("hd")) { headParts = Part.Split('-'); if (!headParts[1].Equals("99999")) { headParts[1] = "99999"; } else { return; } Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, "hd-" + headParts[1] + "-" + headParts[2]); break; } } Session.GetHabbo().Look = PlusEnvironment.GetFigureManager().ProcessFigure(Session.GetHabbo().Look, Session.GetHabbo().Gender, Session.GetHabbo().GetClothing().GetClothingParts, true); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `users` SET `look` = '" + Session.GetHabbo().Look + "' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); } Session.SendPacket(new UserChangeComposer(User, true)); Session.GetHabbo().CurrentRoom.SendPacket(new UserChangeComposer(User, false)); return; }
public bool TryAuthenticate(string authTicket) { try { UserData userData = UserDataFactory.GetUserData(authTicket, out byte errorCode); if (errorCode == 1 || errorCode == 2) { Disconnect(); return(false); } #region Ban Checking //Let's have a quick search for a ban before we successfully authenticate.. if (!string.IsNullOrEmpty(MachineId)) { if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(MachineId, out _)) { if (PlusEnvironment.GetGame().GetModerationManager().MachineBanCheck(MachineId)) { Disconnect(); return(false); } } } if (userData.user != null) { if (PlusEnvironment.GetGame().GetModerationManager().IsBanned(userData.user.Username, out _)) { if (PlusEnvironment.GetGame().GetModerationManager().UsernameBanCheck(userData.user.Username)) { Disconnect(); return(false); } } } #endregion if (userData.user == null) //Possible NPE { return(false); } PlusEnvironment.GetGame().GetClientManager().RegisterClient(this, userData.UserId, userData.user.Username); _habbo = userData.user; if (_habbo != null) { userData.user.Init(this, userData); SendPacket(new AuthenticationOKComposer()); SendPacket(new AvatarEffectsComposer(_habbo.Effects().GetAllEffects)); SendPacket(new NavigatorSettingsComposer(_habbo.HomeRoom)); SendPacket(new FavouritesComposer(userData.user.FavoriteRooms)); SendPacket(new FigureSetIdsComposer(_habbo.GetClothing().GetClothingParts)); SendPacket(new UserRightsComposer(_habbo.Rank)); SendPacket(new AvailabilityStatusComposer()); SendPacket(new AchievementScoreComposer(_habbo.GetStats().AchievementPoints)); SendPacket(new BuildersClubMembershipComposer()); SendPacket(new CfhTopicsInitComposer(PlusEnvironment.GetGame().GetModerationManager().UserActionPresets)); SendPacket(new BadgeDefinitionsComposer(PlusEnvironment.GetGame().GetAchievementManager().Achievements)); SendPacket(new SoundSettingsComposer(_habbo.ClientVolume, _habbo.ChatPreference, _habbo.AllowMessengerInvites, _habbo.FocusPreference, FriendBarStateUtility.GetInt(_habbo.FriendbarState))); //SendMessage(new TalentTrackLevelComposer()); if (GetHabbo().GetMessenger() != null) { GetHabbo().GetMessenger().OnStatusChanged(true); } if (!string.IsNullOrEmpty(MachineId)) { if (_habbo.MachineId != MachineId) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `machine_id` = @MachineId WHERE `id` = @id LIMIT 1"); dbClient.AddParameter("MachineId", MachineId); dbClient.AddParameter("id", _habbo.Id); dbClient.RunQuery(); } } _habbo.MachineId = MachineId; } if (PlusEnvironment.GetGame().GetPermissionManager().TryGetGroup(_habbo.Rank, out PermissionGroup group)) { if (!String.IsNullOrEmpty(group.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(group.Badge)) { _habbo.GetBadgeComponent().GiveBadge(group.Badge, true, this); } } } if (PlusEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(_habbo.VIPRank, out SubscriptionData subData)) { if (!String.IsNullOrEmpty(subData.Badge)) { if (!_habbo.GetBadgeComponent().HasBadge(subData.Badge)) { _habbo.GetBadgeComponent().GiveBadge(subData.Badge, true, this); } } } if (!PlusEnvironment.GetGame().GetCacheManager().ContainsUser(_habbo.Id)) { PlusEnvironment.GetGame().GetCacheManager().GenerateUser(_habbo.Id); } _habbo.Look = PlusEnvironment.GetFigureManager().ProcessFigure(_habbo.Look, _habbo.Gender, _habbo.GetClothing().GetClothingParts, true); _habbo.InitProcess(); if (userData.user.GetPermissions().HasRight("mod_tickets")) { SendPacket(new ModeratorInitComposer( PlusEnvironment.GetGame().GetModerationManager().UserMessagePresets, PlusEnvironment.GetGame().GetModerationManager().RoomMessagePresets, PlusEnvironment.GetGame().GetModerationManager().GetTickets)); } if (PlusEnvironment.GetSettingsManager().TryGetValue("user.login.message.enabled") == "1") { SendPacket(new MotdNotificationComposer(PlusEnvironment.GetLanguageManager().TryGetValue("user.login.message"))); } PlusEnvironment.GetGame().GetRewardManager().CheckRewards(this); return(true); } } catch (Exception e) { ExceptionLogger.LogException(e); } return(false); }
public void Parse(GameClient session, ClientPacket packet) { if (session == null || session.Habbo == null) { return; } string gender = packet.PopString().ToUpper(); string look = PlusEnvironment.GetFigureManager().ProcessFigure(packet.PopString(), gender, session.Habbo.GetClothing().GetClothingParts, true); if (look == session.Habbo.Look) { return; } if ((DateTime.Now - session.Habbo.LastClothingUpdateTime).TotalSeconds <= 2.0) { session.Habbo.ClothingUpdateWarnings += 1; if (session.Habbo.ClothingUpdateWarnings >= 25) { session.Habbo.SessionClothingBlocked = true; } return; } if (session.Habbo.SessionClothingBlocked) { return; } session.Habbo.LastClothingUpdateTime = DateTime.Now; string[] allowedGenders = { "M", "F" }; if (!allowedGenders.Contains(gender)) { session.SendPacket(new BroadcastMessageAlertComposer("Sorry, you chose an invalid gender.")); return; } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.ProfileChangeLook); session.Habbo.Look = PlusEnvironment.FilterFigure(look); session.Habbo.Gender = gender.ToLower(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `look` = @look, `gender` = @gender WHERE `id` = '" + session.Habbo.Id + "' LIMIT 1"); dbClient.AddParameter("look", look); dbClient.AddParameter("gender", gender); dbClient.RunQuery(); } _achievementManager.ProgressAchievement(session, "ACH_AvatarLooks", 1); session.SendPacket(new AvatarAspectUpdateComposer(look, gender)); if (session.Habbo.Look.Contains("ha-1006")) { PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.WearHat); } if (session.Habbo.InRoom) { RoomUser roomUser = session.Habbo.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(session.Habbo.Id); if (roomUser != null) { session.SendPacket(new UserChangeComposer(roomUser, true)); session.Habbo.CurrentRoom.SendPacket(new UserChangeComposer(roomUser, false)); } } }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("You must inculde a thing to update, e.g. :update catalog"); return; } string UpdateVariable = Params[1]; switch (UpdateVariable.ToLower()) { case "cata": case "catalog": case "catalogue": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_catalog")) { Session.SendWhisper("Oops, you do not have the 'command_update_catalog' permission."); break; } PlusEnvironment.GetGame().GetCatalog().Init(PlusEnvironment.GetGame().GetItemManager()); PlusEnvironment.GetGame().GetClientManager().SendPacket(new CatalogUpdatedComposer()); Session.SendWhisper("Catalogue successfully updated."); break; } case "items": case "furni": case "furniture": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_furni")) { Session.SendWhisper("Oops, you do not have the 'command_update_furni' permission."); break; } PlusEnvironment.GetGame().GetItemManager().Init(); Session.SendWhisper("Items successfully updated."); break; } case "models": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_models")) { Session.SendWhisper("Oops, you do not have the 'command_update_models' permission."); break; } PlusEnvironment.GetGame().GetRoomManager().LoadModels(); Session.SendWhisper("Room models successfully updated."); break; } case "promotions": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_promotions")) { Session.SendWhisper("Oops, you do not have the 'command_update_promotions' permission."); break; } PlusEnvironment.GetGame().GetLandingManager().Init(); Session.SendWhisper("Landing view promotions successfully updated."); break; } case "youtube": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_youtube")) { Session.SendWhisper("Oops, you do not have the 'command_update_youtube' permission."); break; } PlusEnvironment.GetGame().GetTelevisionManager().Init(); Session.SendWhisper("Youtube televisions playlist successfully updated."); break; } case "filter": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_filter")) { Session.SendWhisper("Oops, you do not have the 'command_update_filter' permission."); break; } PlusEnvironment.GetGame().GetChatManager().GetFilter().Init(); Session.SendWhisper("Filter definitions successfully updated."); break; } case "navigator": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_navigator")) { Session.SendWhisper("Oops, you do not have the 'command_update_navigator' permission."); break; } PlusEnvironment.GetGame().GetNavigator().Init(); Session.SendWhisper("Navigator items successfully updated."); break; } case "ranks": case "rights": case "permissions": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rights")) { Session.SendWhisper("Oops, you do not have the 'command_update_rights' permission."); break; } PlusEnvironment.GetGame().GetPermissionManager().Init(); foreach (GameClient Client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList()) { if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().GetPermissions() == null) { continue; } Client.GetHabbo().GetPermissions().Init(Client.GetHabbo()); } Session.SendWhisper("Rank definitions successfully updated."); break; } case "config": case "settings": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_configuration")) { Session.SendWhisper("Oops, you do not have the 'command_update_configuration' permission."); break; } PlusEnvironment.GetSettingsManager().Init(); Session.SendWhisper("Server configuration successfully updated."); break; } case "bans": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bans")) { Session.SendWhisper("Oops, you do not have the 'command_update_bans' permission."); break; } PlusEnvironment.GetGame().GetModerationManager().ReCacheBans(); Session.SendWhisper("Ban cache re-loaded."); break; } case "quests": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_quests")) { Session.SendWhisper("Oops, you do not have the 'command_update_quests' permission."); break; } PlusEnvironment.GetGame().GetQuestManager().Init(); Session.SendWhisper("Quest definitions successfully updated."); break; } case "achievements": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_achievements")) { Session.SendWhisper("Oops, you do not have the 'command_update_achievements' permission."); break; } PlusEnvironment.GetGame().GetAchievementManager().Init(); Session.SendWhisper("Achievement definitions bans successfully updated."); break; } case "moderation": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_moderation")) { Session.SendWhisper("Oops, you do not have the 'command_update_moderation' permission."); break; } PlusEnvironment.GetGame().GetModerationManager().Init(); PlusEnvironment.GetGame().GetClientManager().ModAlert("Moderation presets have been updated. Please reload the client to view the new presets."); Session.SendWhisper("Moderation configuration successfully updated."); break; } case "vouchers": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_vouchers")) { Session.SendWhisper("Oops, you do not have the 'command_update_vouchers' permission."); break; } PlusEnvironment.GetGame().GetCatalog().GetVoucherManager().Init(); Session.SendWhisper("Catalogue vouche cache successfully updated."); break; } case "gc": case "games": case "gamecenter": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_game_center")) { Session.SendWhisper("Oops, you do not have the 'command_update_game_center' permission."); break; } PlusEnvironment.GetGame().GetGameDataManager().Init(); Session.SendWhisper("Game Center cache successfully updated."); break; } case "pet_locale": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_pet_locale")) { Session.SendWhisper("Oops, you do not have the 'command_update_pet_locale' permission."); break; } PlusEnvironment.GetGame().GetChatManager().GetPetLocale().Init(); Session.SendWhisper("Pet locale cache successfully updated."); break; } case "locale": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_locale")) { Session.SendWhisper("Oops, you do not have the 'command_update_locale' permission."); break; } PlusEnvironment.GetLanguageManager().Init(); Session.SendWhisper("Locale cache successfully updated."); break; } case "mutant": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_anti_mutant")) { Session.SendWhisper("Oops, you do not have the 'command_update_anti_mutant' permission."); break; } PlusEnvironment.GetFigureManager().Init(); Session.SendWhisper("FigureData manager successfully reloaded."); break; } case "bots": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_bots")) { Session.SendWhisper("Oops, you do not have the 'command_update_bots' permission."); break; } PlusEnvironment.GetGame().GetBotManager().Init(); Session.SendWhisper("Bot managaer successfully reloaded."); break; } case "rewards": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_rewards")) { Session.SendWhisper("Oops, you do not have the 'command_update_rewards' permission."); break; } PlusEnvironment.GetGame().GetRewardManager().Init(); Session.SendWhisper("Rewards managaer successfully reloaded."); break; } case "chat_styles": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_chat_styles")) { Session.SendWhisper("Oops, you do not have the 'command_update_chat_styles' permission."); break; } PlusEnvironment.GetGame().GetChatManager().GetChatStyles().Init(); Session.SendWhisper("Chat Styles successfully reloaded."); break; } case "badge_definitions": { if (!Session.GetHabbo().GetPermissions().HasCommand("command_update_badge_definitions")) { Session.SendWhisper("Oops, you do not have the 'command_update_badge_definitions' permission."); break; } PlusEnvironment.GetGame().GetBadgeManager().Init(); Session.SendWhisper("Badge definitions successfully reloaded."); break; } default: Session.SendWhisper("'" + UpdateVariable + "' is not a valid thing to reload."); break; } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } string Gender = Packet.PopString().ToUpper(); string Look = PlusEnvironment.GetFigureManager().ProcessFigure(Packet.PopString(), Gender, Session.GetHabbo().GetClothing().GetClothingParts, true); if (Look == Session.GetHabbo().Look) { return; } if ((DateTime.Now - Session.GetHabbo().LastClothingUpdateTime).TotalSeconds <= 2.0) { Session.GetHabbo().ClothingUpdateWarnings += 1; if (Session.GetHabbo().ClothingUpdateWarnings >= 25) { Session.GetHabbo().SessionClothingBlocked = true; } return; } if (Session.GetHabbo().SessionClothingBlocked) { return; } Session.GetHabbo().LastClothingUpdateTime = DateTime.Now; string[] AllowedGenders = { "M", "F" }; if (!AllowedGenders.Contains(Gender)) { Session.SendPacket(new BroadcastMessageAlertComposer("Sorry, you chose an invalid gender.")); return; } PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK); Session.GetHabbo().Look = PlusEnvironment.FilterFigure(Look); Session.GetHabbo().Gender = Gender.ToLower(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("UPDATE `users` SET `look` = @look, `gender` = @gender WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1"); dbClient.AddParameter("look", Look); dbClient.AddParameter("gender", Gender); dbClient.RunQuery(); } PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_AvatarLooks", 1); Session.SendPacket(new AvatarAspectUpdateComposer(Look, Gender)); if (Session.GetHabbo().Look.Contains("ha-1006")) { PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.WEAR_HAT); } if (Session.GetHabbo().InRoom) { RoomUser RoomUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (RoomUser != null) { Session.SendPacket(new UserChangeComposer(RoomUser, true)); Session.GetHabbo().CurrentRoom.SendPacket(new UserChangeComposer(RoomUser, false)); } } }