public Habbo(int Id, string Username, int Rank, string Motto, string Look, string Gender, int Credits, int ActivityPoints, int HomeRoom, bool HasFriendRequestsDisabled, int LastOnline, bool AppearOffline, bool HideInRoom, double CreateDate, int Diamonds, string machineID, string clientVolume, bool ChatPreference, bool FocusPreference, bool PetsMuted, bool BotsMuted, bool AdvertisingReportBlocked, double LastNameChange, int GOTWPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank) { _id = Id; _username = Username; _rank = Rank; _motto = Motto; _look = Look; _gender = Gender.ToLower(); _footballLook = PlusEnvironment.FilterFigure(Look.ToLower()); _footballGender = Gender.ToLower(); _credits = Credits; _duckets = ActivityPoints; _diamonds = Diamonds; _gotwPoints = GOTWPoints; _homeRoom = HomeRoom; _lastOnline = LastOnline; _accountCreated = CreateDate; _clientVolume = new List <int>(); foreach (string Str in clientVolume.Split(',')) { int Val = 0; if (int.TryParse(Str, out Val)) { _clientVolume.Add(int.Parse(Str)); } else { _clientVolume.Add(100); } } _lastNameChange = LastNameChange; _machineId = machineID; _chatPreference = ChatPreference; _focusPreference = FocusPreference; _isExpert = IsExpert == true; _appearOffline = AppearOffline; _allowTradingRequests = true; //TODO _allowUserFollowing = true; //TODO _allowFriendRequests = HasFriendRequestsDisabled; //TODO _allowMessengerInvites = IgnoreInvites; _allowPetSpeech = PetsMuted; _allowBotSpeech = BotsMuted; _allowPublicRoomStatus = HideInRoom; _allowConsoleMessages = true; _allowGifts = AllowGifts; _allowMimic = AllowMimic; _receiveWhispers = true; _ignorePublicWhispers = false; _playingFastFood = false; _friendbarState = FriendBarStateUtility.GetEnum(FriendBarState); _christmasDay = ChristmasDay; _wantsToRideHorse = 0; _timeAFK = 0; _disableForcedEffects = DisableForcedEffects; _vipRank = VIPRank; _disconnected = false; _habboSaved = false; _changingName = false; _floodTime = 0; _friendCount = 0; _timeMuted = TimeMuted; _timeCached = DateTime.Now; _tradingLockExpiry = TradingLock; if (_tradingLockExpiry > 0 && PlusEnvironment.GetUnixTimestamp() > TradingLockExpiry) { _tradingLockExpiry = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Id + "' LIMIT 1"); } } _bannedPhraseCount = 0; _sessionStart = PlusEnvironment.GetUnixTimestamp(); _messengerSpamCount = 0; _messengerSpamTime = 0; _creditsTickUpdate = Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("user.currency_scheduler.tick")); _tentId = 0; _hopperId = 0; _isHopping = false; _teleportId = 0; _isTeleporting = false; _teleportingRoomId = 0; _roomAuthOk = false; _currentRoomId = 0; _hasSpoken = false; _lastAdvertiseReport = 0; _advertisingReported = false; _advertisingReportBlocked = AdvertisingReportBlocked; _wiredInteraction = false; _questLastCompleted = 0; _inventoryAlert = false; _ignoreBobbaFilter = false; _wiredTeleporting = false; _customBubbleId = 0; _onHelperDuty = false; _fastfoodScore = 0; _petId = 0; _tempInt = 0; _lastGiftPurchaseTime = DateTime.Now; _lastMottoUpdateTime = DateTime.Now; _lastClothingUpdateTime = DateTime.Now; _lastForumMessageUpdateTime = DateTime.Now; _giftPurchasingWarnings = 0; _mottoUpdateWarnings = 0; _clothingUpdateWarnings = 0; _sessionGiftBlocked = false; _sessionMottoBlocked = false; _sessionClothingBlocked = false; FavoriteRooms = new ArrayList(); Achievements = new ConcurrentDictionary <string, UserAchievement>(); Relationships = new Dictionary <int, Relationship>(); RatedRooms = new List <int>(); //TODO: Nope. InitPermissions(); #region Stats DataRow StatRow = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id`,`roomvisits`,`onlinetime`,`respect`,`respectgiven`,`giftsgiven`,`giftsreceived`,`dailyrespectpoints`,`dailypetrespectpoints`,`achievementscore`,`quest_id`,`quest_progress`,`groupid`,`tickets_answered`,`respectstimestamp`,`forum_posts` FROM `user_stats` WHERE `id` = @user_id LIMIT 1"); dbClient.AddParameter("user_id", Id); StatRow = dbClient.GetRow(); if (StatRow == null)//No row, add it yo { dbClient.RunQuery("INSERT INTO `user_stats` (`id`) VALUES ('" + Id + "')"); dbClient.SetQuery("SELECT `id`,`roomvisits`,`onlinetime`,`respect`,`respectgiven`,`giftsgiven`,`giftsreceived`,`dailyrespectpoints`,`dailypetrespectpoints`,`achievementscore`,`quest_id`,`quest_progress`,`groupid`,`tickets_answered`,`respectstimestamp`,`forum_posts` FROM `user_stats` WHERE `id` = @user_id LIMIT 1"); dbClient.AddParameter("user_id", Id); StatRow = dbClient.GetRow(); } try { _habboStats = new HabboStats(Convert.ToInt32(StatRow["roomvisits"]), Convert.ToDouble(StatRow["onlineTime"]), Convert.ToInt32(StatRow["respect"]), Convert.ToInt32(StatRow["respectGiven"]), Convert.ToInt32(StatRow["giftsGiven"]), Convert.ToInt32(StatRow["giftsReceived"]), Convert.ToInt32(StatRow["dailyRespectPoints"]), Convert.ToInt32(StatRow["dailyPetRespectPoints"]), Convert.ToInt32(StatRow["AchievementScore"]), Convert.ToInt32(StatRow["quest_id"]), Convert.ToInt32(StatRow["quest_progress"]), Convert.ToInt32(StatRow["groupid"]), Convert.ToString(StatRow["respectsTimestamp"]), Convert.ToInt32(StatRow["forum_posts"])); if (Convert.ToString(StatRow["respectsTimestamp"]) != DateTime.Today.ToString("MM/dd")) { _habboStats.RespectsTimestamp = DateTime.Today.ToString("MM/dd"); SubscriptionData SubData = null; int DailyRespects = 10; if (_permissions.HasRight("mod_tool")) { DailyRespects = 20; } else if (PlusEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(VIPRank, out SubData)) { DailyRespects = SubData.Respects; } _habboStats.DailyRespectPoints = DailyRespects; _habboStats.DailyPetRespectPoints = DailyRespects; dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" + DailyRespects + "', `dailyPetRespectPoints` = '" + DailyRespects + "', `respectsTimestamp` = '" + DateTime.Today.ToString("MM/dd") + "' WHERE `id` = '" + Id + "' LIMIT 1"); } } catch (Exception e) { ExceptionLogger.LogException(e); } } Group G = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(_habboStats.FavouriteGroupId, out G)) { _habboStats.FavouriteGroupId = 0; } #endregion }
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 Habbo(int id, string username, int rank, string motto, string look, string gender, int credits, int activityPoints, int homeRoom, bool hasFriendRequestsDisabled, int lastOnline, bool appearOffline, bool hideInRoom, double createDate, int diamonds, string machineId, string clientVolume, bool chatPreference, bool focusPreference, bool petsMuted, bool botsMuted, bool advertisingReportBlocked, double lastNameChange, int gotwPoints, bool ignoreInvites, double timeMuted, double tradingLock, bool allowGifts, int friendBarState, bool disableForcedEffects, bool allowMimic, int vipRank) { Id = id; Username = username; Rank = rank; Motto = motto; Look = look; Gender = gender.ToLower(); FootballLook = PlusEnvironment.FilterFigure(look.ToLower()); FootballGender = gender.ToLower(); Credits = credits; Duckets = activityPoints; Diamonds = diamonds; GotwPoints = gotwPoints; HomeRoom = homeRoom; LastOnline = lastOnline; AccountCreated = createDate; ClientVolume = new List <int>(); foreach (var str in clientVolume.Split(',')) { ClientVolume.Add(int.TryParse(str, out _) ? int.Parse(str) : 100); } LastNameChange = lastNameChange; MachineId = machineId; ChatPreference = chatPreference; FocusPreference = focusPreference; IsExpert = IsExpert; AppearOffline = appearOffline; AllowTradingRequests = true; //TODO AllowUserFollowing = true; //TODO AllowFriendRequests = hasFriendRequestsDisabled; //TODO AllowMessengerInvites = ignoreInvites; AllowPetSpeech = petsMuted; AllowBotSpeech = botsMuted; AllowPublicRoomStatus = hideInRoom; AllowConsoleMessages = true; AllowGifts = allowGifts; AllowMimic = allowMimic; ReceiveWhispers = true; IgnorePublicWhispers = false; PlayingFastFood = false; FriendbarState = FriendBarStateUtility.GetEnum(friendBarState); ChristmasDay = ChristmasDay; WantsToRideHorse = 0; TimeAfk = 0; DisableForcedEffects = disableForcedEffects; VipRank = vipRank; _disconnected = false; _habboSaved = false; ChangingName = false; FloodTime = 0; FriendCount = 0; TimeMuted = timeMuted; _timeCached = DateTime.Now; TradingLockExpiry = tradingLock; if (TradingLockExpiry > 0 && PlusEnvironment.GetUnixTimestamp() > TradingLockExpiry) { TradingLockExpiry = 0; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + id + "' LIMIT 1"); } } BannedPhraseCount = 0; SessionStart = PlusEnvironment.GetUnixTimestamp(); MessengerSpamCount = 0; MessengerSpamTime = 0; CreditsUpdateTick = Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("user.currency_scheduler.tick")); TentId = 0; HopperId = 0; IsHopping = false; TeleporterId = 0; IsTeleporting = false; TeleportingRoomId = 0; RoomAuthOk = false; CurrentRoomId = 0; HasSpoken = false; LastAdvertiseReport = 0; AdvertisingReported = false; AdvertisingReportedBlocked = advertisingReportBlocked; WiredInteraction = false; QuestLastCompleted = 0; InventoryAlert = false; IgnoreBobbaFilter = false; WiredTeleporting = false; CustomBubbleId = 0; OnHelperDuty = false; FastfoodScore = 0; PetId = 0; TempInt = 0; LastGiftPurchaseTime = DateTime.Now; LastMottoUpdateTime = DateTime.Now; LastClothingUpdateTime = DateTime.Now; LastForumMessageUpdateTime = DateTime.Now; GiftPurchasingWarnings = 0; MottoUpdateWarnings = 0; ClothingUpdateWarnings = 0; SessionGiftBlocked = false; SessionMottoBlocked = false; SessionClothingBlocked = false; FavoriteRooms = new ArrayList(); Achievements = new ConcurrentDictionary <string, UserAchievement>(); Relationships = new Dictionary <int, Relationship>(); RatedRooms = new List <int>(); UsersRooms = new List <RoomData>(); //TODO: Nope. InitPermissions(); DataRow statRow = null; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery( "SELECT `id`,`roomvisits`,`onlinetime`,`respect`,`respectgiven`,`giftsgiven`,`giftsreceived`,`dailyrespectpoints`,`dailypetrespectpoints`,`achievementscore`,`quest_id`,`quest_progress`,`groupid`,`tickets_answered`,`respectstimestamp`,`forum_posts` FROM `user_stats` WHERE `id` = @user_id LIMIT 1"); dbClient.AddParameter("user_id", id); statRow = dbClient.GetRow(); if (statRow == null) //No row, add it yo { dbClient.RunQuery("INSERT INTO `user_stats` (`id`) VALUES ('" + id + "')"); dbClient.SetQuery( "SELECT `id`,`roomvisits`,`onlinetime`,`respect`,`respectgiven`,`giftsgiven`,`giftsreceived`,`dailyrespectpoints`,`dailypetrespectpoints`,`achievementscore`,`quest_id`,`quest_progress`,`groupid`,`tickets_answered`,`respectstimestamp`,`forum_posts` FROM `user_stats` WHERE `id` = @user_id LIMIT 1"); dbClient.AddParameter("user_id", id); statRow = dbClient.GetRow(); } try { _habboStats = new HabboStats(Convert.ToInt32(statRow["roomvisits"]), Convert.ToDouble(statRow["onlineTime"]), Convert.ToInt32(statRow["respect"]), Convert.ToInt32(statRow["respectGiven"]), Convert.ToInt32(statRow["giftsGiven"]), Convert.ToInt32(statRow["giftsReceived"]), Convert.ToInt32(statRow["dailyRespectPoints"]), Convert.ToInt32(statRow["dailyPetRespectPoints"]), Convert.ToInt32(statRow["AchievementScore"]), Convert.ToInt32(statRow["quest_id"]), Convert.ToInt32(statRow["quest_progress"]), Convert.ToInt32(statRow["groupid"]), Convert.ToString(statRow["respectsTimestamp"]), Convert.ToInt32(statRow["forum_posts"])); if (Convert.ToString(statRow["respectsTimestamp"]) != DateTime.Today.ToString("MM/dd")) { _habboStats.RespectsTimestamp = DateTime.Today.ToString("MM/dd"); SubscriptionData subData = null; var dailyRespects = 10; if (_permissions.HasRight("mod_tool")) { dailyRespects = 20; } else if (PlusEnvironment.GetGame().GetSubscriptionManager().TryGetSubscriptionData(vipRank, out subData)) { dailyRespects = subData.Respects; } _habboStats.DailyRespectPoints = dailyRespects; _habboStats.DailyPetRespectPoints = dailyRespects; dbClient.RunQuery("UPDATE `user_stats` SET `dailyRespectPoints` = '" + dailyRespects + "', `dailyPetRespectPoints` = '" + dailyRespects + "', `respectsTimestamp` = '" + DateTime.Today.ToString("MM/dd") + "' WHERE `id` = '" + id + "' LIMIT 1"); } } catch (Exception e) { ExceptionLogger.LogException(e); } } Group g = null; if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(_habboStats.FavouriteGroupId, out g)) { _habboStats.FavouriteGroupId = 0; } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null) { return; } string Gender = Packet.PopString().ToUpper(); string Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Packet.PopString()); int ClothingRoom = Convert.ToInt32(RoleplayData.GetData("clothing", "roomid")); if (Session.GetRoomUser() == null || !Session.GetHabbo().InRoom) { return; } if (Session.GetRoomUser().RoomId != ClothingRoom) { Session.SendNotification("Você deve estar dentro da Loja de roupas para mudar suas roupas! [Quarto ID: " + ClothingRoom + "]"); return; } if (Session.GetRoleplay().IsWorking) { Session.SendNotification("Você não pode mudar sua roupa enquanto está trabalhando!"); return; } if (Look == Session.GetHabbo().Look) { Session.SendWhisper("Você já está vestido assim!", 1); 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; } if (Session.GetRoleplay().PurchasingClothing) { Session.GetRoleplay().PurchasingClothing = false; return; } Session.GetHabbo().LastClothingUpdateTime = DateTime.Now; string[] AllowedGenders = { "M", "F" }; if (!AllowedGenders.Contains(Gender)) { Session.SendMessage(new BroadcastMessageAlertComposer("Desculpe, você escolheu um gênero inválido.")); 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(); } Session.SendMessage(new AvatarAspectUpdateMessageComposer(Look, Gender)); //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_AvatarLooks", 1); //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.SendMessage(new UserChangeComposer(RoomUser, true)); Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(RoomUser, false)); } } if (Session.GetHabbo().GetMessenger() != null) { Session.GetHabbo().GetMessenger().OnStatusChanged(true); } Session.GetRoleplay().OriginalOutfit = Session.GetHabbo().Look; }
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)); } } }