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


C# IPacket.CreateReader方法代码示例

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


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

示例1: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            int guildId = reader.ReadInt32();
            var guild = new Guild
                            {
                                Id = guildId,
                                Name = "guild"
                            };

            IPacketBuilder responce = WorldPacketFactory.Build(
                WMSG.SMSG_GUILD_QUERY_RESPONSE,
                writer =>
                    {
                        writer.Write(guild.Id);
                        writer.WriteCString(guild.Name);
                        foreach (GuildRank rank in guild.Ranks)
                            writer.WriteCString(rank.Name);
                        for (int i = 0; i < 10 - guild.Ranks.Count; i++)
                            writer.WriteCString(string.Empty);
                        writer.Write(guild.Tabard.EmblemStyle);
                        writer.Write(guild.Tabard.EmblemColor);
                        writer.Write(guild.Tabard.BorderStyle);
                        writer.Write(guild.Tabard.BorderColor);
                        writer.Write(guild.Tabard.BackgroundColor);
                        writer.Write(0); // NEW 3.0.2
                    });
            session.Send(responce);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:29,代码来源:GuildQuery.cs

示例2: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte castCount = reader.ReadByte();
            uint spellId = reader.ReadUInt32();
            byte unklags = reader.ReadByte();

            IPacket pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_START);
            BinaryWriter writer = pkt.CreateWriter();
            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0); //cast flags
            writer.Write(0); //ticks count
            writer.Write(0); //targetflags
            session.Send(pkt);

            Thread.Sleep(5000);
            pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_GO);
            writer = pkt.CreateWriter();
            writer.WritePackGuid(session.Player.Guid);
            writer.WritePackGuid(session.Player.Guid);
            writer.Write(castCount);
            writer.Write(spellId);
            writer.Write(0); //cast flags
            writer.Write(0); //ticks count
            writer.Write((byte)1); //hit count
            writer.Write(session.Player.Guid);
            writer.Write((byte)0); //miss count
            writer.Write(0); // targetflags
            session.Send(pkt);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:33,代码来源:CastSpellDispatcher.cs

示例3: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader r = packet.CreateReader();
            uint unk1 = r.ReadUInt32();

            session.SendRealmSplitPkt(unk1);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:7,代码来源:RealmSplitDispatcher.cs

示例4: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var type = (MessageType) reader.ReadUInt32();
            uint language = reader.ReadUInt32();
            string channel = type == MessageType.Channel || type == MessageType.Whisper
                                 ? reader.ReadCString()
                                 : string.Empty;
            string message = reader.ReadCString();

            var pkt = WorldPacketFactory.Create(WMSG.SMSG_MESSAGECHAT);
            var writer = pkt.CreateWriter();
            writer.Write((byte)type);
            writer.Write((uint)0);
            writer.Write(session.Player.Guid);
            writer.Write(0);
            /*
            if (target != null)
                writer.WritePascalString(target);
            */
            writer.Write((ulong)0);
            writer.WritePascalString(message);
            writer.Write((byte)0);

            var players = ObjectManager.GetPlayersNear(session.Player);
            foreach (var player in players)
            {
                player.Session.Send(pkt);
            }

            Console.WriteLine("{0} {1} {2} {3}", type, language, channel, message);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:32,代码来源:MessageChat.cs

示例5: Dispatch

 public void Dispatch(ISession session, IPacket packet)
 {
     var reader = packet.CreateReader();
     var guid = reader.ReadUInt64();
     var questId = reader.ReadUInt32();
     var a = reader.ReadByte();
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:7,代码来源:QuestgiverQueryQuest.cs

示例6: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            ulong guid = reader.ReadUInt64();
            Player player = session.Account.GetPlayer(guid);

            session.Login(player);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:8,代码来源:PlayerLoginDispatcher.cs

示例7: Dispatch

 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader r = packet.CreateReader();
     uint creatureId = r.ReadUInt32();
     CreatureTemplate creature = IoC.Resolve<ICreatureTemplateRepository>().FindById(creatureId);
     if(creature != null) {
         session.SendCreatureQueryResponce(creature);
     }
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:9,代码来源:CreatureQueryDispatcher.cs

示例8: Dispatch

 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader r = packet.CreateReader();
     uint itemId = r.ReadUInt32();
     ItemTemplate template = IoC.Resolve<IItemTemplateRepository>().FindById(itemId);
     if(template != null) {
         session.SendItemQuerySingleResponse(template);
     }
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:9,代码来源:ItemQuerySingleDispatcher.cs

示例9: Dispatch

 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader reader = packet.CreateReader();
     uint id = reader.ReadUInt32();
     GameObjectTemplate template = IoC.Resolve<IGameObjectTemplateRepository>().FindById(id);
     if(template != null) {
         session.SendGameObjectQueryResponce(template);
     }
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:9,代码来源:GameObjectQueryDispatcher.cs

示例10: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            var type = (AccountDataType)reader.ReadUInt32();
            ulong guid = session.Player != null ? session.Player.Guid : 0;

            AccpuntData accpuntData = session.Account.FindAccpuntData(type, guid);

            session.Send(GetUpdateAccountDataPkt(accpuntData));
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:10,代码来源:RequestAccountDataDispatcher.cs

示例11: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            byte srcSlot = reader.ReadByte();
            byte dstSlot = reader.ReadByte();

            Player player = session.Player;

            SwapItems(player.Inventory, srcSlot, player.Inventory, dstSlot);
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:10,代码来源:SwapInvItemDispatcher.cs

示例12: GetMoveResponce

        private static IPacket GetMoveResponce(IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            byte[] bytes = reader.ReadBytes(packet.Size);

            IPacket responce = WorldPacketFactory.Create((WMSG)packet.Code);
            BinaryWriter w = responce.CreateWriter();
            w.Write(bytes);
            return responce;
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:11,代码来源:MoveHandlers.cs

示例13: Dispatch

        public void Dispatch(ISession session, IPacket packet)
        {
            BinaryReader reader = packet.CreateReader();
            uint textId = reader.ReadUInt32();
            ulong targetGuid = reader.ReadUInt64();

            NpcTexts text = IoC.Resolve<INpcTextRepository>().FindById(textId);
            if(text != null) {
                session.SendNpcTextUpdate(text);
            }
        }
开发者ID:hazzik,项目名称:uwow2,代码行数:11,代码来源:NpcTextQueryDispatcher.cs

示例14: Dispatch

 public void Dispatch(ISession session, IPacket packet)
 {
     BinaryReader reader = packet.CreateReader();
     ulong targetGuid = reader.ReadUInt64();
     uint unk1 = reader.ReadUInt32();
     uint option = reader.ReadUInt32();
     if(option==1) {
         session.Player.Health = 0;
     }else {
         session.SendShowBank(targetGuid);
     }
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:12,代码来源:GossipSelectOptionDispatcher.cs

示例15: Dispatch

 public void Dispatch(ISession client, IPacket packet)
 {
     Player me = client.Player;
     Session.SendNearExceptMe(me, GetMoveResponce(packet));
     BinaryReader reader = packet.CreateReader();
     reader.BaseStream.Seek(0, SeekOrigin.Begin);
     ulong guid = reader.ReadPackGuid();
     if(guid != me.Guid) {
         throw new Exception();
     }
     me.MovementInfo.Read(reader);
 }
开发者ID:hazzik,项目名称:uwow2,代码行数:12,代码来源:MoveHandlers.cs


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