public ArkGameData(string saveFilePath, string clusterSavePath = null, int?savegameMaxDegreeOfParallelism = null, bool loadOnlyPropertiesInDomain = false) { _saveFilePath = saveFilePath; _clusterData = !string.IsNullOrEmpty(clusterSavePath) ? new ArkClusterData(clusterSavePath) : null; _savegameMaxDegreeOfParallelism = savegameMaxDegreeOfParallelism; _loadOnlyPropertiesInDomain = loadOnlyPropertiesInDomain; }
public ArkGameData(string saveFilePath, ArkClusterDataBase clusterData, int?savegameMaxDegreeOfParallelism = null, bool loadOnlyPropertiesInDomain = false) { _saveFilePath = saveFilePath; _clusterData = clusterData; _savegameMaxDegreeOfParallelism = savegameMaxDegreeOfParallelism; _loadOnlyPropertiesInDomain = loadOnlyPropertiesInDomain; }
private void ApplyNewData(ArkCloudInventory[] inventories, bool decouple = true) { // Setup relations in the domain model between entities var newClusterData = new ArkClusterDataBase(inventories); newClusterData.Initialize(); foreach (var i in inventories) { i.Initialize(newClusterData); } if (decouple) //should always be true except for debugging { // Unset all references to raw extracted game objects and properties to free memory foreach (var i in inventories) { i.Decouple(); } } // Assign updated data to public properties newClusterData.CopyTo(this); // Force an immediate garbage collection because it seems more effective (extraction process requires a great deal of memory) //GC.Collect(); }
internal void Initialize(ArkClusterDataBase clusterData) { _playerTamedCreatures = TamedCreatures.Where(x => x.OwningPlayerId.HasValue && x.TargetingTeam == x.OwningPlayerId.Value) .GroupBy(x => x.TargetingTeam).ToDictionary(x => x.Key, x => x.ToArray()); _tribeTamedCreatures = TamedCreatures.Where(x => !x.OwningPlayerId.HasValue || x.TargetingTeam != x.OwningPlayerId.Value) .GroupBy(x => x.TargetingTeam).ToDictionary(x => x.Key, x => x.ToArray()); _playerStructures = Structures.Where(x => x.OwningPlayerId.HasValue && x.TargetingTeam.HasValue && x.TargetingTeam.Value == x.OwningPlayerId.Value) .GroupBy(x => x.TargetingTeam.Value).ToDictionary(x => x.Key, x => x.ToArray()); _tribeStructures = Structures.Where(x => x.TargetingTeam.HasValue && (!x.OwningPlayerId.HasValue || x.TargetingTeam.Value != x.OwningPlayerId.Value)) .GroupBy(x => x.TargetingTeam.Value).ToDictionary(x => x.Key, x => x.ToArray()); //a player can only have one tribe but there can be many tribes saved that have the same player (just another ark bad data issue) //Tribes.SelectMany(x => x.MemberIds.Select(y => new { t = x, p = y })).ToDictionary(x => x.p, x => x.t) _playerTribes = Players.Join(Tribes, x => x.TribeId, x => x.Id, (p, t) => new { p = p, t = t }).ToDictionary(x => x.p.Id, x => x.t); _tribePlayers = Players.Where(x => x.TribeId.HasValue).GroupBy(x => x.TribeId.Value).ToDictionary(x => x.Key, x => x.ToArray()); _inventoryItems = Items.Where(x => x.OwnerInventoryId.HasValue).GroupBy(x => x.OwnerInventoryId.Value).ToDictionary(x => x.Key, x => x.ToArray()); Rafts = TamedCreatures?.Where(x => x.ClassName.Equals("Raft_BP_C") || x.ClassName.Equals("MotorRaft_BP_C")).ToArray() ?? new ArkTamedCreature[] { }; NoRafts = TamedCreatures?.Where(x => !x.ClassName.Equals("Raft_BP_C") && !x.ClassName.Equals("MotorRaft_BP_C")).ToArray() ?? new ArkTamedCreature[] { }; CloudCreatures = clusterData?._cloudCreatures ?? new ArkTamedCreature[] { }; InclCloud = (TamedCreatures ?? new ArkTamedCreature[] { }).Concat(CloudCreatures).ToArray(); InclCloudNoRafts = InclCloud.Where(x => !x.ClassName.Equals("Raft_BP_C") && !x.ClassName.Equals("MotorRaft_BP_C")).ToArray(); }
internal void CopyTo(ArkClusterDataBase other) { other._inventories = _inventories; other._cloudCreatures = _cloudCreatures; other._playerCloudInventories = _playerCloudInventories; other._playerCloudCreatures = _playerCloudCreatures; other._playerCloudItems = _playerCloudItems; }
private void ApplyNewData(ArkCloudInventory[] inventories, bool decouple = true) { // Setup relations in the domain model between entities var newClusterData = new ArkClusterDataBase(inventories); newClusterData.Initialize(); foreach (var i in inventories) { i.Initialize(newClusterData); } if (decouple) //should always be true except for debugging { // Unset all references to raw extracted game objects and properties to free memory foreach (var i in inventories) { i.Decouple(); } } // Assign updated data to public properties newClusterData.CopyTo(this); }
public ArkGameData(string saveFilePath, ArkClusterDataBase clusterData) { _saveFilePath = saveFilePath; _clusterData = clusterData; }
public ArkGameData(string saveFilePath, string clusterSavePath = null) { _saveFilePath = saveFilePath; _clusterData = !string.IsNullOrEmpty(clusterSavePath) ? new ArkClusterData(clusterSavePath) : null; }
internal void Initialize(ArkGameDataBase gameData, ArkClusterDataBase clusterData) { _gameData = gameData; _clusterData = clusterData; }
internal void Initialize(ArkClusterDataBase clusterData) { _clusterData = clusterData; }