72 lines
2.7 KiB
C#
72 lines
2.7 KiB
C#
using System;
|
|
using PkmnLib.Plugin.Gen7.Libraries.Battling;
|
|
using PkmnLib.Static.Libraries;
|
|
|
|
namespace PkmnLib.Plugin.Gen7;
|
|
|
|
public class Gen7PluginConfiguration : PluginConfiguration
|
|
{
|
|
public bool DamageCalculatorHasRandomness { get; set; } = true;
|
|
}
|
|
|
|
public class Gen7Plugin : Dynamic.ScriptHandling.Registry.Plugin, IResourceProvider
|
|
{
|
|
private readonly Gen7PluginConfiguration _configuration;
|
|
|
|
public Gen7Plugin()
|
|
{
|
|
_configuration = new Gen7PluginConfiguration();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public Gen7Plugin(PluginConfiguration configuration) : base(configuration)
|
|
{
|
|
_configuration = (Gen7PluginConfiguration)configuration;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override string Name => "Gen7";
|
|
|
|
/// <inheritdoc />
|
|
public override uint LoadOrder => 0;
|
|
|
|
/// <inheritdoc />
|
|
public override void Register(ScriptRegistry registry)
|
|
{
|
|
registry.RegisterAssemblyScripts(typeof(Gen7Plugin).Assembly);
|
|
registry.RegisterBattleStatCalculator(new Gen7BattleStatCalculator());
|
|
registry.RegisterDamageCalculator(new Gen7DamageCalculator(_configuration.DamageCalculatorHasRandomness));
|
|
registry.RegisterMiscLibrary(new Gen7MiscLibrary());
|
|
registry.RegisterCaptureLibrary(new Gen7CaptureLibrary());
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public LibrarySettings Settings => new()
|
|
{
|
|
MaxLevel = 100,
|
|
ShinyRate = 4096,
|
|
};
|
|
|
|
/// <inheritdoc />
|
|
IResourceResult IResourceProvider.GetResource(ResourceFileType request)
|
|
{
|
|
return request switch
|
|
{
|
|
ResourceFileType.Types => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Types.csv",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.Natures => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Natures.csv",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.Moves => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Moves.jsonc",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.Items => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Items.json",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.Abilities => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Abilities.json",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.GrowthRates => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.GrowthRates.json",
|
|
typeof(Gen7Plugin).Assembly),
|
|
ResourceFileType.Species => new AssemblyResourceResult("PkmnLib.Plugin.Gen7.Data.Pokemon.json",
|
|
typeof(Gen7Plugin).Assembly),
|
|
_ => throw new ArgumentOutOfRangeException(nameof(request), request, null),
|
|
};
|
|
}
|
|
} |