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


C# PacketWriter.WriteMagic方法代码示例

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


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

示例1: Build

 public override byte[] Build()
 {
     PacketWriter writer = new PacketWriter();
     writer.WriteMagic((uint)questdefs.Length, 0x1DB0, 0xC5);
     foreach (QuestDefiniton d in questdefs)
     {
         writer.WriteStruct(d);
     }
     return writer.ToArray();
 }
开发者ID:bruno32,项目名称:PolarisServer,代码行数:10,代码来源:QuestListPacket.cs

示例2: Build

        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();

            writer.WriteMagic((uint)questdiffs.Length, 0x292C, 0x5B);
            foreach (QuestDifficulty d in questdiffs)
            {
                writer.WriteStruct(d);
            }
            return writer.ToArray();
        }
开发者ID:ChowZenki,项目名称:PolarisServer,代码行数:11,代码来源:QuestDifficultyPacket.cs

示例3: Build

        public override byte[] Build()
        {
            PacketWriter writer = new PacketWriter();
            writer.WriteStruct(player);
            writer.Write(-1); // Dunno what goes here
            writer.WriteMagic(0x20, 0xE80C, 0xED); // 20 Things
            writer.Write(new Byte[16 * 0x20]); // 16 Bytes each

            return writer.ToArray();

        }
开发者ID:Dreadlow,项目名称:PolarisServer,代码行数:11,代码来源:SymbolArtList.cs

示例4: HandlePacket

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            PacketReader reader = new PacketReader(data);
            reader.ReadStruct<ObjectHeader>(); // Skip blank entity header.
            var preformer = reader.ReadStruct<ObjectHeader>(); // Preformer
            byte[] preData = reader.ReadBytes(40);
            string command = reader.ReadAscii(0x922D, 0x45);
            byte[] rest = reader.ReadBytes(4);
            uint thingCount = reader.ReadMagic(0x922D, 0x45);
            byte[] things;
            PacketWriter thingWriter = new PacketWriter();
            for (int i = 0; i < thingCount; i++)
            {
                thingWriter.Write(reader.ReadBytes(4));
            }
            things = thingWriter.ToArray();
            byte[] final = reader.ReadBytes(4);

            Logger.WriteInternal("[ACT] {0} is preforming {1}", context.Character.Name, command);

            foreach (var c in Server.Instance.Clients)
            {
                if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
                    continue;
                PacketWriter output = new PacketWriter();
                output.WriteStruct(new ObjectHeader((uint)context.User.PlayerId, EntityType.Player));
                output.WriteStruct(preformer);
                output.Write(preData);
                output.WriteAscii(command, 0x4315, 0x7A);
                output.Write(rest);
                output.WriteMagic(thingCount, 0x4315, 0x7A);
                output.Write(things);
                output.Write(final);

                c.SendPacket(0x4, 0x80, 0x44, output.ToArray());

            }
        }
开发者ID:Joslyn-Maddie,项目名称:PolarisServer,代码行数:38,代码来源:MovementHandlers.cs

示例5: Build

        public override byte[] Build()
        {
            if (members.Length < 1)
                return new byte[0];

            // xor: 0xD863, sub: 0xA9
            PacketWriter writer = new PacketWriter();
            writer.WriteBytes(0, 12); // Unknown 12 bytes, not obj header
            writer.WriteStruct(new ObjectHeader((uint)members[0].Player.PlayerId, EntityType.Player)); // Player receiving the thing
            writer.WriteStruct(members.Length); // Likely partymembercount

            for(int i = 0; i < members.Length; i++)
            {
                writer.WriteStruct(new ObjectHeader((uint)members[i].Player.PlayerId, EntityType.Player)); // Header of player
                writer.WriteUtf16(members[i].Name, 0xD863, 0xA9);
                writer.WriteUtf16(members[i].Player.Nickname, 0xD863, 0xA9);
                writer.Write((byte)members[i].Jobs.entries.hunter.level); // Active class level
                writer.Write((byte)0); // idk
                writer.Write((byte)4); // idk
                writer.Write((byte)0xFF); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0xFF); // idk
                writer.Write((byte)0xFF); // idk
                writer.Write((byte)0); // idk
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.WriteBytes(0, 12);
                writer.Write(0);
                writer.Write(0);
            }

            for(int i = 0; i < 4 - members.Length; i++) // Empty entries
            {
                writer.WriteStruct(new ObjectHeader(0, 0)); // Header of player
                writer.WriteMagic(0, 0xD863, 0xA9);
                writer.WriteMagic(0, 0xD863, 0xA9);
                writer.Write((byte)0); // Active class level
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((byte)0); // idk
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.Write((ushort)0);
                writer.WriteBytes(0, 12);
                writer.Write(0);
            }

            return writer.ToArray();
        }
开发者ID:ChowZenki,项目名称:PolarisServer,代码行数:62,代码来源:PartyInitPacket.cs


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