예제 #1
0
        public ArkCreature(IGameObject creature, IGameObject status, ISaveState saveState) : this()
        {
            _creature = creature;
            _status   = status;

            //Id = creature.Index;
            //Uuid = _creature.Uuid;
            Id1       = creature.GetPropertyValue <uint>(_dinoId1);
            Id2       = creature.GetPropertyValue <uint>(_dinoId2);
            ClassName = creature.ClassName.Name;
            IsBaby    = creature.GetPropertyValue <bool?>(_bIsBaby) ?? false;
            BabyAge   = creature.GetPropertyValue <float?>(_babyAge);
            Gender    = creature.GetPropertyValue <bool?>(_bIsFemale) == true ? ArkCreatureGender.Female : ArkCreatureGender.Male;
            for (var i = 0; i < Colors.Length; i++)
            {
                Colors[i] = creature.GetPropertyValue <sbyte?>(_colorSetIndices[i]) ?? 0;
            }
            if (status != null)
            {
                BaseLevel = status.GetPropertyValue <int?>(_baseCharacterLevel) ?? 1;
                for (var i = 0; i < BaseStats.Length; i++)
                {
                    BaseStats[i] = status.GetPropertyValue <byte?>(_numberOfLevelUpPointsApplied[i]) ?? 0;
                }
            }

            if (creature.Location != null)
            {
                Location = new ArkLocation(creature.Location, saveState);
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="profile">.arkprofile->PrimalPlayerData</param>
        /// <param name="player">savegame->PlayerPawnTest_Female/Male_C</param>
        public ArkPlayer(IGameObject profile, IGameObject player, DateTime profileSaveTime, ISaveState saveState) : this()
        {
            _profile = profile;
            _player  = player;

            var mydata = profile.GetPropertyValue <StructPropertyList>(_myData);
            var myPlayerCharacterConfig    = mydata.GetPropertyValue <StructPropertyList>(_myPlayerCharacterConfig);
            var myPersistentCharacterStats = mydata.GetPropertyValue <StructPropertyList>(_myPersistentCharacterStats);

            Id                  = (int)mydata.GetPropertyValue <ulong>(_playerDataID);
            SteamId             = mydata.GetPropertyValue <StructUniqueNetIdRepl>(_uniqueID)?.NetId;
            TribeId             = mydata.GetPropertyValue <int?>(_tribeID);
            Name                = mydata.GetPropertyValue <string>(_playerName);
            SavedNetworkAddress = mydata.GetPropertyValue <string>(_savedNetworkAddress);
            CharacterName       = myPlayerCharacterConfig.GetPropertyValue <string>(_playerCharacterName);
            Gender              = myPlayerCharacterConfig.GetPropertyValue <bool?>(_bIsFemale) == true ? ArkPlayerGender.Female : ArkPlayerGender.Male;
            TotalEngramPoints   = myPersistentCharacterStats.GetPropertyValue <int>(_playerState_TotalEngramPoints);
            ExperiencePoints    = myPersistentCharacterStats.GetPropertyValue <float>(_characterStatusComponent_ExperiencePoints);
            CharacterLevel      = (short)(myPersistentCharacterStats.GetPropertyValue <short>(_characterStatusComponent_ExtraCharacterLevel) + 1);
            for (var i = 0; i < Stats.Length; i++)
            {
                Stats[i] = myPersistentCharacterStats.GetPropertyValue <sbyte?>(_characterStatusComponent_NumberOfLevelUpPointsApplied[i]) ?? 0;
            }
            InventoryId = player?.GetPropertyValue <ObjectReference>(_myInventoryComponent)?.ObjectId;

            if (player?.Location != null)
            {
                Location = new ArkLocation(player.Location, saveState);
            }

            SavedAt = profileSaveTime;
        }
예제 #3
0
        public ArkDeathCache(IGameObject deathCache, ISaveState saveState) : this()
        {
            _deathCache = deathCache;

            ClassName      = deathCache.ClassName.Name;
            OwnerName      = deathCache.GetPropertyValue <string>(_ownerName);
            TargetingTeam  = deathCache.GetPropertyValue <int?>(_targetingTeam);
            OwningPlayerId = deathCache.GetPropertyValue <int?>(_owningPlayerID);
            InventoryId    = deathCache.GetPropertyValue <ObjectReference>(_myInventoryComponent)?.ObjectId;

            if (deathCache?.Location != null)
            {
                Location = new ArkLocation(deathCache.Location, saveState);
            }
        }
예제 #4
0
        public ArkStructure(IGameObject structure, ISaveState saveState) : this()
        {
            _structure = structure;

            ClassName = structure.ClassName.Name;
            //Id = structure.Index;
            //Uuid = _structure.Uuid;
            OwnerName         = structure.GetPropertyValue <string>(_ownerName);
            TargetingTeam     = structure.GetPropertyValue <int?>(_targetingTeam);
            OwningPlayerId    = structure.GetPropertyValue <int?>(_owningPlayerID);
            OwningPlayerName  = structure.GetPropertyValue <string>(_owningPlayerName);
            InventoryId       = structure.GetPropertyValue <ObjectReference>(_myInventoryComponent)?.ObjectId;
            BoxName           = structure.GetPropertyValue <string>(_boxName);
            AttachedToDinoId1 = structure.GetPropertyValue <uint?>(_attachedToDinoId1);

            if (structure?.Location != null)
            {
                Location = new ArkLocation(structure.Location, saveState);
            }
        }
예제 #5
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);
            }
        }
예제 #6
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);
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="profile">.arkprofile->PrimalPlayerData</param>
        /// <param name="player">savegame->PlayerPawnTest_Female/Male_C</param>
        public ArkPlayer(IGameObject profile, IGameObject player, DateTime profileSaveTime, ISaveState saveState) : this()
        {
            _profile = profile;
            _player  = player;

            var mydata = profile.GetPropertyValue <StructPropertyList>(_myData);
            var myPlayerCharacterConfig    = mydata.GetPropertyValue <StructPropertyList>(_myPlayerCharacterConfig);
            var myPersistentCharacterStats = mydata.GetPropertyValue <StructPropertyList>(_myPersistentCharacterStats);

            Id      = (int)mydata.GetPropertyValue <ulong>(_playerDataID);
            SteamId = mydata.GetPropertyValue <StructUniqueNetIdRepl>(_uniqueID)?.NetId;
            TribeId = mydata.GetPropertyValue <int?>(_tribeID);
            if (TribeId == null)
            {
                TribeId = mydata.GetPropertyValue <int?>(_tribeId);
            }

            Name = mydata.GetPropertyValue <string>(_playerName);
            SavedNetworkAddress = mydata.GetPropertyValue <string>(_savedNetworkAddress);
            CharacterName       = myPlayerCharacterConfig.GetPropertyValue <string>(_playerCharacterName);
            Gender            = myPlayerCharacterConfig.GetPropertyValue <bool?>(_bIsFemale) == true ? ArkPlayerGender.Female : ArkPlayerGender.Male;
            TotalEngramPoints = myPersistentCharacterStats.GetPropertyValue <int>(_playerState_TotalEngramPoints);
            ExperiencePoints  = myPersistentCharacterStats.GetPropertyValue <float>(_characterStatusComponent_ExperiencePoints);
            CharacterLevel    = (short)(myPersistentCharacterStats.GetPropertyValue <short>(_characterStatusComponent_ExtraCharacterLevel) + 1);
            for (var i = 0; i < Stats.Length; i++)
            {
                Stats[i] = myPersistentCharacterStats.GetPropertyValue <sbyte?>(_characterStatusComponent_NumberOfLevelUpPointsApplied[i]) ?? 0;
            }
            InventoryId = player?.GetPropertyValue <ObjectReference>(_myInventoryComponent)?.ObjectId;

            if (player?.Location != null)
            {
                Location = new ArkLocation(player.Location, saveState);
            }

            MissionScores = new List <ArkMissionData>();
            //if (mydata.Properties.ContainsKey(_missionScores))
            //{
            //    var missionData = mydata.GetProperty<PropertyArray>(_missionScores);

            //    foreach (StructPropertyList missionInf in missionData.Value)
            //    {
            //        try
            //        {
            //            var missionTag = missionInf.GetProperty<PropertyName>(_missionTag).Value;

            //            var latestScoreData = ((StructPropertyList)missionInf.GetProperty<PropertyStruct>(_latestScore).Value);
            //            float latestScore = ((PropertyFloat)latestScoreData.Properties[ArkName.Create("FloatValue")]).Value.GetValueOrDefault(0);

            //            var bestScoreData = ((StructPropertyList)missionInf.GetProperty<PropertyStruct>(_bestScore).Value);
            //            float bestScore = ((PropertyFloat)latestScoreData.Properties[ArkName.Create("FloatValue")]).Value.GetValueOrDefault(0);

            //            MissionScores.Add(new ArkMissionData()
            //            {
            //                MissionTag = missionTag.Name,
            //                LastScore = latestScore,
            //                BestScore = bestScore

            //            }); ;


            //        }
            //        finally { }

            //    }

            //}

            SavedAt = profileSaveTime;
        }