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


C# Client.SendPacket方法代码示例

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


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

示例1: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var reader = new PacketReader(data, position, size);
            var charId = reader.ReadUInt32();

            if (context.User == null)
                return;

            if (context.Character == null) // On character create, this is already set.
            {
                using (var db = new PolarisEf())
                {
                    var character = db.Characters.Find((int)charId);

                    if (character == null || character.Player.PlayerId != context.User.PlayerId)
                        return;

                    context.Character = character;
                }

            }

            // Initialize you in an empty party
            context.SendPacket(new PartyInitPacket(new Models.Character[1] { context.Character }));

            // Transition to the loading screen
            context.SendPacket(new NoPayloadPacket(0x3, 0x4));

            // TODO Set area, Set character, possibly more. See PolarisLegacy for more.
        }
开发者ID:mattkloc,项目名称:PolarisServer,代码行数:30,代码来源:StartGame.cs

示例2: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.User == null || context.Character == null)
                return;

            // Looks/Jobs
            if (size > 0)
            {
                var reader = new PacketReader(data);

                reader.BaseStream.Seek(0x38, SeekOrigin.Begin);
                context.Character.Looks = reader.ReadStruct<Character.LooksParam>();
                context.Character.Jobs = reader.ReadStruct<Character.JobParam>();

                using(var db = new PolarisEf())
                    db.ChangeTracker.DetectChanges();
            }

            Map lobbyMap = ZoneManager.Instance.MapFromInstance("lobby", "lobby");
            lobbyMap.SpawnClient(context, lobbyMap.GetDefaultLocation(), "lobby");

            // Unlock Controls
            context.SendPacket(new NoPayloadPacket(0x03, 0x2B));

            //context.SendPacket(File.ReadAllBytes("testbed/237.23-7.210.189.208.30.bin"));

            // Give a blank palette
            context.SendPacket(new PalettePacket());

            // memset packet - Enables menus
            // Also holds event items and likely other stuff too
            var memSetPacket = File.ReadAllBytes("Resources/setMemoryPacket.bin");
            context.SendPacket(memSetPacket);
        }
开发者ID:ChowZenki,项目名称:PolarisServer,代码行数:34,代码来源:CharacterSpawn.cs

示例3: Init

        /// <summary>
        /// Initialises the connection to the server.
        /// Connects to the server and sends packets to initialise the session.
        /// </summary>
        /// <param name="client">Client to initialise</param>
        public Init(Client client)
        {
            client.ChangeConnection("109.234.73.11", 8484);

            PacketWriter Writer = new PacketWriter();
            Writer.WriteShort((short)PacketOpcodes.sInit1);
            client.SendPacket(Writer);
            Writer.Reset(0);

            Writer.WriteShort((short)PacketOpcodes.sInit2);
            client.SendPacket(Writer);
        }
开发者ID:dasdsad,项目名称:ms-wind,代码行数:17,代码来源:Init.cs

示例4: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.User == null)
                return;

            // Dunno what these are yet.
            context.SendPacket(0x11, 0xA, 0x0, BitConverter.GetBytes(context.User.PlayerId));
            context.SendPacket(0x1E, 0xC, 0x0, BitConverter.GetBytes(101));

            Map casinoMap = ZoneManager.Instance.MapFromInstance("casino", "lobby");
            casinoMap.SpawnClient(context, casinoMap.GetDefaultLocation());

        }
开发者ID:bruno32,项目名称:PolarisServer,代码行数:13,代码来源:CasinoTeleportHandler.cs

示例5: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            // What am I doing
            PSOPackets.QuestListPacket.QuestDefiniton[] defs = new PSOPackets.QuestListPacket.QuestDefiniton[1];
            for (int i = 0; i < defs.Length; i++)
            {
                defs[i].dateOrSomething = "2013/01/25";
                defs[i].questNameString = 20070;
                defs[i].needsToBeNonzero = 0x36;
                defs[i].getsSetToWord = 0xFFFF;
            }

            context.SendPacket(new QuestListPacket(defs));
            context.SendPacket(new NoPayloadPacket(0xb, 0x1b));
        }
开发者ID:bruno32,项目名称:PolarisServer,代码行数:15,代码来源:QuestCounterHandler.cs

示例6: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var tooManyZeros = new byte[UInt32.MaxValue - 8];

            // TODO: Test this lol
            context.SendPacket(0x00, 0x00, 0, tooManyZeros);
        }
开发者ID:bruno32,项目名称:PolarisServer,代码行数:7,代码来源:ClientDebug.cs

示例7: HandlePin

        public HandlePin(Client client, byte[] packet)
        {
            PacketReader Reader = new PacketReader(packet);

            byte type = Reader.ReadByte();

            if (type == 0)
            {
                PacketWriter Writer = new PacketWriter();

                Writer.WriteShort((short)PacketOpcodes.sWorldInfoRequest);
                client.SendPacket(Writer);
            }
            else if (type == 1)
            {
                MessageBox.Show("Please set a pin.");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
            else if (type == 2)
            {
                MessageBox.Show("Incorrect pin");
                client.MapleConnect.Close();
                client.LoginThread.Abort();
                client.Account.LoggingIn = false;
                client.MForm.ChangedAccount();
            }
        }
开发者ID:dasdsad,项目名称:ms-wind,代码行数:30,代码来源:HandlePin.cs

示例8: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.User == null || context.Character == null)
                return;

            context.SendPacket(new NoPayloadPacket(0x03, 0x23));
        }
开发者ID:Zenohate,项目名称:PolarisServer,代码行数:7,代码来源:StartGame.cs

示例9: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var writer = new PacketWriter();
            writer.Write((uint) 0);

            context.SendPacket(0x11, 0x55, 0x0, writer.ToArray());
        }
开发者ID:Zenohate,项目名称:PolarisServer,代码行数:7,代码来源:SimplePackets.cs

示例10: HandleSelectWorld

        public HandleSelectWorld(Client client)
        {
            for (int i = 0; i <= 1; i++)
            {
                if (client.Account.Worlds[i].Name.ToUpper() == client.Account.World.ToUpper())
                {
                    client.Account.WorldIndex = i;
                    int MinIndex = 0;

                    if (client.Account.AutoSelect)
                    {
                        for (int j = 0; j < client.Account.Worlds[i].ChannelCount; j++)
                        {
                            if (MinIndex == 0)
                                MinIndex = j;
                            else if (client.Account.Worlds[i].Channels[j].Population < client.Account.Worlds[i].Channels[MinIndex].Population)
                                MinIndex = j;
                        }
                        // MessageBox.Show("Selecting channel " + client.Account.Worlds[i].Channels[MinIndex].Name + " with the lowest population (" + client.Account.Worlds[i].Channels[MinIndex].Population + ")");
                        client.Account.ChannelIndex = MinIndex;
                    }
                }
            }

            if (client.Account.WorldIndex == -1)
                MessageBox.Show("Unable to find world.");
            else
            {
                PacketWriter Writer = new PacketWriter();
                Writer.WriteShort((short)PacketOpcodes.sSelectWorld);
                Writer.WriteShort(client.Account.Worlds[client.Account.WorldIndex].ID);
                client.SendPacket(Writer);
            }
        }
开发者ID:dasdsad,项目名称:ms-wind,代码行数:34,代码来源:HandleSelectWorld.cs

示例11: HandlePing

        public HandlePing(Client client)
        {
            PacketWriter Writer = new PacketWriter();
            Writer.WriteShort((short)PacketOpcodes.sPong);

            client.SendPacket(Writer);
        }
开发者ID:dasdsad,项目名称:ms-wind,代码行数:7,代码来源:HandlePing.cs

示例12: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.InputArc4 != null)
                return;

            if (size < 0x80)
                return;

            // Extract the first 0x80 bytes into a separate array
            var cryptedBlob = new byte[0x80];
            Array.Copy(data, position, cryptedBlob, 0, 0x80);
            Array.Reverse(cryptedBlob);

            // FIXME
            if (Client.RsaCsp == null)
            {
                Client.RsaCsp = new RSACryptoServiceProvider();
                var rsaBlob = File.ReadAllBytes("privateKey.blob");
                Client.RsaCsp.ImportCspBlob(rsaBlob);
            }

            var pkcs = new RSAPKCS1KeyExchangeDeformatter(Client.RsaCsp);
            byte[] decryptedBlob;

            try
            {
                decryptedBlob = pkcs.DecryptKeyExchange(cryptedBlob);
            }
            catch (CryptographicException ex)
            {
                Logger.WriteException("Error occured when decrypting the key exchange", ex);
                context.Socket.Close();
                return;
            }

            // Also a failure.
            if (decryptedBlob.Length < 0x20)
                return;

            // Extract the RC4 key
            var arc4Key = new byte[16];
            Array.Copy(decryptedBlob, 0x10, arc4Key, 0, 0x10);

            // Create three RC4 mungers
            var arc4 = new Arc4Managed {Key = arc4Key};
            context.InputArc4 = arc4.CreateDecryptor();

            arc4 = new Arc4Managed {Key = arc4Key};
            context.OutputArc4 = arc4.CreateEncryptor();

            arc4 = new Arc4Managed {Key = arc4Key};
            var tempDecryptor = arc4.CreateDecryptor();

            // Also, grab the init token for the client
            var decryptedToken = new byte[16];
            tempDecryptor.TransformBlock(decryptedBlob, 0, 0x10, decryptedToken, 0);

            context.SendPacket(0x11, 0xC, 0, decryptedToken);
        }
开发者ID:Zenohate,项目名称:PolarisServer,代码行数:59,代码来源:KeyExchange.cs

示例13: LoginCharacter

 public LoginCharacter(Client client, int id)
 {
     PacketWriter Writer = new PacketWriter();
     Writer.WriteShort((short)PacketOpcodes.sSelectCharacter);
     Writer.WriteInt(client.Account.Characters[id].ID);
     client.SendPacket(Writer);
     // Program.mFrm.CharLoggedIn(id);
 }
开发者ID:dasdsad,项目名称:ms-wind,代码行数:8,代码来源:LoginCharacter.cs

示例14: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            QuestDifficultyPacket.QuestDifficulty[] diffs = new QuestDifficultyPacket.QuestDifficulty[1];
            for (int i = 0; i < diffs.Length; i++)
            {
                diffs[i].dateOrSomething = "2012/01/05";
                diffs[i].something = 0x20;
                diffs[i].something2 = 0x0B;
                diffs[i].questNameString = 30010;

                // These are likely bitfields
                diffs[i].something3 = 0x00030301;
            }

            context.SendPacket(new QuestDifficultyPacket(diffs));

            // [K873] I believe this is the correct packet, but it causes an infinite send/recieve loop, we're probably just missing something else
            context.SendPacket(new NoPayloadPacket(0xB, 0x1C));
        }
开发者ID:mattkloc,项目名称:PolarisServer,代码行数:19,代码来源:QuestCounterHandler.cs

示例15: HandleEnter

        public static void HandleEnter(Client pClient, Packet pPacket)
        {
            pClient.SendPacket(CashShopPacket.Cash_Shop_Enter(pClient));
            pClient.SendPacket(CashShopPacket.Cash_Shop_Disable());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Categories());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Top_Items());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Picture_Items());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Special_Items());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Featured_Items());
            pClient.SendPacket(CashShopPacket.Cash_Shop_Update(pClient));

            HelpPacket.CashShopPackets(pClient);
        }
开发者ID:DragonNeos,项目名称:serenity-maple,代码行数:13,代码来源:CashShopHandler.cs


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