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, int UserPoints, bool IgnoreInvites, double TimeMuted, double TradingLock, bool AllowGifts, int FriendBarState, bool DisableForcedEffects, bool AllowMimic, int VIPRank, byte guidelevel, byte publicistalevel, byte builder, byte croupier, bool Nux, byte TargetedBuy, string NameColor, string Tag, string TagColor, byte NameChange, string PinClient, int CatRank) { this.Id = Id; this.Username = Username; this.Rank = Rank; this.CatRank = CatRank; this.Motto = Motto; this.Look = NeonEnvironment.GetGame().GetAntiMutant().RunLook(Look); this.Gender = Gender.ToLower(); FootballLook = NeonEnvironment.FilterFigure(Look.ToLower()); FootballGender = Gender.ToLower(); this.Credits = Credits; Duckets = ActivityPoints; this.Diamonds = Diamonds; this.GOTWPoints = GOTWPoints; this.PinClient = PinClient; _NUX = Nux; this.UserPoints = UserPoints; this.HomeRoom = HomeRoom; this.LastOnline = LastOnline; _guidelevel = guidelevel; _publicistalevel = publicistalevel; _builder = builder; _croupier = croupier; _TargetedBuy = TargetedBuy; AccountCreated = CreateDate; ClientVolume = new List <int>(); _nameColor = NameColor; _tag = Tag; _tagcolor = TagColor; _changename = NameChange; foreach (string Str in clientVolume.Split(',')) { if (int.TryParse(Str, out _)) { ClientVolume.Add(int.Parse(Str)); } else { ClientVolume.Add(100); } } this.LastNameChange = LastNameChange; MachineId = machineID; this.ChatPreference = ChatPreference; this.FocusPreference = FocusPreference; IsExpert = IsExpert == true; this.AppearOffline = AppearOffline; AllowTradingRequests = true; //TODO AllowUserFollowing = true; //TODO AllowFriendRequests = HasFriendRequestsDisabled; //TODO AllowMessengerInvites = IgnoreInvites; AllowPetSpeech = PetsMuted; AllowBotSpeech = BotsMuted; AllowPublicRoomStatus = HideInRoom; AllowConsoleMessages = true; this.AllowGifts = AllowGifts; this.AllowMimic = AllowMimic; _lastPhotoPreview = lastPhotoPreview; ReceiveWhispers = true; IgnorePublicWhispers = false; PlayingFastFood = false; FriendbarState = FriendBarStateUtility.GetEnum(FriendBarState); ChristmasDay = ChristmasDay; WantsToRideHorse = 0; TimeAFK = 0; this.DisableForcedEffects = DisableForcedEffects; this.VIPRank = VIPRank; _bet = 0; onDuty = false; requestHelp = false; requestTour = false; userHelping = 0; reportsOfHarassment = false; onService = false; _disconnected = false; _habboSaved = false; ChangingName = false; FloodTime = 0; FriendCount = 0; this.TimeMuted = TimeMuted; _timeCached = DateTime.Now; _sellingroom = false; //this._CurrentTalentLevel = GetCurrentTalentLevel(); TradingLockExpiry = TradingLock; if (TradingLockExpiry > 0 && NeonEnvironment.GetUnixTimestamp() > TradingLockExpiry) { TradingLockExpiry = 0; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '0' WHERE `user_id` = '" + Id + "' LIMIT 1"); } } BannedPhraseCount = 0; SessionStart = NeonEnvironment.GetUnixTimestamp(); MessengerSpamCount = 0; MessengerSpamTime = 0; CreditsUpdateTick = NeonStaticGameSettings.UserCreditsUpdateTimer; TentId = 0; HopperId = 0; IsHopping = false; TeleporterId = 0; IsTeleporting = false; TeleportingRoomID = 0; RoomAuthOk = false; CurrentRoomId = 0; HasSpoken = false; LastAdvertiseReport = 0; AdvertisingReported = false; AdvertisingReportedBlocked = AdvertisingReportBlocked; _multiWhisper = false; WiredInteraction = false; QuestLastCompleted = 0; InventoryAlert = false; IgnoreBobbaFilter = false; WiredTeleporting = false; LastClothingUpdateTime = DateTime.Now; CustomBubbleId = 0; OnHelperDuty = false; FastfoodScore = 0; PetId = 0; TempInt = 0; LastGiftPurchaseTime = DateTime.Now; LastMottoUpdateTime = DateTime.Now; LastForumMessageUpdateTime = DateTime.Now; ClothingUpdateWarnings = 0; GiftPurchasingWarnings = 0; MottoUpdateWarnings = 0; SessionGiftBlocked = false; SessionMottoBlocked = false; _isFirstThrow = true; SessionClothingBlocked = false; FavoriteRooms = new ArrayList(); MutedUsers = new List <int>(); MultiWhispers = new List <RoomUser>(); Achievements = new ConcurrentDictionary <string, UserAchievement>(); Relationships = new Dictionary <int, Relationship>(); RatedRooms = new List <int>(); UsersRooms = new List <RoomData>(); TradeItems = new List <Item>(); //TODO: Nope. InitPermissions(); #region Stats using (IQueryAdapter dbClient = NeonEnvironment.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`, `PurchaseUsersConcurrent`, `vip_gifts` FROM `user_stats` WHERE `id` = @user_id LIMIT 1"); dbClient.AddParameter("user_id", Id); DataRow 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`, `PurchaseUsersConcurrent`, `vip_gifts` 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"]), Convert.ToBoolean(StatRow["PurchaseUsersConcurrent"]), Convert.ToInt32(StatRow["vip_gifts"])); if (Convert.ToString(StatRow["respectsTimestamp"]) != DateTime.Today.ToString("MM/dd")) { _habboStats.RespectsTimestamp = DateTime.Today.ToString("MM/dd"); SubscriptionData SubData = null; int DailyRespects = 3; if (_permissions.HasRight("mod_tool")) { DailyRespects = 20; } else if (NeonEnvironment.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) { Logging.LogException(e.ToString()); } } if (!NeonEnvironment.GetGame().GetGroupManager().TryGetGroup(_habboStats.FavouriteGroupId, out _)) { _habboStats.FavouriteGroupId = 0; } #endregion }
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 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; } }