Esempio n. 1
0
        private void SendInventoryRemovePackets(List <ushort> indexes)
        {
            int currentIndex = 0;

            while (true)
            {
                if (indexes.Count - currentIndex >= 64)
                {
                    owner.QueuePacket(InventoryRemoveX64Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
                }
                else if (indexes.Count - currentIndex >= 32)
                {
                    owner.QueuePacket(InventoryRemoveX32Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
                }
                else if (indexes.Count - currentIndex >= 16)
                {
                    owner.QueuePacket(InventoryRemoveX16Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
                }
                else if (indexes.Count - currentIndex > 1)
                {
                    owner.QueuePacket(InventoryRemoveX08Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
                }
                else if (indexes.Count - currentIndex == 1)
                {
                    owner.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, indexes[currentIndex]));
                    currentIndex++;
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 2
0
        private void sendRemoveInventoryPackets(List <ushort> slots)
        {
            int currentIndex = 0;

            while (true)
            {
                if (slots.Count - currentIndex >= 64)
                {
                    queuePacket(InventoryRemoveX64Packet.buildPacket(actorId, slots, ref currentIndex));
                }
                else if (slots.Count - currentIndex >= 32)
                {
                    queuePacket(InventoryRemoveX32Packet.buildPacket(actorId, slots, ref currentIndex));
                }
                else if (slots.Count - currentIndex >= 16)
                {
                    queuePacket(InventoryRemoveX16Packet.buildPacket(actorId, slots, ref currentIndex));
                }
                else if (slots.Count - currentIndex >= 8)
                {
                    queuePacket(InventoryRemoveX08Packet.buildPacket(actorId, slots, ref currentIndex));
                }
                else if (slots.Count - currentIndex == 1)
                {
                    queuePacket(InventoryRemoveX01Packet.buildPacket(actorId, slots[currentIndex]));
                }
                else
                {
                    break;
                }
            }
        }