Ejemplo n.º 1
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            var forumId     = Packet.PopInt();
            var threadId    = Packet.PopInt();
            var postId      = Packet.PopInt();
            var deleteLevel = Packet.PopInt();

            var forum = CloudServer.GetGame().GetGroupForumManager().GetForum(forumId);

            var thread = forum.GetThread(threadId);

            var post = thread.GetPost(postId);

            post.DeletedLevel = deleteLevel / 10;
            post.DeleterId    = Session.GetHabbo().Id;
            post.Save();
            Session.SendMessage(new PostUpdatedComposer(Session, post));

            if (post.DeletedLevel != 0)
            {
                Session.SendMessage(new RoomNotificationComposer("forums.message.hidden"));
            }
            else
            {
                Session.SendMessage(new RoomNotificationComposer("forums.message.restored"));
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int GroupId = Packet.PopInt();
            int UserId  = Packet.PopInt();

            Group Group = null;

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

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

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

            Group.HandleRequest(UserId, false);
            Session.SendMessage(new UnknownGroupComposer(Group.Id, UserId));
        }
Ejemplo n.º 3
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            string Category = packet.PopString();
            string Search   = packet.PopString();

            ICollection <SearchResultList> Categories = new List <SearchResultList>();

            if (!string.IsNullOrEmpty(Search))
            {
                SearchResultList QueryResult = null;
                if (CloudServer.GetGame().GetNavigator().TryGetSearchResultList(0, out QueryResult))
                {
                    Categories.Add(QueryResult);
                }
            }
            else
            {
                Categories = CloudServer.GetGame().GetNavigator().GetCategorysForSearch(Category);
                if (Categories.Count == 0)
                {
                    //Are we going in deep?!
                    Categories = CloudServer.GetGame().GetNavigator().GetResultByIdentifier(Category);
                    if (Categories.Count > 0)
                    {
                        session.SendMessage(new NavigatorSearchResultSetComposer(Category, Search, Categories, session, 2, 100));
                        return;
                    }
                }
            }

            session.SendMessage(new NavigatorSearchResultSetComposer(Category, Search, Categories, session));
        }
Ejemplo n.º 4
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Debe especificar un identificador de habitación!");
                return;
            }

            int roomId = 0;

            if (!int.TryParse(Params[1], out roomId))
            {
                Session.SendWhisper("You must enter a valid room ID");
            }
            else
            {
                Room room = null;
                if (!CloudServer.GetGame().GetRoomManager().TryGetRoom(roomId, out room))
                {
                    Session.SendWhisper("This room does not exist!");
                    return;
                }

                Session.GetHabbo().PrepareRoom(room.Id, "");
            }
        }
Ejemplo n.º 5
0
        public bool TryExecute(string[] parameters)
        {
            int userId = 0;

            if (!int.TryParse(parameters[0].ToString(), out userId))
            {
                return(false);
            }

            GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client == null || client.GetHabbo() == null)
            {
                return(false);
            }

            // Validate the badge
            if (string.IsNullOrEmpty(Convert.ToString(parameters[1])))
            {
                return(false);
            }

            string badge = Convert.ToString(parameters[1]);

            if (client != null)
            {
                if (!client.GetHabbo().GetBadgeComponent().HasBadge(badge))
                {
                    client.SendMessage(RoomNotificationComposer.SendBubble("badge/" + badge, "Acabas de recibir una placa!", "/inventory/open/badge"));
                    client.GetHabbo().GetBadgeComponent().GiveBadge(badge, true, client);
                }
            }
            return(true);
        }
Ejemplo n.º 6
0
        private void OnRoomCrash(Exception e)
        {
            ExceptionLogger.LogThreadException(e);

            try
            {
                foreach (RoomUser user in _roomUserManager.GetRoomUsers().ToList())
                {
                    if (user == null || user.GetClient() == null)
                    {
                        continue;
                    }

                    user.GetClient().SendNotification("O quarto a apenas crashear, entre em contato com um administrador.");//Unhandled exception in room: " + e);

                    try
                    {
                        GetRoomUserManager().RemoveUserFromRoom(user.GetClient(), true, false);
                    }
                    catch (Exception e2) { ExceptionLogger.LogException(e2); }
                }
            }
            catch (Exception e3) { ExceptionLogger.LogException(e3); }

            isCrashed = true;
            CloudServer.GetGame().GetRoomManager().UnloadRoom(this, true);
        }
Ejemplo n.º 7
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (Session != null)
            {
                if (Room != null)
                {
                    if (Params.Length == 1)
                    {
                        Session.SendWhisper("Por favor, digite uma mensagem para enviar.");
                        return;
                    }
                    else
                    {
                        string Message = CommandManager.MergeParams(Params, 1);

                        CloudServer.GetGame().GetClientManager().SendMessage(new RoomNotificationComposer("Novo Evento no Hotel ",
                                                                                                          "<font color=\"#00adff\"> <b>" + Session.GetHabbo().Username + "</b></font> Esta organizando um novo Evento!<br><br>" +
                                                                                                          "Quer particpar desse jogo ? Clique no botão inferior  <b>Ir ao Evento</b>, e você pode participar, siga as instruções!<br><br>" +
                                                                                                          "Qual Evento é?<br><br>" +
                                                                                                          "<font color=\"#f11648\"><b>" + Message + "</b></font><br><br>" +
                                                                                                          "Te esperamos de braços abertos, " + CloudServer.HotelName + "!",
                                                                                                          NotificationSettings.NOTIFICATION_EVENT_IMG, "Ir ao Evento", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

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

            if (!Room.CanTradeInRoom)
            {
                return;
            }

            Trade Trade = Room.GetUserTrade(Session.GetHabbo().Id);

            if (Trade == null)
            {
                return;
            }

            Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Packet.PopInt());

            if (Item == null)
            {
                return;
            }

            Trade.TakeBackItem(Session.GetHabbo().Id, Item);
        }
Ejemplo n.º 9
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            long nowTime     = CloudServer.CurrentTimeMillis();
            long timeBetween = nowTime - Session.GetHabbo()._lastTimeUsedHelpCommand;

            if (timeBetween < 60000)
            {
                Session.SendMessage(RoomNotificationComposer.SendBubble("abuse", "Espere pelo menos 1 minuto para reutilizar o sistema de apoio", ""));
                return;
            }

            Session.GetHabbo()._lastTimeUsedHelpCommand = nowTime;
            string Request = CommandManager.MergeParams(Params, 1);

            if (Params.Length == 1)
            {
                Session.SendMessage(new RoomNotificationComposer("Sistema de suporte:", "<font color='#B40404'><b>¡Atenção, " + Session.GetHabbo().Username + "!</b></font>\n\n<font size=\"11\" color=\"#1C1C1C\">O sistema de suporte foi criado para fazer solicitações detalhadas de ajuda. Então você não pode enviar uma mensagem vazia porque é inútil.\n\n" +
                                                                 "Se você quiser pedir ajuda, descrever <font color='#B40404'> <b> detalhadamente o seu problema</b></font>. \n\nO sistema detecta se você abusar estes pedidos, então não enviar mais do que um ou você será bloqueado.\n\n" +
                                                                 "Lembre-se que você também tem ajuda central para resolver seus problemas.", "help_user", ""));
                return;
            }
            else
            {
                CloudServer.GetGame().GetClientManager().GuideAlert(new RoomNotificationComposer("¡Novo caso de atenção!",
                                                                                                 "O usuario " + Session.GetHabbo().Username + " Ele requer a ajuda de um guia, o embaixador ou moderador.<br></font></b><br>Sua pergunta ou problema é este:<br><b>s"
                                                                                                 + Request + "</b></font><br><br>Atender ao usuário mais rapidamente possível para resolver a sua pergunta, lembre-se que em breve sua ajuda vai ser marcado e que serão considerados para a promoção.", "Ajude-me", "Seguir a " + Session.GetHabbo().Username + "", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
            }

            CloudServer.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GuideEnrollmentLifetime", 1);
            Session.SendMessage(RoomNotificationComposer.SendBubble("ambassador", "Seu pedido de ajuda foi enviada com sucesso, aguarde.", ""));
        }
Ejemplo n.º 10
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            int goal        = int.Parse(CloudServer.GetGame().GetSettingsManager().TryGetValue("usersconcurrent_goal"));;
            int UsersOnline = CloudServer.GetGame().GetClientManager().Count;

            foreach (GameClient Target in CloudServer.GetGame().GetClientManager().GetClients.ToList())
            {
                if (UsersOnline < goal)
                {
                    int type = 1;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else if (!Target.GetHabbo().GetStats().PurchaseUsersConcurrent&& UsersOnline >= goal)
                {
                    int type = 2;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else if (Target.GetHabbo().GetStats().PurchaseUsersConcurrent&& UsersOnline >= goal)
                {
                    int type = 3;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
                else
                {
                    int type = 0;
                    Target.SendMessage(new ConcurrentUsersGoalProgressComposer(UsersOnline, type, goal));
                }
            }
        }
Ejemplo n.º 11
0
        public HabboSearchResultComposer(List <SearchResult> Friends, List <SearchResult> OtherUsers)
            : base(ServerPacketHeader.HabboSearchResultMessageComposer)
        {
            WriteInteger(Friends.Count);
            foreach (SearchResult Friend in Friends.ToList())
            {
                bool Online = (CloudServer.GetGame().GetClientManager().GetClientByUserID(Friend.UserId) != null);

                WriteInteger(Friend.UserId);
                WriteString(Friend.Username);
                WriteString(Friend.Motto);
                WriteBoolean(Online);
                WriteBoolean(false);
                WriteString(string.Empty);
                WriteInteger(0);
                WriteString(Online ? Friend.Figure : "");
                WriteString(Friend.LastOnline);
            }

            WriteInteger(OtherUsers.Count);
            foreach (SearchResult OtherUser in OtherUsers.ToList())
            {
                bool Online = (CloudServer.GetGame().GetClientManager().GetClientByUserID(OtherUser.UserId) != null);

                WriteInteger(OtherUser.UserId);
                WriteString(OtherUser.Username);
                WriteString(OtherUser.Motto);
                WriteBoolean(Online);
                WriteBoolean(false);
                WriteString(string.Empty);
                WriteInteger(0);
                WriteString(Online ? OtherUser.Figure : "");
                WriteString(OtherUser.LastOnline);
            }
        }
Ejemplo n.º 12
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int userID = Packet.PopInt();

            Habbo targetData = CloudServer.GetHabboById(userID);

            if (targetData == null)
            {
                Session.SendNotification("Ocorreu um erro ao encontrar o perfil do usuário.");
                return;
            }

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

            int friendCount = 0;

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)");
                dbClient.AddParameter("userid", userID);
                friendCount = dbClient.getInteger();
            }

            Session.SendMessage(new ProfileInformationComposer(targetData, Session, groups, friendCount));
        }
Ejemplo n.º 13
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Please enter the username of the user you would like to unmute.");
                return;
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null || TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '0' WHERE `id` = '" + TargetClient.GetHabbo().Id + "' LIMIT 1");
            }

            TargetClient.GetHabbo().TimeMuted = 0;
            TargetClient.SendNotification("You have been un-muted by " + Session.GetHabbo().Username + "!");
            Session.SendWhisper("You have successfully un-muted " + TargetClient.GetHabbo().Username + "!");
        }
Ejemplo n.º 14
0
        public bool TryExecute(string[] parameters)
        {
            int userId = 0;

            if (!int.TryParse(parameters[0].ToString(), out userId))
            {
                return(false);
            }

            GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client == null || client.GetHabbo() == null)
            {
                return(false);
            }

            // Validate the badge
            if (string.IsNullOrEmpty(Convert.ToString(parameters[1])))
            {
                return(false);
            }

            string badge = Convert.ToString(parameters[1]);

            if (client.GetHabbo().GetBadgeComponent().HasBadge(badge))
            {
                client.GetHabbo().GetBadgeComponent().RemoveBadge(badge);
            }
            return(true);
        }
Ejemplo n.º 15
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario.");
                return;
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario, tal vez no están en línea.");
                return;
            }

            if (TargetClient.GetHabbo() == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario, tal vez no están en línea.");
                return;
            }

            if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
            {
                Session.SendWhisper("Consigue una vida.");
                return;
            }

            string Message = CommandManager.MergeParams(Params, 2);

            TargetClient.SendMessage(new RoomNotificationComposer("command_gmessage", "message", "" + Message + "!"));
            Session.SendMessage(new RoomNotificationComposer("command_gmessage", "message", "Mensaje enviado con éxito para " + TargetClient.GetHabbo().Username));
        }
Ejemplo n.º 16
0
        internal static void Process(object caller)
        {
            if (lowPriorityProcessWatch.ElapsedMilliseconds >= 10000 || !isExecuted)
            {
                isExecuted = true;
                lowPriorityProcessWatch.Restart();

                var clientCount      = CloudServer.GetGame().GetClientManager().Count;
                var loadedRoomsCount = CloudServer.GetGame().GetRoomManager().Count;
                var Uptime           = DateTime.Now - CloudServer.ServerStarted;
                Game.SessionUserRecord = clientCount > Game.SessionUserRecord ? clientCount : Game.SessionUserRecord;
                Console.Title          = string.Concat("Cloud Server [" + CloudServer.HotelName + "] » [" + clientCount + "] ON » [" + loadedRoomsCount + "] SALAS » [" + Uptime.Days + "] DÍAS » [" + Uptime.Hours + "] HORAS");

                using (var queryReactor = CloudServer.GetDatabaseManager().GetQueryReactor())
                {
                    if (clientCount > _userPeak)
                    {
                        _userPeak = clientCount;
                    }

                    _lastDate = DateTime.Now.ToShortDateString();
                    queryReactor.runFastQuery(string.Concat("UPDATE `server_status` SET `status` = '2', `users_online` = '", clientCount, "', `loaded_rooms` = '", loadedRoomsCount, "'"));
                }
            }
        }
Ejemplo n.º 17
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            var room = Session.GetHabbo().CurrentRoom;

            using (var queryReactor = CloudServer.GetDatabaseManager().GetQueryReactor())
                queryReactor.runFastQuery(string.Format("UPDATE rooms SET roomtype = 'private' WHERE id = {0}",
                                                        room.RoomId));

            var roomId = Session.GetHabbo().CurrentRoom.RoomId;
            var users  = new List <RoomUser>(Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUsers().ToList());

            CloudServer.GetGame().GetRoomManager().UnloadRoom(Session.GetHabbo().CurrentRoom);

            RoomData Data = CloudServer.GetGame().GetRoomManager().GenerateRoomData(roomId);

            Session.GetHabbo().PrepareRoom(Session.GetHabbo().CurrentRoom.RoomId, "");

            CloudServer.GetGame().GetRoomManager().LoadRoom(roomId);

            var data = new RoomForwardComposer(roomId);

            foreach (var user in users.Where(user => user != null && user.GetClient() != null))
            {
                user.GetClient().SendMessage(data);
            }
        }
Ejemplo n.º 18
0
        public bool TryExecute(string[] parameters)
        {
            int userId = 0;

            if (!int.TryParse(parameters[0].ToString(), out userId))
            {
                return(false);
            }

            GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client == null || client.GetHabbo() == null)
            {
                return(false);
            }

            // Validate the achievement
            if (string.IsNullOrEmpty(Convert.ToString(parameters[1])))
            {
                return(false);
            }

            string achievement = Convert.ToString(parameters[1]);

            // Validate the progress
            int progress = 0;

            if (!int.TryParse(parameters[2].ToString(), out progress))
            {
                return(false);
            }

            CloudServer.GetGame().GetAchievementManager().ProgressAchievement(client, achievement, progress);
            return(true);
        }
Ejemplo n.º 19
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }


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

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

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

            Session.GetHabbo().IsTeleporting     = false;
            Session.GetHabbo().TeleportingRoomID = 0;
            Session.GetHabbo().TeleporterId      = 0;
            Session.GetHabbo().CurrentRoomId     = 0;
        }
Ejemplo n.º 20
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room;

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

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

            if (User == null)
            {
                return;
            }

            if (User.CarryItemID > 0 && User.CarryTimer > 0)
            {
                User.CarryItem(0);
            }
        }
Ejemplo n.º 21
0
        public bool TryExecute(string[] parameters)
        {
            int userId = 0;

            if (!int.TryParse(parameters[0].ToString(), out userId))
            {
                return(false);
            }

            GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client == null || client.GetHabbo() == null)
            {
                return(false);
            }

            // Validate the message
            if (string.IsNullOrEmpty(Convert.ToString(parameters[1])))
            {
                return(false);
            }

            string message = Convert.ToString(parameters[1]);

            client.SendMessage(new BroadcastMessageAlertComposer(message));
            return(true);
        }
Ejemplo n.º 22
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_kick"))
            {
                return;
            }

            int    UserId  = Packet.PopInt();
            string Message = Packet.PopString();

            GameClient Client = CloudServer.GetGame().GetClientManager().GetClientByUserID(UserId);

            if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId < 1 || Client.GetHabbo().Id == Session.GetHabbo().Id)
            {
                return;
            }

            if (Client.GetHabbo().Rank >= Session.GetHabbo().Rank)
            {
                Session.SendNotification(CloudServer.GetGame().GetLanguageManager().TryGetValue("moderation.kick.disallowed"));
                return;
            }

            Room Room = null;

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

            Room.GetRoomUserManager().RemoveUserFromRoom(Client, true, false);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Room Room = null;

            if (!CloudServer.GetGame().GetRoomManager().TryGetRoom(Packet.PopInt(), out Room))
            {
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                return;
            }

            int CategoryId    = Packet.PopInt();
            int TradeSettings = Packet.PopInt();

            if (TradeSettings < 0 || TradeSettings > 2)
            {
                TradeSettings = 0;
            }

            SearchResultList SearchResultList = null;

            if (!CloudServer.GetGame().GetNavigator().TryGetSearchResultList(CategoryId, out SearchResultList))
            {
                CategoryId = 36;
            }

            if (SearchResultList.CategoryType != NavigatorCategoryType.CATEGORY || SearchResultList.RequiredRank > Session.GetHabbo().Rank)
            {
                CategoryId = 36;
            }
        }
Ejemplo n.º 24
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario del usuario que desea congelar.");
                return;
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario, tal vez no están en línea.");
                return;
            }

            RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Params[1]);

            if (TargetUser != null)
            {
                TargetUser.Frozen = true;
            }

            Session.SendWhisper("Se congelo exitosamente a " + TargetClient.GetHabbo().Username + "!");
        }
Ejemplo n.º 25
0
 public GetRelationshipsComposer(Habbo Habbo, int Loves, int Likes, int Hates)
     : base(ServerPacketHeader.GetRelationshipsMessageComposer)
 {
     WriteInteger(Habbo.Id);
     WriteInteger(Habbo.Relationships.Count);             // Count
     foreach (Relationship Rel in Habbo.Relationships.Values)
     {
         UserCache HHab = CloudServer.GetGame().GetCacheManager().GenerateUser(Rel.UserId);
         if (HHab == null)
         {
             WriteInteger(0);
             WriteInteger(0);
             WriteInteger(0);                     // Their ID
             WriteString("Placeholder");
             WriteString("hr-115-42.hd-190-1.ch-215-62.lg-285-91.sh-290-62");
         }
         else
         {
             WriteInteger(Rel.Type);
             WriteInteger(Rel.Type == 1 ? Loves : Rel.Type == 2 ? Likes : Hates);
             WriteInteger(Rel.UserId);                     // Their ID
             WriteString(HHab.Username);
             WriteString(HHab.Look);
         }
     }
 }
Ejemplo n.º 26
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket packet)
        {
            string word;
            string Name = packet.PopString();

            Name = CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Name, out word) ? "Spam" : Name;
            string Description = packet.PopString();

            Description = CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Description, out word) ? "Spam" : Description;
            int RoomId  = packet.PopInt();
            int Colour1 = packet.PopInt();
            int Colour2 = packet.PopInt();
            int Unknown = packet.PopInt();

            int groupCost = Convert.ToInt32(CloudServer.GetGame().GetSettingsManager().TryGetValue("catalog.group.purchase.cost"));

            if (Session.GetHabbo().Credits < groupCost)
            {
                Session.SendMessage(new BroadcastMessageAlertComposer("Um grupo custa " + groupCost + " creditos! E você tem " + Session.GetHabbo().Credits + "!"));
                return;
            }
            else
            {
                Session.GetHabbo().Credits -= groupCost;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            RoomData Room = CloudServer.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Room == null || Room.OwnerId != Session.GetHabbo().Id || Room.Group != null)
            {
                return;
            }

            string Badge = string.Empty;

            for (int i = 0; i < 5; i++)
            {
                Badge += BadgePartUtility.WorkBadgeParts(i == 0, packet.PopInt().ToString(), packet.PopInt().ToString(), packet.PopInt().ToString());
            }

            Group Group = null;

            if (!CloudServer.GetGame().GetGroupManager().TryCreateGroup(Session.GetHabbo(), Name, Description, RoomId, Badge, Colour1, Colour2, out Group))
            {
                Session.SendNotification("Houve um erro ao tentar criar este grupo.\n\nTenta de novo.Se você receber esta mensagem mais de uma vez, fale com o moderador.\r\r");
                return;
            }

            Session.SendMessage(new PurchaseOKComposer());

            Room.Group = Group;

            if (Session.GetHabbo().CurrentRoomId != Room.Id)
            {
                Session.SendMessage(new RoomForwardComposer(Room.Id));
            }

            Session.SendMessage(new NewGroupInfoComposer(RoomId, Group.Id));
        }
Ejemplo n.º 27
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Por favor, introduzca el nombre de usuario que desea cambiar.");
                return;
            }

            GameClient TargetClient = CloudServer.GetGame().GetClientManager().GetClientByUsername(Params[1]);

            if (TargetClient == null)
            {
                Session.SendWhisper("Se produjo un error mientras que la búsqueda de usuario, tal vez no están en línea.");
                return;
            }

            if (TargetClient.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                Session.SendWhisper("No se le permite al usuario de que la bandera.");
                return;
            }
            else
            {
                TargetClient.GetHabbo().LastNameChange = 0;
                TargetClient.GetHabbo().ChangingName   = true;
                TargetClient.SendNotification("Tenga en cuenta que si su nombre de usuario se considerará como no apropiado, se le prohibió sin lugar a dudas.\r\rTambién tenga en cuenta que el personal no le permitirá cambiar su nombre de usuario de nuevo en caso de tener un problema con lo que haya elegido.\r\rCierre esta ventana y haga clic en sí mismo para comenzar a elegir un nuevo nombre de usuario!");
                TargetClient.SendMessage(new UserObjectComposer(TargetClient.GetHabbo()));
            }
        }
Ejemplo n.º 28
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            var length = Packet.PopInt();

            for (var i = 0; i < length; i++)
            {
                var forumid = Packet.PopInt();     //Forum ID
                var postid  = Packet.PopInt();     //Post ID
                var readall = Packet.PopBoolean(); //Make all read

                var forum = CloudServer.GetGame().GetGroupForumManager().GetForum(forumid);
                if (forum == null)
                {
                    continue;
                }

                var post = forum.GetPost(postid);
                if (post == null)
                {
                    continue;
                }

                var thread = post.ParentThread;
                var index  = thread.Posts.IndexOf(post);
                thread.AddView(Session.GetHabbo().Id, index + 1);
            }
            //Thread.AddView(Session.GetHabbo().Id);
        }
Ejemplo n.º 29
0
        public bool TryExecute(string[] parameters)
        {
            int userId = 0;

            if (!int.TryParse(parameters[0].ToString(), out userId))
            {
                return(false);
            }

            GameClient client = CloudServer.GetGame().GetClientManager().GetClientByUserID(userId);

            if (client == null || client.GetHabbo() == null)
            {
                return(false);
            }

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `rank` FROM `users` WHERE `id` = @userId LIMIT 1");
                dbClient.AddParameter("userId", userId);
                client.GetHabbo().Rank = dbClient.getInteger();
            }

            client.GetHabbo().GetPermissions().Init(client.GetHabbo());

            if (client.GetHabbo().GetPermissions().HasRight("mod_tickets"))
            {
                client.SendMessage(new ModeratorInitComposer(
                                       CloudServer.GetGame().GetModerationManager().UserMessagePresets,
                                       CloudServer.GetGame().GetModerationManager().RoomMessagePresets,
                                       CloudServer.GetGame().GetModerationManager().GetTickets));
            }
            return(true);
        }
Ejemplo n.º 30
0
        public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Session == null || Session.GetHabbo() == null || Item == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (Actor == null)
            {
                return;
            }

            if (Item.ExtraData == "1")
            {
                return;
            }

            if (Gamemap.TileDistance(Actor.X, Actor.Y, Item.GetX, Item.GetY) > 2)
            {
                return;
            }

            CloudServer.GetGame().GetPinataManager().ReceiveCrackableReward(Actor, Room, Item);
        }