Esempio n. 1
0
        public ArkItem(IGameObject item, ISaveState saveState) : this()
        {
            _item      = item;
            _saveState = saveState;

            //Id = item.Index;
            ClassName = item.ClassName.Name;
            var itemId = item.GetPropertyValue <StructPropertyList>(_itemId);

            //todo: Scorched Earth store buff data as items that have no id. There may be other cases.
            //Do we want missing item ids to be set to 0 or do we need to change the Id-properties to be nullable?

            if (itemId != null)
            {
                Id1 = itemId.GetPropertyValue <uint>(_itemId1);
                Id2 = itemId.GetPropertyValue <uint>(_itemId2);
            }
            OwnerInventoryId = item.GetPropertyValue <ObjectReference>(_ownerInventory)?.ObjectId;
            //OwnerContainerId
            Quantity    = item.GetPropertyValue <uint?>(_itemQuantity) ?? 1;
            IsBlueprint = item.GetPropertyValue <bool?>(_bIsBlueprint) ?? false;
            IsEngram    = item.GetPropertyValue <bool?>(_bIsEngram) ?? false;
            HideFromInventoryDisplay = item.GetPropertyValue <bool?>(_bHideFromInventoryDisplay) ?? false;
            CustomDescription        = item.GetPropertyValue <string>(_customItemDescription);
            CustomName      = item.GetPropertyValue <string>(_customItemName);
            Rating          = item.GetPropertyValue <float?>(_itemRating);
            SavedDurability = item.GetPropertyValue <float?>(_savedDurability);
            QualityIndex    = item.GetPropertyValue <sbyte?>(_itemQualityIndex);
            CreationTime    = item.GetPropertyValue <double?>(_creationTime);
            {
                var statValues = new short?[_itemStatValues.Length];
                var found      = 0;
                for (var i = 0; i < statValues.Length; i++)
                {
                    var statValue = item.GetPropertyValue <short?>(_itemStatValues[i]);
                    if (statValue == null)
                    {
                        continue;
                    }

                    found++;
                    statValues[i] = statValue.Value;
                }
                if (found > 0)
                {
                    StatValues = statValues;
                }
            }

            EggDinoAncestors     = ArkTamedCreatureAncestor.FromPropertyValue(item.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestors));
            EggDinoAncestorsMale = ArkTamedCreatureAncestor.FromPropertyValue(item.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestorsMale));

            {
                var colors = new sbyte[_eggColorSetIndices.Length];
                var found  = 0;
                for (var i = 0; i < colors.Length; i++)
                {
                    var color = item.GetPropertyValue <sbyte?>(_eggColorSetIndices[i]);
                    if (color == null)
                    {
                        continue;
                    }

                    found++;
                    colors[i] = color.Value;
                }
                if (found > 0)
                {
                    EggColors = colors;
                }
            }
            {
                var basestats = new sbyte[_eggNumberOfLevelUpPointsApplied.Length];
                var found     = 0;
                for (var i = 0; i < basestats.Length; i++)
                {
                    var basestat = item.GetPropertyValue <sbyte?>(_eggNumberOfLevelUpPointsApplied[i]);
                    if (basestat == null)
                    {
                        continue;
                    }

                    found++;
                    basestats[i] = basestat.Value;
                }
                if (found > 0)
                {
                    EggBaseStats = basestats;
                }
            }
            EggRandomMutationsMale   = item.GetPropertyValue <int?>(_eggRandomMutationsMale);
            EggRandomMutationsFemale = item.GetPropertyValue <int?>(_eggRandomMutationsFemale);

            //todo: LocationData should be replaced since drop-locations do not have pitch, roll and yaw
            var dropLocation = item.GetPropertyValue <StructVector>(_originalItemDropLocation);

            if (dropLocation != null)
            {
                Location = new ArkLocation(new LocationData {
                    X = dropLocation.X, Y = dropLocation.Y, Z = dropLocation.Z
                }, saveState);
            }
        }
Esempio n. 2
0
        public ArkDroppedItem(IGameObject droppedItem, IGameObject item, ISaveState saveState)
        {
            _droppedItem = droppedItem;
            _item        = item;
            _saveState   = saveState;


            //load dropped item properties
            DroppedByName     = droppedItem.GetPropertyValue <string>(_dropedByName);
            DroppedByPlayerId = droppedItem.GetPropertyValue <int>(_droppedByPlayerId);
            TargetingTeam     = droppedItem.GetPropertyValue <int>(_targetingTeam);

            Location = new ArkLocation(droppedItem.Location, saveState);

            //Id = item.Index;
            ClassName = item.ClassName.Name;
            var itemId = item.GetPropertyValue <StructPropertyList>(_itemId);

            //load item properties
            if (itemId != null)
            {
                Id1 = itemId.GetPropertyValue <uint>(_itemId1);
                Id2 = itemId.GetPropertyValue <uint>(_itemId2);
            }
            OwnerInventoryId         = item.GetPropertyValue <ObjectReference>(_ownerInventory)?.ObjectId;
            Quantity                 = item.GetPropertyValue <uint?>(_itemQuantity) ?? 1;
            IsBlueprint              = item.GetPropertyValue <bool?>(_bIsBlueprint) ?? false;
            IsEngram                 = item.GetPropertyValue <bool?>(_bIsEngram) ?? false;
            HideFromInventoryDisplay = item.GetPropertyValue <bool?>(_bHideFromInventoryDisplay) ?? false;
            CustomDescription        = item.GetPropertyValue <string>(_customItemDescription);
            CustomName               = item.GetPropertyValue <string>(_customItemName);
            Rating          = item.GetPropertyValue <float?>(_itemRating);
            SavedDurability = item.GetPropertyValue <float?>(_savedDurability);
            QualityIndex    = item.GetPropertyValue <sbyte?>(_itemQualityIndex);
            CreationTime    = item.GetPropertyValue <double?>(_creationTime);
            {
                var statValues = new short?[_itemStatValues.Length];
                var found      = 0;
                for (var i = 0; i < statValues.Length; i++)
                {
                    var statValue = item.GetPropertyValue <short?>(_itemStatValues[i]);
                    if (statValue == null)
                    {
                        continue;
                    }

                    found++;
                    statValues[i] = statValue.Value;
                }
                if (found > 0)
                {
                    StatValues = statValues;
                }
            }

            EggDinoAncestors     = ArkTamedCreatureAncestor.FromPropertyValue(item.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestors));
            EggDinoAncestorsMale = ArkTamedCreatureAncestor.FromPropertyValue(item.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestorsMale));

            {
                var colors = new sbyte[_eggColorSetIndices.Length];
                var found  = 0;
                for (var i = 0; i < colors.Length; i++)
                {
                    var color = item.GetPropertyValue <sbyte?>(_eggColorSetIndices[i]);
                    if (color == null)
                    {
                        continue;
                    }

                    found++;
                    colors[i] = color.Value;
                }
                if (found > 0)
                {
                    EggColors = colors;
                }
            }
            {
                var basestats = new sbyte[_eggNumberOfLevelUpPointsApplied.Length];
                var found     = 0;
                for (var i = 0; i < basestats.Length; i++)
                {
                    var basestat = item.GetPropertyValue <sbyte?>(_eggNumberOfLevelUpPointsApplied[i]);
                    if (basestat == null)
                    {
                        continue;
                    }

                    found++;
                    basestats[i] = basestat.Value;
                }
                if (found > 0)
                {
                    EggBaseStats = basestats;
                }
            }
            EggRandomMutationsMale   = item.GetPropertyValue <int?>(_eggRandomMutationsMale);
            EggRandomMutationsFemale = item.GetPropertyValue <int?>(_eggRandomMutationsFemale);
        }
Esempio n. 3
0
        public ArkTamedCreature(IGameObject creature, IGameObject status, ISaveState saveState) : base(creature, status, saveState)
        {
            Construct();

            _saveState = saveState;

            OwningPlayerId             = creature.GetPropertyValue <int?>(_owningPlayerID);
            OwningPlayerName           = creature.GetPropertyValue <string>(_owningPlayerName);
            Name                       = creature.GetPropertyValue <string>(_tamedName);
            TamedOnServerName          = creature.GetPropertyValue <string>(_tamedOnServerName);
            TamerName                  = creature.GetPropertyValue <string>(_tamerString);
            TargetingTeam              = creature.GetPropertyValue <int>(_targetingTeam);
            TribeName                  = creature.GetPropertyValue <string>(_tribeName);
            RandomMutationsMale        = creature.GetPropertyValue <int?>(_randomMutationsMale) ?? 0;
            RandomMutationsFemale      = creature.GetPropertyValue <int?>(_randomMutationsFemale) ?? 0;
            TamedAtTime                = creature.GetPropertyValue <double?>(_tamedAtTime);
            LastUpdatedGestationAtTime = creature.GetPropertyValue <double?>(_lastUpdatedGestationAtTime);
            LastUpdatedMatingAtTime    = creature.GetPropertyValue <double?>(_lastUpdatedMatingAtTime);

            BabyGestationProgress = creature.GetPropertyValue <float?>(_babyGestationProgress);
            BabyNextCuddleTime    = creature.GetPropertyValue <double?>(_babyNextCuddleTime);
            IsNeutered            = creature.GetPropertyValue <bool?>(_bNeutered) ?? false;
            DinoAncestors         = ArkTamedCreatureAncestor.FromPropertyValue(creature.GetPropertyValue <ArkArrayStruct>(_dinoAncestors));
            DinoAncestorsMale     = ArkTamedCreatureAncestor.FromPropertyValue(creature.GetPropertyValue <ArkArrayStruct>(_dinoAncestorsMale));

            {
                var colors = new sbyte[_gestationEggColorSetIndices.Length];
                var found  = 0;
                for (var i = 0; i < colors.Length; i++)
                {
                    var color = creature.GetPropertyValue <sbyte?>(_gestationEggColorSetIndices[i]);
                    if (color == null)
                    {
                        continue;
                    }

                    found++;
                    colors[i] = color.Value;
                }
                if (found > 0)
                {
                    GestationEggColors = colors;
                }
            }
            {
                var basestats = new sbyte[_gestationEggNumberOfLevelUpPointsApplied.Length];
                var found     = 0;
                for (var i = 0; i < basestats.Length; i++)
                {
                    var basestat = creature.GetPropertyValue <sbyte?>(_gestationEggNumberOfLevelUpPointsApplied[i]);
                    if (basestat == null)
                    {
                        continue;
                    }

                    found++;
                    basestats[i] = basestat.Value;
                }
                if (found > 0)
                {
                    GestationEggBaseStats = basestats;
                }
            }
            GestationEggRandomMutationsMale   = creature.GetPropertyValue <int?>(_gestationEggRandomMutationsMale);
            GestationEggRandomMutationsFemale = creature.GetPropertyValue <int?>(_gestationEggRandomMutationsFemale);
            ImprinterName             = creature.GetPropertyValue <string>(_imprinterName);
            ImprinterPlayerDataId     = creature.GetPropertyValue <long?>(_imprinterPlayerDataID);
            NextAllowedMatingTime     = creature.GetPropertyValue <double?>(_nextAllowedMatingTime);
            NextBabyDinoAncestors     = ArkTamedCreatureAncestor.FromPropertyValue(creature.GetPropertyValue <ArkArrayStruct>(_nextBabyDinoAncestors));
            NextBabyDinoAncestorsMale = ArkTamedCreatureAncestor.FromPropertyValue(creature.GetPropertyValue <ArkArrayStruct>(_nextBabyDinoAncestorsMale));
            InventoryId = creature.GetPropertyValue <ObjectReference>(_myInventoryComponent)?.ObjectId;

            TamedStats = new sbyte[_numberOfLevelUpPointsAppliedTamed.Length];
            if (status != null)
            {
                for (var i = 0; i < TamedStats.Length; i++)
                {
                    TamedStats[i] = status.GetPropertyValue <sbyte?>(_numberOfLevelUpPointsAppliedTamed[i]) ?? 0;
                }
                DinoImprintingQuality        = status.GetPropertyValue <float?>(_dinoImprintingQuality);
                ExperiencePoints             = status.GetPropertyValue <float?>(_experiencePoints);
                ExtraCharacterLevel          = status.GetPropertyValue <short?>(_extraCharacterLevel) ?? 0;
                TamedIneffectivenessModifier = status.GetPropertyValue <float?>(_tamedIneffectivenessModifier);
                CurrentStatusValues          = new float?[_currentStatusValues.Length];
                for (var i = 0; i < CurrentStatusValues.Length; i++)
                {
                    CurrentStatusValues[i] = status.GetPropertyValue <float?>(_currentStatusValues[i]);
                }
            }
        }
Esempio n. 4
0
        public ArkCloudInventoryItem(IPropertyContainer item) : this()
        {
            _item = item;

            var tribute = item.GetPropertyValue <StructPropertyList>(_arkTributeItem);
            var itemid  = tribute.GetPropertyValue <StructPropertyList>(_itemId);

            Id1               = itemid.GetPropertyValue <uint>(_itemId1);
            Id2               = itemid.GetPropertyValue <uint>(_itemId2);
            ClassName         = tribute.GetPropertyValue <ObjectReference>(_itemArchetype)?.ObjectString?.Name;
            IsBlueprint       = tribute.GetPropertyValue <bool?>(_bIsBlueprint) ?? false;
            CustomDescription = tribute.GetPropertyValue <string>(_customItemDescription);
            CustomName        = tribute.GetPropertyValue <string>(_customItemName);
            Quantity          = tribute.GetPropertyValue <uint?>(_itemQuantity) ?? 1;
            Rating            = tribute.GetPropertyValue <float?>(_itemRating);
            Durability        = tribute.GetPropertyValue <float?>(_itemDurability);
            QualityIndex      = tribute.GetPropertyValue <sbyte?>(_itemQualityIndex);
            {
                var statValues = new short?[_itemStatValues.Length];
                var found      = 0;
                for (var i = 0; i < statValues.Length; i++)
                {
                    var statValue = tribute.GetPropertyValue <short?>(_itemStatValues[i]);
                    if (statValue == null)
                    {
                        continue;
                    }

                    found++;
                    statValues[i] = statValue.Value;
                }
                if (found > 0)
                {
                    StatValues = statValues;
                }
            }

            EggDinoAncestors     = ArkTamedCreatureAncestor.FromPropertyValue(tribute.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestors));
            EggDinoAncestorsMale = ArkTamedCreatureAncestor.FromPropertyValue(tribute.GetPropertyValue <ArkArrayStruct>(_eggDinoAncestorsMale));

            {
                var colors = new sbyte[_eggColorSetIndices.Length];
                var found  = 0;
                for (var i = 0; i < colors.Length; i++)
                {
                    var color = tribute.GetPropertyValue <sbyte?>(_eggColorSetIndices[i]);
                    if (color == null)
                    {
                        continue;
                    }

                    found++;
                    colors[i] = color.Value;
                }
                if (found > 0)
                {
                    EggColors = colors;
                }
            }
            {
                var basestats = new sbyte[_eggNumberOfLevelUpPointsApplied.Length];
                var found     = 0;
                for (var i = 0; i < basestats.Length; i++)
                {
                    var basestat = tribute.GetPropertyValue <sbyte?>(_eggNumberOfLevelUpPointsApplied[i]);
                    if (basestat == null)
                    {
                        continue;
                    }

                    found++;
                    basestats[i] = basestat.Value;
                }
                if (found > 0)
                {
                    EggBaseStats = basestats;
                }
            }
            EggRandomMutationsMale   = tribute.GetPropertyValue <int?>(_eggRandomMutationsMale);
            EggRandomMutationsFemale = tribute.GetPropertyValue <int?>(_eggRandomMutationsFemale);
        }