Ejemplo n.º 1
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);
                    }
                }
            }
        }
Ejemplo n.º 2
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.º 3
0
        public FieldRenderer(ObjectTypeId enumType)
        {
            EnumType = enumType;

            var fields = FieldRenderUtil.GetValues(enumType);

            Fields = new FieldRenderInfo[fields.Length];

            uint i = 0;

            var fieldDefs = UpdateFieldMgr.Get(enumType);

            foreach (var e in fields)
            {
                var fieldDef = fieldDefs.Fields.Get((uint)((int)e));

                UpdateFieldType type = fieldDef == null ? UpdateFieldType.UInt32 : fieldDef.Type;
                Fields[i] = new FieldRenderInfo(e, type);
                i++;
            }
        }
Ejemplo n.º 4
0
 public static void Init()
 {
     UpdateFieldMgr.Init();
     DynamicObjectFieldHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Object).TotalLength];
     DynamicItemFieldHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Item).TotalLength];
     DynamicContainerFieldHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Container)
                                       .TotalLength];
     DynamicDOFieldHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.DynamicObject)
                                       .TotalLength];
     DynamicGOHandlers =
         new DynamicUpdateFieldHandler
         [UpdateFieldMgr.Get(ObjectTypeId.GameObject).TotalLength];
     DynamicCorpseHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Corpse).TotalLength];
     DynamicUnitHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Unit).TotalLength];
     DynamicPlayerHandlers =
         new DynamicUpdateFieldHandler[UpdateFieldMgr.Get(ObjectTypeId.Player).TotalLength];
     InitHandlers();
     Inherit(DynamicItemFieldHandlers,
             DynamicObjectFieldHandlers);
     Inherit(DynamicContainerFieldHandlers,
             DynamicItemFieldHandlers);
     Inherit(DynamicDOFieldHandlers,
             DynamicObjectFieldHandlers);
     Inherit(DynamicGOHandlers,
             DynamicObjectFieldHandlers);
     Inherit(DynamicCorpseHandlers,
             DynamicObjectFieldHandlers);
     Inherit(DynamicUnitHandlers,
             DynamicObjectFieldHandlers);
     Inherit(DynamicPlayerHandlers,
             DynamicUnitHandlers);
 }