Ejemplo n.º 1
0
        public static UpdateObject read(BinaryReader binaryReader)
        {
            UpdateObject newObj = new UpdateObject();

            newObj.object_id   = binaryReader.ReadUInt32();
            newObj.objdesc     = ObjDesc.read(binaryReader);
            newObj.physicsdesc = PhysicsDesc.read(binaryReader);
            newObj.wdesc       = PublicWeenieDesc.read(binaryReader);
            return(newObj);
        }
Ejemplo n.º 2
0
        public static PublicWeenieDesc read(BinaryReader binaryReader)
        {
            PublicWeenieDesc newObj = new PublicWeenieDesc();
            var startPosition       = binaryReader.BaseStream.Position;

            newObj.packedItems = new List <string>();
            newObj.header      = binaryReader.ReadUInt32();
            newObj._name       = PStringChar.read(binaryReader);
            var wcidStart = binaryReader.BaseStream.Position;

            newObj._wcid        = Util.readWClassIDCompressed(binaryReader);
            newObj._wcid_length = (int)(binaryReader.BaseStream.Position - wcidStart);
            var iconIdStart = binaryReader.BaseStream.Position;

            newObj._iconID        = Util.readDataIDOfKnownType(0x6000000, binaryReader);
            newObj._iconID_length = (int)(binaryReader.BaseStream.Position - iconIdStart);
            newObj._type          = (ITEM_TYPE)binaryReader.ReadUInt32();
            newObj._bitfield      = binaryReader.ReadUInt32();

            newObj.headerPadding = Util.readToAlign(binaryReader);

            if ((newObj._bitfield & (uint)BitfieldIndex.BF_INCLUDES_SECOND_HEADER) != 0)
            {
                newObj.header2 = binaryReader.ReadUInt32();
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_PluralName) != 0)
            {
                newObj._plural_name = PStringChar.read(binaryReader);
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_PluralName.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_ItemsCapacity) != 0)
            {
                newObj._itemsCapacity = binaryReader.ReadByte();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_ItemsCapacity.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_ContainersCapacity) != 0)
            {
                newObj._containersCapacity = binaryReader.ReadByte();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_ContainersCapacity.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_AmmoType) != 0)
            {
                newObj._ammoType = (AMMO_TYPE)binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_AmmoType.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Value) != 0)
            {
                newObj._value = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Value.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Useability) != 0)
            {
                newObj._useability = (ITEM_USEABLE)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Useability.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_UseRadius) != 0)
            {
                newObj._useRadius = binaryReader.ReadSingle();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_UseRadius.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_TargetType) != 0)
            {
                newObj._targetType = (ITEM_TYPE)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_TargetType.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_UIEffects) != 0)
            {
                newObj._effects = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_UIEffects.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_CombatUse) != 0)
            {
                newObj._combatUse = binaryReader.ReadByte();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_CombatUse.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Structure) != 0)
            {
                newObj._structure = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Structure.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_MaxStructure) != 0)
            {
                newObj._maxStructure = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_MaxStructure.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_StackSize) != 0)
            {
                newObj._stackSize = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_StackSize.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_MaxStackSize) != 0)
            {
                newObj._maxStackSize = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_MaxStackSize.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_ContainerID) != 0)
            {
                newObj._containerID = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_ContainerID.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_WielderID) != 0)
            {
                newObj._wielderID = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_WielderID.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_ValidLocations) != 0)
            {
                newObj._valid_locations = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_ValidLocations.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Location) != 0)
            {
                newObj._location = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Location.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Priority) != 0)
            {
                newObj._priority = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Priority.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_BlipColor) != 0)
            {
                newObj._blipColor = binaryReader.ReadByte();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_BlipColor.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_RadarEnum) != 0)
            {
                newObj._radar_enum = (RadarEnum)binaryReader.ReadByte();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_RadarEnum.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_PScript) != 0)
            {
                newObj._pscript = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_PScript.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Workmanship) != 0)
            {
                newObj._workmanship = binaryReader.ReadSingle();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Workmanship.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Burden) != 0)
            {
                newObj._burden = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Burden.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_SpellID) != 0)
            {
                newObj._spellID = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_SpellID.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_HouseOwner) != 0)
            {
                newObj._house_owner_iid = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_HouseOwner.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_HouseRestrictions) != 0)
            {
                newObj._db = CM_House.RestrictionDB.read(binaryReader);
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_HouseRestrictions.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_HookItemTypes) != 0)
            {
                newObj._hook_item_types = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_HookItemTypes.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_Monarch) != 0)
            {
                newObj._monarch = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_Monarch.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_HookType) != 0)
            {
                newObj._hook_type = binaryReader.ReadUInt16();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_HookType.ToString());
            }

            if ((newObj.header & (uint)PublicWeenieDescPackHeader.PWD_Packed_IconOverlay) != 0)
            {
                var _iconOverlayStart = binaryReader.BaseStream.Position;
                newObj._iconOverlayID     = Util.readDataIDOfKnownType(0x6000000, binaryReader);
                newObj._iconOverlayLength = (int)(binaryReader.BaseStream.Position - _iconOverlayStart);
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_IconOverlay.ToString());
            }

            if ((newObj.header2 & (uint)PublicWeenieDescPackHeader2.PWD2_Packed_IconUnderlay) != 0)
            {
                var _iconUnderlayStart = binaryReader.BaseStream.Position;
                newObj._iconUnderlayID     = Util.readDataIDOfKnownType(0x6000000, binaryReader);
                newObj._iconUnderlayLength = (int)(binaryReader.BaseStream.Position - _iconUnderlayStart);
                newObj.packedItems.Add(PublicWeenieDescPackHeader2.PWD2_Packed_IconUnderlay.ToString());
            }

            if ((newObj.header & unchecked ((uint)PublicWeenieDescPackHeader.PWD_Packed_MaterialType)) != 0)
            {
                newObj._material_type = (MaterialType)binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader.PWD_Packed_MaterialType.ToString());
            }

            if ((newObj.header2 & (uint)PublicWeenieDescPackHeader2.PWD2_Packed_CooldownID) != 0)
            {
                newObj._cooldown_id = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader2.PWD2_Packed_CooldownID.ToString());
            }

            if ((newObj.header2 & (uint)PublicWeenieDescPackHeader2.PWD2_Packed_CooldownDuration) != 0)
            {
                newObj._cooldown_duration = binaryReader.ReadDouble();
                newObj.packedItems.Add(PublicWeenieDescPackHeader2.PWD2_Packed_CooldownDuration.ToString());
            }

            if ((newObj.header2 & (uint)PublicWeenieDescPackHeader2.PWD2_Packed_PetOwner) != 0)
            {
                newObj._pet_owner = binaryReader.ReadUInt32();
                newObj.packedItems.Add(PublicWeenieDescPackHeader2.PWD2_Packed_PetOwner.ToString());
            }
            newObj.endPadding = Util.readToAlign(binaryReader);
            newObj.Length     = (int)(binaryReader.BaseStream.Position - startPosition);

            return(newObj);
        }