mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Added 0x6c to the actorIdChanger. Mount appearance is now broadcast to show Goobbue. Equipment packets implemented as well as Equipment object.
This commit is contained in:
		@@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
        public const ushort OPCODE = 0x014D;
 | 
			
		||||
        public const uint PACKET_SIZE = 0x28;
 | 
			
		||||
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorID, ushort slot, uint itemSlot)
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorID, ushort equipSlot, uint itemSlot)
 | 
			
		||||
        {
 | 
			
		||||
            byte[] data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +21,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
            {
 | 
			
		||||
                using (BinaryWriter binWriter = new BinaryWriter(mem))
 | 
			
		||||
                {
 | 
			
		||||
                    binWriter.Write((UInt16)slot);
 | 
			
		||||
                    binWriter.Write((UInt16)equipSlot);
 | 
			
		||||
                    binWriter.Write((UInt32)itemSlot);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using FFXIVClassic_Lobby_Server.packets;
 | 
			
		||||
using FFXIVClassic_Map_Server.dataobjects;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
@@ -13,85 +14,33 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
        public const ushort OPCODE = 0x14E;
 | 
			
		||||
        public const uint PACKET_SIZE = 0x58;
 | 
			
		||||
 | 
			
		||||
        public const uint UNEQUIPPED = 0xFFFFFFFF;
 | 
			
		||||
 | 
			
		||||
        public const int SLOT_MAINHAND			    = 0x00;
 | 
			
		||||
		public const int SLOT_OFFHAND			    = 0x01;
 | 
			
		||||
		public const int SLOT_THROWINGWEAPON		= 0x04;
 | 
			
		||||
		public const int SLOT_PACK				    = 0x05;
 | 
			
		||||
		public const int SLOT_POUCH				    = 0x06;
 | 
			
		||||
		public const int SLOT_HEAD				    = 0x08;
 | 
			
		||||
		public const int SLOT_UNDERSHIRT			= 0x09;
 | 
			
		||||
		public const int SLOT_BODY				    = 0x0A;
 | 
			
		||||
		public const int SLOT_UNDERGARMENT		    = 0x0B;
 | 
			
		||||
		public const int SLOT_LEGS				    = 0x0C;
 | 
			
		||||
		public const int SLOT_HANDS				    = 0x0D;
 | 
			
		||||
		public const int SLOT_BOOTS				    = 0x0E;
 | 
			
		||||
		public const int SLOT_WAIST				    = 0x0F;
 | 
			
		||||
		public const int SLOT_NECK				    = 0x10;
 | 
			
		||||
		public const int SLOT_EARS				    = 0x11;
 | 
			
		||||
		public const int SLOT_WRISTS				= 0x13;
 | 
			
		||||
		public const int SLOT_RIGHTFINGER		    = 0x15;
 | 
			
		||||
		public const int SLOT_LEFTFINGER			= 0x16;
 | 
			
		||||
 | 
			
		||||
        private uint[] equipment = new uint[0x17];
 | 
			
		||||
 | 
			
		||||
        public EquipmentListX08Packet()
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorId, Item[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
                equipment[i] = UNEQUIPPED; //We will use this as "Unequipped"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setItem(int slot, uint itemSlot)
 | 
			
		||||
        {
 | 
			
		||||
            if (slot >= equipment.Length)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            equipment[slot] = itemSlot;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public List<SubPacket> buildPackets(uint playerActorID)
 | 
			
		||||
        {            
 | 
			
		||||
            List<SubPacket> packets = new List<SubPacket>();
 | 
			
		||||
            int packetCount = 0;
 | 
			
		||||
            int runningCount = 0;
 | 
			
		||||
            byte[] data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
            MemoryStream mem = new MemoryStream(data);
 | 
			
		||||
            BinaryWriter binWriter = new BinaryWriter(mem);
 | 
			
		||||
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
            using (MemoryStream mem = new MemoryStream(data))
 | 
			
		||||
            {
 | 
			
		||||
                if (equipment[i] == UNEQUIPPED)
 | 
			
		||||
                    continue;
 | 
			
		||||
 | 
			
		||||
                binWriter.Write((UInt16)i);
 | 
			
		||||
                binWriter.Write((UInt32)equipment[i]);
 | 
			
		||||
 | 
			
		||||
                packetCount++;
 | 
			
		||||
                runningCount++;
 | 
			
		||||
 | 
			
		||||
                //Create another packet
 | 
			
		||||
                if (runningCount >= 8)
 | 
			
		||||
                using (BinaryWriter binWriter = new BinaryWriter(mem))
 | 
			
		||||
                {
 | 
			
		||||
                    packetCount = 0;
 | 
			
		||||
                    binWriter.Write((UInt32)8);
 | 
			
		||||
                    binWriter.Dispose();
 | 
			
		||||
                    mem.Dispose();
 | 
			
		||||
                    packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                    data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
                    mem = new MemoryStream(data);
 | 
			
		||||
                    binWriter = new BinaryWriter(mem);
 | 
			
		||||
                    int max;
 | 
			
		||||
                    if (slotsToUpdate.Count - listOffset <= 8)
 | 
			
		||||
                        max = slotsToUpdate.Count - listOffset;
 | 
			
		||||
                    else
 | 
			
		||||
                        max = 8;
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < max; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        binWriter.Write((UInt16)slotsToUpdate[i]);
 | 
			
		||||
                        binWriter.Write((UInt32)equipment[slotsToUpdate[i]].slot);
 | 
			
		||||
                        listOffset++;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    binWriter.Seek(0x30, SeekOrigin.Begin);
 | 
			
		||||
                    binWriter.Write((UInt32)max);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Create any leftover subpacket
 | 
			
		||||
            binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin);
 | 
			
		||||
            binWriter.Write((UInt32)packetCount);
 | 
			
		||||
            binWriter.Dispose();
 | 
			
		||||
            mem.Dispose();
 | 
			
		||||
            packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                   
 | 
			
		||||
            return packets;
 | 
			
		||||
            return new SubPacket(OPCODE, playerActorId, playerActorId, data);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using FFXIVClassic_Lobby_Server.packets;
 | 
			
		||||
using FFXIVClassic_Map_Server.dataobjects;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
@@ -13,85 +14,31 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
        public const ushort OPCODE = 0x14F;
 | 
			
		||||
        public const uint PACKET_SIZE = 0x80;
 | 
			
		||||
 | 
			
		||||
        public const uint UNEQUIPPED = 0xFFFFFFFF;
 | 
			
		||||
 | 
			
		||||
        public const int SLOT_MAINHAND			    = 0x00;
 | 
			
		||||
		public const int SLOT_OFFHAND			    = 0x01;
 | 
			
		||||
		public const int SLOT_THROWINGWEAPON		= 0x04;
 | 
			
		||||
		public const int SLOT_PACK				    = 0x05;
 | 
			
		||||
		public const int SLOT_POUCH				    = 0x06;
 | 
			
		||||
		public const int SLOT_HEAD				    = 0x08;
 | 
			
		||||
		public const int SLOT_UNDERSHIRT			= 0x09;
 | 
			
		||||
		public const int SLOT_BODY				    = 0x0A;
 | 
			
		||||
		public const int SLOT_UNDERGARMENT		    = 0x0B;
 | 
			
		||||
		public const int SLOT_LEGS				    = 0x0C;
 | 
			
		||||
		public const int SLOT_HANDS				    = 0x0D;
 | 
			
		||||
		public const int SLOT_BOOTS				    = 0x0E;
 | 
			
		||||
		public const int SLOT_WAIST				    = 0x0F;
 | 
			
		||||
		public const int SLOT_NECK				    = 0x10;
 | 
			
		||||
		public const int SLOT_EARS				    = 0x11;
 | 
			
		||||
		public const int SLOT_WRISTS				= 0x13;
 | 
			
		||||
		public const int SLOT_RIGHTFINGER		    = 0x15;
 | 
			
		||||
		public const int SLOT_LEFTFINGER			= 0x16;
 | 
			
		||||
 | 
			
		||||
        private uint[] equipment = new uint[0x17];
 | 
			
		||||
 | 
			
		||||
        public EquipmentListX16Packet()
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorId, Item[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
                equipment[i] = UNEQUIPPED; //We will use this as "Unequipped"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setItem(int slot, uint itemSlot)
 | 
			
		||||
        {
 | 
			
		||||
            if (slot >= equipment.Length)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            equipment[slot] = itemSlot;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public List<SubPacket> buildPackets(uint playerActorID)
 | 
			
		||||
        {            
 | 
			
		||||
            List<SubPacket> packets = new List<SubPacket>();
 | 
			
		||||
            int packetCount = 0;
 | 
			
		||||
            int runningCount = 0;
 | 
			
		||||
            byte[] data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
            MemoryStream mem = new MemoryStream(data);
 | 
			
		||||
            BinaryWriter binWriter = new BinaryWriter(mem);
 | 
			
		||||
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
            using (MemoryStream mem = new MemoryStream(data))
 | 
			
		||||
            {
 | 
			
		||||
                if (equipment[i] == UNEQUIPPED)
 | 
			
		||||
                    continue;
 | 
			
		||||
 | 
			
		||||
                binWriter.Write((UInt16)i);
 | 
			
		||||
                binWriter.Write((UInt32)equipment[i]);
 | 
			
		||||
 | 
			
		||||
                packetCount++;
 | 
			
		||||
                runningCount++;
 | 
			
		||||
 | 
			
		||||
                //Create another packet
 | 
			
		||||
                if (runningCount >= 16)
 | 
			
		||||
                using (BinaryWriter binWriter = new BinaryWriter(mem))
 | 
			
		||||
                {
 | 
			
		||||
                    packetCount = 0;
 | 
			
		||||
                    binWriter.Write((UInt32)8);
 | 
			
		||||
                    binWriter.Dispose();
 | 
			
		||||
                    mem.Dispose();
 | 
			
		||||
                    packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                    data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
                    mem = new MemoryStream(data);
 | 
			
		||||
                    binWriter = new BinaryWriter(mem);
 | 
			
		||||
                    int max;
 | 
			
		||||
                    if (slotsToUpdate.Count - listOffset <= 16)
 | 
			
		||||
                        max = slotsToUpdate.Count - listOffset;
 | 
			
		||||
                    else
 | 
			
		||||
                        max = 16;
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < max; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        binWriter.Write((UInt16)slotsToUpdate[i]);
 | 
			
		||||
                        binWriter.Write((UInt32)equipment[slotsToUpdate[i]].slot);
 | 
			
		||||
                        listOffset++;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Create any leftover subpacket
 | 
			
		||||
            binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin);
 | 
			
		||||
            binWriter.Write((UInt32)packetCount);
 | 
			
		||||
            binWriter.Dispose();
 | 
			
		||||
            mem.Dispose();
 | 
			
		||||
            packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                   
 | 
			
		||||
            return packets;
 | 
			
		||||
            return new SubPacket(OPCODE, playerActorId, playerActorId, data);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using FFXIVClassic_Lobby_Server.packets;
 | 
			
		||||
using FFXIVClassic_Map_Server.dataobjects;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
@@ -13,86 +14,32 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
        public const ushort OPCODE = 0x150;
 | 
			
		||||
        public const uint PACKET_SIZE = 0xE0;
 | 
			
		||||
 | 
			
		||||
        public const uint UNEQUIPPED = 0xFFFFFFFF;
 | 
			
		||||
 | 
			
		||||
        public const int SLOT_MAINHAND			    = 0x00;
 | 
			
		||||
		public const int SLOT_OFFHAND			    = 0x01;
 | 
			
		||||
		public const int SLOT_THROWINGWEAPON		= 0x04;
 | 
			
		||||
		public const int SLOT_PACK				    = 0x05;
 | 
			
		||||
		public const int SLOT_POUCH				    = 0x06;
 | 
			
		||||
		public const int SLOT_HEAD				    = 0x08;
 | 
			
		||||
		public const int SLOT_UNDERSHIRT			= 0x09;
 | 
			
		||||
		public const int SLOT_BODY				    = 0x0A;
 | 
			
		||||
		public const int SLOT_UNDERGARMENT		    = 0x0B;
 | 
			
		||||
		public const int SLOT_LEGS				    = 0x0C;
 | 
			
		||||
		public const int SLOT_HANDS				    = 0x0D;
 | 
			
		||||
		public const int SLOT_BOOTS				    = 0x0E;
 | 
			
		||||
		public const int SLOT_WAIST				    = 0x0F;
 | 
			
		||||
		public const int SLOT_NECK				    = 0x10;
 | 
			
		||||
		public const int SLOT_EARS				    = 0x11;
 | 
			
		||||
		public const int SLOT_WRISTS				= 0x13;
 | 
			
		||||
		public const int SLOT_RIGHTFINGER		    = 0x15;
 | 
			
		||||
		public const int SLOT_LEFTFINGER			= 0x16;
 | 
			
		||||
 | 
			
		||||
        private uint[] equipment = new uint[0x17];
 | 
			
		||||
 | 
			
		||||
        public EquipmentListX32Packet()
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorId, Item[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
                equipment[i] = UNEQUIPPED; //We will use this as "Unequipped"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setItem(int slot, uint itemSlot)
 | 
			
		||||
        {
 | 
			
		||||
            if (slot >= equipment.Length)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            equipment[slot] = itemSlot;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public List<SubPacket> buildPackets(uint playerActorID)
 | 
			
		||||
        {            
 | 
			
		||||
            List<SubPacket> packets = new List<SubPacket>();
 | 
			
		||||
            int packetCount = 0;
 | 
			
		||||
            int runningCount = 0;
 | 
			
		||||
            byte[] data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
            MemoryStream mem = new MemoryStream(data);
 | 
			
		||||
            BinaryWriter binWriter = new BinaryWriter(mem);
 | 
			
		||||
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
            using (MemoryStream mem = new MemoryStream(data))
 | 
			
		||||
            {
 | 
			
		||||
                if (equipment[i] == UNEQUIPPED)
 | 
			
		||||
                    continue;
 | 
			
		||||
 | 
			
		||||
                binWriter.Write((UInt16)i);
 | 
			
		||||
                binWriter.Write((UInt32)equipment[i]);
 | 
			
		||||
 | 
			
		||||
                packetCount++;
 | 
			
		||||
                runningCount++;
 | 
			
		||||
 | 
			
		||||
                //Create another packet
 | 
			
		||||
                if (runningCount >= 32)
 | 
			
		||||
                using (BinaryWriter binWriter = new BinaryWriter(mem))
 | 
			
		||||
                {
 | 
			
		||||
                    packetCount = 0;
 | 
			
		||||
                    binWriter.Write((UInt32)8);
 | 
			
		||||
                    binWriter.Dispose();
 | 
			
		||||
                    mem.Dispose();
 | 
			
		||||
                    packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                    data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
                    mem = new MemoryStream(data);
 | 
			
		||||
                    binWriter = new BinaryWriter(mem);
 | 
			
		||||
                    int max;
 | 
			
		||||
                    if (slotsToUpdate.Count - listOffset <= 32)
 | 
			
		||||
                        max = slotsToUpdate.Count - listOffset;
 | 
			
		||||
                    else
 | 
			
		||||
                        max = 32;
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < max; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        binWriter.Write((UInt16)slotsToUpdate[i]);
 | 
			
		||||
                        binWriter.Write((UInt32)equipment[slotsToUpdate[i]].slot);
 | 
			
		||||
                        listOffset++;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Create any leftover subpacket
 | 
			
		||||
            binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin);
 | 
			
		||||
            binWriter.Write((UInt32)packetCount);
 | 
			
		||||
            binWriter.Dispose();
 | 
			
		||||
            mem.Dispose();
 | 
			
		||||
            packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                   
 | 
			
		||||
            return packets;
 | 
			
		||||
        }
 | 
			
		||||
            return new SubPacket(OPCODE, playerActorId, playerActorId, data);
 | 
			
		||||
        }    
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
using FFXIVClassic_Lobby_Server.packets;
 | 
			
		||||
using FFXIVClassic_Map_Server.dataobjects;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.IO;
 | 
			
		||||
@@ -13,85 +14,31 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
 | 
			
		||||
        public const ushort OPCODE = 0x151;
 | 
			
		||||
        public const uint PACKET_SIZE = 0x194;
 | 
			
		||||
 | 
			
		||||
        public const uint UNEQUIPPED = 0xFFFFFFFF;
 | 
			
		||||
 | 
			
		||||
        public const int SLOT_MAINHAND			    = 0x00;
 | 
			
		||||
		public const int SLOT_OFFHAND			    = 0x01;
 | 
			
		||||
		public const int SLOT_THROWINGWEAPON		= 0x04;
 | 
			
		||||
		public const int SLOT_PACK				    = 0x05;
 | 
			
		||||
		public const int SLOT_POUCH				    = 0x06;
 | 
			
		||||
		public const int SLOT_HEAD				    = 0x08;
 | 
			
		||||
		public const int SLOT_UNDERSHIRT			= 0x09;
 | 
			
		||||
		public const int SLOT_BODY				    = 0x0A;
 | 
			
		||||
		public const int SLOT_UNDERGARMENT		    = 0x0B;
 | 
			
		||||
		public const int SLOT_LEGS				    = 0x0C;
 | 
			
		||||
		public const int SLOT_HANDS				    = 0x0D;
 | 
			
		||||
		public const int SLOT_BOOTS				    = 0x0E;
 | 
			
		||||
		public const int SLOT_WAIST				    = 0x0F;
 | 
			
		||||
		public const int SLOT_NECK				    = 0x10;
 | 
			
		||||
		public const int SLOT_EARS				    = 0x11;
 | 
			
		||||
		public const int SLOT_WRISTS				= 0x13;
 | 
			
		||||
		public const int SLOT_RIGHTFINGER		    = 0x15;
 | 
			
		||||
		public const int SLOT_LEFTFINGER			= 0x16;
 | 
			
		||||
 | 
			
		||||
        private uint[] equipment = new uint[0x17];
 | 
			
		||||
 | 
			
		||||
        public EquipmentListX64Packet()
 | 
			
		||||
        public static SubPacket buildPacket(uint playerActorId, Item[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
                equipment[i] = UNEQUIPPED; //We will use this as "Unequipped"
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void setItem(int slot, uint itemSlot)
 | 
			
		||||
        {
 | 
			
		||||
            if (slot >= equipment.Length)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            equipment[slot] = itemSlot;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public List<SubPacket> buildPackets(uint playerActorID)
 | 
			
		||||
        {            
 | 
			
		||||
            List<SubPacket> packets = new List<SubPacket>();
 | 
			
		||||
            int packetCount = 0;
 | 
			
		||||
            int runningCount = 0;
 | 
			
		||||
            byte[] data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
            MemoryStream mem = new MemoryStream(data);
 | 
			
		||||
            BinaryWriter binWriter = new BinaryWriter(mem);
 | 
			
		||||
 | 
			
		||||
            for (int i = 0; i < equipment.Length; i++)
 | 
			
		||||
            using (MemoryStream mem = new MemoryStream(data))
 | 
			
		||||
            {
 | 
			
		||||
                if (equipment[i] == UNEQUIPPED)
 | 
			
		||||
                    continue;
 | 
			
		||||
 | 
			
		||||
                binWriter.Write((UInt16)i);
 | 
			
		||||
                binWriter.Write((UInt32)equipment[i]);
 | 
			
		||||
 | 
			
		||||
                packetCount++;
 | 
			
		||||
                runningCount++;
 | 
			
		||||
 | 
			
		||||
                //Create another packet
 | 
			
		||||
                if (runningCount >= 64)
 | 
			
		||||
                using (BinaryWriter binWriter = new BinaryWriter(mem))
 | 
			
		||||
                {
 | 
			
		||||
                    packetCount = 0;
 | 
			
		||||
                    binWriter.Write((UInt32)8);
 | 
			
		||||
                    binWriter.Dispose();
 | 
			
		||||
                    mem.Dispose();
 | 
			
		||||
                    packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                    data = new byte[PACKET_SIZE - 0x20];
 | 
			
		||||
                    mem = new MemoryStream(data);
 | 
			
		||||
                    binWriter = new BinaryWriter(mem);
 | 
			
		||||
                    int max;
 | 
			
		||||
                    if (slotsToUpdate.Count - listOffset <= 64)
 | 
			
		||||
                        max = slotsToUpdate.Count - listOffset;
 | 
			
		||||
                    else
 | 
			
		||||
                        max = 64;
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < max; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        binWriter.Write((UInt16)slotsToUpdate[i]);
 | 
			
		||||
                        binWriter.Write((UInt32)equipment[slotsToUpdate[i]].slot);
 | 
			
		||||
                        listOffset++;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Create any leftover subpacket
 | 
			
		||||
            binWriter.BaseStream.Seek(0x30, SeekOrigin.Begin);
 | 
			
		||||
            binWriter.Write((UInt32)packetCount);
 | 
			
		||||
            binWriter.Dispose();
 | 
			
		||||
            mem.Dispose();
 | 
			
		||||
            packets.Add(new SubPacket(OPCODE, playerActorID, playerActorID, data));
 | 
			
		||||
                   
 | 
			
		||||
            return packets;
 | 
			
		||||
            return new SubPacket(OPCODE, playerActorId, playerActorId, data);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user