public void Init(GameClient client, UserData.UserData data) { Achievements = data.achievements; FavoriteRooms = new ArrayList(); foreach (int id in data.favouritedRooms) { FavoriteRooms.Add(id); } _client = client; BadgeComponent = new BadgeComponent(this, data); InventoryComponent = new InventoryComponent(Id, client); quests = data.quests; Messenger = new HabboMessenger(Id); Messenger.Init(data.friends, data.requests); _friendCount = Convert.ToInt32(data.friends.Count); _disconnected = false; Relationships = data.Relations; InitSearches(); InitFX(); InitClothing(); InitIgnores(); }
public void InitMessenger() { if (this.GetMessenger() == null) { this.HabboMessenger = new HabboMessenger(this.ID, this); this.HabboMessenger.LoadCategorys(); this.HabboMessenger.LoadFriends(); this.HabboMessenger.LoadFriendRequestsPending(); this.HabboMessenger.LoadFriendRequestsSend(); this.HabboMessenger.UpdateAllFriends(true); } }
internal void InitInformation(UserData data) { this.SubscriptionManager = new SubscriptionManager(this.Id, data); this.BadgeComponent = new BadgeComponent(this.Id, data); this.quests = data.quests; this.Messenger = new HabboMessenger(this.Id); this.Messenger.Init(data.friends, data.requests); this.SpectatorMode = false; this.Disconnected = false; this.UsersRooms = data.rooms; this.Relationships = data.Relations; this.AnsweredPolls = data.suggestedPolls; }
/// <summary> /// Initializes the information. /// </summary> /// <param name="data">The data.</param> internal void InitInformation(UserData data) { _subscriptionManager = new SubscriptionManager(Id, data); _badgeComponent = new UserBadgeManager(Id, data); Quests = data.Quests; _messenger = new HabboMessenger(Id); _messenger.Init(data.Friends, data.Requests); SpectatorMode = false; Disconnected = false; UsersRooms = data.Rooms; Relationships = data.Relations; AnsweredPolls = data.SuggestedPolls; }
internal void InitInformation(UserData data) { this.SubscriptionManager = new SubscriptionManager(Id, data); this.BadgeComponent = new BadgeComponent(Id, data); this.quests = data.quests; this.chatMessageManager = new ChatMessageManager(); this.Messenger = new HabboMessenger(Id); this.Messenger.Init(data.friends, data.requests); this.SpectatorMode = false; this.Disconnected = false; this.UsersRooms = data.rooms; }
public void Init(GameClient client, UserData.UserData data) { this.mClient = client; this.BadgeComponent = new BadgeComponent(this.Id, data.badges); this.InventoryComponent = new InventoryComponent(this.Id, client); this.InventoryComponent.SetActiveState(client); this.quests = data.quests; this.chatMessageManager = new ChatMessageManager(); this.chatMessageManager.LoadUserChatlogs(this.Id); this.Messenger = new HabboMessenger(this.Id); this.Messenger.AppearOffline = this.HideOnline; this.Messenger.Init(data.friends, data.requests, data.Relationships); this.MyGroups = data.MyGroups; this.UpdateRooms(); }
public void InitMessenger() { if (GetMessenger() == null) { this.Messenger = new HabboMessenger(Id); this.Messenger.LoadBuddies(HabboData); this.Messenger.method_1(HabboData); GameClient client = GetClient(); if (client != null) { client.SendMessage(this.Messenger.SerializeFriends()); client.SendMessage(this.Messenger.SerializeRequests()); this.Messenger.OnStatusChanged(true); } } }
internal void Init(GameClient client, UserData data) { this.mClient = client; this.SubscriptionManager = new SubscriptionManager(Id, data); this.BadgeComponent = new BadgeComponent(Id, data); this.InventoryComponent = InventoryGlobal.GetInventory(Id, client, data); this.InventoryComponent.SetActiveState(client); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, client, data); this.quests = data.quests; this.chatMessageManager = new ChatMessageManager(); this.Messenger = new HabboMessenger(Id); this.Messenger.Init(data.friends, data.requests); this.SpectatorMode = false; this.Disconnected = false; this.UsersRooms = data.rooms; }
internal void Init(GameClient client, UserData data) { this.mClient = client; this.SubscriptionManager = new SubscriptionManager(this.Id, data); this.BadgeComponent = new BadgeComponent(this.Id, data); this.InventoryComponent = InventoryGlobal.GetInventory(this.Id, client, data); this.InventoryComponent.SetActiveState(client); this.CommandHandler = new ChatCommandHandler(client); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(this.Id, client, data); this.quests = data.quests; this.Messenger = new HabboMessenger(this.Id); this.Messenger.Init(data.friends, data.requests); this.FriendCount = Convert.ToUInt32(data.friends.Count); this.SpectatorMode = false; this.Disconnected = false; this.UsersRooms = data.rooms; this.MinimailUnreadMessages = data.miniMailCount; this.Relationships = data.Relations; this.AnsweredPolls = data.suggestedPolls; }
/// <summary> /// Initializes the specified client. /// </summary> /// <param name="client">The client.</param> /// <param name="data">The data.</param> internal void Init(GameClient client, UserData data) { _mClient = client; _subscriptionManager = new SubscriptionManager(Id, data); _badgeComponent = new UserBadgeManager(Id, data); _inventoryComponent = new InventoryComponent(Id, client, data); _inventoryComponent.SetActiveState(client); _avatarEffectComponent = new AvatarEffectComponent(Id, client, data); Quests = data.Quests; _messenger = new HabboMessenger(Id); _messenger.Init(data.Friends, data.Requests); FriendCount = Convert.ToUInt32(data.Friends.Count); SpectatorMode = false; Disconnected = false; UsersRooms = data.Rooms; MinimailUnreadMessages = data.MiniMailCount; Relationships = data.Relations; AnsweredPolls = data.SuggestedPolls; ClothesManagerManager = new UserClothesManager(Id); Preferences = new UserPreferences(Id); YoutubeManager = new YoutubeManager(Id); }
internal void Init(UserData data) { this.PresentBuyStopwatch = new Stopwatch(); this.PresentBuyStopwatch.Start(); this.FavoriteRooms = data.favouritedRooms; this.InventoryComponent = new InventoryComponent(Id, mClient); this.InventoryComponent.SetActiveState(mClient); this.AvatarEffectsInventoryComponent = new AvatarEffectsInventoryComponent(Id, mClient, data); this.chatMessageManager = new ChatMessageManager(); this.premiumManager = PremiumManager.LoadPremiumData(Id); this.userclothingManager = new UserClothing(Id); if (HasFuse("fuse_chat_staff")) { data.friends.Add(EmuSettings.CHAT_USER_ID, StaffChat.MessengerStaff); } this.Messenger = new HabboMessenger(Id, data.friends, data.requests); this.UpdateRooms(); this.LoadMuteUsers(); }
/// <summary> /// Called when [disconnect]. /// </summary> /// <param name="reason">The reason.</param> internal void OnDisconnect(string reason) { if (Disconnected) { return; } Disconnected = true; if (_inventoryComponent != null) { lock (_inventoryComponent) { _inventoryComponent?.RunDbUpdate(); _inventoryComponent?.SetIdleState(); } } string navilogs = string.Empty; if (NavigatorLogs.Any()) { navilogs = NavigatorLogs.Values.Aggregate(navilogs, (current, navi) => current + $"{navi.Id},{navi.Value1},{navi.Value2};"); navilogs = navilogs.Remove(navilogs.Length - 1); } Yupi.GetGame().GetClientManager().UnregisterClient(Id, UserName); YupiWriterManager.WriteLine(UserName + " left game. Reason: " + reason, "Yupi.Users", ConsoleColor.DarkYellow); TimeSpan getOnlineSeconds = DateTime.Now - TimeLoggedOn; int secondsToGive = getOnlineSeconds.Seconds; if (!_habboinfoSaved) { _habboinfoSaved = true; using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor()) { queryReactor.SetQuery("UPDATE users SET activity_points = " + Duckets + ", credits = " + Credits + ", diamonds = " + Diamonds + ", online='0', last_online = '" + Yupi.GetUnixTimeStamp() + "', builders_items_used = " + BuildersItemsUsed + ", navigator_logs = @navilogs WHERE id = " + Id + " LIMIT 1;UPDATE users_stats SET achievement_score=" + AchievementPoints + " WHERE id=" + Id + " LIMIT 1;"); queryReactor.AddParameter("navilogs", navilogs); queryReactor.RunQuery(); queryReactor.RunFastQuery("UPDATE users_stats SET online_seconds = online_seconds + " + secondsToGive + " WHERE id = " + Id); if (Rank >= 4) { queryReactor.RunFastQuery( $"UPDATE moderation_tickets SET status='open', moderator_id=0 WHERE status='picked' AND moderator_id={Id}"); } queryReactor.RunFastQuery("UPDATE users SET block_newfriends = '" + Convert.ToInt32(HasFriendRequestsDisabled) + "', hide_online = '" + Convert.ToInt32(AppearOffline) + "', hide_inroom = '" + Convert.ToInt32(HideInRoom) + "' WHERE id = " + Id); } } if (InRoom) { CurrentRoom?.GetRoomUserManager().RemoveUserFromRoom(_mClient, false, false); } if (_messenger != null) { _messenger.AppearOffline = true; _messenger.Destroy(); _messenger = null; } _avatarEffectComponent?.Dispose(); _mClient = null; }
public void OnDisconnect() { if (!this.Disconnected) { this.Disconnected = true; PhoenixEnvironment.GetGame().GetClientManager().NullClientShit(this.Id, this.Username); if (!this.HabboInfoSaved) { this.HabboInfoSaved = true; using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET last_online = UNIX_TIMESTAMP(), users.online = '0', activity_points = '", this.ActivityPoints, "', activity_points_lastupdate = '", this.LastActivityPointsUpdate, "', credits = '", this.Credits, "' WHERE Id = '", this.Id, "' LIMIT 1;" })); int num = (int)PhoenixEnvironment.GetUnixTimestamp() - this.Stat_LoginTime; adapter.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET RoomVisits = '", this.RoomVisits, "', OnlineTime = OnlineTime + ", num, ", Respect = '", this.Respect, "', RespectGiven = '", this.RespectGiven, "', GiftsGiven = '", this.GiftsGiven, "', GiftsReceived = '", this.GiftsReceived, "' WHERE Id = '", this.Id, "' LIMIT 1; " })); } } if (this.InRoom && this.CurrentRoom != null) { this.CurrentRoom.RemoveUserFromRoom(this.Session, false, false); } if (this.Messenger != null) { this.Messenger.AppearOffline = true; this.Messenger.OnStatusChanged(true); this.Messenger = null; } if (this.SubscriptionManager != null) { this.SubscriptionManager.Clear(); this.SubscriptionManager = null; } this.InventoryComponent.RunDBUpdate(); } }
internal void OnDisconnect() { try { if (Disconnected) { return; } Disconnected = true; if (Messenger != null) { Messenger.AppearOffline = true; Messenger.Destroy(); Messenger = null; } if (IsPremium()) { GetPremiumManager().Destroy(); } saveWardrobe(); SaveBadges(); //HabboEnvironment.GetGame().GetMuteManager().RemoveUserMute(Id); var pollParticipation = ""; if (this.PollParticipation.Count > 0) { foreach (UInt32 value in this.PollParticipation) { pollParticipation += value + ";"; } pollParticipation = pollParticipation.Remove(pollParticipation.Length - 1); } var votedRooms = ""; if (this.RatedRooms.Count > 0) { foreach (UInt32 value in this.RatedRooms) { votedRooms += value + ";"; } votedRooms = votedRooms.Remove(votedRooms.Length - 1); } var actrewards = ""; if (this.WiredRewards.Count > 0) { foreach (WiredActReward wrd in this.WiredRewards.Values) { actrewards += wrd.ItemId + "," + wrd.LastUpdate + "," + wrd.ActualRewards + "," + wrd.OriginalInt + ";"; } actrewards = actrewards.Remove(actrewards.Length - 1); } var navilogs = ""; if (this.navigatorLogs.Count > 0) { foreach (NaviLogs navi in this.navigatorLogs.Values) { navilogs += navi.Id + "," + navi.Value1 + "," + navi.Value2 + ";"; } navilogs = navilogs.Remove(navilogs.Length - 1); } var targetedoffers = ""; if (this.TargetedOffers.Count > 0) { foreach (KeyValuePair <uint, uint> k in this.TargetedOffers) { targetedoffers += k.Key + "-" + k.Value + ";"; } targetedoffers = targetedoffers.Remove(targetedoffers.Length - 1); } using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { dbClient.setQuery("UPDATE users SET namechanges = '" + NameChanges + "', respect = '" + Respect + "', daily_respect_points = '" + DailyRespectPoints + "', daily_pet_respect_points = '" + DailyPetRespectPoints + "'," + " diamonds = '" + Diamonds + "', machine_last = @machineLast, currentquestid = '" + CurrentQuestId + "', block_trade = '" + ((BlockTrade) ? "1" : "0") + "'," + " block_newfriends = '" + ((HasFriendRequestsDisabled) ? "1" : "0") + "', look = @look, motto = @motto, gender = @gender, last_online = '" + LastOnline.ToString() + "'," + " achievement_points = '" + AchievementPoints + "', home_room = '" + HomeRoom + "', volumenSystem = '" + volumenSystem + "', prefer_old_chat = '" + ((preferOldChat) ? "1" : "0") + "'," + " last_purchase = '" + LastPurchase + "'," + " poll_participation = '" + pollParticipation + "', voted_rooms = '" + votedRooms + "'," + " lastfollowinglogin = '******', ignoreRoomInvitations = '" + ((IgnoreRoomInvitations) ? "1" : "0") + "'," + " citizenship_level = '" + CitizenshipLevel + "', helper_level = '" + HelperLevel + "', actrewards = '" + actrewards + "', dontfocususers = '" + ((DontFocusUser) ? "1" : "0") + "'," + " navilogs = @navilogs, targeted_offers = @targetedoffers, alertasAtivados = '" + ((alertasAtivados) ? "1" : "0") + "', frankJaApareceu = '" + ((frankJaApareceu) ? "1" : "0") + "', FavoriteGroup = '" + FavoriteGroup + "', moedas = '" + Moedas + "', corAtual = @coratual, coresjaTenho = '" + coresjaTenho + "', new_identity = '" + NewIdentity + "', new_bot = '" + NewBot + "', coins_purchased = '" + CoinsPurchased + "' WHERE id = " + Id); dbClient.addParameter("look", Look); dbClient.addParameter("coratual", corAtual); dbClient.addParameter("motto", Motto); dbClient.addParameter("gender", Gender); dbClient.addParameter("machineLast", MachineId); dbClient.addParameter("navilogs", navilogs); dbClient.addParameter("targetedoffers", targetedoffers); dbClient.runQuery(); dbClient.runFastQuery("DELETE FROM users_online WHERE user_id = '" + Id + "'"); } if (this.AlfaServiceEnabled) { if (this.AlfaGuideEnabled) { OtanixEnvironment.GetGame().GetAlfaManager().GetTourManager().RemoveAlfa(this.Id); this.AlfaGuideEnabled = false; } if (this.AlfaHelperEnabled) { Help help = null; if (OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps.ContainsKey(AlfaServiceId)) { help = OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().Helps[AlfaServiceId]; } if (help != null) { if (help.helpState == HelpState.TALKING) { help.helpState = HelpState.FINISHED; } else if (help.helpState == HelpState.SEARCHING_USER) { help.NeedUpdate = true; } } OtanixEnvironment.GetGame().GetAlfaManager().GetHelpManager().RemoveAlfa(this.Id); this.AlfaHelperEnabled = false; } if (this.AlfaGuardianEnabled) { Bully bully = null; if (OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies.ContainsKey(AlfaServiceId)) { bully = OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().Bullies[AlfaServiceId]; } if (bully != null) { if (bully.bullyState == BullyState.WAITING_RESPONSE) { bully.bullySolution = BullySolution.EXIT; bully.bullyState = BullyState.FINISHED; } else if (bully.bullyState == BullyState.SEARCHING_USER) { bully.NeedUpdate = true; } } OtanixEnvironment.GetGame().GetAlfaManager().GetBullyManager().RemoveGuardian(this.Id); this.AlfaGuardianEnabled = false; } } if (InRoom && CurrentRoom != null && CurrentRoom.GetRoomUserManager() != null) { CurrentRoom.GetRoomUserManager().RemoveUserFromRoom(mClient, false, false, false); } if (AvatarEffectsInventoryComponent != null) { AvatarEffectsInventoryComponent.Dispose(); AvatarEffectsInventoryComponent = null; } if (InventoryComponent != null) { InventoryComponent.SetIdleState(); InventoryComponent.RunDBUpdate(); InventoryComponent.Destroy(); InventoryComponent = null; } if (BadgeComponent != null) { BadgeComponentLoaded = false; BadgeComponent.Destroy(); BadgeComponent = null; } if (RelationshipComposer != null) { RelationsLoaded = false; RelationshipComposer.Destroy(); RelationshipComposer = null; } if (Achievements != null && Achievements.Count > 0) { AchievementsLoaded = false; Achievements.Clear(); Achievements = null; } if (quests != null && quests.Count > 0) { QuestsLoaded = false; quests.Clear(); quests = null; } if (wardrobes != null && wardrobes.Count > 0) { WardrobeLoaded = false; wardrobes.Clear(); wardrobes = null; } if (clubManager != null) { clubManager.Clear(); clubManager = null; } if (sanctionManager != null) { sanctionManager.Clear(); sanctionManager = null; } } catch (Exception e) { Logging.LogCriticalException("Disconnecting user " + e); } finally { OtanixEnvironment.GetGame().GetClientManager().UnregisterClient(Id, Username); Logging.WriteLine(Username + " has logged out."); } }
public void method_12() { if (this.GetMessenger() == null) { this.Messenger = new HabboMessenger(this.Id); this.Messenger.method_0(this.UserDataFactory); this.Messenger.method_1(this.UserDataFactory); GameClient client = this.GetClient(); if (client != null) { client.SendMessage(this.Messenger.method_21()); client.SendMessage(this.Messenger.method_23()); this.Messenger.method_5(true); } } }
public void Dispose() { if (!this.bool_9) { this.bool_9 = true; Essential.GetGame().GetClientManager().RemoveClient(this.Id, this.Username); if (!this.bool_16) { this.bool_16 = true; this.Online = false; using (DatabaseClient dbClient = Essential.GetDatabase().GetClient()) { dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE users SET last_online = UNIX_TIMESTAMP(), online = '0', activity_points = '", this.ActivityPoints, "', activity_points_lastupdate = '", this.LastActivityPointsUpdate.ToString().Replace(",", "."), "', credits = '", this.Credits, "' WHERE Id = '", this.Id, "' LIMIT 1;" })); dbClient.ExecuteQuery("UPDATE user_clientsessions SET logout_timestamp='" + Essential.GetUnixTimestamp() + "' WHERE userId = " + this.Id + " AND login_timestamp='" + this.GetUserDataFactory().LoginTime + "'"); int num = (int)Essential.GetUnixTimestamp() - this.LoginTimestamp; dbClient.ExecuteQuery(string.Concat(new object[] { "UPDATE user_stats SET RoomVisits = '", this.RoomVisits, "', OnlineTime = OnlineTime + ", num, ", Respect = '", this.Respect, "', RespectGiven = '", this.RespectGiven, "', GiftsGiven = '", this.GiftsGiven, "', GiftsReceived = '", this.GiftsReceived, "', FootballGoalScorer = '", this.FootballGoalScorer, "', FootballGoalHost = '", this.FootballGoalHost, "', TilesLocked = '", this.TilesLocked, "', staff_picks = '", this.StaffPicks, "' WHERE Id = '", this.Id, "' LIMIT 1; " })); dbClient.ExecuteQuery("DELETE FROM user_currentroom WHERE userid=" + this.Id); } } try { Essential.GetGame().GetGuideManager().ToggleState(false, this.Id); GuideTicket gt = Essential.GetGame().GetGuideManager().GetTicket(this.Id); Essential.GetGame().GetGuideManager().RemoveTicket(this.Id); gt.SendToTicket(Essential.GetGame().GetGuideManager().DetachedMessage); } catch { } if (this.InRoom && this.CurrentRoom != null) this.CurrentRoom.RemoveUserFromRoom(this.Session, false, false); if (this.Messenger != null) { this.Messenger.bool_0 = true; this.Messenger.method_5(true); this.Messenger = null; } if (this.SubscriptionManager != null) { this.SubscriptionManager.GetSubscriptions().Clear(); this.SubscriptionManager = null; } this.InventoryComponent.SavePets(); } }