/// <summary> /// Removes a bot friendship /// </summary> /// <param name="BotId"></param> internal void RemoveBotAsFriend(int BotId) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `rp_bots_friendships` WHERE `bot_id` = '" + BotId + "' AND `user_id` = '" + Client.GetHabbo().Id + "'"); } Client.SendWhisper("Você removeu com sucesso " + RoleplayBotManager.GetCachedBotById(BotId).Name + " da sua lista de contatos do celular!", 1); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int UserId = Packet.PopInt(); if (UserId > 1000000) { int BotId = UserId - 1000000; var Bot = RoleplayBotManager.GetCachedBotById(BotId); if (Bot != null) { Session.SendMessage(new HabboUserBadgesComposer(null, Bot)); } } else { Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { return; } if (Session.GetRoleplay().CombatMode) { if (Session.GetRoleplay().InCombat) { Session.GetRoleplay().InCombat = false; if (Habbo.GetClient() != null && Habbo.GetClient().GetRoomUser() != null && !Habbo.GetClient().GetRoomUser().IsBot) { if (Session.GetRoleplay().EquippedWeapon == null) { CombatManager.GetCombatType("fist").Execute(Session, Habbo.GetClient()); } else { CombatManager.GetCombatType("gun").Execute(Session, Habbo.GetClient()); } } } } Session.SendMessage(new HabboUserBadgesComposer(Habbo)); } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int UserId = Packet.PopInt(); if (UserId > 1000000) { int BotId = UserId - 1000000; var Bot = RoleplayBotManager.GetCachedBotById(BotId); if (Bot != null) { Session.SendMessage(new GetRelationshipsComposer(null, Bot)); } } else { Habbo Habbo = PlusEnvironment.GetHabboById(UserId); if (Habbo == null) { return; } #region Open user statistics dialogue (sockets) if (Habbo.GetClient() != null) { if (Habbo.GetClient() != Session) { PlusEnvironment.GetGame().GetWebEventManager().ExecuteWebEvent(Session, "event_characterbar", "" + Habbo.Id); } } #endregion Session.SendMessage(new GetRelationshipsComposer(Habbo)); } }
/// <summary> /// Loads bot friendships /// </summary> internal void LoadBotFriendships() { BotFriendShips = new ConcurrentDictionary <int, RoleplayBot>(); DataTable BotFriends = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `bot_id` FROM `rp_bots_friendships` WHERE `user_id` = '" + Client.GetHabbo().Id + "'"); BotFriends = dbClient.getTable(); if (BotFriends == null) { return; } foreach (DataRow BotUser in BotFriends.Rows) { int BotId = Convert.ToInt32(BotUser["bot_id"]); RoleplayBot Botfriend = RoleplayBotManager.GetCachedBotById(BotId); if (Botfriend == null) { return; } MessengerBuddy newfriend = new MessengerBuddy(Botfriend.Id + RoleplayBotManager.BotFriendMultiplyer, Botfriend.Name, Botfriend.Figure, Botfriend.Motto, 0, false, true, true); int addid = Botfriend.Id + RoleplayBotManager.BotFriendMultiplyer; if (Client.GetHabbo() == null) { return; } if (Client.GetHabbo().GetMessenger() == null) { return; } if (Client.GetHabbo().GetMessenger()._friends == null) { return; } if (!Client.GetHabbo().GetMessenger()._friends.ContainsKey(addid)) { Client.GetHabbo().GetMessenger()._friends.Add(addid, newfriend); } if (!BotFriendShips.ContainsKey(Botfriend.Id)) { BotFriendShips.TryAdd(Botfriend.Id, Botfriend); } Client.SendMessage(Client.GetHabbo().GetMessenger().SerializeUpdate(newfriend)); } } }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int userID = Packet.PopInt(); Boolean IsMe = Packet.PopBoolean(); if (userID >= 5000000) { Group Group = GroupManager.GetGang(userID - 5000000); Session.SendMessage(new GroupInfoComposer(Group, Session, true)); return; } if (userID > 1000000) { RoleplayBot Bot = RoleplayBotManager.GetCachedBotById(userID - 1000000); List <Group> BotGroups = new List <Group>(); if (Bot.Corporation > 0) { Group Job = GroupManager.GetJob(Bot.Corporation); if (Job != null) { BotGroups.Add(Job); } } else { Group Job = GroupManager.GetJob(1); if (Job != null) { BotGroups.Add(Job); } } Group Gang = GroupManager.GetGang(1000); if (Gang != null) { BotGroups.Add(Gang); } int BotFriendCount = 0; using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `rp_bots_friendships` WHERE `bot_id` = '" + Bot.Id + "'"); BotFriendCount = dbClient.getInteger(); } Session.SendMessage(new ProfileInformationComposer(null, Session, BotGroups, BotFriendCount, Bot)); return; } Habbo targetData = PlusEnvironment.GetHabboById(userID); List <Group> Groups = PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id); int friendCount = 0; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)"); dbClient.AddParameter("userid", userID); friendCount = dbClient.getInteger(); } Session.SendMessage(new ProfileInformationComposer(targetData, Session, Groups, friendCount)); }