More warning fixes

This commit is contained in:
2025-05-02 16:04:54 +02:00
parent dabb26e4f2
commit b69ba6eaff
56 changed files with 56 additions and 80 deletions

View File

@@ -4,6 +4,7 @@ using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Text.Json;
using JetBrains.Annotations;
using PkmnLib.Dataloader.Models;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
@@ -26,12 +27,14 @@ public static class MoveDataLoader
return library;
}
[PublicAPI]
public static
Func<SerializedMove, StringKey, TypeIdentifier, MoveCategory, byte, byte, byte, MoveTarget, sbyte,
ISecondaryEffect?, IEnumerable<StringKey>, MoveDataImpl> MoveConstructor =
(serialized, name, moveType, category, basePower, accuracy, baseUsages, target, priority, secondaryEffect,
flags) => new MoveDataImpl(name, moveType, category, basePower, accuracy, baseUsages, target, priority,
secondaryEffect, flags);
ISecondaryEffect?
, IEnumerable<StringKey>, MoveDataImpl> MoveConstructor =
(_, name, moveType, category, basePower, accuracy, baseUsages, target, priority, secondaryEffect, flags) =>
new MoveDataImpl(name, moveType, category, basePower, accuracy, baseUsages, target, priority,
secondaryEffect, flags);
private static MoveDataImpl DeserializeMove(SerializedMove serialized, TypeLibrary typeLibrary)
{

View File

@@ -21,7 +21,7 @@ public static class SpeciesDataLoader
if (obj == null)
throw new InvalidDataException("Species data is empty.");
return obj.Where(x => x.Key != "$schema").ToDictionary(x => x.Key,
x => x.Value.Deserialize<SerializedSpecies>(JsonOptions.DefaultOptions));
x => x.Value.Deserialize<SerializedSpecies>(JsonOptions.DefaultOptions))!;
}
public static SpeciesLibrary LoadSpecies(Stream[] streams, IReadOnlyTypeLibrary typeLibrary)
@@ -159,17 +159,17 @@ public static class SpeciesDataLoader
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"happinessday" => new HappinessDayEvolution()
"happinessday" => new HappinessDayEvolution
{
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"happinessnight" => new HappinessNightEvolution()
"happinessnight" => new HappinessNightEvolution
{
Happiness = evolution.Data.GetValue<byte>(),
ToSpecies = evolution.Species,
},
"item" => new ItemUseEvolution()
"item" => new ItemUseEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
@@ -184,17 +184,17 @@ public static class SpeciesDataLoader
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"holditem" => new HoldItemEvolution()
"holditem" => new HoldItemEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"dayholditem" => new DayHoldItemEvolution()
"dayholditem" => new DayHoldItemEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,
},
"nightholditem" => new NightHoldItemEvolution()
"nightholditem" => new NightHoldItemEvolution
{
Item = evolution.Data.GetValue<string>() ?? throw new InvalidDataException("Item is null."),
ToSpecies = evolution.Species,

View File

@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Linq;
using PkmnLib.Static;
using PkmnLib.Static.Libraries;
namespace PkmnLib.Dataloader;