コード例 #1
0
ファイル: Game.cs プロジェクト: sgf/Yupi
        /// <summary>
        ///     Continues the loading.
        /// </summary>
        internal void ContinueLoading()
        {
            using (IQueryAdapter queryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                int catalogPageLoaded;

                PetRace.Init(queryReactor);

                _catalog.Initialize(queryReactor, out catalogPageLoaded);

                UserChatInputFilter.Load();
                ServerSecurityChatFilter.InitSwearWord();
                BlackWordsManager.Load();
                SoundMachineSongManager.Initialize();

                ServerCpuLowPriorityWorker.Init(queryReactor);

                _roomManager.InitVotedRooms(queryReactor);

                _roomManager.LoadCompetitionManager();
            }

            StartGameLoop();

            _pixelManager.StartTimer();
        }
コード例 #2
0
ファイル: HabboHotel.cs プロジェクト: xXSicilyXx/Yupi
        /// <summary>
        ///     Continues the loading.
        /// </summary>
        internal void ContinueLoading()
        {
            int catalogPageLoaded;

            GetNavigator().LoadNewPublicRooms();

            PetTypeManager.Load();

            GetCatalogManager().Init(out catalogPageLoaded);

            UserChatInputFilter.Load();
            ServerSecurityChatFilter.Load();
            BlackWordsManager.Load();
            SoundMachineSongManager.Load();
            ServerCpuLowPriorityWorker.Load();

            GetRoomManager().InitVotedRooms();

            GetRoomManager().LoadCompetitionManager();

            StartGameLoop();

            GetPixelManager().StartTimer();
        }
コード例 #3
0
ファイル: RoomUser.cs プロジェクト: sgf/Yupi
        /// <summary>
        ///     Chats the specified session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="msg">The MSG.</param>
        /// <param name="shout">if set to <c>true</c> [shout].</param>
        /// <param name="count">The count.</param>
        /// <param name="textColor">Color of the text.</param>
        internal void Chat(GameClient session, string msg, bool shout, int count, int textColor = 0)
        {
            if (IsPet || IsBot)
            {
                if (!IsPet)
                {
                    textColor = 2;
                }

                ServerMessage botChatmsg = new ServerMessage();
                botChatmsg.Init(shout
                    ? LibraryParser.OutgoingRequest("ShoutMessageComposer")
                    : LibraryParser.OutgoingRequest("ChatMessageComposer"));
                botChatmsg.AppendInteger(VirtualId);
                botChatmsg.AppendString(msg);
                botChatmsg.AppendInteger(0);
                botChatmsg.AppendInteger(textColor);
                botChatmsg.AppendInteger(0);
                botChatmsg.AppendInteger(count);

                GetRoom().SendMessage(botChatmsg);
                return;
            }

            if (msg.Length > 100) // si el mensaje es mayor que la máxima longitud (scripter)
            {
                return;
            }
            if (!ServerSecurityChatFilter.CanTalk(session, msg))
            {
                return;
            }

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

            BlackWord word;

            if (!(msg.StartsWith(":deleteblackword ") && session.GetHabbo().Rank > 4) &&
                BlackWordsManager.Check(msg, BlackWordType.Hotel, out word))
            {
                BlackWordTypeSettings settings = word.TypeSettings;
                //session.HandlePublicist(word.Word, msg, "CHAT", settings);

                if (settings.ShowMessage)
                {
                    session.SendWhisper("A mensagem contém a palavra: " + word.Word +
                                        " que não é permitida, você poderá ser banido!");
                    return;
                }
            }

            if (!IsBot && IsFlooded && FloodExpiryTime <= Yupi.GetUnixTimeStamp())
            {
                IsFlooded = false;
            }
            else if (!IsBot && IsFlooded)
            {
                return; // ciao flooders!
            }
            if (session.GetHabbo().Rank < 4 && GetRoom().CheckMute(session))
            {
                return;
            }

            UnIdle();
            if (!IsPet && !IsBot)
            {
                if (msg.StartsWith(":") && CommandsManager.TryExecute(msg.Substring(1), session))
                {
                    return;
                }

                Habbo habbo = GetClient().GetHabbo();

                if (GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerOnUserSay, this, msg))
                {
                    return;
                }

                GetRoom().AddChatlog(session.GetHabbo().Id, msg, true);

                uint rank = 1;

                if (session.GetHabbo() != null)
                {
                    rank = session.GetHabbo().Rank;
                }

                msg = GetRoom()
                      .WordFilter
                      .Aggregate(msg,
                                 (current1, current) => Regex.Replace(current1, current, "bobba", RegexOptions.IgnoreCase));

                if (rank < 4)
                {
                    TimeSpan span = DateTime.Now - habbo.SpamFloodTime;
                    if ((span.TotalSeconds > habbo.SpamProtectionTime) && habbo.SpamProtectionBol)
                    {
                        _floodCount               = 0;
                        habbo.SpamProtectionBol   = false;
                        habbo.SpamProtectionAbuse = 0;
                    }
                    else if (span.TotalSeconds > 4.0)
                    {
                        _floodCount = 0;
                    }
                    ServerMessage message;
                    if ((span.TotalSeconds < habbo.SpamProtectionTime) && habbo.SpamProtectionBol)
                    {
                        message = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
                        int i = habbo.SpamProtectionTime - span.Seconds;
                        message.AppendInteger(i);
                        IsFlooded       = true;
                        FloodExpiryTime = Yupi.GetUnixTimeStamp() + i;
                        GetClient().SendMessage(message);
                        return;
                    }
                    if ((span.TotalSeconds < 4.0) && (_floodCount > 5) && (rank < 5))
                    {
                        message = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
                        habbo.SpamProtectionCount++;
                        if (habbo.SpamProtectionCount % 2 == 0)
                        {
                            habbo.SpamProtectionTime = 10 * habbo.SpamProtectionCount;
                        }
                        else
                        {
                            habbo.SpamProtectionTime = 10 * (habbo.SpamProtectionCount - 1);
                        }
                        habbo.SpamProtectionBol = true;
                        int j = habbo.SpamProtectionTime - span.Seconds;
                        message.AppendInteger(j);
                        IsFlooded       = true;
                        FloodExpiryTime = Yupi.GetUnixTimeStamp() + j;
                        GetClient().SendMessage(message);
                        return;
                    }
                    habbo.SpamFloodTime = DateTime.Now;
                    _floodCount++;
                }
                if (habbo.Preferences.ChatColor != textColor)
                {
                    habbo.Preferences.ChatColor = textColor;
                    habbo.Preferences.Save();
                }
            }
            else if (!IsPet)
            {
                textColor = 2;
            }

            ServerMessage chatMsg = new ServerMessage();

            chatMsg.Init(shout
                ? LibraryParser.OutgoingRequest("ShoutMessageComposer")
                : LibraryParser.OutgoingRequest("ChatMessageComposer"));
            chatMsg.AppendInteger(VirtualId);
            chatMsg.AppendString(msg);
            chatMsg.AppendInteger(ChatEmotions.GetEmotionsForText(msg));
            chatMsg.AppendInteger(textColor);
            chatMsg.AppendInteger(0); // links count (foreach string string bool)
            chatMsg.AppendInteger(count);
            GetRoom().BroadcastChatMessage(chatMsg, this, session.GetHabbo().Id);

            GetRoom().OnUserSay(this, msg, shout);

            GetRoom().GetRoomUserManager().TurnHeads(X, Y, HabboId);
        }