Beispiel #1
0
        public bool BuildPacket(out UpdateObject packet)
        {
            packet = new UpdateObject();

            packet.NumObjUpdates = BlockCount;
            packet.MapID         = (ushort)MapId;

            WorldPacket buffer = new WorldPacket();

            if (buffer.WriteBit(!outOfRangeGUIDs.Empty()))
            {
                buffer.WriteUInt16(0); // object limit to instantly destroy - objects before this index on m_outOfRangeGUIDs list get "smoothly phased out"
                buffer.WriteUInt32(outOfRangeGUIDs.Count);

                foreach (var guid in outOfRangeGUIDs)
                {
                    buffer.WritePackedGuid(guid);
                }
            }
            var bytes = data.GetData();

            buffer.WriteUInt32(bytes.Length);
            buffer.WriteBytes(bytes);

            packet.Data = buffer.GetData();
            return(true);
        }
Beispiel #2
0
        public bool BuildPacket(out UpdateObject packet)
        {
            packet = new UpdateObject();

            packet.NumObjUpdates = BlockCount;
            packet.MapID         = (ushort)MapId;

            WorldPacket buffer = new WorldPacket();

            if (buffer.WriteBit(!outOfRangeGUIDs.Empty() || !destroyGUIDs.Empty()))
            {
                buffer.WriteUInt16((ushort)destroyGUIDs.Count);
                buffer.WriteInt32(destroyGUIDs.Count + outOfRangeGUIDs.Count);

                foreach (var destroyGuid in destroyGUIDs)
                {
                    buffer.WritePackedGuid(destroyGuid);
                }

                foreach (var outOfRangeGuid in outOfRangeGUIDs)
                {
                    buffer.WritePackedGuid(outOfRangeGuid);
                }
            }

            var bytes = data.GetData();

            buffer.WriteInt32(bytes.Length);
            buffer.WriteBytes(bytes);

            packet.Data = buffer.GetData();
            return(true);
        }
        void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedItemMask, UpdateMask requestedAzeriteItemMask, Player target)
        {
            UpdateFieldFlag flags      = GetUpdateFieldFlagsFor(target);
            UpdateMask      valuesMask = new UpdateMask((int)TypeId.Max);

            if (requestedObjectMask.IsAnySet())
            {
                valuesMask.Set((int)TypeId.Object);
            }

            m_itemData.FilterDisallowedFieldsMaskForFlag(requestedItemMask, flags);
            if (requestedItemMask.IsAnySet())
            {
                valuesMask.Set((int)TypeId.Item);
            }

            m_azeriteItemData.FilterDisallowedFieldsMaskForFlag(requestedAzeriteItemMask, flags);
            if (requestedAzeriteItemMask.IsAnySet())
            {
                valuesMask.Set((int)TypeId.AzeriteItem);
            }

            WorldPacket buffer = new WorldPacket();

            buffer.WriteUInt32(valuesMask.GetBlock(0));

            if (valuesMask[(int)TypeId.Object])
            {
                m_objectData.WriteUpdate(buffer, requestedObjectMask, true, this, target);
            }

            if (valuesMask[(int)TypeId.Item])
            {
                m_itemData.WriteUpdate(buffer, requestedItemMask, true, this, target);
            }

            if (valuesMask[(int)TypeId.AzeriteItem])
            {
                m_azeriteItemData.WriteUpdate(buffer, requestedAzeriteItemMask, true, this, target);
            }

            WorldPacket buffer1 = new WorldPacket();

            buffer1.WriteUInt8((byte)UpdateType.Values);
            buffer1.WritePackedGuid(GetGUID());
            buffer1.WriteUInt32(buffer.GetSize());
            buffer1.WriteBytes(buffer.GetData());

            data.AddUpdateBlock(buffer1);
        }
Beispiel #4
0
        void BuildValuesUpdateForPlayerWithMask(UpdateData data, UpdateMask requestedObjectMask, UpdateMask requestedDynamicObjectMask, Player target)
        {
            UpdateMask valuesMask = new UpdateMask((int)TypeId.Max);

            if (requestedObjectMask.IsAnySet())
            {
                valuesMask.Set((int)TypeId.Object);
            }

            if (requestedDynamicObjectMask.IsAnySet())
            {
                valuesMask.Set((int)TypeId.DynamicObject);
            }

            WorldPacket buffer = new WorldPacket();

            buffer.WriteUInt32(valuesMask.GetBlock(0));

            if (valuesMask[(int)TypeId.Object])
            {
                m_objectData.WriteUpdate(buffer, requestedObjectMask, true, this, target);
            }

            if (valuesMask[(int)TypeId.DynamicObject])
            {
                m_dynamicObjectData.WriteUpdate(buffer, requestedDynamicObjectMask, true, this, target);
            }

            WorldPacket buffer1 = new WorldPacket();

            buffer1.WriteUInt8((byte)UpdateType.Values);
            buffer1.WritePackedGuid(GetGUID());
            buffer1.WriteUInt32(buffer.GetSize());
            buffer1.WriteBytes(buffer.GetData());

            data.AddUpdateBlock(buffer1);
        }