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,10 +1,22 @@
using System.Text.Json.Nodes;
// ReSharper disable CollectionNeverUpdated.Global
namespace PkmnLib.Dynamic.Libraries.DataLoaders.Models;
/// <summary>
/// Represents a serialized ability.
/// </summary>
public class SerializedAbility
{
/// <inheritdoc cref="PkmnLib.Static.Species.IAbility.Effect"/>
public string? Effect { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.IAbility.Parameters"/>
public Dictionary<string, JsonNode> Parameters { get; set; } = new();
/// <summary>
/// A collection of arbitrary flags that can be used to mark the ability with specific properties.
/// </summary>
public string[] Flags { get; set; } = [];
}

View File

@@ -4,17 +4,38 @@ using System.Text.Json.Serialization;
namespace PkmnLib.Dynamic.Libraries.DataLoaders.Models;
/// <summary>
/// Represents a serialized item.
/// </summary>
public class SerializedItem
{
/// <inheritdoc cref="PkmnLib.Static.Utils.INamedValue.Name" />
public string Name { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.IItem.Category" />
public string ItemType { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.IItem.BattleCategory" />
public string BattleType { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.IItem.Flags" />
public string[] Flags { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.IItem.Price" />
public int Price { get; set; }
/// <inheritdoc cref="PkmnLib.Static.IItem.Effect" />
public SerializedMoveEffect? Effect { get; set; }
/// <inheritdoc cref="PkmnLib.Static.IItem.BattleEffect" />
public SerializedMoveEffect? BattleEffect { get; set; }
/// <inheritdoc cref="PkmnLib.Static.IItem.AdditionalData" />
public Dictionary<string, JsonNode>? AdditionalData { get; set; } = null!;
[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
/// <summary>
/// A collection of non-standard data that can be set on the item.
/// </summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}

View File

@@ -4,30 +4,72 @@ using System.Text.Json.Serialization;
namespace PkmnLib.Dynamic.Libraries.DataLoaders.Models;
/// <summary>
/// A wrapper class for serialized move data.
/// </summary>
public class SerializedMoveDataWrapper
{
public SerializedMove[] Data { get; set; } = null!;
/// <summary>
/// The name of the move data file.
/// </summary>
public List<SerializedMove> Data { get; set; } = null!;
}
/// <summary>
/// A class representing a serialized move.
/// </summary>
public class SerializedMove
{
/// <inheritdoc cref="PkmnLib.Static.Utils.INamedValue.Name" />
public string Name { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.MoveType" />
public string Type { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.BasePower" />
public byte Power { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.BaseUsages" />
public byte PP { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.Accuracy" />
public byte Accuracy { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.Priority" />
public sbyte Priority { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.Target" />
public string Target { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.Category" />
public string Category { get; set; } = null!;
/// <summary>
/// Arbitrary flags that can be applied to the move.
/// </summary>
public string[] Flags { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Moves.IMoveData.SecondaryEffect" />
public SerializedMoveEffect? Effect { get; set; }
[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
/// <summary>
/// Additional non-standard data that can be added to the move.
/// </summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
/// <summary>
/// A class representing a serialized move effect.
/// </summary>
public class SerializedMoveEffect
{
/// <inheritdoc cref="PkmnLib.Static.Moves.ISecondaryEffect.Name" />
public string Name { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Moves.ISecondaryEffect.Chance" />
public float? Chance { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Moves.ISecondaryEffect.Parameters" />
public Dictionary<string, JsonNode>? Parameters { get; set; } = null!;
}

View File

@@ -2,71 +2,198 @@ using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable PropertyCanBeMadeInitOnly.Global
namespace PkmnLib.Dynamic.Libraries.DataLoaders.Models;
/// <summary>
/// Represents a serialized species.
/// </summary>
public class SerializedSpecies
{
/// <inheritdoc cref="PkmnLib.Static.Utils.INamedValue.Name"/>
public string Species { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.Id"/>
public ushort Id { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.GenderRate"/>
public float GenderRatio { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.GrowthRate"/>
public string GrowthRate { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.BaseHappiness"/>
public byte BaseHappiness { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.CaptureRate"/>
public byte CatchRate { get; set; }
/// <summary>
/// The color of the Pokémon, used for Pokédex sorting.
/// </summary>
public string Color { get; set; } = null!;
/// <summary>
/// Whether the Pokémon has a different form per gender
/// </summary>
public bool GenderDifference { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.EggGroups"/>
public string[] EggGroups { get; set; } = null!;
/// <summary>
/// The number of steps required to hatch the Pokémon's egg, in cycles (1 cycle = 255 steps).
/// </summary>
public int EggCycles { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.Flags"/>
public string[] Flags { get; set; } = [];
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.Forms"/>
public Dictionary<string, SerializedForm> Formes { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.ISpecies.EvolutionData"/>
public SerializedEvolution[] Evolutions { get; set; } = [];
[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
/// <summary>
/// Additional data that is not part of the standard species data.
/// </summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
/// <summary>
/// Represents a serialized form of a Pokémon species.
/// </summary>
public class SerializedForm
{
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Abilities"/>
public string[] Abilities { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.HiddenAbilities"/>
public string[] HiddenAbilities { get; set; } = [];
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.BaseStats"/>
public SerializedStats BaseStats { get; set; } = null!;
/// <summary>
/// The Pokémon's EV yield. This is the number of EVs gained when defeating a Pokémon of this species.
/// </summary>
public SerializedStats EVReward { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Types"/>
public string[] Types { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Height"/>
public float Height { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Weight"/>
public float Weight { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.BaseExperience"/>
public uint BaseExp { get; set; }
/// <summary>
/// Whether the form is a Mega Evolution.
/// </summary>
public bool IsMega { get; set; }
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Moves"/>
public SerializedMoves Moves { get; set; } = null!;
/// <inheritdoc cref="PkmnLib.Static.Species.IForm.Flags"/>
public string[] Flags { get; set; } = [];
[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
/// <summary>
/// Additional data that is not part of the standard form data.
/// </summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; set; }
}
/// <summary>
/// Represents a serialized evolution of a Pokémon species.
/// </summary>
public class SerializedEvolution
{
/// <inheritdoc cref="PkmnLib.Static.Species.IEvolution.ToSpecies"/>
public string Species { get; set; } = null!;
/// <summary>
/// The method of evolution.
/// </summary>
public string Method { get; set; } = null!;
/// <summary>
/// Additional data for the evolution method.
/// </summary>
public JsonNode Data { get; set; } = null!;
}
public class SerializedStats
/// <summary>
/// Represents the base stats of a Pokémon species.
/// </summary>
public record SerializedStats
{
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.Hp"/>
public ushort Hp { get; set; }
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.Attack"/>
public ushort Attack { get; set; }
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.Defense"/>
public ushort Defense { get; set; }
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.SpecialAttack"/>
public ushort SpecialAttack { get; set; }
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.SpecialDefense"/>
public ushort SpecialDefense { get; set; }
/// <inheritdoc cref="PkmnLib.Static.ImmutableStatisticSet{T}.Speed"/>
public ushort Speed { get; set; }
}
/// <summary>
/// Represents a serialized level move.
/// </summary>
public class SerializedLevelMove
{
/// <summary>
/// The name of the move.
/// </summary>
public string Name { get; set; } = null!;
/// <summary>
/// The level at which the move is learned.
/// </summary>
public uint Level { get; set; }
}
/// <summary>
/// Represents a serialized set of moves a Pokémon can learn.
/// </summary>
public class SerializedMoves
{
/// <summary>
/// The moves the Pokémon can learn by leveling up.
/// </summary>
public SerializedLevelMove[]? LevelMoves { get; set; } = null!;
/// <summary>
/// The moves the Pokémon can learn by breeding.
/// </summary>
public string[]? EggMoves { get; set; } = null!;
/// <summary>
/// The moves the Pokémon can learn by tutoring.
/// </summary>
public string[]? TutorMoves { get; set; } = null!;
/// <summary>
/// The moves the Pokémon can learn by TM.
/// </summary>
public string[]? Machine { get; set; } = null!;
}