Adds battle history, fixes code style

This commit is contained in:
2024-08-23 09:24:00 +02:00
parent d48889e21a
commit e7dc885afd
21 changed files with 80 additions and 70 deletions

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Text.Json.Nodes;
using PkmnLib.Static.Utils;
namespace PkmnLib.Dataloader.Models;

View File

@@ -2,10 +2,10 @@ namespace PkmnLib.Dataloader.Models;
public class SerializedItem
{
public string Name { get; set; }
public string ItemType { get; set; }
public string BattleType { get; set; }
public string[] Flags { get; set; }
public string Name { get; set; } = null!;
public string ItemType { get; set; } = null!;
public string BattleType { get; set; } = null!;
public string[] Flags { get; set; } = null!;
public int Price { get; set; }
public byte FlingPower { get; set; }
}

View File

@@ -5,26 +5,26 @@ namespace PkmnLib.Dataloader.Models;
public class SerializedMoveDataWrapper
{
public SerializedMove[] Data { get; set; }
public SerializedMove[] Data { get; set; } = null!;
}
public class SerializedMove
{
public string Name { get; set; }
public string Type { get; set; }
public string Name { get; set; } = null!;
public string Type { get; set; } = null!;
public byte Power { get; set; }
public byte PP { get; set; }
public byte Accuracy { get; set; }
public sbyte Priority { get; set; }
public string Target { get; set; }
public string Category { get; set; }
public string[] Flags { get; set; }
public string Target { get; set; } = null!;
public string Category { get; set; } = null!;
public string[] Flags { get; set; } = null!;
public SerializedMoveEffect? Effect { get; set; }
}
public class SerializedMoveEffect
{
public string Name { get; set; }
public string Name { get; set; } = null!;
public float Chance { get; set; }
public Dictionary<string, JsonNode>? Parameters { get; set; }
public Dictionary<string, JsonNode>? Parameters { get; set; } = null!;
}

View File

@@ -1,46 +1,45 @@
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Nodes;
namespace PkmnLib.Dataloader.Models;
public class SerializedSpecies
{
public string Species { get; set; }
public string Species { get; set; } = null!;
public ushort Id { get; set; }
public float GenderRatio { get; set; }
public string GrowthRate { get; set; }
public string GrowthRate { get; set; } = null!;
public byte BaseHappiness { get; set; }
public byte CatchRate { get; set; }
public string Color { get; set; }
public string Color { get; set; } = null!;
public bool GenderDifference { get; set; }
public string[] EggGroups { get; set; }
public string[] EggGroups { get; set; } = null!;
public int EggCycles { get; set; }
public string[] Flags { get; set; } = [];
public Dictionary<string, SerializedForm> Formes { get; set; }
public Dictionary<string, SerializedForm> Formes { get; set; } = null!;
public SerializedEvolution[] Evolutions { get; set; } = [];
}
public class SerializedForm
{
public string[] Abilities { get; set; }
public string[] Abilities { get; set; } = null!;
public string[] HiddenAbilities { get; set; } = [];
public SerializedStats BaseStats { get; set; }
public SerializedStats EVReward { get; set; }
public string[] Types { get; set; }
public SerializedStats BaseStats { get; set; } = null!;
public SerializedStats EVReward { get; set; } = null!;
public string[] Types { get; set; } = null!;
public float Height { get; set; }
public float Weight { get; set; }
public uint BaseExp { get; set; }
public bool IsMega { get; set; }
public SerializedMoves Moves { get; set; }
public SerializedMoves Moves { get; set; } = null!;
public string[] Flags { get; set; } = [];
}
public class SerializedEvolution
{
public string Species { get; set; }
public string Method { get; set; }
public JsonNode Data { get; set; }
public string Species { get; set; } = null!;
public string Method { get; set; } = null!;
public JsonNode Data { get; set; } = null!;
}
public class SerializedStats
@@ -55,14 +54,14 @@ public class SerializedStats
public class SerializedLevelMove
{
public string Name { get; set; }
public string Name { get; set; } = null!;
public uint Level { get; set; }
}
public class SerializedMoves
{
public SerializedLevelMove[] LevelMoves { get; set; }
public string[] EggMoves { get; set; }
public string[] TutorMoves { get; set; }
public string[] Machine { get; set; }
public SerializedLevelMove[] LevelMoves { get; set; } = null!;
public string[] EggMoves { get; set; } = null!;
public string[] TutorMoves { get; set; } = null!;
public string[] Machine { get; set; } = null!;
}

View File

@@ -187,7 +187,7 @@ public static class SpeciesDataLoader
Name = "location",
Parameters = new Dictionary<StringKey, object?>
{
["location"] = evolution.Data.ToString() ?? throw new InvalidDataException("Location is null.")
["location"] = evolution.Data.ToString() ?? throw new InvalidDataException("Location is null."),
},
ToSpecies = evolution.Species,
},
@@ -200,7 +200,7 @@ public static class SpeciesDataLoader
.ToDictionary(x => new StringKey(x.Key), x => x.Value!.ToParameter()),
ToSpecies = evolution.Species,
},
_ => throw new InvalidDataException($"Evolution type {evolution.Method} is invalid.")
_ => throw new InvalidDataException($"Evolution type {evolution.Method} is invalid."),
};
}
}