Support for finding a previous evolution of a Pokemon.

This commit is contained in:
Deukhoofd 2020-08-11 21:57:02 +02:00
parent e08be5c013
commit 504bee3bda
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
6 changed files with 62 additions and 8 deletions

View File

@ -0,0 +1,37 @@
// AUTOMATICALLY GENERATED, DO NOT EDIT
using System;
using System.Runtime.InteropServices;
namespace Pkmnlib.Generated
{
internal static class LearnableMoves
{
/// <param name="out">LearnableMoves * &</param>
/// <param name="levelAttackCapacity">long unsigned int</param>
/// <returns>unsigned char</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_LearnableMoves_Construct")]
internal static extern byte Construct(ref IntPtr @out, ulong levelAttackCapacity);
/// <param name="p">const LearnableMoves *</param>
/// <returns>void</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_LearnableMoves_Destruct")]
internal static extern void Destruct(IntPtr p);
/// <param name="p">LearnableMoves *</param>
/// <param name="move">MoveData *</param>
/// <returns>void</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_LearnableMoves_AddEggMove")]
internal static extern void AddEggMove(IntPtr p, IntPtr move);
/// <param name="p">LearnableMoves *</param>
/// <returns>long unsigned int</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_LearnableMoves_GetEggMovesCount")]
internal static extern ulong GetEggMovesCount(IntPtr p);
/// <param name="p">LearnableMoves *</param>
/// <returns>const const MoveData * *</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_LearnableMoves_GetEggMoves")]
internal static extern IntPtr GetEggMoves(IntPtr p);
}
}

View File

@ -28,11 +28,5 @@ namespace Pkmnlib.Generated
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_PokemonLibrary_GetNatureLibrary")]
internal static extern IntPtr GetNatureLibrary(IntPtr p);
/// <param name="p">const SpeciesLibrary *</param>
/// <param name="species">const PokemonSpecies *</param>
/// <returns>const PokemonSpecies *</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_PokemonLibrary_FindPreEvolution")]
internal static extern IntPtr FindPreEvolution(IntPtr p, IntPtr species);
}
}

View File

@ -0,0 +1,16 @@
// AUTOMATICALLY GENERATED, DO NOT EDIT
using System;
using System.Runtime.InteropServices;
namespace Pkmnlib.Generated
{
internal static class SpeciesLibrary
{
/// <param name="p">const SpeciesLibrary *</param>
/// <param name="species">const PokemonSpecies *</param>
/// <returns>const PokemonSpecies *</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_SpeciesLibrary_FindPreEvolution")]
internal static extern IntPtr FindPreEvolution(IntPtr p, IntPtr species);
}
}

View File

@ -54,6 +54,13 @@ namespace PkmnLibSharp.Library
return species;
}
public Species? FindPreEvolution(Species species)
{
var ptr = Pkmnlib.Generated.SpeciesLibrary.FindPreEvolution(Ptr, species.Ptr);
if (ptr == IntPtr.Zero) return null;
return TryResolvePointer(ptr, out Species? prevoSpecies) ? prevoSpecies : new Species(ptr);
}
public IEnumerable<Species> GetEnumerator()
{
var count = Creaturelib.Generated.SpeciesLibrary.GetCount(Ptr);

BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

File diff suppressed because one or more lines are too long