Beispiel #1
0
        private void _BuildValuesUpdate(ObjectUpdateType type, ObjectUpdateFlags flags, ref PacketOut pkt, IPlayer plr)
        {
            UpdateMask mask = new UpdateMask(State.UpdateFields.Length);
            PacketOut  tmp  = new PacketOut();


            UpdatefieldFlags visibilityFlags = UpdatefieldFlags.UF_FLAG_PUBLIC;

            if (plr.GetPrimaryKeyLong() == this.GetPrimaryKeyLong())
            {
                visibilityFlags |= UpdatefieldFlags.UF_FLAG_PRIVATE;
            }

            var fieldFlags = GetFlagVisibility();

            for (var i = 0; i < State.UpdateFields.Length; ++i)
            {
                //if ((fieldFlags[i] & visibilityFlags) == 0)
                //    continue;
                tmp.Write(State.UpdateFields[i].data);
                mask.SetBit(i);
            }

            pkt.Write((byte)mask.GetMaxBlockCount());
            for (var i = 0; i < mask.GetMaxBlockCount(); ++i)
            {
                pkt.Write(mask.m_blocks[i]);
            }

            pkt.Write(tmp);
        }