예제 #1
0
        public void OnChat(int Colour, string Message, bool Shout)
        {
            if (GetClient() == null || GetClient().GetHabbo() == null || mRoom == null)
            {
                return;
            }

            if (mRoom.GetWired().TriggerEvent(Items.Wired.WiredBoxType.TriggerUserSays, GetClient().GetHabbo(), Message))
            {
                return;
            }

            if (UsingColourCode(Message))
            {
                if (GetClient().GetHabbo().VIPRank < 1)
                {
                    Message = ReplaceColourCode(Message);
                }
            }

            GetClient().GetHabbo().HasSpoken = true;

            if (mRoom.WordFilterList.Count > 0 && !GetClient().GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = mRoom.GetFilter().CheckMessage(Message);
            }

            ServerPacket Packet = null;

            if (GetClient().GetHabbo().Translating)
            {
                string LG1 = GetClient().GetHabbo().FromLanguage.ToLower();
                string LG2 = GetClient().GetHabbo().ToLanguage.ToLower();

                if (Shout)
                {
                    Packet = new ShoutComposer(VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
                }
                else
                {
                    Packet = new ChatComposer(VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
                }
            }
            else
            {
                if (Shout)
                {
                    Packet = new ShoutComposer(VirtualId, Message, PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
                }
                else
                {
                    Packet = new ChatComposer(VirtualId, Message, PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
                }
            }

            if (GetClient().GetHabbo().TentId > 0)
            {
                mRoom.SendToTent(GetClient().GetHabbo().Id, GetClient().GetHabbo().TentId, Packet);

                Packet = new WhisperComposer(this.VirtualId, "[Chat da Tenda] " + Message, 0, Colour);

                List <RoomUser> ToNotify = mRoom.GetRoomUserManager().GetRoomUserByRank(2);

                if (ToNotify.Count > 0)
                {
                    SendNameColourPacket();
                    foreach (RoomUser user in ToNotify)
                    {
                        if (user == null || user.GetClient() == null || user.GetClient().GetHabbo() == null ||
                            user.GetClient().GetHabbo().TentId == GetClient().GetHabbo().TentId)
                        {
                            continue;
                        }

                        user.GetClient().SendMessage(Packet);
                    }
                    SendNamePacket();
                }
            }
            else
            {
                if (mRoom.TutorialEnabled)
                {
                    this.GetClient().SendMessage(Packet);
                }
                else
                {
                    SendNameColourPacket();
                    foreach (RoomUser User in mRoom.GetRoomUserManager().GetRoomUsers().ToList())
                    {
                        if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null || User.GetClient().GetHabbo().MutedUsers.Contains(mClient.GetHabbo().Id))
                        {
                            continue;
                        }

                        if (GetClient().GetRoleplay().Invisible)
                        {
                            if (!User.GetClient().GetRoleplay().Invisible)
                            {
                                continue;
                            }
                        }

                        User.GetClient().SendMessage(Packet);
                    }
                    SendNamePacket();
                }
            }

            #region Pets/Bots responces
            if (Shout)
            {
                foreach (RoomUser User in mRoom.GetRoomUserManager().GetUserList().ToList())
                {
                    if (!User.IsBot)
                    {
                        continue;
                    }

                    if (User.IsBot)
                    {
                        if (User.GetBotRoleplayAI() != null)
                        {
                            User.GetBotRoleplayAI().OnUserShout(this, Message);
                        }
                        else
                        {
                            User.BotAI.OnUserShout(this, Message);
                        }
                    }
                }
            }
            else
            {
                foreach (RoomUser User in mRoom.GetRoomUserManager().GetUserList().ToList())
                {
                    if (!User.IsBot)
                    {
                        continue;
                    }

                    if (User.GetBotRoleplayAI() != null)
                    {
                        User.GetBotRoleplayAI().OnUserSay(this, Message);
                    }
                    else
                    {
                        User.BotAI.OnUserSay(this, Message);
                    }
                }
            }
            #endregion
        }
예제 #2
0
        public void OnChat(int Colour, string Message, bool Shout)
        {
            if (GetClient() == null || GetClient().GetHabbo() == null || mRoom == null)
            {
                return;
            }

            if (mRoom.GetWired().TriggerEvent(Items.Wired.WiredBoxType.TriggerUserSays, GetClient().GetHabbo(), Message))
            {
                return;
            }


            GetClient().GetHabbo().HasSpoken = true;

            if (mRoom.WordFilterList.Count > 0 && !GetClient().GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = mRoom.GetFilter().CheckMessage(Message);
            }

            ServerPacket Packet = null;

            if (Shout)
            {
                Packet = new ShoutComposer(VirtualId, Message, PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
            }
            else
            {
                Packet = new ChatComposer(VirtualId, Message, PlusEnvironment.GetGame().GetChatManager().GetEmotions().GetEmotionsForText(Message), Colour);
            }


            if (GetClient().GetHabbo().TentId > 0)
            {
                mRoom.SendToTent(GetClient().GetHabbo().Id, GetClient().GetHabbo().TentId, Packet);

                Packet = new WhisperComposer(this.VirtualId, "[Tent Chat] " + Message, 0, Colour);

                List <RoomUser> ToNotify = mRoom.GetRoomUserManager().GetRoomUserByRank(2);

                if (ToNotify.Count > 0)
                {
                    foreach (RoomUser user in ToNotify)
                    {
                        if (user == null || user.GetClient() == null || user.GetClient().GetHabbo() == null ||
                            user.GetClient().GetHabbo().TentId == GetClient().GetHabbo().TentId)
                        {
                            continue;
                        }

                        user.GetClient().SendPacket(Packet);
                    }
                }
            }
            else
            {
                foreach (RoomUser User in mRoom.GetRoomUserManager().GetRoomUsers().ToList())
                {
                    if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null || User.GetClient().GetHabbo().GetIgnores().IgnoredUserIds().Contains(mClient.GetHabbo().Id))
                    {
                        continue;
                    }

                    if (mRoom.chatDistance > 0 && Gamemap.TileDistance(this.X, this.Y, User.X, User.Y) > mRoom.chatDistance)
                    {
                        continue;
                    }

                    User.GetClient().SendPacket(Packet);
                }
            }

            #region Pets/Bots responces
            if (Shout)
            {
                foreach (RoomUser User in mRoom.GetRoomUserManager().GetUserList().ToList())
                {
                    if (!User.IsBot)
                    {
                        continue;
                    }

                    if (User.IsBot)
                    {
                        User.BotAI.OnUserShout(this, Message);
                    }
                }
            }
            else
            {
                foreach (RoomUser User in mRoom.GetRoomUserManager().GetUserList().ToList())
                {
                    if (!User.IsBot)
                    {
                        continue;
                    }

                    if (User.IsBot)
                    {
                        User.BotAI.OnUserSay(this, Message);
                    }
                }
            }
            #endregion
        }