public PetInformationComposer(Habbo Habbo)
     : base(ServerPacketHeader.PetInformationMessageComposer)
 {
     base.WriteInteger(Habbo.Id);
     base.WriteString(Habbo.Username);
     base.WriteInteger(Habbo.Rank);
     base.WriteInteger(10);
     base.WriteInteger(0);
     base.WriteInteger(0);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(100);
     base.WriteInteger(Habbo.GetStats().Respect);
     base.WriteInteger(Habbo.Id);
     base.WriteInteger(Convert.ToInt32(Math.Floor((RocketEmulador.GetUnixTimestamp() - Habbo.AccountCreated) / 86400))); //How?
     base.WriteString(Habbo.Username);
     base.WriteInteger(1);                                                                                               //3 on hab
     base.WriteBoolean(false);
     base.WriteBoolean(false);
     base.WriteInteger(0); //5 on hab
     base.WriteInteger(0); // Anyone can ride horse
     base.WriteInteger(0);
     base.WriteInteger(0); //512 on hab
     base.WriteInteger(0); //1536
     base.WriteInteger(0); //2560
     base.WriteInteger(0); //3584
     base.WriteInteger(0);
     base.WriteString("");
     base.WriteBoolean(false);
     base.WriteInteger(-1);//255 on hab
     base.WriteInteger(-1);
     base.WriteInteger(-1);
     base.WriteBoolean(false);
 }
        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 = RocketEmulador.GetHabboById(Ticket.ReportedId);
                int      time2 = ((int)RocketEmulador.GetUnixTimestamp() - Convert.ToInt32(Timestamp)) * 1000;
                DateTime time  = new DateTime(time2);
                base.WriteString(time.ToString("hh:mm"));
                //base.WriteString(time2);
                //base.WriteInteger(((int)RocketEmulador.GetUnixTimestamp() - Convert.ToInt32(Timestamp)) * 1000);
                base.WriteInteger(Ticket.ReportedId);
                base.WriteString(Habbo != null ? Habbo.Username : "******");
                base.WriteString(Chat);
                base.WriteBoolean(false);
            }
        }
예제 #3
0
        public ForumsListDataComposer(ICollection <GroupForum> Forums, GameClient Session, int ViewOrder = 0, int StartIndex = 0, int MaxLength = 20)
            : base(ServerPacketHeader.ForumsListDataMessageComposer)
        {
            base.WriteInteger(ViewOrder);
            base.WriteInteger(StartIndex);
            base.WriteInteger(StartIndex);

            base.WriteInteger(Forums.Count); // Liste Compte Forums

            foreach (var Forum in Forums)
            {
                var lastpost = Forum.GetLastPost();
                var isn      = lastpost == null;
                base.WriteInteger(Forum.Id);
                base.WriteString(Forum.Name);
                base.WriteString(Forum.Description);
                base.WriteString(Forum.Group.Badge);
                base.WriteInteger(0);
                base.WriteInteger(0);
                base.WriteInteger(Forum.MessagesCount);
                base.WriteInteger(Forum.UnreadMessages(Session.GetHabbo().Id));
                base.WriteInteger(0);
                base.WriteInteger(!isn ? lastpost.GetAuthor().Id : 0);
                base.WriteString(!isn ? lastpost.GetAuthor().Username : "");
                base.WriteInteger(!isn ? (int)RocketEmulador.GetUnixTimestamp() - lastpost.Timestamp : 0);
            }
        }
예제 #4
0
 public ModeratorSupportTicketComposer(SupportTicket Ticket)
     : base(ServerPacketHeader.ModeratorSupportTicketMessageComposer)
 {
     base.WriteInteger(Ticket.Id);
     base.WriteInteger(Ticket.TabId);
     base.WriteInteger(Ticket.Type);
     base.WriteInteger(Ticket.Category);
     base.WriteInteger(((int)RocketEmulador.GetUnixTimestamp() - (int)Ticket.Timestamp) * 1000);
     base.WriteInteger(Ticket.Score);
     base.WriteInteger(0);
     base.WriteInteger(Ticket.SenderId);
     base.WriteString(Ticket.SenderName);
     base.WriteInteger(Ticket.ReportedId);
     base.WriteString(Ticket.ReportedName);
     base.WriteInteger((Ticket.Status == TicketStatus.PICKED) ? Ticket.ModeratorId : 0);
     base.WriteString(Ticket.ModName);
     base.WriteString(Ticket.Message);
     base.WriteInteger(0); //No idea?
     base.WriteInteger(0); //String, int, int - this is the "matched to" a string
     {
         base.WriteString("fresh-hotel.org");
         base.WriteInteger(-1);
         base.WriteInteger(-1);
     }
 }
예제 #5
0
        public ProfileInformationComposer(Habbo Data, GameClient Session, List <Group> Groups, int friendCount)
            : base(ServerPacketHeader.ProfileInformationMessageComposer)
        {
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Data.AccountCreated);

            base.WriteInteger(Data.Id);
            base.WriteString(Data.Username);
            base.WriteString(Data.Look);
            base.WriteString(Data.Motto);
            base.WriteString(origin.ToString("dd/MM/yyyy"));
            base.WriteInteger(Data.GetStats().AchievementPoints);
            base.WriteInteger(friendCount);                                                                                                                                                 // Friend Count
            base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id));                                                              //  Is friend
            base.WriteBoolean(Data.Id != Session.GetHabbo().Id&& !Session.GetHabbo().GetMessenger().FriendshipExists(Data.Id) && Session.GetHabbo().GetMessenger().RequestExists(Data.Id)); // Sent friend request
            base.WriteBoolean((RocketEmulador.GetGame().GetClientManager().GetClientByUserID(Data.Id)) != null);

            base.WriteInteger(Groups.Count);
            foreach (Group Group in Groups)
            {
                base.WriteInteger(Group.Id);
                base.WriteString(Group.Name);
                base.WriteString(Group.Badge);
                base.WriteString(RocketEmulador.GetGame().GetGroupManager().GetGroupColour(Group.Colour1, true));
                base.WriteString(RocketEmulador.GetGame().GetGroupManager().GetGroupColour(Group.Colour2, false));
                base.WriteBoolean(Data.GetStats().FavouriteGroupId == Group.Id); // todo favs
                base.WriteInteger(0);                                            //what the f**k
                base.WriteBoolean(Group != null ? Group.ForumEnabled : true);    //HabboTalk
            }

            base.WriteInteger(Convert.ToInt32(RocketEmulador.GetUnixTimestamp() - Data.LastOnline)); // Last online
            base.WriteBoolean(true);                                                                 // Show the profile
        }
        public ModeratorInitComposer(ICollection <string> UserPresets, ICollection <string> RoomPresets, Dictionary <string, List <ModerationPresetActionMessages> > UserActionPresets, ICollection <SupportTicket> Tickets)
            : base(ServerPacketHeader.ModeratorInitMessageComposer)
        {
            base.WriteInteger(Tickets.Count);
            foreach (SupportTicket ticket in Tickets.ToList())
            {
                base.WriteInteger(ticket.Id);
                base.WriteInteger(ticket.TabId);
                base.WriteInteger(1);               // Type
                base.WriteInteger(ticket.Category); // Category
                base.WriteInteger(((int)RocketEmulador.GetUnixTimestamp() - Convert.ToInt32(ticket.Timestamp)) * 1000);
                base.WriteInteger(ticket.Score);
                base.WriteInteger(0);
                base.WriteInteger(ticket.SenderId);
                base.WriteString(ticket.SenderName);
                base.WriteInteger(ticket.ReportedId);
                base.WriteString(ticket.ReportedName);
                base.WriteInteger((ticket.Status == TicketStatus.PICKED) ? ticket.ModeratorId : 0);
                base.WriteString(ticket.ModName);
                base.WriteString(ticket.Message);
                base.WriteInteger(0);
                base.WriteInteger(0);
            }


            base.WriteInteger(UserPresets.Count);
            foreach (string pre in UserPresets)
            {
                base.WriteString(pre);
            }


            base.WriteInteger(UserActionPresets.Count);
            foreach (KeyValuePair <string, List <ModerationPresetActionMessages> > Cat in UserActionPresets.ToList())
            {
                base.WriteString(Cat.Key);
            }


            base.WriteBoolean(true); // Ticket right
            base.WriteBoolean(true); // Chatlogs
            base.WriteBoolean(true); // User actions alert etc
            base.WriteBoolean(true); // Kick users
            base.WriteBoolean(true); // Ban users
            base.WriteBoolean(true); // Caution etc
            base.WriteBoolean(true); // Love you, Tom


            base.WriteInteger(RoomPresets.Count);
            foreach (string pre in RoomPresets)
            {
                base.WriteString(pre);
            }
        }
예제 #7
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            int UserId = Packet.PopInt();
            int RoomId = Packet.PopInt();
            int Time   = Packet.PopInt();

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (((Room.WhoCanMute == 0 && !Room.CheckRights(Session, true) && Room.Group == null) || (Room.WhoCanMute == 1 && !Room.CheckRights(Session)) && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true)))
            {
                return;
            }

            RoomUser Target = Room.GetRoomUserManager().GetRoomUserByHabbo(RocketEmulador.GetUsernameById(UserId));

            if (Target == null)
            {
                return;
            }
            else if (Target.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            if (Room.MutedUsers.ContainsKey(UserId))
            {
                if (Room.MutedUsers[UserId] < RocketEmulador.GetUnixTimestamp())
                {
                    Room.MutedUsers.Remove(UserId);
                }
                else
                {
                    return;
                }
            }

            Room.MutedUsers.Add(UserId, (RocketEmulador.GetUnixTimestamp() + (Time * 60)));

            Target.GetClient().SendNotification("A sala foi silenciado por " + Time + " minutos!");
            RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModMuteSeen", 1);
        }
        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 = (RocketEmulador.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = RocketEmulador.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("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.SendNotification("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 = RocketEmulador.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("Suas trocas foram banidas " + Days + " dia(s)!\r\rMotivo:\r\r" + Message);
            }
        }
예제 #9
0
        public GroupForumThread(GroupForum parent, int id, int userid, int timestamp, string caption, bool pinned, bool locked, int deletedlevel, int deleterid)
        {
            // desactivated for this moments
            //Game.GetClientManager().OnClientDisconnect += GroupForumThread_OnClientDisconnect;
            Views         = new List <GroupForumThreadPostView>();;
            UsersOnThread = new List <GameClient>();
            ParentForum   = parent;

            Id        = id;
            UserId    = userid;
            Timestamp = timestamp;
            Caption   = caption;
            Posts     = new List <GroupForumThreadPost>();

            Pinned           = pinned;
            Locked           = locked;
            DeletedLevel     = deletedlevel;
            DeleterUserId    = deleterid;
            DeletedTimestamp = (int)RocketEmulador.GetUnixTimestamp();

            DataTable table;

            using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                adap.SetQuery("SELECT * FROM group_forums_thread_posts WHERE thread_id = @id");
                adap.AddParameter("id", this.Id);
                table = adap.getTable();
            }

            foreach (DataRow Row in table.Rows)
            {
                Posts.Add(new GroupForumThreadPost(this, Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["timestamp"]), Row["message"].ToString(), Convert.ToInt32(Row["deleted_level"]), Convert.ToInt32(Row["deleter_user_id"])));
            }


            //DataTable table;
            using (IQueryAdapter Adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                Adap.SetQuery("SELECT * FROM group_forums_thread_views WHERE thread_id = @id");
                Adap.AddParameter("id", Id);
                table = Adap.getTable();
            }


            foreach (DataRow Row in table.Rows)
            {
                Views.Add(new GroupForumThreadPostView(Convert.ToInt32(Row["id"]), Convert.ToInt32(Row["user_id"]), Convert.ToInt32(Row["count"])));
            }
        }
예제 #10
0
        public static Pet CreatePet(int UserId, string Name, int Type, string Race, string Color)
        {
            Pet pet = new Pet(0, UserId, 0, Name, Type, Race, Color, 0, 100, 100, 0, RocketEmulador.GetUnixTimestamp(), 0, 0, 0.0, 0, 0, 0, -1, "-1");

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO bots (user_id,name, ai_type) VALUES (" + pet.OwnerId + ",@" + pet.PetId + "name, 'pet')");
                dbClient.AddParameter(pet.PetId + "name", pet.Name);
                pet.PetId = Convert.ToInt32(dbClient.InsertQuery());

                dbClient.SetQuery("INSERT INTO bots_petdata (id,type,race,color,experience,energy,createstamp) VALUES (" + pet.PetId + ", " + pet.Type + ",@" + pet.PetId + "race,@" + pet.PetId + "color,0,100,UNIX_TIMESTAMP())");
                dbClient.AddParameter(pet.PetId + "race", pet.Race);
                dbClient.AddParameter(pet.PetId + "color", pet.Color);
                dbClient.RunQuery();
            }
            return(pet);
        }
예제 #11
0
        public bool Execute(params object[] Params)
        {
            if (Params.Length != 1)
            {
                return(false);
            }

            Habbo Player = (Habbo)Params[0];

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

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

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

            if (Player.GetPermissions().HasRight("mod_tool") || this.Instance.OwnerId == Player.Id)
            {
                Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Wired Mutação: Você não pode ser mutado.", 0, 0));
                return(false);
            }

            int    Time    = (StringData != null ? int.Parse(StringData.Split(';')[0]) : 0);
            string Message = (StringData != null ? (StringData.Split(';')[1]) : "Nenhuma mensagem!");

            if (Time > 0)
            {
                Player.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "Wired Mutação: Mutado por " + Time + "! Messagem: " + Message, 0, 0));
                if (!Instance.MutedUsers.ContainsKey(Player.Id))
                {
                    Instance.MutedUsers.Add(Player.Id, (RocketEmulador.GetUnixTimestamp() + (Time * 60)));
                }
                else
                {
                    Instance.MutedUsers.Remove(Player.Id);
                    Instance.MutedUsers.Add(Player.Id, (RocketEmulador.GetUnixTimestamp() + (Time * 60)));
                }
            }

            return(true);
        }
예제 #12
0
        public GroupForumThreadPost CreatePost(int userid, string message)
        {
            var now  = (int)RocketEmulador.GetUnixTimestamp();
            var Post = new GroupForumThreadPost(this, 0, userid, now, message, 0, 0);

            using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                adap.SetQuery("INSERT INTO group_forums_thread_posts (thread_id, user_id, message, timestamp) VALUES (@a, @b, @c, @d)");
                adap.AddParameter("a", this.Id);
                adap.AddParameter("b", userid);
                adap.AddParameter("c", message);
                adap.AddParameter("d", now);
                Post.Id = (int)adap.InsertQuery();
            }

            Posts.Add(Post);
            return(Post);
        }
예제 #13
0
        public GroupForumThread CreateThread(int Creator, string Caption)
        {
            var timestamp = (int)RocketEmulador.GetUnixTimestamp();
            var Thread    = new GroupForumThread(this, 0, Creator, (int)timestamp, Caption, false, false, 0, 0);

            using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                adap.SetQuery("INSERT INTO group_forums_threads (forum_id, user_id, caption, timestamp) VALUES (@a, @b, @c, @d)");
                adap.AddParameter("a", this.Id);
                adap.AddParameter("b", Creator);
                adap.AddParameter("c", Caption);
                adap.AddParameter("d", timestamp);
                Thread.Id = (int)adap.InsertQuery();
            }

            this.Threads.Add(Thread);
            return(Thread);
        }
        public void SerializeData(ServerPacket Packet)
        {
            var User        = GetAuthor();
            var oculterData = GetDeleter();

            Packet.WriteInteger(Id);
            Packet.WriteInteger(ParentThread.Posts.IndexOf(this));

            Packet.WriteInteger(User.Id);
            Packet.WriteString(User.Username);
            Packet.WriteString(User.Look);

            Packet.WriteInteger((int)(RocketEmulador.GetUnixTimestamp() - Timestamp));
            Packet.WriteString(Message);
            Packet.WriteByte(DeletedLevel * 10);
            Packet.WriteInteger(oculterData != null ? oculterData.Id : 0);
            Packet.WriteString(oculterData != null ? oculterData.Username : "******");
            Packet.WriteInteger(242342340);
            Packet.WriteInteger(ParentThread.GetUserPosts(User.Id).Count);
        }
        public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            User.LastInteraction = RocketEmulador.GetUnixTimestamp();

            // Alright. But is this user in the right position?
            if (User.Coordinate == Item.Coordinate || User.Coordinate == Item.SquareInFront)
            {
                // Fine. But is this tele even free?
                if (Item.InteractingUser != 0)
                {
                    return;
                }

                if (!User.CanWalk || Session.GetHabbo().IsTeleporting || Session.GetHabbo().TeleporterId != 0 ||
                    (User.LastInteraction + 2) - RocketEmulador.GetUnixTimestamp() < 0)
                {
                    return;
                }

                User.TeleDelay = 2;

                Item.InteractingUser = User.GetClient().GetHabbo().Id;
            }
            else if (User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
            }
        }
예제 #16
0
        public bool TryCreateGroup(Habbo Player, string Name, string Description, int RoomId, string Badge, int Colour1, int Colour2, out Group Group)
        {
            Group = new Group(0, Name, Description, Badge, RoomId, Player.Id, (int)RocketEmulador.GetUnixTimestamp(), 0, Colour1, Colour2, 0, false);
            if (string.IsNullOrWhiteSpace(Name) || string.IsNullOrWhiteSpace(Badge))
            {
                return(false);
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `groups` (`name`, `desc`, `badge`, `owner_id`, `created`, `room_id`, `state`, `colour1`, `colour2`, `admindeco`) VALUES (@name, @desc, @badge, @owner, UNIX_TIMESTAMP(), @room, '0', @colour1, @colour2, '0')");
                dbClient.AddParameter("name", Group.Name);
                dbClient.AddParameter("desc", Group.Description);
                dbClient.AddParameter("owner", Group.CreatorId);
                dbClient.AddParameter("badge", Group.Badge);
                dbClient.AddParameter("room", Group.RoomId);
                dbClient.AddParameter("colour1", Group.Colour1);
                dbClient.AddParameter("colour2", Group.Colour2);
                Group.Id = Convert.ToInt32(dbClient.InsertQuery());

                Group.AddMember(Player.Id);
                Group.MakeAdmin(Player.Id);

                if (!this._groups.TryAdd(Group.Id, Group))
                {
                    return(false);
                }
                else
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `group_id` = @gid WHERE `id` = @rid LIMIT 1");
                    dbClient.AddParameter("gid", Group.Id);
                    dbClient.AddParameter("rid", Group.RoomId);
                    dbClient.RunQuery();

                    dbClient.RunQuery("DELETE FROM `room_rights` WHERE `room_id` = '" + RoomId + "'");
                }
            }
            return(true);
        }
        public ThreadReplyComposer(GameClient Session, GroupForumThreadPost Post)
            : base(ServerPacketHeader.ThreadReplyMessageComposer)
        {
            var User = Post.GetAuthor();

            base.WriteInteger(Post.ParentThread.ParentForum.Id);
            base.WriteInteger(Post.ParentThread.Id);

            base.WriteInteger(Post.Id);                                                   //Post Id
            base.WriteInteger(Post.ParentThread.Posts.IndexOf(Post));                     //Post Index

            base.WriteInteger(User.Id);                                                   //User id
            base.WriteString(User.Username);                                              //Username
            base.WriteString(User.Look);                                                  //User look

            base.WriteInteger((int)(RocketEmulador.GetUnixTimestamp() - Post.Timestamp)); //User message timestamp
            base.WriteString(Post.Message);                                               // Message text
            base.WriteByte(0);                                                            // User message oculted by - level
            base.WriteInteger(0);                                                         // User that oculted message ID
            base.WriteString("");                                                         //Oculted message user name
            base.WriteInteger(10);
            base.WriteInteger(Post.ParentThread.GetUserPosts(User.Id).Count);             //User messages count
        }
예제 #18
0
        public void SerializeData(GameClient Session, ServerPacket Packet)
        {
            var lastpost = GetLastMessage();
            var isn      = lastpost == null;

            Packet.WriteInteger(Id);                  // ID Discussion
            Packet.WriteInteger(GetAuthor().Id);
            Packet.WriteString(GetAuthor().Username); // Autheur de la discussion
            Packet.WriteString(Caption);              //titre de la discussion
            Packet.WriteBoolean(Pinned);
            Packet.WriteBoolean(Locked);
            Packet.WriteInteger((int)(RocketEmulador.GetUnixTimestamp() - Timestamp));
            Packet.WriteInteger(Posts.Count); //Message compte
            Packet.WriteInteger(GetUnreadMessages(Session.GetHabbo().Id));
            Packet.WriteInteger(0);

            Packet.WriteInteger(!isn ? lastpost.GetAuthor().Id : 0);
            Packet.WriteString(!isn ? lastpost.GetAuthor().Username : "");
            Packet.WriteInteger(!isn ? (int)(RocketEmulador.GetUnixTimestamp() - lastpost.Timestamp) : 0);

            Packet.WriteByte(DeletedLevel * 10);

            var deleter = GetDeleter();

            if (deleter != null)
            {
                Packet.WriteInteger(deleter.Id);
                Packet.WriteString(deleter.Username);
                Packet.WriteInteger((int)(RocketEmulador.GetUnixTimestamp() - DeletedTimestamp));
            }
            else
            {
                Packet.WriteInteger(1);
                Packet.WriteString("unknow");
                Packet.WriteInteger(0);
            }
        }
        public ThreadCreatedComposer(GameClient Session, GroupForumThread Thread)
            : base(ServerPacketHeader.ThreadCreatedMessageComposer)
        {
            base.WriteInteger(Thread.ParentForum.Id);                                       //Thread ID
            base.WriteInteger(Thread.Id);                                                   //Thread ID
            base.WriteInteger(Thread.GetAuthor().Id);
            base.WriteString(Thread.GetAuthor().Username);                                  //Thread Author
            base.WriteString(Thread.Caption);                                               //Thread Title
            base.WriteBoolean(false);                                                       //Pinned
            base.WriteBoolean(false);                                                       //Locked
            base.WriteInteger((int)(RocketEmulador.GetUnixTimestamp() - Thread.Timestamp)); //Created Secs Ago
            base.WriteInteger(Thread.Posts.Count);                                          //Message count
            base.WriteInteger(Thread.GetUnreadMessages(Session.GetHabbo().Id));             //Unread message count
            base.WriteInteger(0);                                                           // idk
            base.WriteInteger(0);                                                           // idk

            base.WriteString("Unknown");                                                    // Last User Post Username
            base.WriteInteger(65);                                                          // Last User Post time ago [Sec]

            base.WriteByte(0);                                                              //idk
            base.WriteInteger(10);                                                          // idk
            base.WriteString("Str4");                                                       //idk
            base.WriteInteger(11);                                                          //idk
        }
        public ModeratorUserInfoComposer(DataRow User, DataRow Info)
            : base(ServerPacketHeader.ModeratorUserInfoMessageComposer)
        {
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Convert.ToDouble(Info["trading_locked"]));


            base.WriteInteger(User != null ? Convert.ToInt32(User["id"]) : 0);
            base.WriteString(User != null ? Convert.ToString(User["username"]) : "Unknown");
            base.WriteString(User != null ? Convert.ToString(User["look"]) : "Unknown");
            base.WriteInteger(User != null ? Convert.ToInt32(Math.Ceiling((RocketEmulador.GetUnixTimestamp() - Convert.ToDouble(User["account_created"])) / 60)) : 0);
            base.WriteInteger(User != null ? Convert.ToInt32(Math.Ceiling((RocketEmulador.GetUnixTimestamp() - Convert.ToDouble(User["last_online"])) / 60)) : 0);
            base.WriteBoolean(User != null ? RocketEmulador.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(User["id"])) != null : false);
            base.WriteInteger(Info != null ? Convert.ToInt32(Info["cfhs"]) : 0);
            base.WriteInteger(Info != null ? Convert.ToInt32(Info["cfhs_abusive"]) : 0);
            base.WriteInteger(Info != null ? Convert.ToInt32(Info["cautions"]) : 0);
            base.WriteInteger(Info != null ? Convert.ToInt32(Info["bans"]) : 0);
            base.WriteInteger(Info != null ? Convert.ToInt32(Info["trading_locks_count"]) : 0);                               //Trading lock counts
            base.WriteString(Convert.ToDouble(Info["trading_locked"]) != 0 ? (origin.ToString("dd/MM/yyyy HH:mm:ss")) : "0"); //Trading lock
            base.WriteString("");                                                                                             //Purchases
            base.WriteInteger(0);                                                                                             //Itendity information tool
            base.WriteInteger(0);                                                                                             //Id bans.
            base.WriteString(User != null ? Convert.ToString(User["mail"]) : "Unknown");
            base.WriteString("");                                                                                             //user_classification
        }
예제 #21
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int  SignId = Packet.PopInt();
            Room Room;

            if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }


            User.UnIdle();

            User.AddStatus("sign", Convert.ToString(SignId));
            User.UpdateNeeded = true;
            User.SignTime     = RocketEmulador.GetUnixTimestamp() + 5;
        }
 public double FormatTimestamp()
 {
     return(RocketEmulador.GetUnixTimestamp() - 172800.0);
 }
예제 #23
0
        public MarketPlaceOwnOffersComposer(int UserId)
            : base(ServerPacketHeader.MarketPlaceOwnOffersMessageComposer)
        {
            int       i     = 0;
            DataTable table = null;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price, limited_number, limited_stack FROM catalog_marketplace_offers WHERE user_id = '" + UserId + "'");
                table = dbClient.getTable();

                dbClient.SetQuery("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = '" + UserId + "'");
                i = dbClient.getInteger();

                base.WriteInteger(i);
                if (table != null)
                {
                    base.WriteInteger(table.Rows.Count);
                    foreach (DataRow row in table.Rows)
                    {
                        int num2 = Convert.ToInt32(Math.Floor((double)(((((double)row["timestamp"]) + 172800.0) - RocketEmulador.GetUnixTimestamp()) / 60.0)));
                        int num3 = int.Parse(row["state"].ToString());
                        if ((num2 <= 0) && (num3 != 2))
                        {
                            num3 = 3;
                            num2 = 0;
                        }
                        base.WriteInteger(Convert.ToInt32(row["offer_id"]));
                        base.WriteInteger(num3);
                        base.WriteInteger(1);
                        base.WriteInteger(Convert.ToInt32(row["sprite_id"]));

                        base.WriteInteger(256);
                        base.WriteString("");
                        base.WriteInteger(Convert.ToInt32(row["limited_number"]));
                        base.WriteInteger(Convert.ToInt32(row["limited_stack"]));

                        base.WriteInteger(Convert.ToInt32(row["total_price"]));
                        base.WriteInteger(num2);
                        base.WriteInteger(Convert.ToInt32(row["sprite_id"]));
                    }
                }
                else
                {
                    base.WriteInteger(0);
                }
            }
        }
예제 #24
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            var int1 = Packet.PopInt();
            var int2 = Packet.PopInt();
            int int3 = Packet.PopInt();



            var       forums = new List <GroupForum>();
            DataTable table;

            switch (int1)
            {
            case 2:
                var Forums = RocketEmulador.GetGame().GetGroupForumManager().GetForumsByUserId(Session.GetHabbo().Id);

                if (Forums.Count - 1 >= int2)
                {
                    Forums = Forums.GetRange(int2, Math.Min(int3, Forums.Count));
                }
                Session.SendMessage(new ForumsListDataComposer(Forums, Session, int1, int2, int3));
                return;

            case 0:


                using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_posts as posts, group_forums_threads as threads WHERE posts.thread_id = threads.id AND @now - posts.`timestamp`<= @sdays AND threads.forum_id = g.id GROUP BY g.id ORDER BY posts.`timestamp` DESC LIMIT @index, @limit");
                    adap.AddParameter("limit", int3);
                    adap.AddParameter("index", int2);
                    adap.AddParameter("now", (int)RocketEmulador.GetUnixTimestamp());
                    adap.AddParameter("sdays", (60 * 60 * 24 * 7));
                    table = adap.getTable();
                }



                foreach (DataRow Row in table.Rows)
                {
                    GroupForum forum;
                    if (RocketEmulador.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum))
                    {
                        forums.Add(forum);
                    }
                }
                break;

            case 1:
                using (IQueryAdapter adap = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_views as v, group_forums_threads as threads WHERE v.thread_id = threads.id AND threads.forum_id = g.id AND  @now - v.`timestamp` <= @sdays GROUP BY g.id ORDER BY v.`timestamp` DESC LIMIT @index, @limit");
                    adap.AddParameter("limit", int3);
                    adap.AddParameter("index", int2);
                    adap.AddParameter("now", (int)RocketEmulador.GetUnixTimestamp());
                    adap.AddParameter("sdays", (60 * 60 * 24 * 7));

                    table = adap.getTable();
                }



                foreach (DataRow Row in table.Rows)
                {
                    GroupForum forum;
                    if (RocketEmulador.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum))
                    {
                        forums.Add(forum);
                    }
                }
                break;
            }

            Session.SendMessage(new ForumsListDataComposer(forums, Session, int1, int2, int3));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            //0 = sent, 1 = blocked, 2 = no chat, 3 = already reported.
            if (Session == null)
            {
                return;
            }

            int UserId = Packet.PopInt();

            if (UserId == Session.GetHabbo().Id)//Hax
            {
                return;
            }

            if (Session.GetHabbo().AdvertisingReportedBlocked)
            {
                Session.SendMessage(new SubmitBullyReportComposer(1));//This user is blocked from reporting.
                return;
            }

            GameClient Client = RocketEmulador.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(UserId));

            if (Client == null)
            {
                Session.SendMessage(new SubmitBullyReportComposer(0));//Just say it's sent, the user isn't found.
                return;
            }

            if (Session.GetHabbo().LastAdvertiseReport > RocketEmulador.GetUnixTimestamp())
            {
                Session.SendNotification("Reports can only be sent per 5 minutes!");
                return;
            }

            if (Client.GetHabbo().GetPermissions().HasRight("mod_tool"))//Reporting staff, nope!
            {
                Session.SendNotification("Sorry, you cannot report staff members via this tool.");
                return;
            }

            //This user hasn't even said a word, nope!
            if (!Client.GetHabbo().HasSpoken)
            {
                Session.SendMessage(new SubmitBullyReportComposer(2));
                return;
            }

            //Already reported, nope.
            if (Client.GetHabbo().AdvertisingReported&& Session.GetHabbo().Rank < 2)
            {
                Session.SendMessage(new SubmitBullyReportComposer(3));
                return;
            }

            if (Session.GetHabbo().Rank <= 1)
            {
                Session.GetHabbo().LastAdvertiseReport = RocketEmulador.GetUnixTimestamp() + 300;
            }
            else
            {
                Session.GetHabbo().LastAdvertiseReport = RocketEmulador.GetUnixTimestamp();
            }

            Client.GetHabbo().AdvertisingReported = true;
            Session.SendMessage(new SubmitBullyReportComposer(0));
            RocketEmulador.GetGame().GetClientManager().ModAlert("New advertising report! " + Client.GetHabbo().Username + " has been reported for advertising by " + Session.GetHabbo().Username + ".");
            RocketEmulador.GetGame().GetClientManager().DoAdvertisingReport(Session, Client);
            return;
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban"))
            {
                return;
            }

            int    UserId     = Packet.PopInt();
            string Message    = Packet.PopString();
            double Length     = (Packet.PopInt() * 3600) + RocketEmulador.GetUnixTimestamp();
            string Unknown1   = Packet.PopString();
            string Unknown2   = Packet.PopString();
            bool   IPBan      = Packet.PopBoolean();
            bool   MachineBan = Packet.PopBoolean();

            if (MachineBan)
            {
                IPBan = false;
            }

            Habbo Habbo = RocketEmulador.GetHabboById(UserId);

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

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendNotification("Oops, you cannot ban that user.");
                return;
            }

            Message = (Message != null ? Message : "No reason specified.");

            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (IPBan == false && MachineBan == false)
            {
                RocketEmulador.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
            }
            else if (IPBan == true)
            {
                RocketEmulador.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
            }
            else if (MachineBan == true)
            {
                RocketEmulador.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
                RocketEmulador.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
                RocketEmulador.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length);
            }

            GameClient TargetClient = RocketEmulador.GetGame().GetClientManager().GetClientByUsername(Habbo.Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }
        }
예제 #27
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (User == null)
            {
                return;
            }

            string NewName = Packet.PopString();
            string OldName = Session.GetHabbo().Username;

            if (NewName == OldName)
            {
                Session.GetHabbo().ChangeName(OldName);
                Session.SendMessage(new UpdateUsernameComposer(NewName));
                return;
            }

            if (!CanChangeName(Session.GetHabbo()))
            {
                Session.SendNotification("Ops, parece que você atualmente não pode alterar seu nome de usuário!");
                return;
            }

            bool InUse = false;

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT COUNT(0) FROM `users` WHERE `username` = @name LIMIT 1");
                dbClient.AddParameter("name", NewName);
                InUse = dbClient.getInteger() == 1;
            }

            char[] Letters           = NewName.ToLower().ToCharArray();
            string AllowedCharacters = "abcdefghijklmnopqrstuvwxyz.,_-;:?!1234567890";

            foreach (char Chr in Letters)
            {
                if (!AllowedCharacters.Contains(Chr))
                {
                    return;
                }
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && NewName.ToLower().Contains("mod") || NewName.ToLower().Contains("adm") || NewName.ToLower().Contains("admin") ||
                NewName.ToLower().Contains("m0d") || NewName.ToLower().Contains("mob") || NewName.ToLower().Contains("Hotel") || NewName.ToLower().Contains("m0b"))
            {
                return;
            }
            else if (!NewName.ToLower().Contains("mod") && (Session.GetHabbo().Rank == 2 || Session.GetHabbo().Rank == 3))
            {
                return;
            }
            else if (NewName.Length > 15)
            {
                return;
            }
            else if (NewName.Length < 3)
            {
                return;
            }
            else if (InUse)
            {
                return;
            }
            else
            {
                if (!RocketEmulador.GetGame().GetClientManager().UpdateClientUsername(Session, OldName, NewName))
                {
                    Session.SendNotification("Ups! Ocorreu um problema ao atualizar seu nome de usuário.");
                    return;
                }

                Session.GetHabbo().ChangingName = false;

                Room.GetRoomUserManager().RemoveUserFromRoom(Session, true, false);

                Session.GetHabbo().ChangeName(NewName);
                Session.GetHabbo().GetMessenger().OnStatusChanged(true);

                Session.SendMessage(new UpdateUsernameComposer(NewName));
                Room.SendMessage(new UserNameChangeComposer(Room.Id, User.VirtualId, NewName));

                using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("INSERT INTO `logs_client_namechange` (`user_id`,`new_name`,`old_name`,`timestamp`) VALUES ('" + Session.GetHabbo().Id + "', @name, '" + OldName + "', '" + RocketEmulador.GetUnixTimestamp() + "')");
                    dbClient.AddParameter("name", NewName);
                    dbClient.RunQuery();
                }

                ICollection <RoomData> Rooms = Session.GetHabbo().UsersRooms;
                foreach (RoomData Data in Rooms)
                {
                    if (Data == null)
                    {
                        continue;
                    }

                    Data.OwnerName = NewName;
                }

                foreach (Room UserRoom in RocketEmulador.GetGame().GetRoomManager().GetRooms().ToList())
                {
                    if (UserRoom == null || UserRoom.RoomData.OwnerName != NewName)
                    {
                        continue;
                    }

                    UserRoom.OwnerName          = NewName;
                    UserRoom.RoomData.OwnerName = NewName;

                    UserRoom.SendMessage(new RoomInfoUpdatedComposer(UserRoom.RoomId));
                }

                RocketEmulador.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Name", 1);

                Session.SendMessage(new RoomForwardComposer(Room.Id));
            }
        }
예제 #28
0
        private static bool CanChangeName(Habbo Habbo)
        {
            if (Habbo.Rank == 1 && Habbo.VIPRank == 0 && Habbo.LastNameChange == 0)
            {
                return(true);
            }
            else if (Habbo.Rank == 1 && Habbo.VIPRank == 1 && (Habbo.LastNameChange == 0 || (RocketEmulador.GetUnixTimestamp() + 604800) > Habbo.LastNameChange))
            {
                return(true);
            }
            else if (Habbo.Rank == 1 && Habbo.VIPRank == 2 && (Habbo.LastNameChange == 0 || (RocketEmulador.GetUnixTimestamp() + 86400) > Habbo.LastNameChange))
            {
                return(true);
            }
            else if (Habbo.Rank == 1 && Habbo.VIPRank == 3)
            {
                return(true);
            }
            else if (Habbo.GetPermissions().HasRight("mod_tool"))
            {
                return(true);
            }

            return(false);
        }
예제 #29
0
        public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Session == null)
            {
                return;
            }

            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (Item.InteractingUser2 != User.UserId)
            {
                Item.InteractingUser2 = User.UserId;
            }

            if (User == null)
            {
                return;
            }
            if (Item.GetBaseItem().InteractionType == InteractionType.ONE_WAY_GATE)
            {
                if (User.Coordinate != Item.SquareInFront && User.CanWalk)
                {
                    User.MoveTo(Item.SquareInFront);
                    return;
                }
                if (!Item.GetRoom().GetGameMap().ValidTile(Item.SquareBehind.X, Item.SquareBehind.Y) ||
                    !Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, false) ||
                    !Item.GetRoom().GetGameMap().SquareIsOpen(Item.SquareBehind.X, Item.SquareBehind.Y, false))
                {
                    return;
                }

                if ((User.LastInteraction - RocketEmulador.GetUnixTimestamp() < 0) && User.InteractingGate &&
                    User.GateId == Item.Id)
                {
                    User.InteractingGate = false;
                    User.GateId          = 0;
                }


                if (!Item.GetRoom().GetGameMap().CanWalk(Item.SquareBehind.X, Item.SquareBehind.Y, User.AllowOverride))
                {
                    return;
                }

                if (Item.InteractingUser == 0)
                {
                    User.InteractingGate = true;
                    User.GateId          = Item.Id;
                    Item.InteractingUser = User.HabboId;

                    User.CanWalk = false;

                    if (User.IsWalking && (User.GoalX != Item.SquareInFront.X || User.GoalY != Item.SquareInFront.Y))
                    {
                        User.ClearMovement(true);
                    }

                    User.AllowOverride = true;
                    User.MoveTo(Item.Coordinate);

                    Item.RequestUpdate(4, true);
                }
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (Session.GetHabbo().InRoom)
            {
                Room OldRoom;

                if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out OldRoom))
                {
                    return;
                }

                if (OldRoom.GetRoomUserManager() != null)
                {
                    OldRoom.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
                }
            }

            if (!Room.GetRoomUserManager().AddAvatarToRoom(Session))
            {
                Room.GetRoomUserManager().RemoveUserFromRoom(Session, false, false);
                return;//TODO: Remove?
            }

            Room.SendObjects(Session);

            //Status updating for messenger, do later as buggy.

            try
            {
                if (Session.GetHabbo().GetMessenger() != null)
                {
                    Session.GetHabbo().GetMessenger().OnStatusChanged(true);
                }
            }
            catch { }

            if (Session.GetHabbo().GetStats().QuestID > 0)
            {
                RocketEmulador.GetGame().GetQuestManager().QuestReminder(Session, Session.GetHabbo().GetStats().QuestID);
            }

            Session.SendMessage(new RoomEntryInfoComposer(Room.RoomId, Room.CheckRights(Session, true)));
            Session.SendMessage(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, RocketEmulador.EnumToBool(Room.Hidewall.ToString())));

            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (ThisUser != null && Session.GetHabbo().PetId == 0)
            {
                Room.SendMessage(new UserChangeComposer(ThisUser, false));
            }

            Session.SendMessage(new RoomEventComposer(Room.RoomData, Room.RoomData.Promotion));

            if (Room.GetWired() != null)
            {
                Room.GetWired().TriggerEvent(WiredBoxType.TriggerRoomEnter, Session.GetHabbo());
            }

            if (RocketEmulador.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                Session.SendMessage(new FloodControlComposer((int)Session.GetHabbo().FloodTime - (int)RocketEmulador.GetUnixTimestamp()));
            }

            if (Room.OwnerId == Session.GetHabbo().Id)
            {
                DataRow dFrank = null;
                using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT bot_frank FROM users WHERE id = '" + Session.GetHabbo().Id + "'");
                    dFrank = dbClient.getRow();
                }

                if (Convert.ToBoolean(dFrank["bot_frank"]) == false)
                {
                    using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("UPDATE users SET bot_frank = 'true' WHERE id = " + Session.GetHabbo().Id + ";");
                        dbClient.RunQuery("UPDATE users SET bot_user = '******' WHERE id = " + Session.GetHabbo().Id + ";");
                    }
                    string Chat1    = RocketEmulador.GetDBConfig().DBData["frank.chat.1"];
                    string Chat2    = RocketEmulador.GetDBConfig().DBData["frank.chat.2"];
                    string Chat3    = RocketEmulador.GetDBConfig().DBData["frank.chat.3"];
                    string Chat4    = RocketEmulador.GetDBConfig().DBData["frank.chat.4"];
                    string Chat5    = RocketEmulador.GetDBConfig().DBData["frank.chat.5"];
                    string Credits  = RocketEmulador.GetDBConfig().DBData["frank.give.credits"];
                    string Diamonds = RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"];
                    string Duckets  = RocketEmulador.GetDBConfig().DBData["frank.give.duckets"];
                    string Gotws    = RocketEmulador.GetDBConfig().DBData["frank.give.gotws"];
                    string Furni    = RocketEmulador.GetDBConfig().DBData["frank.give.furni"];

                    List <RandomSpeech> BotSpeechList = new List <RandomSpeech>();
                    Console.WriteLine("Só se mostra bot e nuxs 1 vez por usuario.");
                    int      X       = 0;
                    int      Y       = 0;
                    string   hola    = "false";
                    RoomUser BotUser = Room.GetRoomUserManager().DeployBot(new RoomBot(0, Session.GetHabbo().CurrentRoomId, "generic", "freeroam", "Frank", "Gerente do hotel", "hr-3194-38-36.hd-180-1.ch-220-1408.lg-285-73.sh-906-90.ha-3129-73.fa-1206-73.cc-3039-73", X, Y, 0, 4, 0, 0, 0, 0, ref BotSpeechList, "", 0, 0, false, 0, Convert.ToBoolean(hola), 1), null);
                    System.Threading.Thread.Sleep(4000); // Mensagem de Boas vindas.
                    BotUser.Chat(Chat1, false, 0);
                    System.Threading.Thread.Sleep(3000); // Segunda mensagem
                    BotUser.Chat(Chat2, false, 0);
                    System.Threading.Thread.Sleep(2000); // Terceira mensagem e entrega das moedas
                    if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets, " + Gotws + " estrelas e nubes!", false, 0);
                        Session.GetHabbo().Credits    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds   += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets) && !string.IsNullOrWhiteSpace(Gotws))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes, " + Duckets + " duckets e " + Gotws + " estrelas!", false, 0);
                        Session.GetHabbo().Credits    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds   += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets    += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.GetHabbo().GOTWPoints += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.gotws"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds) && !string.IsNullOrWhiteSpace(Duckets))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos, " + Diamonds + " diamantes e " + Duckets + " duckets!", false, 0);
                        Session.GetHabbo().Credits  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.GetHabbo().Duckets  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.duckets"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits) && !string.IsNullOrWhiteSpace(Diamonds))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos e " + Diamonds + " diamantes!", false, 0);
                        Session.GetHabbo().Credits  += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.GetHabbo().Diamonds += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.diamonds"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                        Session.SendMessage(new ActivityPointsComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Diamonds, Session.GetHabbo().GOTWPoints));
                    }
                    else if (!string.IsNullOrWhiteSpace(Credits))
                    {
                        BotUser.Chat("Você tem " + Credits + " créditos!", false, 0);
                        Session.GetHabbo().Credits += Convert.ToInt32(RocketEmulador.GetDBConfig().DBData["frank.give.credits"]);
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                    else
                    {
                        BotUser.Chat("Não iremos te dar nada por enquanto.", false, 0);
                    }
                    if (!string.IsNullOrWhiteSpace(Chat4) || !string.IsNullOrEmpty(Furni))
                    {
                        System.Threading.Thread.Sleep(4000); // Quarta mensagen, entregando o raro.
                        BotUser.Chat(Chat4, false, 0);
                        DataRow dFurni = null;
                        using (var dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.SetQuery("SELECT public_name FROM furniture WHERE id = '" + Convert.ToInt32(Furni) + "'");
                            dFurni = dbClient.getRow();
                        }
                        Session.GetHabbo().GetInventoryComponent().AddNewItem(0, Convert.ToInt32(Furni), Convert.ToString(dFurni["public_name"]), 1, true, false, 0, 0);
                        Session.GetHabbo().GetInventoryComponent().UpdateItems(false);
                    }
                    System.Threading.Thread.Sleep(5000); // Quinta mensagem.
                    BotUser.Chat(Chat5, false, 0);
                    Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(0, 0));
                    Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
                }
                else
                {
                    Console.WriteLine("O Bot não irá mais aparecer para esse usuário.");
                }
            }
        }