2024-09-03 07:31:32 +00:00
|
|
|
using PkmnLib.Dataloader;
|
|
|
|
using PkmnLib.Dynamic.Libraries;
|
|
|
|
using PkmnLib.Plugin.Gen7;
|
|
|
|
using PkmnLib.Static.Libraries;
|
|
|
|
|
|
|
|
namespace PkmnLib.Tests.Integration;
|
|
|
|
|
|
|
|
public static class LibraryHelpers
|
|
|
|
{
|
|
|
|
public static IDynamicLibrary LoadLibrary()
|
|
|
|
{
|
2024-12-27 13:30:22 +00:00
|
|
|
using var typesFile = File.Open("Data/Types.csv", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var types = TypeDataLoader.LoadTypeLibrary(typesFile);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var naturesFile = File.Open("Data/Natures.csv", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var natures = NatureDataLoader.LoadNatureLibrary(naturesFile);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var movesFile = File.Open("Data/Moves.json", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var moves = MoveDataLoader.LoadMoves(movesFile, types);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var itemsFile = File.Open("Data/Items.json", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var items = ItemDataLoader.LoadItems(itemsFile);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var abilitiesFile = File.Open("Data/Abilities.json", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var abilities = AbilityDataLoader.LoadAbilities(abilitiesFile);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var growthRatesFile = File.Open("Data/GrowthRates.json", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var growthRates = GrowthRateDataLoader.LoadGrowthRates(growthRatesFile);
|
2024-12-27 13:30:22 +00:00
|
|
|
using var speciesFile = File.Open("Data/Pokemon.json", FileMode.Open, FileAccess.Read, FileShare.Read);
|
2024-09-03 07:31:32 +00:00
|
|
|
var species = SpeciesDataLoader.LoadSpecies(speciesFile, types);
|
|
|
|
|
|
|
|
var staticLibrary = new StaticLibraryImpl(new LibrarySettings()
|
|
|
|
{
|
|
|
|
MaxLevel = 100,
|
|
|
|
ShinyRate = 4096,
|
|
|
|
}, species, moves, abilities, types, natures, growthRates, items);
|
|
|
|
|
|
|
|
var dynamicLibrary = DynamicLibraryImpl.Create(staticLibrary, [
|
|
|
|
new Gen7Plugin(new Gen7PluginConfiguration()
|
|
|
|
{
|
|
|
|
DamageCalculatorHasRandomness = false,
|
|
|
|
}),
|
|
|
|
]);
|
|
|
|
return dynamicLibrary;
|
2025-03-02 16:19:57 +00:00
|
|
|
}
|
2024-09-03 07:31:32 +00:00
|
|
|
}
|