Exemplo n.º 1
0
        public static InfoDictionary <WeaponBalanceDefinition> Load(InfoDictionary <WeaponTypeDefinition> weaponTypes)
        {
            try
            {
                var rawPartLists = LoaderHelper.DeserializeDump <Dictionary <string, Raw.WeaponBalancePartCollection> >(
                    "Weapon Balance Part Lists");
                var partLists = new InfoDictionary <WeaponBalancePartCollection>(
                    rawPartLists.ToDictionary(
                        kv => kv.Key,
                        kv => CreateWeaponBalancePartCollection(weaponTypes, kv)));

                var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.WeaponBalanceDefinition> >(
                    "Weapon Balance");
                var balances = new InfoDictionary <WeaponBalanceDefinition>(
                    raws.ToDictionary(
                        kv => kv.Key,
                        kv => CreateWeaponBalance(weaponTypes, kv, partLists)));

                foreach (var kv in raws.Where(kv => string.IsNullOrEmpty(kv.Value.Base) == false))
                {
                    if (balances.TryGetValue(kv.Value.Base, out var baseBalance) == false)
                    {
                        throw ResourceNotFoundException.Create("weapon balance", kv.Value.Base);
                    }
                    balances[kv.Key].Base = baseBalance;
                }

                return(balances);
            }
            catch (Exception e)
            {
                throw new InfoLoadException("failed to load weapon balance", e);
            }
        }
Exemplo n.º 2
0
 public static AssetLibraryManager Load()
 {
     try
     {
         var raw = LoaderHelper.DeserializeDump <Raw.AssetLibraryManager>(
             "Asset Library Manager");
         return(GetAssetLibraryManager(raw));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load asset library manager", e);
     }
 }
Exemplo n.º 3
0
 public static InfoDictionary <Platform, PlatformConfiguration> Load()
 {
     try
     {
         var raws = LoaderHelper.Deserialize <Dictionary <Platform, Raw.PlatformConfiguration> >(
             "Platform Configurations");
         return(new InfoDictionary <Platform, PlatformConfiguration>(
                    raws.ToDictionary(kv => kv.Key, CreatePlatformConfiguration)));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load platform configurations", e);
     }
 }
Exemplo n.º 4
0
 public static InfoDictionary <ItemTypeDefinition> Load()
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.ItemTypeDefinition> >(
             "Item Types");
         return(new InfoDictionary <ItemTypeDefinition>(
                    raws.ToDictionary(kv => kv.Key, GetItemTypeDefinition)));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load item types", e);
     }
 }
 public static InfoDictionary <WeaponNamePartDefinition> Load()
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.WeaponNamePartDefinition> >(
             "Weapon Name Parts");
         return(new InfoDictionary <WeaponNamePartDefinition>(
                    raws.ToDictionary(kv => kv.Key, CreateWeaponNamePart)));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load weapon name parts", e);
     }
 }
 public static InfoDictionary <WeaponTypeDefinition> Load()
 {
     try
     {
         var raws = LoaderHelper
                    .DeserializeJson <Dictionary <string, Raw.WeaponTypeDefinition> >("Weapon Types");
         return(new InfoDictionary <WeaponTypeDefinition>(
                    raws.ToDictionary(kv => kv.Key, GetWeaponTypeDefinition)));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load weapon types", e);
     }
 }
Exemplo n.º 7
0
 public static InfoDictionary <DownloadablePackageDefinition> Load()
 {
     try
     {
         var raws = LoaderHelper
                    .DeserializeJson <Dictionary <string, Raw.DownloadablePackage> >("Downloadable Packages");
         return(new InfoDictionary <DownloadablePackageDefinition>(
                    raws.ToDictionary(kv => kv.Key,
                                      GetDownloadablePackage)));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load downloadable packages", e);
     }
 }
Exemplo n.º 8
0
 public static InfoDictionary <CustomizationDefinition> Load(
     InfoDictionary <DownloadableContentDefinition> downloadableContents)
 {
     try
     {
         var raws = LoaderHelper
                    .DeserializeJson <Dictionary <string, Raw.CustomizationDefinition> >("Customizations");
         return(new InfoDictionary <CustomizationDefinition>(
                    raws.ToDictionary(kv => kv.Key,
                                      kv => GetCustomizationDefinition(downloadableContents, kv))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load customizations", e);
     }
 }
Exemplo n.º 9
0
 public static InfoDictionary <PlayerClassDefinition> Load(
     InfoDictionary <DownloadableContentDefinition> downloadableContents)
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.PlayerClassDefinition> >(
             "Player Classes");
         return(new InfoDictionary <PlayerClassDefinition>(
                    raws.ToDictionary(kv => kv.Key,
                                      kv => GetPlayerClassDefinition(downloadableContents, kv))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load player classes", e);
     }
 }
 public static InfoDictionary <DownloadableContentDefinition> Load(
     InfoDictionary <DownloadablePackageDefinition> downloadablePackages)
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.DownloadableContentDefinition> >(
             "Downloadable Contents");
         return(new InfoDictionary <DownloadableContentDefinition>(
                    raws.ToDictionary(kv => kv.Key,
                                      kv => GetDownloadableContent(downloadablePackages, kv))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load downloadable contents", e);
     }
 }
Exemplo n.º 11
0
        public static InfoDictionary <TravelStationDefinition> Load(
            InfoDictionary <DownloadableContentDefinition> downloadableContents)
        {
            try
            {
                var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.TravelStationDefinition> >(
                    "Travel Stations");
                var stations = new InfoDictionary <TravelStationDefinition>(
                    raws.ToDictionary(
                        kv => kv.Key,
                        kv => CreateTravelStation(downloadableContents, kv)));

                foreach (var kv in raws)
                {
                    var stationPath = kv.Value.PreviousStation;
                    if (string.IsNullOrEmpty(stationPath) == true)
                    {
                        continue;
                    }
                    if (stations.TryGetValue(stationPath, out var station) == false)
                    {
                        throw ResourceNotFoundException.Create("travel station", stationPath);
                    }
                    stations[kv.Key].PreviousStation = station;
                }

                foreach (var kv in raws.Where(kv => kv.Value is Raw.LevelTravelStationDefinition))
                {
                    var raw = (Raw.LevelTravelStationDefinition)kv.Value;
                    if (string.IsNullOrEmpty(raw.DestinationStation) == true)
                    {
                        continue;
                    }
                    if (stations.TryGetValue(raw.DestinationStation, out var destination) == false)
                    {
                        throw ResourceNotFoundException.Create("level travel station", raw.DestinationStation);
                    }
                    var station = (LevelTravelStationDefinition)stations[kv.Key];
                    station.DestinationStation = (LevelTravelStationDefinition)destination;
                }
                return(stations);
            }
            catch (Exception e)
            {
                throw new InfoLoadException("failed to load travel stations", e);
            }
        }
 public static InfoDictionary <FastTravelStationOrdering> Load(
     InfoDictionary <TravelStationDefinition> travelStations,
     InfoDictionary <DownloadableContentDefinition> downloadableContents)
 {
     try
     {
         var raws = LoaderHelper
                    .DeserializeJson <Dictionary <string, Raw.FastTravelStationOrdering> >("Fast Travel Station Ordering");
         return(new InfoDictionary <FastTravelStationOrdering>(
                    raws.ToDictionary(kv => kv.Key,
                                      kv => GetFastTravelStationOrdering(travelStations, downloadableContents, kv))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load fast travel station ordering", e);
     }
 }
 public static InfoDictionary <DownloadablePackageDefinition> Load()
 {
     try
     {
         var displayNameOverrides = LoaderHelper.Deserialize <Dictionary <string, string> >(
             "Downloadable Package Display Name Overrides");
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.DownloadablePackage> >(
             "Downloadable Packages");
         return(new InfoDictionary <DownloadablePackageDefinition>(
                    raws.ToDictionary(kv => kv.Key,
                                      kv => GetDownloadablePackage(kv, displayNameOverrides))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load downloadable packages", e);
     }
 }
Exemplo n.º 14
0
 public static InfoDictionary <ItemDefinition> Load()
 {
     try
     {
         var partLists = LoaderHelper.DeserializeDump <Dictionary <string, List <string> > >(
             "Item Part Lists");
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.ItemDefinition> >(
             "Items");
         return(new InfoDictionary <ItemDefinition>(
                    raws.ToDictionary(
                        kv => kv.Key,
                        kv => CreateItem(kv, partLists))));
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load items", e);
     }
 }
 public static InfoDictionary <TravelStationDefinition> Load(
     InfoDictionary <DownloadableContentDefinition> downloadableContents)
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.TravelStationDefinition> >(
             "Travel Stations");
         var defs = new InfoDictionary <TravelStationDefinition>(
             raws.ToDictionary(kv => kv.Key,
                               kv => GetTravelStationDefinition(downloadableContents, kv)));
         foreach (var kv in raws.Where(kv => string.IsNullOrEmpty(kv.Value.PreviousStation) == false))
         {
             if (defs.ContainsKey(kv.Value.PreviousStation) == false)
             {
                 throw ResourceNotFoundException.Create("travel station", kv.Value.PreviousStation);
             }
             defs[kv.Key].PreviousStation = defs[kv.Value.PreviousStation];
         }
         foreach (var kv in raws
                  .Where(
                      kv =>
                      (kv.Value is Raw.LevelTravelStationDefinition) &&
                      string.IsNullOrEmpty(((Raw.LevelTravelStationDefinition)kv.Value).DestinationStation) == false))
         {
             var rawLevelTravelStation = (Raw.LevelTravelStationDefinition)kv.Value;
             if (defs.ContainsKey(rawLevelTravelStation.DestinationStation) == false)
             {
                 throw ResourceNotFoundException.Create(
                           "level travel station",
                           rawLevelTravelStation.DestinationStation);
             }
             var levelTravelStation = (LevelTravelStationDefinition)defs[kv.Key];
             levelTravelStation.DestinationStation =
                 (LevelTravelStationDefinition)defs[rawLevelTravelStation.DestinationStation];
         }
         return(defs);
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load travel stations", e);
     }
 }
Exemplo n.º 16
0
 public static InfoDictionary <ItemBalanceDefinition> Load(InfoDictionary <ItemTypeDefinition> itemTypes)
 {
     try
     {
         var raws = LoaderHelper.DeserializeDump <Dictionary <string, Raw.ItemBalanceDefinition> >(
             "Item Balance");
         var defs = new InfoDictionary <ItemBalanceDefinition>(
             raws.ToDictionary(kv => kv.Key,
                               kv => GetItemBalanceDefinition(itemTypes, kv)));
         foreach (var kv in raws.Where(kv => string.IsNullOrEmpty(kv.Value.Base) == false))
         {
             if (defs.ContainsKey(kv.Value.Base) == false)
             {
                 throw ResourceNotFoundException.Create("item balance", kv.Value.Base);
             }
             defs[kv.Key].Base = defs[kv.Value.Base];
         }
         return(defs);
     }
     catch (Exception e)
     {
         throw new InfoLoadException("failed to load item balance", e);
     }
 }