Example #1
0
        public static void Initialize()
        {
            // read static game data
            GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication);

            // read user game data
            MainGameData userGameData = new MainGameData();

            if (!UserDataFolder.Equals(MainDataFolder, StringComparison.OrdinalIgnoreCase))
            {
                GameDataUtils.ReadAllData(out userGameData, UserDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication, true);
            }

            // game maps
            gameData.GameMaps.AddRange(userGameData.GameMaps);

            if (gameData.GameMaps.Count > 0)
            {
                var maps = gameMaps.ToList();
                maps.AddRange(gameData.GameMaps.ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));

                gameMaps = maps.ToArray();
            }

            // branches
            gameData.Branches.AddRange(userGameData.Branches);

            if (gameData.Branches.Count > 0)
            {
                var allBranches = branches.ToList();
                allBranches.AddRange(gameData.Branches.ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.BranchName, DisplayMember = item.Description
                }));

                branches = allBranches.ToArray();
            }

            // server regions
            gameData.ServerRegions.AddRange(userGameData.ServerRegions);

            if (gameData.ServerRegions.Count > 0)
            {
                var allServerRegions = serverRegions.ToList();
                allServerRegions.AddRange(gameData.ServerRegions.ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.RegionNumber, DisplayMember = item.Description
                }));

                serverRegions = allServerRegions.ToArray();
            }
        }
Example #2
0
        public static void Initialize()
        {
            // read static game data
            GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication);

            // read user game data
            MainGameData userGameData = new MainGameData();

            if (!UserDataFolder.Equals(MainDataFolder, StringComparison.OrdinalIgnoreCase))
            {
                GameDataUtils.ReadAllData(out userGameData, UserDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication, true);
            }

            // creatures
            gameData.Creatures.AddRange(userGameData.Creatures);

            dinoSpawns = gameData.Creatures.ConvertAll(item => new DinoSpawn {
                ClassName = item.ClassName, Mod = item.Mod, KnownDino = true, DinoNameTag = item.NameTag
            }).ToArray();
            dinoMultipliers = gameData.Creatures.ConvertAll(item => new ClassMultiplier {
                ClassName = item.ClassName
            }).ToArray();

            // engrams
            gameData.Engrams.AddRange(userGameData.Engrams);

            engrams = gameData.Engrams.ConvertAll(item => new Engram {
                EngramClassName = item.ClassName, EngramLevelRequirement = item.Level, EngramPointsCost = item.Points, Mod = item.Mod, KnownEngram = true, IsTekgram = item.IsTekGram
            }).ToArray();

            // items
            gameData.Items.AddRange(userGameData.Items);

            items = gameData.Items.ConvertAll(item => new PrimalItem {
                ClassName = item.ClassName, Mod = item.Mod, KnownItem = true, Category = item.Category
            }).ToArray();

            // resources
            resourceMultipliers = gameData.Items.Where(item => item.IsHarvestable).ToList().ConvertAll(item => new ResourceClassMultiplier {
                ClassName = item.ClassName, Mod = item.Mod, KnownResource = true
            }).ToArray();

            // map spawners
            gameData.MapSpawners.AddRange(userGameData.MapSpawners);

            mapSpawners = gameData.MapSpawners.ConvertAll(item => new MapSpawner {
                ClassName = item.ClassName, Mod = item.Mod, KnownSpawner = true
            }).ToArray();

            // supply crates
            gameData.SupplyCrates.AddRange(userGameData.SupplyCrates);

            var crates = gameData.SupplyCrates.ConvertAll(item => new SupplyCrate {
                ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true
            });

            // inventories
            gameData.Inventories.AddRange(userGameData.Inventories);

            crates.AddRange(gameData.Inventories.ConvertAll(item => new SupplyCrate {
                ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true
            }));

            supplyCrates = crates.ToArray();

            // game maps
            gameData.GameMaps.AddRange(userGameData.GameMaps);

            if (gameData.GameMaps.Count > 0)
            {
                var maps1 = gameMaps.ToList();
                maps1.AddRange(gameData.GameMaps.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));
                var maps2 = gameMapsSotF.ToList();
                maps2.AddRange(gameData.GameMaps.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));

                gameMaps     = maps1.ToArray();
                gameMapsSotF = maps2.ToArray();
            }

            // total conversion mods
            gameData.Mods.AddRange(userGameData.Mods);

            if (gameData.Mods.Count > 0)
            {
                var mods1 = totalConversions.ToList();
                mods1.AddRange(gameData.Mods.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));
                var mods2 = totalConversionsSotF.ToList();
                mods2.AddRange(gameData.Mods.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));

                totalConversions     = mods1.ToArray();
                totalConversionsSotF = mods2.ToArray();
            }

            // creature levels
            if (userGameData.CreatureLevels.Count > 0)
            {
                gameData.CreatureLevels = userGameData.CreatureLevels;
            }

            if (gameData.CreatureLevels.Count > 0)
            {
                levelsDino = gameData.CreatureLevels.ConvertAll(item => new Level {
                    XPRequired = item.XPRequired
                }).ToArray();
                DefaultMaxExperiencePointsDino = levelsDino.Max(l => l.XPRequired) + 1;
            }

            // player levels
            if (userGameData.PlayerLevels.Count > 0)
            {
                gameData.PlayerLevels = userGameData.PlayerLevels;
            }

            LevelsPlayerAdditional = userGameData.PlayerAdditionalLevels;

            if (gameData.PlayerLevels.Count > 0)
            {
                levelsPlayer = gameData.PlayerLevels.ConvertAll(item => new Level {
                    EngramPoints = item.EngramPoints, XPRequired = item.XPRequired
                }).ToArray();
                DefaultMaxExperiencePointsPlayer = levelsPlayer.Max(l => l.XPRequired) + 1;
            }

            if (gameData.PlayerAdditionalLevels > LevelsPlayerAdditional)
            {
                LevelsPlayerAdditional = gameData.PlayerAdditionalLevels;
            }

            // branches
            gameData.Branches.AddRange(userGameData.Branches);

            if (gameData.Branches.Count > 0)
            {
                var branches1 = branches.ToList();
                branches1.AddRange(gameData.Branches.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.BranchName, DisplayMember = item.Description
                }));
                var branches2 = branchesSotF.ToList();
                branches2.AddRange(gameData.Branches.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.BranchName, DisplayMember = item.Description
                }));

                branches     = branches1.ToArray();
                branchesSotF = branches2.ToArray();
            }

            // events
            gameData.Events.AddRange(userGameData.Events);

            if (gameData.Events.Count > 0)
            {
                var events1 = events.ToList();
                events1.AddRange(gameData.Events.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.EventName, DisplayMember = item.Description
                }));
                var events2 = eventsSotF.ToList();
                events2.AddRange(gameData.Events.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.EventName, DisplayMember = item.Description
                }));

                events     = events1.ToArray();
                eventsSotF = events2.ToArray();
            }

            // official mods
            gameData.OfficialMods.AddRange(userGameData.OfficialMods);

            if (gameData.OfficialMods.Count > 0)
            {
                ModUtils.AddOfficialMods(gameData.OfficialMods.Where(m => !string.IsNullOrWhiteSpace(m.ModId)).Select(m => m.ModId));
            }
        }
        public static void Initialize()
        {
            // read static game data
            GameDataUtils.ReadAllData(out gameData);

            // read user game data
            var dataFolder = System.IO.Path.Combine(Config.Default.DataDir, Config.Default.GameDataDir);

            GameDataUtils.ReadAllData(out BaseGameData userGameData, dataFolder, true);

            // creatures
            gameData.Creatures.AddRange(userGameData.Creatures);

            dinoSpawns = gameData.Creatures.ConvertAll(item => new DinoSpawn {
                ClassName = item.ClassName, Mod = item.Mod, KnownDino = true, DinoNameTag = item.NameTag, ArkApplication = item.ArkApplication
            }).ToArray();
            dinoMultipliers = gameData.Creatures.ConvertAll(item => new ClassMultiplier {
                ClassName = item.ClassName
            }).ToArray();

            // engrams
            gameData.Engrams.AddRange(userGameData.Engrams);

            engrams = gameData.Engrams.ConvertAll(item => new EngramEntry {
                EngramClassName = item.ClassName, Mod = item.Mod, KnownEngram = true, EngramLevelRequirement = item.Level, EngramPointsCost = item.Points, IsTekgram = item.IsTekGram, ArkApplication = item.ArkApplication
            }).ToArray();

            // items
            gameData.Items.AddRange(userGameData.Items);

            items = gameData.Items.ConvertAll(item => new PrimalItem {
                ClassName = item.ClassName, Mod = item.Mod, KnownItem = true, Category = item.Category, ArkApplication = item.ArkApplication
            }).ToArray();

            // resources
            resourceMultipliers = gameData.Items.Where(item => item.IsHarvestable).ToList().ConvertAll(item => new ResourceClassMultiplier {
                ClassName = item.ClassName, Mod = item.Mod, KnownResource = true, ArkApplication = item.ArkApplication
            }).ToArray();

            // map spawners
            gameData.MapSpawners.AddRange(userGameData.MapSpawners);

            mapSpawners = gameData.MapSpawners.ConvertAll(item => new MapSpawner {
                ClassName = item.ClassName, Mod = item.Mod, KnownSpawner = true
            }).ToArray();

            // supply crates
            gameData.SupplyCrates.AddRange(userGameData.SupplyCrates);

            var crates = gameData.SupplyCrates.ConvertAll(item => new SupplyCrate {
                ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true
            });

            // inventories
            gameData.Inventories.AddRange(userGameData.Inventories);

            crates.AddRange(gameData.Inventories.ConvertAll(item => new SupplyCrate {
                ClassName = item.ClassName, Mod = item.Mod, KnownSupplyCrate = true
            }));

            supplyCrates = crates.ToArray();

            // game maps
            gameData.GameMaps.AddRange(userGameData.GameMaps);

            if (gameData.GameMaps.Count > 0)
            {
                var maps1 = gameMaps.ToList();
                maps1.AddRange(gameData.GameMaps.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));
                var maps2 = gameMapsSotF.ToList();
                maps2.AddRange(gameData.GameMaps.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));

                gameMaps     = maps1.ToArray();
                gameMapsSotF = maps2.ToArray();
            }

            // total conversion mods
            gameData.Mods.AddRange(userGameData.Mods);

            if (gameData.Mods.Count > 0)
            {
                var mods1 = totalConversions.ToList();
                mods1.AddRange(gameData.Mods.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));
                var mods2 = totalConversionsSotF.ToList();
                mods2.AddRange(gameData.Mods.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.ClassName, DisplayMember = item.Description
                }));

                totalConversions     = mods1.ToArray();
                totalConversionsSotF = mods2.ToArray();
            }

            // creature levels
            if (userGameData.CreatureLevels.Count > 0)
            {
                gameData.CreatureLevels = userGameData.CreatureLevels;
            }

            if (gameData.CreatureLevels.Count > 0)
            {
                levelsDino = gameData.CreatureLevels.ConvertAll(item => new Level {
                    XPRequired = item.XPRequired
                }).ToArray();
                DefaultMaxExperiencePointsDino = levelsDino.Max(l => l.XPRequired) + 1;
            }

            // player levels
            if (userGameData.PlayerLevels.Count > 0)
            {
                gameData.PlayerLevels = userGameData.PlayerLevels;
            }

            if (gameData.PlayerLevels.Count > 0)
            {
                levelsPlayer = gameData.PlayerLevels.ConvertAll(item => new Level {
                    EngramPoints = item.EngramPoints, XPRequired = item.XPRequired
                }).ToArray();
                DefaultMaxExperiencePointsPlayer = levelsPlayer.Max(l => l.XPRequired) + 1;
            }

            // branches
            gameData.Branches.AddRange(userGameData.Branches);

            if (gameData.Branches.Count > 0)
            {
                var branches1 = branches.ToList();
                branches1.AddRange(gameData.Branches.Where(item => !item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.BranchName, DisplayMember = item.Description
                }));
                var branches2 = branchesSotF.ToList();
                branches2.AddRange(gameData.Branches.Where(item => item.IsSotF).ToList().ConvertAll(item => new ComboBoxItem {
                    ValueMember = item.BranchName, DisplayMember = item.Description
                }));

                branches     = branches1.ToArray();
                branchesSotF = branches2.ToArray();
            }
        }