Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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.
        }