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


C# GameClients.SendMessage方法代码示例

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


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

示例1: Execute

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the room owner can run this command!");
                return;
            }

            foreach (RoomUser User in Room.GetRoomUserManager().GetUserList().ToList())
            {
                if (User == null || User.IsPet || !User.IsBot)
                    continue;

                RoomUser BotUser = null;
                if (!Room.GetRoomUserManager().TryGetBot(User.BotData.Id, out BotUser))
                    return;

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", User.BotData.Id);
                    dbClient.RunQuery();
                }

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }

            Session.SendWhisper("Success, removed all bots.");
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:31,代码来源:KickBotsCommand.cs

示例2: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(5);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(1);

            if (Item.wiredHandler != null)
            {
                ScoreAchieved handler = (ScoreAchieved)Item.wiredHandler;
                message.AddInt32(handler.scoreLevel);
            }
            else
            {
                message.AddInt32(0);
            }

            message.AddInt32(0);
            message.AddInt32(10);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:30,代码来源:ScoreAchievedTriggerWired.cs

示例3: Execute

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null || User.GetClient() == null)
                return;

            string[] headParts;
            string[] figureParts = Session.GetHabbo().Look.Split('.');
            foreach (string Part in figureParts)
            {
                if (Part.StartsWith("hd"))
                {
                    headParts = Part.Split('-');
                    if (!headParts[1].Equals("99999"))
                        headParts[1] = "99999";
                    else
                        return;

                    Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, "hd-" + headParts[1] + "-" + headParts[2]);
                    break;
                }
            }
            Session.GetHabbo().Look = PlusEnvironment.GetGame().GetAntiMutant().RunLook(Session.GetHabbo().Look);
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `look` = '" + Session.GetHabbo().Look + "' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            Session.SendMessage(new UserChangeComposer(User, true));
            Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(User, false));
            return;
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:32,代码来源:FacelessCommand.cs

示例4: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            message.AddString(string.Empty);
            message.AddInt32(2);

            if (Item.wiredHandler != null)
            {
                GiveScore handler = (GiveScore)Item.wiredHandler;
                message.AddInt32(handler.scoreToGive);
                message.AddInt32(handler.maxCountPerGame);
            }
            else
            {
                message.AddInt32(0); //Points 
                message.AddInt32(0); //Rounds
            }

            message.AddInt32(0);
            message.AddInt32(6);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:33,代码来源:ActionGiveScoreWired.cs

示例5: Execute

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            int TotalValue = 0;

            try
            {
                DataTable Table = null;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `id` FROM `items` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND (`room_id`=  '0' OR `room_id` = '')");
                    Table = dbClient.getTable();
                }

                if (Table == null)
                {
                    Session.SendWhisper("You currently have no items in your inventory!");
                    return;
                }

                foreach (DataRow Row in Table.Rows)
                {
                    Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Convert.ToInt32(Row[0]));
                    if (Item == null)
                        continue;

                    if (!Item.GetBaseItem().ItemName.StartsWith("CF_") && !Item.GetBaseItem().ItemName.StartsWith("CFC_"))
                        continue;

                    if (Item.RoomId > 0)
                        continue;

                    string[] Split = Item.GetBaseItem().ItemName.Split('_');
                    int Value = int.Parse(Split[1]);

                    using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");
                    }

                    Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);

                    TotalValue += Value;

                    if (Value > 0)
                    {
                        Session.GetHabbo().Credits += Value;
                        Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
                    }
                }

                if (TotalValue > 0)
                    Session.SendNotification("All credits have successfully been converted!\r\r(Total value: " + TotalValue + " credits!");
                else
                    Session.SendNotification("It appears you don't have any exchangeable items!");
            }
            catch
            {
                Session.SendNotification("Oops, an error occoured whilst converting your credits!");
            }
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:60,代码来源:ConvertCreditsCommand.cs

示例6: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            if (Item.wiredHandler != null)
            {
                EntersRoom handler = (EntersRoom)Item.wiredHandler;

                if (!string.IsNullOrEmpty(handler.userName))
                    message.AddString(handler.userName);
                else
                    message.AddString(string.Empty);
            }
            else
            {
                message.AddString(string.Empty);
            }

            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(7);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:32,代码来源:RoomEnterTriggerWired.cs

示例7: Execute

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!this.CanChangeName(Session.GetHabbo()))
            {
                Session.SendWhisper("Sorry, it seems you currently do not have the option to change your username!");
                return;
            }

            Session.GetHabbo().ChangingName = true;
            Session.SendNotification("Please be aware that if your username is deemed as inappropriate, you will be banned without question.\r\rAlso note that Staff will NOT change your username again should you have an issue with what you have chosen.\r\rClose this window and click yourself to begin choosing a new username!");
            Session.SendMessage(new UserObjectComposer(Session.GetHabbo()));
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:12,代码来源:FlagMeCommand.cs

示例8: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniActionEvent);

            if (Item.wiredHandler != null)
            {
                MoveRotate handler = (MoveRotate)Item.wiredHandler;
                message.AddBoolean(false);
                message.AddInt32(MAX_FURNI_SELECTION);

                message.AddInt32(handler.items.Count);
                foreach (RoomItem item in handler.items)
                {
                    message.AddInt32((int)item.Id);
                }

                message.AddInt32(Item.GetBaseItem().SpriteId);
                message.AddUInt32(Item.Id);

                message.AddString(string.Empty);
                message.AddInt32(2);
                message.AddInt32((int)handler.movement);
                message.AddInt32((int)handler.rotation);
                message.AddInt32(0);
                message.AddInt32(4);
                message.AddInt32(handler.delay);
                message.AddInt32(0);
                message.AddString(string.Empty);
            }
            else
            {
                message.AddBoolean(false);
                message.AddInt32(MAX_FURNI_SELECTION);
                message.AddInt32(0);
                message.AddInt32(Item.GetBaseItem().SpriteId);
                message.AddUInt32(Item.Id);

                message.AddString(string.Empty);
                message.AddInt32(2);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddInt32(4);
                message.AddInt32(0);
                message.AddInt32(0);
                message.AddString(string.Empty);
            }

            Session.SendMessage(message);
                        
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:51,代码来源:MoveOrRotateWired.cs

示例9: Execute

        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 wish to mimic.");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
                return;
            }

            if (!TargetClient.GetHabbo().AllowMimic)
            {
                Session.SendWhisper("Oops, you cannot mimic this user - sorry!");
                return;
            }

            RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (TargetUser == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online or in this room.");
                return;
            }

            Session.GetHabbo().Gender = TargetUser.GetClient().GetHabbo().Gender;
            Session.GetHabbo().Look = TargetUser.GetClient().GetHabbo().Look;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `gender` = @gender, `look` = @look WHERE `id` = @id LIMIT 1");
                dbClient.AddParameter("gender", Session.GetHabbo().Gender);
                dbClient.AddParameter("look", Session.GetHabbo().Look);
                dbClient.AddParameter("id", Session.GetHabbo().Id);
                dbClient.RunQuery();
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User != null)
            {
                Session.SendMessage(new UserChangeComposer(User, true));
                Room.SendMessage(new UserChangeComposer(User, false));
            }
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:47,代码来源:MimicCommand.cs

示例10: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);
            message.AddString(string.Empty);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(8);
            message.AddInt32(0);
            message.AddString(string.Empty);

            Session.SendMessage(message);
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:17,代码来源:GameStartTriggerWired.cs

示例11: Execute

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

            Room.GetRoomItemHandler().RemoveItems(Session);

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `items` SET `room_id` = '0' WHERE `room_id` = @RoomId AND `user_id` = @UserId");
                dbClient.AddParameter("RoomId", Room.Id);
                dbClient.AddParameter("UserId", Session.GetHabbo().Id);
                dbClient.RunQuery();
            }

            List<Item> Items = Room.GetRoomItemHandler().GetWallAndFloor.ToList();
            if (Items.Count > 0)
                Session.SendWhisper("There are still more items in this room, manually remove them or use :ejectall to eject them!");

            Session.SendMessage(new FurniListUpdateComposer());
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:21,代码来源:PickAllCommand.cs

示例12: DoTrigger

        protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
        {
            ServerMessage message = PacketHandelingManager.GetRecycledItem(OutputCode.WiredFurniTriggerEvent);
            message.AddBoolean(false);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(Item.GetBaseItem().SpriteId);
            message.AddUInt32(Item.Id);

            if (Item.wiredHandler != null)
            {
                UserSays trigger = (UserSays)Item.wiredHandler;
                message.AddString(trigger.triggerMessage);
            }
            else
            {
                message.AddString(string.Empty);  // What is said
            }

            message.AddInt32(1);
            if (Item.wiredHandler != null && Item.wiredHandler as UserSays != null)
            {
                UserSays says = (Item.wiredHandler as UserSays);
                message.AddInt32(says.IsOwnerOnly ? 1 : 0);
            }
            else
            {
                message.AddInt32(0);
            }
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddInt32(0);
            message.AddString(string.Empty);


            Session.SendMessage(message);
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:37,代码来源:OnUserSayTriggerWired.cs

示例13: Execute

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oops, only the room owner can run this command!");
                return;
            }

            if (Room.GetRoomUserManager().GetPets().Count > 0)
            {
                foreach (RoomUser Pet in Room.GetRoomUserManager().GetUserList().ToList())
                {
                    if (Pet == null)
                        continue;

                    if (Pet.RidingHorse)
                    {
                        RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID);
                        if (UserRiding != null)
                        {
                            UserRiding.RidingHorse = false;
                            UserRiding.ApplyEffect(-1);
                            UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1));
                        }
                        else
                            Pet.RidingHorse = false;
                    }

                    Pet.PetData.RoomId = 0;
                    Pet.PetData.PlacedInRoom = false;

                    Pet pet = Pet.PetData;
                    if (pet != null)
                    {
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + pet.PetId + "' LIMIT 1");
                            dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + pet.experience + "', `energy` = '" + pet.Energy + "', `nutrition` = '" + pet.Nutrition + "', `respect` = '" + pet.Respect + "' WHERE `id` = '" + pet.PetId + "' LIMIT 1");
                        }
                    }

                    if (pet.OwnerId != Session.GetHabbo().Id)
                    {
                        GameClient Target = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(pet.OwnerId);
                        if (Target != null)
                        {
                            Target.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData);
                            Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false);

                            Target.SendMessage(new PetInventoryComposer(Target.GetHabbo().GetInventoryComponent().GetPets()));
                            return;
                        }
                    }

                    Session.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData);
                    Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false);
                    Session.SendMessage(new PetInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetPets()));
                }
                Session.SendWhisper("Success, removed all pets.");
            }
            else
            {
                Session.SendWhisper("Oops, there isn't any pets in here!?");
            }
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:65,代码来源:KickPetsCommand.cs

示例14: OnTrigger

        public void OnTrigger(GameClients.GameClient Session, Item Item, int Request, bool HasRights)
        {
            if (Item.ExtraData.Contains(Convert.ToChar(5).ToString()))
            {
                String[] Stuff = Item.ExtraData.Split(Convert.ToChar(5));
                Session.GetHabbo().Gender = Stuff[0].ToUpper();
                Dictionary<String, String> NewFig = new Dictionary<String, String>();
                NewFig.Clear();
                foreach (String Man in Stuff[1].Split('.'))
                {
                    foreach (String Fig in Session.GetHabbo().Look.Split('.'))
                    {
                        if (Fig.Split('-')[0] == Man.Split('-')[0])
                        {
                            if (NewFig.ContainsKey(Fig.Split('-')[0]) && !NewFig.ContainsValue(Man))
                            {
                                NewFig.Remove(Fig.Split('-')[0]);
                                NewFig.Add(Fig.Split('-')[0], Man);
                            }
                            else if (!NewFig.ContainsKey(Fig.Split('-')[0]) && !NewFig.ContainsValue(Man))
                            {
                                NewFig.Add(Fig.Split('-')[0], Man);
                            }
                        }
                        else
                        {
                            if (!NewFig.ContainsKey(Fig.Split('-')[0]))
                            {
                                NewFig.Add(Fig.Split('-')[0], Fig);
                            }
                        }
                    }
                }

                string Final = "";
                foreach (String Str in NewFig.Values)
                {
                    Final += Str + ".";
                }


                Session.GetHabbo().Look = Final.TrimEnd('.');

                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE users SET look = @look, gender = @gender WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
                    dbClient.AddParameter("look", Session.GetHabbo().Look);
                    dbClient.AddParameter("gender", Session.GetHabbo().Gender);
                    dbClient.RunQuery();
                }

                Room Room = Session.GetHabbo().CurrentRoom;
                if (Room != null)
                {
                    RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
                    if (User != null)
                    {
                        Session.SendMessage(new UserChangeComposer(User, true));
                        Session.GetHabbo().CurrentRoom.SendMessage(new UserChangeComposer(User, false));
                    }
                }
            }
        }
开发者ID:BjkGkh,项目名称:Boon,代码行数:63,代码来源:InteractorMannequin.cs

示例15: DoTrigger

 protected override void DoTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool UserHasRights)
 {
     if (UserHasRights)
         Session.SendMessage(ConditionPacketBuilder.GenerateMessage(Item));
 }
开发者ID:BjkGkh,项目名称:R106,代码行数:5,代码来源:StatePositionWired.cs


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