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


C# PacketWriter.WriteInt8方法代码示例

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


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

示例1: HandleCliQueryNPCText

        public static void HandleCliQueryNPCText(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            byte[] guidMask = { 5, 1, 4, 3, 2, 0, 7, 6 };
            byte[] guidBytes = { 3, 1, 4, 6, 2, 0, 5, 7 };

            var gossipTextId = packet.Read<int>();
            var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);

            var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));

            if (gossipData != null)
            {
                PacketWriter queryNPCTextResponse = new PacketWriter(ServerMessage.QueryNPCTextResponse);
                BitPack BitPack = new BitPack(queryNPCTextResponse);

                queryNPCTextResponse.WriteInt32(0);
                queryNPCTextResponse.WriteFloat(1);

                for (int i = 0; i < 7; i++)
                    queryNPCTextResponse.WriteUInt32(0);

                queryNPCTextResponse.WriteInt32(gossipData.BroadCastText.Id);

                for (int i = 0; i < 7; i++)
                    queryNPCTextResponse.WriteUInt32(0);

                var size = (uint)queryNPCTextResponse.BaseStream.Length - 8;

                queryNPCTextResponse.WriteUInt32Pos(size, 4);
                queryNPCTextResponse.WriteInt8(0);
                queryNPCTextResponse.WriteInt32(gossipTextId);

                BitPack.Write(1);
                BitPack.Flush();

                session.Send(ref queryNPCTextResponse);
            }
        }
开发者ID:Nowhereman23,项目名称:Arctium-WoW,代码行数:40,代码来源:CacheHandler.cs

示例2: HandleUpdateActionButtons

        public static void HandleUpdateActionButtons(ref WorldClass session)
        {
            var pChar = session.Character;

            PacketWriter updateActionButtons = new PacketWriter(ServerMessage.UpdateActionButtons);
            BitPack BitPack = new BitPack(updateActionButtons);

            const int buttonCount = 132;
            var buttons = new byte[buttonCount][];

            byte[] buttonMask = { 0, 1, 3, 4, 6, 7, 2, 5 };
            byte[] buttonBytes = { 5, 2, 0, 1, 3, 6, 4, 7 };

            var actions = ActionMgr.GetActionButtons(pChar, pChar.ActiveSpecGroup);

            for (int i = 0; i < buttonCount; i++)
                if (actions.Any(action => action.SlotId == i))
                    buttons[i] = BitConverter.GetBytes((ulong)actions.Where(action => action.SlotId == i).Select(action => action.Action).First());
                else
                    buttons[i] = new byte[8];

            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < buttonCount; j++)
                {
                    if (i < 8)
                        BitPack.Write(buttons[j][buttonMask[i]]);
                    else if (i < 16)
                    {
                        BitPack.Flush();

                        if (buttons[j][buttonBytes[i - 8]] != 0)
                            updateActionButtons.WriteUInt8((byte)(buttons[j][buttonBytes[i - 8]] ^ 1));
                    }
                }
            }

            // 0 - Initial packet on Login (no verification) / 1 - Verify spells on switch (Spec change) / 2 - Clear Action Buttons (Spec change)
            updateActionButtons.WriteInt8(0);

            session.Send(ref updateActionButtons);
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:42,代码来源:MiscHandler.cs

示例3: HandleVendorTabeList

        public static void HandleVendorTabeList(ref PacketReader packet, ref WorldClass session)
        {
            ulong targetGuid = packet.ReadUInt64();
            if (targetGuid == session.Character.TargetGuid)
            {
            HighGuidType  lol = Framework.ObjectDefines.ObjectGuid.GetGuidType(targetGuid);
              ulong odd =      ObjectGuid.GetGuid(targetGuid);
              CreatureSpawn spawn =  Globals.SpawnMgr.FindSpawn(targetGuid);
              Creature  npc = spawn.Creature;

                  PacketWriter Inventory = new PacketWriter(JAMCMessage.VendorInventory);
                  BitPack ss = new BitPack(Inventory);
                  Inventory.WriteInt8(0x01);//client expects counting to start at 1??
                byte[] count = {00,10,00};//count dat bitstream fortmat unkown
                Inventory.WriteBytes(count, 3);
             /*Item1*/
                Inventory.WriteInt8(11);//slot
                Inventory.WriteInt32(0xFFF010);//left ub stock?
                  ss.Flush();
                 string ssss = "00 00 0C 34 00 00 0C 10 00 00 00 10 00 00 05 30 00 00 03 C0 00 00 00 10 00 00 0C 74 00 00 00 B0 E0 00 0F FF FF FF F0 00 00 00 00 20 00 00 00 10 00 00 02 80 00 00 01 40 00 00 00 10 00 00 0C 44 00 00 0C 20 00 00 0F FF FF FF F0 00 00 00 00 30 00 00 00 10 00 00 05 30 00 00 02 D0 00 00 00 10 00 00 0C 64 00 00 0C 30 00 00 0F FF FF FF F0 00 00 00 00 40 00 00 00 10 00 00 03 E0 00 00 01 E0 00 00 00 10 00 00 0C 84 00 00 00 C0 E0 00 0F FF FF FF F0 00 00 00 00 50 00 00 00 10 00 00 02 80 00 00 01 40 00 00 00 10 00 00 0C 54 00 00 0C 70 20 00 0F FF FF FF F0 00 00 00 00 60 00 00 00 10 00 00 02 C0 00 00 01 40 00 00 00 10 00 00 0F 34 10 00 05 50 00 00 0F FF FF FF F0 00 00 00 00 70 00 00 00 10 00 00 05 50 00 00 03 C0 00 00 00 10 00 00 06 B3 80 00 02 B0 70 00 0F FF FF FF F0 00 00 00 00 80 00 00 00 10 00 00 02 B0 00 00 01 40 00 00 00 10 00 00 0F 44 20 00 0D 10 00 00 0F FF FF FF F0 00 00 00 00 90 00 00 00 10 00 00 05 20 00 00 02 D0 00 00 00 10 00 00 06 C3 80 00 0D 20 00 00 0F FF FF FF F0 00 00 00 00 A0 00 00 00 10 00 00 03 D0 00 00 01 E0 00 00 00 10 00 00 0A 93 70 00 02 C0 70 00 0F FF FF FF F0 00 00 00 00 B0 00 00 00 10 00 00 02 B0 00 00 01 40 00 00 00 10 00 00 06 D3 80 00 0C A0 20 00 0F FF FF FF F0 00 00 00 00 C0 00 00 00 10 00 00 02 C0 00 00 01 40 00 00 05 99 CF 03 10 D9 C0";
                  string[] all = ssss.Split(' ');

                //  int gu = int.Parse(all[0] + " " + all[1] + " " + all[2] + " " + all[3], System.Globalization.NumberStyles.HexNumber);
                  foreach (string a in all)
                  {
                      byte test = byte.Parse(a, System.Globalization.NumberStyles.HexNumber);
                      Inventory.WriteUInt8(test);
                  }

                 /* Inventory.WriteGuid(121332123);
                   Item ii = npc.Data.VendorItems[0];

                   Inventory.WriteUInt32(1);       // client expects counting to start at 1
                   Inventory.WriteUInt32(1); // unk 4.0.1 always 1
                   Inventory.WriteUInt32((uint)71634);
                   Inventory.WriteUInt32((uint)69314);
                   Inventory.WriteUInt32(0xFFFFFFFF);//left in stcok
                   Inventory.WriteUInt32(1);
                   Inventory.WriteUInt32(0);
                   Inventory.WriteUInt32(1);
                   Inventory.WriteUInt32(0);
                   Inventory.WriteInt8(0); ;*/
                  // unk 4.0.1
                 session.Send(ref Inventory);

              Console.WriteLine(npc.Data.NpcFlags);
            }
              //  Globals.WorldMgr.
        }
开发者ID:Mathias1000,项目名称:Arctium,代码行数:49,代码来源:ItemHandler.cs


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