Ejemplo n.º 1
0
        protected void WriteSpontaneousUpdate(UpdateMask mask, UpdatePacket packet, Character receiver,
                                              UpdateFieldId[] indices, bool visible)
        {
            for (int index1 = 0; index1 < indices.Length; ++index1)
            {
                int         rawId = indices[index1].RawId;
                UpdateField field = UpdateFieldMgr.Get(this.ObjectTypeId).Fields[rawId];
                for (int index2 = 0; (long)index2 < (long)field.Size; ++index2)
                {
                    mask.SetBit(rawId + index2);
                }
            }

            mask.WriteTo((PrimitiveWriter)packet);
            for (int lowestIndex = mask.m_lowestIndex; lowestIndex <= mask.m_highestIndex; ++lowestIndex)
            {
                if (mask.GetBit(lowestIndex))
                {
                    if (visible)
                    {
                        this.WriteUpdateValue(packet, receiver, lowestIndex);
                    }
                    else
                    {
                        packet.Write(0);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void WriteSpontaneousUpdate(UpdateMask mask, UpdatePacket packet, Character receiver, UpdateFieldId[] indices, bool visible)
        {
            // create mask
            for (var i = 0; i < indices.Length; i++)
            {
                var index = indices[i].RawId;
                var field = UpdateFieldMgr.Get(ObjectTypeId).Fields[index];
                for (var j = 0; j < field.Size; j++)
                {
                    mask.SetBit(index + j);
                }
            }

            // write mask
            mask.WriteTo(packet);

            // write values
            for (var i = mask.m_lowestIndex; i <= mask.m_highestIndex; i++)
            {
                if (mask.GetBit(i))
                {
                    if (visible)
                    {
                        WriteUpdateValue(packet, receiver, i);
                    }
                    else
                    {
                        packet.Write(0);
                    }
                }
            }
        }