Example #1
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            int userId = packet.PopInt();

            packet.PopBoolean(); //IsMe?

            Habbo targetData = PlusEnvironment.GetHabboById(userId);

            if (targetData == null)
            {
                session.SendNotification("An error occured whilst finding that user's profile.");
                return;
            }

            List <Group> groups = PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id);

            int friendCount;

            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.SendPacket(new ProfileInformationComposer(targetData, session, groups, friendCount));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            int   UserId = Packet.PopInt();
            Habbo Habbo  = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oops, we couldn't find this user.");
                return;
            }

            try
            {
                Session.SendMessage(new ModeratorUserChatlogComposer(UserId));
            }
            catch { Session.SendNotification("Overflow :/"); }
        }
        private List <ChatlogEntry> GetChatlogs(RoomData RoomData, double TimeEnter, double TimeExit)
        {
            List <ChatlogEntry> Chats = new List <ChatlogEntry>();

            DataTable Data = null;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `user_id`, `timestamp`, `message` FROM `chatlogs` WHERE `room_id` = " + RoomData.Id + " AND `timestamp` > " + TimeEnter + " AND `timestamp` < " + TimeExit + " ORDER BY `timestamp` DESC LIMIT 100");
                Data = dbClient.GetTable();

                if (Data != null)
                {
                    foreach (DataRow Row in Data.Rows)
                    {
                        Habbo Habbo = PlusEnvironment.GetHabboById(Convert.ToInt32(Row["user_id"]));

                        if (Habbo != null)
                        {
                            Chats.Add(new ChatlogEntry(Convert.ToInt32(Row["user_id"]), RoomData.Id, Convert.ToString(Row["message"]), Convert.ToDouble(Row["timestamp"]), Habbo));
                        }
                    }
                }
            }

            return(Chats);
        }
Example #4
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            int groupId = packet.PopInt();
            int userId  = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(groupId, out Group group))
            {
                return;
            }

            if (session.GetHabbo().Id != group.CreatorId && !group.IsAdmin(session.GetHabbo().Id) && !session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any"))
            {
                return;
            }

            if (!group.HasRequest(userId))
            {
                return;
            }

            Habbo habbo = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                session.SendNotification("Oops, an error occurred whilst finding this user.");
                return;
            }

            group.HandleRequest(userId, true);

            session.SendPacket(new GroupMemberUpdatedComposer(groupId, habbo, 4));
        }
Example #5
0
        /// <summary>
        /// Removes the chosen client from the bounty
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="Expired"></param>
        public static void RemoveBounty(int UserId, bool Expired = false)
        {
            if (!BountyUsers.ContainsKey(UserId))
            {
                return;
            }

            Bounty Junk;

            BountyUsers.TryRemove(UserId, out Junk);

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("DELETE FROM `rp_bounties` WHERE `user_id` = '" + UserId + "'");
            }

            if (!Expired)
            {
                try
                {
                    Habbo BountyOwner = PlusEnvironment.GetHabboById(Convert.ToInt32(Junk.AddedBy));

                    if (BountyOwner == null || BountyOwner.GetClient() == null)
                    {
                        return;
                    }

                    BountyOwner.Credits += Junk.Reward;
                    BountyOwner.UpdateCreditsBalance();
                }
                catch { }
            }
        }
Example #6
0
        public static void CheckBounty(GameClient Session, int UserId)
        {
            try
            {
                if (Session == null || !BountyUsers.ContainsKey(UserId))
                {
                    return;
                }

                Bounty Junk;
                BountyUsers.TryRemove(UserId, out Junk);

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("DELETE FROM `rp_bounties` WHERE `user_id` = '" + UserId + "'");
                }

                if (PlusEnvironment.GetUnixTimestamp() < Junk.ExpiryTimeStamp)
                {
                    Session.Shout("*Reinvindica R$" + String.Format("{0:N0}", Junk.Reward) + " da recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + "*", 4);
                    Session.SendWhisper("Você reivindicou com sucesso R$" + String.Format("{0:N0}", Junk.Reward) + " da recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + "!", 1);

                    Session.GetHabbo().Credits += Junk.Reward;
                    Session.GetHabbo().UpdateCreditsBalance();
                    return;
                }
                else
                {
                    Session.SendWhisper("Você reivindicou a recompensa de " + PlusEnvironment.GetHabboById(UserId).Username + ", mas a recompensa expirou!", 1);
                    return;
                }
            }
            catch { }
        }
Example #7
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            StringBuilder Message = new StringBuilder().Append("<----- Usuários com Recompensas ----->\n\n");

            if (BountyManager.BountyUsers.Count <= 0)
            {
                Message.Append("Ninguém está em uma recompensa agora!\n");
            }

            lock (BountyManager.BountyUsers.Values)
            {
                foreach (Bounty Bounty in BountyManager.BountyUsers.Values)
                {
                    if (PlusEnvironment.GetUnixTimestamp() > Bounty.ExpiryTimeStamp)
                    {
                        BountyManager.RemoveBounty(Bounty.UserId, true);
                        Habbo BountyOwner = PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.AddedBy));

                        if (BountyOwner == null || BountyOwner.GetClient() == null)
                        {
                            continue;
                        }

                        BountyOwner.GetClient().SendWhisper("A recompensa que você definiu " + PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.UserId)).Username + " expirou!", 1);
                    }

                    TimeSpan Difference = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Bounty.ExpiryTimeStamp).Subtract(new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(PlusEnvironment.GetUnixTimestamp()));

                    Message.Append("Usuário: " + PlusEnvironment.GetHabboById(Convert.ToInt32(Bounty.UserId)).Username + " - Expira em " + ((int)Difference.TotalMinutes < 0 ? 0 : (int)Difference.TotalMinutes) + " minutos\n");
                    Message.Append("Recompensa: R$" + String.Format("{0:N0}", Bounty.Reward) + "\n\n");
                }
            }
            Session.SendMessage(new MOTDNotificationComposer(Message.ToString()));
        }
Example #8
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group = null;

            if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
            {
                return;
            }

            if ((Session.GetHabbo().Id != Group.CreatorId && !Group.IsAdmin(Session.GetHabbo().Id)) && !Session.GetHabbo().GetPermissions().HasRight("fuse_group_accept_any"))
            {
                return;
            }

            if (!Group.HasRequest(UserId))
            {
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oops, an error occurred whilst finding this user.");
                return;
            }

            Group.HandleRequest(UserId, true);

            Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 4));
        }
Example #9
0
        public void AddNewMember(int UserId, int RankId = 1, bool UpdateDatabase = false)
        {
            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                return;
            }

            RemoveAllOldGroups(UserId);
            RemoveAllOldRequests(UserId);

            GroupMember Member = new GroupMember(this.Id, UserId, RankId, RankId >= 6);

            this.Members.TryAdd(UserId, Member);

            if (Habbo.GetClient() == null || UpdateDatabase)
            {
                using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    if (this.Id < 1000)
                    {
                        dbClient.SetQuery("UPDATE `rp_stats` SET `job_id` = '" + this.Id + "', `job_rank` = '" + RankId + "', `job_request` = '0', `time_worked` = '0' WHERE `id` = '" + UserId + "' LIMIT 1");
                    }
                    else
                    {
                        dbClient.SetQuery("UPDATE `rp_stats` SET `gang_id` = '" + this.Id + "', `gang_rank` = '" + RankId + "', `gang_request` = '0' WHERE `id` = '" + UserId + "' LIMIT 1");
                    }
                    dbClient.RunQuery();
                }
            }
        }
        public void Parse(GameClient session, ClientPacket packet)
        {
            int groupId = packet.PopInt();
            int userId = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(groupId, out Group group))
                return;

            if (session.Habbo.Id != group.CreatorId || !group.IsMember(userId))
                return;

            Habbo habbo = PlusEnvironment.GetHabboById(userId);
            if (habbo == null)
            {
                session.SendNotification("Oops, an error occurred whilst finding this user.");
                return;
            }

            group.MakeAdmin(userId);

            if (PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(group.RoomId, out Room room))
            {
                RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(userId);
                if (user != null)
                {
                    if (!user.Statusses.ContainsKey("flatctrl 3"))
                        user.SetStatus("flatctrl 3");
                    user.UpdateNeeded = true;
                    if (user.GetClient() != null)
                        user.GetClient().SendPacket(new YouAreControllerComposer(3));
                }
            }

            session.SendPacket(new GroupMemberUpdatedComposer(groupId, habbo, 1));
        }
        public ModeratorTicketChatlogComposer(SupportTicket Ticket, RoomData RoomData, double Timestamp)
            : base(ServerPacketHeader.ModeratorTicketChatlogMessageComposer)
        {
            base.WriteInteger(Ticket.TicketId);
            base.WriteInteger(Ticket.SenderId);
            base.WriteInteger(Ticket.ReportedId);
            base.WriteInteger(RoomData.Id);

            base.WriteByte(1);
            base.WriteShort(2);//Count
            base.WriteString("roomName");
            base.WriteByte(2);
            base.WriteString(RoomData.Name);
            base.WriteString("roomId");
            base.WriteByte(1);
            base.WriteInteger(RoomData.Id);

            base.WriteShort(Ticket.ReportedChats.Count);
            foreach (string Chat in Ticket.ReportedChats)
            {
                Habbo Habbo = PlusEnvironment.GetHabboById(Ticket.ReportedId);

                base.WriteInteger(((int)PlusEnvironment.GetUnixTimestamp() - Convert.ToInt32(Timestamp)) * 1000);
                base.WriteInteger(Ticket.ReportedId);
                base.WriteString(Habbo != null ? Habbo.Username : "******");
                base.WriteString(Chat);
                base.WriteBoolean(false);
            }
        }
Example #12
0
        public void GetGangData()
        {
            Gangs.Clear();
            GenericGangRanks.Clear();
            GenericGangRanks = GenerateGangRanks();

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `rp_gangs`");
                DataTable Table = dbClient.getTable();

                if (Table != null)
                {
                    foreach (DataRow Row in Table.Rows)
                    {
                        int    Id            = Convert.ToInt32(Row["id"]);
                        string Name          = Row["name"].ToString();
                        string Description   = Row["desc"].ToString();
                        string Badge         = Row["badge"].ToString();
                        int    OwnerId       = Convert.ToInt32(Row["owner_id"]);
                        int    Created       = Convert.ToInt32(Row["created"]);
                        int    RoomId        = Convert.ToInt32(Row["room_id"]);
                        int    State         = Convert.ToInt32(Row["state"]);
                        int    Colour1       = Convert.ToInt32(Row["colour1"]);
                        int    Colour2       = Convert.ToInt32(Row["colour2"]);
                        int    AdminOnlyDeco = Convert.ToInt32(Row["admindeco"]);

                        bool   ForumEnabled        = PlusEnvironment.EnumToBool(Row["forum_enabled"].ToString());
                        int    ForumMessagesCount  = Convert.ToInt32(Row["forum_messages_count"]);
                        double ForumScore          = Convert.ToDouble(Row["forum_score"]);
                        int    LastPosterId        = Convert.ToInt32(Row["forum_lastposter_id"]);
                        string LastPosterName      = PlusEnvironment.GetHabboById(LastPosterId) == null ? "HabboRPG" : PlusEnvironment.GetHabboById(LastPosterId).Username;
                        int    LastPosterTimeStamp = Convert.ToInt32(Row["forum_lastposter_timestamp"]);

                        int WhoCanRead   = Convert.ToInt32(Row["who_can_read"]);
                        int WhoCanPost   = Convert.ToInt32(Row["who_can_post"]);
                        int WhoCanThread = Convert.ToInt32(Row["who_can_thread"]);
                        int WhoCanMod    = Convert.ToInt32(Row["who_can_mod"]);

                        int Kills     = Convert.ToInt32(Row["gang_kills"]);
                        int Deaths    = Convert.ToInt32(Row["gang_deaths"]);
                        int Score     = Convert.ToInt32(Row["gang_score"]);
                        int MediPacks = Convert.ToInt32(Row["medipacks"]);

                        List <int> Requests;
                        ConcurrentDictionary <int, GroupMember> Members = GenerateGangMembers(Id, out Requests);

                        Group Gang = new Group(Id, Name, Description, Badge, RoomId, OwnerId, Created, State, Colour1, Colour2, AdminOnlyDeco,
                                               ForumEnabled, Name, Description, ForumMessagesCount, ForumScore, LastPosterId, LastPosterName, LastPosterTimeStamp,
                                               WhoCanMod, WhoCanPost, WhoCanRead, WhoCanThread, GenericGangRanks, Members, Requests, Kills, Deaths, Score, MediPacks);

                        if (!Gangs.ContainsKey(Id))
                        {
                            Gangs.TryAdd(Id, Gang);
                        }
                    }
                }
            }
        }
Example #13
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int UserId = Packet.PopInt();

            // Ignore the user who was just reported
            if (PlusEnvironment.GetHabboById(UserId) != null)
            {
                Session.SendMessage(new IgnoreStatusComposer(1, PlusEnvironment.GetHabboById(UserId).Username));
            }
        }
Example #14
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            if (GroupId >= 1000)
            {
                return;
            }

            Group Group = GroupManager.GetJob(GroupId);

            if (Group == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager") && (Session.GetHabbo().Id != Group.CreatorId || !Group.IsMember(UserId)))
            {
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Opa, ocorreu um erro ao encontrar este usuário.");
                return;
            }

            Group.TakeAdmin(UserId);
            GroupRank Rank = GroupManager.GetJobRank(Group.Id, 1);

            Session.Shout("*Rebaixa " + Habbo.Username + " todos os cargos da Empresa " + Group.Name + " até o cargo " + Rank.Name + "*", 23);

            #region (Disabled) Take Room Rights

            /*
             * Room Room = null;
             * if (PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room))
             * {
             *  RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId);
             *  if (User != null)
             *  {
             *      if (User.Statusses.ContainsKey("flatctrl 3"))
             *          User.RemoveStatus("flatctrl 3");
             *      User.UpdateNeeded = true;
             *      if (User.GetClient() != null)
             *          User.GetClient().SendMessage(new YouAreControllerComposer(0));
             *  }
             * }*/
            #endregion

            Session.SendMessage(new GroupMemberUpdatedComposer(GroupId, Habbo, 2));
        }
Example #15
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session?.GetHabbo() == null || !session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            var    userId  = packet.PopInt();
            var    message = packet.PopString();
            double days    = packet.PopInt() / 1440;

            packet.PopString();
            packet.PopString();

            var length = PlusEnvironment.GetUnixTimestamp() + days * 86400;

            var habbo = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (habbo.GetPermissions().HasRight("mod_trade_lock") && !session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher.");
                return;
            }

            if (days < 1)
            {
                days = 1;
            }

            if (days > 365)
            {
                days = 365;
            }

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + habbo.Id +
                                  "' LIMIT 1");
            }

            if (habbo.GetClient() == null)
            {
                return;
            }

            habbo.TradingLockExpiry = length;
            habbo.GetClient().SendNotification("You have been trade banned for " + days + " day(s)!\r\rReason:\r\r" + message);
        }
Example #16
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int   UserId = Packet.PopInt();
            Habbo Habbo  = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                return;
            }

            Session.SendMessage(new HabboUserBadgesComposer(Habbo));
        }
Example #17
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            var userId = packet.PopInt();
            var habbo  = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                return;
            }

            session.SendPacket(new HabboUserBadgesComposer(habbo));
        }
Example #18
0
 public void Pick(int pModeratorId, Boolean UpdateInDb)
 {
     Status      = TicketStatus.PICKED;
     ModeratorId = pModeratorId;
     ModName     = PlusEnvironment.GetHabboById(pModeratorId).Username;
     if (UpdateInDb)
     {
         using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
         {
             dbClient.RunQuery("UPDATE moderation_tickets SET status = 'picked', moderator_id = " + pModeratorId + ", timestamp = '" + PlusEnvironment.GetUnixTimestamp() + "' WHERE id = " + Id + "");
         }
     }
 }
Example #19
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session?.GetHabbo() == null)
            {
                return;
            }

            if (!session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            packet.PopInt();
            var roomId = packet.PopInt();

            Room room;

            if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(roomId, out room))
            {
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().FlushAndSave();

            var chats = new List <ChatlogEntry>();

            DataTable data;

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `chatlogs` WHERE `room_id` = @id ORDER BY `id` DESC LIMIT 100");
                dbClient.AddParameter("id", roomId);
                data = dbClient.GetTable();

                if (data != null)
                {
                    foreach (DataRow row in data.Rows)
                    {
                        var habbo = PlusEnvironment.GetHabboById(Convert.ToInt32(row["user_id"]));

                        if (habbo != null)
                        {
                            chats.Add(new ChatlogEntry(Convert.ToInt32(row["user_id"]), roomId, Convert.ToString(row["message"]), Convert.ToDouble(row["timestamp"]), habbo));
                        }
                    }
                }
            }

            session.SendPacket(new ModeratorRoomChatlogComposer(room, chats));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            int Junk   = Packet.PopInt();
            int RoomId = Packet.PopInt();

            Room Room = null;

            if (!PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(RoomId, out Room))
            {
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().FlushAndSave();

            List <ChatlogEntry> Chats = new List <ChatlogEntry>();

            DataTable Data = null;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT * FROM `chatlogs` WHERE `room_id` = @id ORDER BY `id` DESC LIMIT 100");
                dbClient.AddParameter("id", RoomId);
                Data = dbClient.GetTable();

                if (Data != null)
                {
                    foreach (DataRow Row in Data.Rows)
                    {
                        Habbo Habbo = PlusEnvironment.GetHabboById(Convert.ToInt32(Row["user_id"]));

                        if (Habbo != null)
                        {
                            Chats.Add(new ChatlogEntry(Convert.ToInt32(Row["user_id"]), RoomId, Convert.ToString(Row["message"]), Convert.ToDouble(Row["timestamp"]), Habbo));
                        }
                    }
                }
            }

            Session.SendPacket(new ModeratorRoomChatlogComposer(Room, Chats));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Opa, você não pode fazer uma troca com outro usuário com Rank 5 ou mais.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!\r\rReason:\r\r" + Message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!\r\rReason:\r\r" + Message);
            }
        }
        public void Parse(GameClient session, ClientPacket packet)
        {
            Habbo habbo = PlusEnvironment.GetHabboById(packet.PopInt());

            if (habbo == null)
            {
                return;
            }

            var rand = new Random();

            habbo.Relationships = habbo.Relationships.OrderBy(x => rand.Next()).ToDictionary(item => item.Key, item => item.Value);

            session.SendPacket(new GetRelationshipsComposer(habbo));
        }
Example #24
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group = null;

            if (!PlusEnvironment.GetGame().GetGroupManager().TryGetGroup(GroupId, out Group))
            {
                return;
            }

            if (Session.GetHabbo().Id != Group.CreatorId || !Group.IsMember(UserId))
            {
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Oops, an error occurred whilst finding this user.");
                return;
            }

            Group.MakeAdmin(UserId);

            Room Room = null;

            if (PlusEnvironment.GetGame().GetRoomManager().TryGetRoom(Group.RoomId, out Room))
            {
                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId);
                if (User != null)
                {
                    if (!User.Statusses.ContainsKey("flatctrl 3"))
                    {
                        User.SetStatus("flatctrl 3", "");
                    }
                    User.UpdateNeeded = true;
                    if (User.GetClient() != null)
                    {
                        User.GetClient().SendPacket(new YouAreControllerComposer(3));
                    }
                }
            }

            Session.SendPacket(new GroupMemberUpdatedComposer(GroupId, Habbo, 1));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            Habbo Data = PlusEnvironment.GetHabboById(Packet.PopInt());

            if (Data == null)
            {
                Session.SendNotification("Unable to load info for user.");
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().FlushAndSave();

            List <KeyValuePair <RoomData, List <ChatlogEntry> > > Chatlogs = new List <KeyValuePair <RoomData, List <ChatlogEntry> > >();

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `room_id`,`entry_timestamp`,`exit_timestamp` FROM `user_roomvisits` WHERE `user_id` = '" + Data.Id + "' ORDER BY `entry_timestamp` DESC LIMIT 7");
                DataTable GetLogs = dbClient.GetTable();

                if (GetLogs != null)
                {
                    foreach (DataRow Row in GetLogs.Rows)
                    {
                        RoomData RoomData = null;
                        if (!RoomFactory.TryGetData(Convert.ToInt32(Row["room_id"]), out RoomData))
                        {
                            continue;
                        }

                        double TimestampExit = (Convert.ToDouble(Row["exit_timestamp"]) <= 0 ? UnixTimestamp.GetNow() : Convert.ToDouble(Row["exit_timestamp"]));

                        Chatlogs.Add(new KeyValuePair <RoomData, List <ChatlogEntry> >(RoomData, GetChatlogs(RoomData, Convert.ToDouble(Row["entry_timestamp"]), TimestampExit)));
                    }
                }

                Session.SendPacket(new ModeratorUserChatlogComposer(Data, Chatlogs));
            }
        }
Example #26
0
        public RentableSpaceComposer(Item Item, HabboHotel.GameClients.GameClient Session) : base(ServerPacketHeader.RentableSpaceMessageComposer)
        {
            int Cost = GetCost(Item);

            if (Item != null)
            {
                var RentableSpaceData = Item.RentableSpaceData;

                if (RentableSpaceData != null)
                {
                    base.WriteBoolean(RentableSpaceData.Enabled);
                    base.WriteInteger(0);
                    base.WriteInteger(-1); // nothing??
                    base.WriteString(PlusEnvironment.GetHabboById(RentableSpaceData.OwnerId).Username);
                    base.WriteInteger(RentableSpaceData.TimeLeft);
                    base.WriteInteger(Cost); // Rentable Space Cost

                    var House = PlusEnvironment.GetGame().GetHouseManager().GetHouseBySignItem(Item);

                    if (House != null)
                    {
                        if (House.OwnerId == Session.GetHabbo().Id)
                        {
                            if (!House.ForSale)
                            {
                                Session.SendWhisper("Olá, " + Session.GetHabbo().Username + "! Se você gostaria de vender sua casa, use o comando ':vender [quantidade]' e clique em 'Vender'!");
                                return;
                            }
                            else
                            {
                                Session.SendWhisper("Olá, " + Session.GetHabbo().Username + "! Sua casa já está à venda por R$" + House.Cost + "! Use o comando ':vender [quantidade]' para mudar o preço da casa!");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    WriteNullData();
                }
            }
            else
            {
                WriteNullData();
            }
        }
Example #27
0
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            Habbo Owner = PlusEnvironment.GetHabboById(Item.UserID);

            if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
            {
                return(false);
            }

            Habbo Player = (Habbo)Params[0];

            if (Player == null || Player.GetClient() == null)
            {
                return(false);
            }

            RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Id);

            if (User == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(StringData))
            {
                return(false);
            }

            if (Player.GetBadgeComponent().HasBadge(StringData))
            {
                Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Parece que você já recebeu este emblema!", 0, User.LastBubble));
            }
            else
            {
                Player.GetBadgeComponent().GiveBadge(StringData, true, Player.GetClient());
                Player.GetClient().SendNotification("Você recebeu um Emblema!");
            }

            return(true);
        }
Example #28
0
        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));
            }
        }
Example #29
0
        public bool Execute(params object[] Params)
        {
            if (Params == null || Params.Length == 0)
            {
                return(false);
            }

            Habbo Owner = PlusEnvironment.GetHabboById(Item.UserID);

            if (Owner == null || !Owner.GetPermissions().HasRight("room_item_wired_rewards"))
            {
                return(false);
            }

            Habbo Player = (Habbo)Params[0];

            if (Player == null || Player.GetClient() == null)
            {
                return(false);
            }

            RoomUser User = Player.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Player.Username);

            if (User == null)
            {
                return(false);
            }

            if (String.IsNullOrEmpty(StringData))
            {
                return(false);
            }

            if (Player.GetBadgeComponent().HasBadge(StringData))
            {
                Player.GetClient().SendPacket(new WhisperComposer(User.VirtualId, "Oops, it appears you have already recieved this badge!", 0, User.LastBubble));
            }
            else
            {
                Player.GetBadgeComponent().GiveBadge(StringData, true, Player.GetClient());
                Player.GetClient().SendNotification("You have recieved a badge!");
            }

            return(true);
        }
Example #30
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            var ignoredUsers = new List <string>();

            foreach (var userId in new List <int>(session.GetHabbo().GetIgnores().IgnoredUserIds()))
            {
                var player = PlusEnvironment.GetHabboById(userId);
                if (player != null)
                {
                    if (!ignoredUsers.Contains(player.Username))
                    {
                        ignoredUsers.Add(player.Username);
                    }
                }
            }

            session.SendPacket(new IgnoredUsersComposer(ignoredUsers));
        }