Document all undocumented methods and properties
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-16 13:59:36 +02:00
parent 810cdbb15a
commit fdfca99e71
27 changed files with 384 additions and 39 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Immutable;
using System.Text.Json;
using System.Text.Json.Nodes;
using JetBrains.Annotations;
using PkmnLib.Dynamic.Libraries.DataLoaders.Models;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
@@ -9,6 +10,9 @@ using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.Libraries.DataLoaders;
/// <summary>
/// Loads species data from a JSON file.
/// </summary>
public static class SpeciesDataLoader
{
private static Dictionary<string, SerializedSpecies> LoadSpeciesData(Stream stream)
@@ -20,6 +24,9 @@ public static class SpeciesDataLoader
x => x.Value.Deserialize<SerializedSpecies>(JsonOptions.DefaultOptions))!;
}
/// <summary>
/// Loads the species library from a JSON file.
/// </summary>
public static SpeciesLibrary LoadSpecies(Stream stream, IReadOnlyTypeLibrary typeLibrary,
Action<Dictionary<string, SerializedSpecies>>? action = null)
{
@@ -34,14 +41,21 @@ public static class SpeciesDataLoader
return library;
}
public static
Func<SerializedSpecies, ushort, StringKey, float, StringKey, byte, byte, IReadOnlyDictionary<StringKey, IForm>,
IEnumerable<StringKey>, IReadOnlyList<IEvolution>, IEnumerable<StringKey>, SpeciesImpl> SpeciesConstructor =
(_, id, name, genderRate, growthRate, captureRate, baseHappiness, forms, flags, evolutionData, eggGroups) =>
{
return new SpeciesImpl(id, name, genderRate, growthRate, captureRate, baseHappiness, forms, flags,
evolutionData, eggGroups);
};
/// <summary>
/// Factory delegate for creating species.
/// </summary>
public delegate SpeciesImpl SpeciesFactoryDelegate(SerializedSpecies serialized, ushort id, StringKey name,
float genderRate, StringKey growthRate, byte captureRate, byte baseHappiness,
IReadOnlyDictionary<StringKey, IForm> forms, IEnumerable<StringKey> flags,
IReadOnlyList<IEvolution> evolutionData, IEnumerable<StringKey> eggGroups);
/// <summary>
/// The species constructor. This is used to create species from the JSON data.
/// </summary>
[PublicAPI] public static SpeciesFactoryDelegate SpeciesConstructor =
(_, id, name, genderRate, growthRate, captureRate, baseHappiness, forms, flags, evolutionData, eggGroups) =>
new SpeciesImpl(id, name, genderRate, growthRate, captureRate, baseHappiness, forms, flags, evolutionData,
eggGroups);
private static SpeciesImpl DeserializeSpecies(SerializedSpecies serialized, IReadOnlyTypeLibrary typeLibrary)
{