当前位置: 首页>>代码示例>>C#>>正文


C# GameClient.SendWhisper方法代码示例

本文整理汇总了C#中Plus.HabboHotel.GameClients.GameClient.SendWhisper方法的典型用法代码示例。如果您正苦于以下问题:C# GameClient.SendWhisper方法的具体用法?C# GameClient.SendWhisper怎么用?C# GameClient.SendWhisper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plus.HabboHotel.GameClients.GameClient的用法示例。


在下文中一共展示了GameClient.SendWhisper方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 public void Execute(GameClient Session, Room Room, string[] Params)
 {
     if (Session != null)
     {
         if (Room != null)
         {
             if (Params.Length != 1)
             {
                 Session.SendWhisper("Invalid command! :eventalert", 0);
             }
             else if (!PlusEnvironment.Event)
             {
                 PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(":follow " + Session.GetHabbo().Username + " for events! win prizes!\r\n- " + Session.GetHabbo().Username, ""), "");
                 PlusEnvironment.lastEvent = DateTime.Now;
                 PlusEnvironment.Event = true;
             }
             else
             {
                 TimeSpan timeSpan = DateTime.Now - PlusEnvironment.lastEvent;
                 if (timeSpan.Hours >= 1)
                 {
                     PlusEnvironment.GetGame().GetClientManager().SendMessage(new BroadcastMessageAlertComposer(":follow " + Session.GetHabbo().Username + " for events! win prizes!\r\n- " + Session.GetHabbo().Username, ""), "");
                     PlusEnvironment.lastEvent = DateTime.Now;
                 }
                 else
                 {
                     int num = checked(60 - timeSpan.Minutes);
                     Session.SendWhisper("Event Cooldown! " + num + " minutes left until another event can be hosted.", 0);
                 }
             }
         }
     }
 }
开发者ID:BjkGkh,项目名称:Boon,代码行数:33,代码来源:EventAlertCommand.cs

示例2: Execute

        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
                return;

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to choose a price to sell the room for.");
                return;
            }
            else if (Room.Group != null)
            {
                Session.SendWhisper("Oops, this room has a group. You must delete the group before you can sell the room.");
                return;
            }

            int Price = 0;
            if (!int.TryParse(Params[1], out Price))
            {
                Session.SendWhisper("Oops, you've entered an invalid integer.");
                return;
            }

            if (Price == 0)
            {
                Session.SendWhisper("Oops, you cannot sell a room for 0 credits.");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `rooms` SET `sale_price` = @SalePrice WHERE `id` = @Id LIMIT 1");
                dbClient.AddParameter("SalePrice", Price);
                dbClient.AddParameter("Id", Room.Id);
                dbClient.RunQuery();
            }

            Session.SendNotification("Your room is now up for sale. The the current room visitors have been alerted, any item that belongs to you in this room will be transferred to the new owner once purchased. Other items shall be ejected.");

            foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
            {
                if (User == null || User.GetClient() == null)
                    continue;

                User.GetClient().SendWhisper("Attention! This room has been put up for sale, you can buy it now for " + Price + " credits! Use the :buyroom command.");
            }
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:47,代码来源:SellRoomCommand.cs

示例3: OnTrigger

        internal override void OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            // Is this user valid?
            if (Item == null || Item.GetRoom() == null || Session == null || Session.GetHabbo() == null)
                return;
            RoomUser User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            User.LastInteraction = PlusEnvironment.GetUnixTimestamp();
            if (User == null)
            {
                return;
            }

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

            if (!User.InteractingGate && User.GateId != Item.Id && Item.TollPrice > 0)
            {
                if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    Session.SendNotif("You have not got enough credits to get through this gate.\n" +
                        "You need atleast " + Item.TollPrice + " to get through this gate");
                    return;
                }
                Session.SendWhisper("This gate has a toll of " + Item.TollPrice + " credits.");
                Session.SendWhisper("To continue through it, double click again!");
                User.InteractingGate = true;
                User.GateId = Item.Id;
                User.LastInteraction = PlusEnvironment.GetUnixTimestamp() + 7;
                return;
            }

            // 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) - PlusEnvironment.GetUnixTimestamp() < 0)
                    return;

                if (Item.TollPrice > 0 && Session.GetHabbo().Credits > Item.TollPrice)
                {
                    Habbo Data = PlusEnvironment.getHabboForId(Convert.ToUInt32(Item.GetRoom().OwnerId));
                    if (Data != null)
                    {
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            dbClient.setQuery("SELECT online FROM users WHERE id=" + Data.Id + " LIMIT 1");
                            string online = dbClient.getString();
                            if (online == "0")
                            {
                                dbClient.runFastQuery("UPDATE users SET credits = credits+" + Item.TollPrice + " WHERE id=" + Data.Id + " LIMIT 1");
                            }
                            else if (online == "1")
                            {
                                GameClient H = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Data.Id);
                                H.GetHabbo().Credits += Item.TollPrice;
                                H.GetHabbo().UpdateCreditsBalance();
                            }
                            else
                            {
                                Session.SendWhisper("An error occured!");
                                return;
                            }
                        }
                    }
                    Session.GetHabbo().Credits -= Item.TollPrice;
                    Session.GetHabbo().UpdateCreditsBalance();
                }
                else if (Session.GetHabbo().Credits < Item.TollPrice)
                {
                    User.InteractingGate = false;
                    User.GateId = 0;
                    return;
                }

                User.TeleDelay = 2;
                Item.InteractingUser = User.GetClient().GetHabbo().Id;

            }
            else if (User.CanWalk)
            {
                User.MoveTo(Item.SquareInFront);
            }
        }
开发者ID:BjkGkh,项目名称:07052014,代码行数:91,代码来源:FurniInteractor.cs

示例4: Execute

        public void Execute(GameClient session, Room room, string[] Params)
        {
            if (Params.Length == 1)
            {
                session.SendWhisper("Please enter a currency type! (coins, duckets, diamonds, gotw)");
                return;
            }

            string updateVal = Params[1];
            switch (updateVal.ToLower())
            {
                case "coins":
                case "credits":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_coins"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                            {
                                client.GetHabbo().Credits += amount;
                                client.SendMessage(new CreditBalanceComposer(client.GetHabbo().Credits));
                            }
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.RunQuery("UPDATE users SET credits = credits + " + amount);
                            }
                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }
                case "pixels":
                case "duckets":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_pixels"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                            {
                                client.GetHabbo().Duckets += amount;
                                client.SendMessage(new HabboActivityPointNotificationComposer(
                                    client.GetHabbo().Duckets, amount));
                            }
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.RunQuery("UPDATE users SET activity_points = activity_points + " + amount);
                            }
                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }
                case "diamonds":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_diamonds"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                            {
                                client.GetHabbo().Diamonds += amount;
                                client.SendMessage(new HabboActivityPointNotificationComposer(client.GetHabbo().Diamonds,
                                    amount,
                                    5));
                            }
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.RunQuery("UPDATE users SET vip_points = vip_points + " + amount);
                            }
                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }
                case "gotw":
                case "gotwpoints":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_gotw"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (GameClient client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:Boon,代码行数:101,代码来源:GlobalGiveCommand.cs

示例5: Execute

        public void Execute(GameClient session, Room room, string[] Params)
        {
            if (Params.Length == 1)
            {
                session.SendWhisper("Please enter a currency type! (coins, duckets, diamonds, gotw)");
                return;
            }

            var updateVal = Params[1];
            switch (updateVal.ToLower())
            {
                case "coins":
                case "credits":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_coins"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList().Where(client => client?.GetHabbo() != null && client.GetHabbo().Username != session.GetHabbo().Username))
                            {
                                client.GetHabbo().Credits = client.GetHabbo().Credits += amount;
                                client.SendMessage(new CreditBalanceComposer(client.GetHabbo().Credits));

                                if (client.GetHabbo().Id != session.GetHabbo().Id)
                                    client.SendNotification(session.GetHabbo().Username + " has given you " + amount +
                                                            " Credit(s)!");
                                session.SendWhisper("Successfully given " + amount + " Credit(s) to " +
                                                    client.GetHabbo().Username + "!");
                            }

                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }

                case "pixels":
                case "duckets":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_pixels"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList().Where(client => client?.GetHabbo() != null && client.GetHabbo().Username != session.GetHabbo().Username))
                            {
                                client.GetHabbo().Duckets += amount;
                                client.SendMessage(new HabboActivityPointNotificationComposer(
                                    client.GetHabbo().Duckets, amount));

                                if (client.GetHabbo().Id != session.GetHabbo().Id)
                                    client.SendNotification(session.GetHabbo().Username + " has given you " + amount +
                                                            " Ducket(s)!");
                                session.SendWhisper("Successfully given " + amount + " Ducket(s) to " +
                                                    client.GetHabbo().Username + "!");
                            }
                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }

                case "diamonds":
                    {
                        if (!session.GetHabbo().GetPermissions().HasCommand("command_give_diamonds"))
                        {
                            session.SendWhisper("Oops, it appears that you do not have the permissions to use this command!");
                            break;
                        }
                        int amount;
                        if (int.TryParse(Params[2], out amount))
                        {
                            foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList().Where(client => client?.GetHabbo() != null && client.GetHabbo().Username != session.GetHabbo().Username))
                            {
                                client.GetHabbo().Diamonds += amount;
                                client.SendMessage(new HabboActivityPointNotificationComposer(client.GetHabbo().Diamonds,
                                    amount,
                                    5));

                                if (client.GetHabbo().Id != session.GetHabbo().Id)
                                    client.SendNotification(session.GetHabbo().Username + " has given you " + amount +
                                                            " Diamond(s)!");
                                session.SendWhisper("Successfully given " + amount + " Diamond(s) to " +
                                                    client.GetHabbo().Username + "!");
                            }

                            break;
                        }
                        session.SendWhisper("Oops, that appears to be an invalid amount!");
                        break;
                    }

                case "gotw":
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:Boon,代码行数:101,代码来源:MassGiveCommand.cs

示例6: Parse

        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
                return;

            Room Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
                return;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oops, you're currently muted.");
                return;
            }

            if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
                return;

            string Params = Packet.PopString();
            string ToUser = Params.Split(' ')[0];
            string Message = Params.Substring(ToUser.Length + 1);
            int Colour = Packet.PopInt();

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

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);
            if (User2 == null)
                return;

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
                Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);

            ChatStyle Style = null;
            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
                Colour = 0;

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (!User2.GetClient().GetHabbo().ReceiveWhispers && !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
            {
                Session.SendWhisper("Oops, this user has their whispers disabled!");
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Plus.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, "<Whisper to " + ToUser + ">: " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            Room.AddChatlog(Session.GetHabbo().Id, "<Whisper to " + ToUser + ">: " + Message);

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                Session.SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                return;
            }


            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.UnIdle();
            User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));

            if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                {
                    User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                }
            }

            List<RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(2);
            if (ToNotify.Count > 0)
            {
                foreach (RoomUser user in ToNotify)
                {
                    if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                    {
//.........这里部分代码省略.........
开发者ID:BjkGkh,项目名称:Boon,代码行数:101,代码来源:WhisperEvent.cs

示例7: Parse

        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
                return;

            Room Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
                return;

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

            string Message = StringCharFilter.Escape(Packet.PopString());
            if (Message.Length > 100)
                Message = Message.Substring(0, 100);

            int Colour = Packet.PopInt();

            ChatStyle Style = null;
            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
                Colour = 0;

            User.UnIdle();

            if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
                return;

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oops, you're currently muted.");
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
                return;

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }

                Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
                Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);


            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.OnChat(User.LastBubble, Message, false);
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:79,代码来源:ChatEvent.cs


注:本文中的Plus.HabboHotel.GameClients.GameClient.SendWhisper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。