41 lines
2.2 KiB
C++
41 lines
2.2 KiB
C++
#include "../../src/Library/Species/PokemonSpecies.hpp"
|
|
#include "../Core.hpp"
|
|
using namespace PkmnLib::Library;
|
|
|
|
export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name,
|
|
const PokemonForme* defaultForme, float genderRatio,
|
|
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
|
const char* const* eggGroupsRaw, size_t eggGroupsLength,
|
|
const char* flags[], size_t flagsCount) {
|
|
|
|
Try(
|
|
std::unordered_set<uint32_t> conversedFlags(flagsCount); for (size_t i = 0; i < flagsCount; i++) {
|
|
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
|
|
} ArbUt::List<ArbUt::StringView>
|
|
eggGroups(eggGroupsLength);
|
|
for (size_t i = 0; i < eggGroupsLength;
|
|
i++) { eggGroups.Append(ArbUt::StringView(eggGroupsRaw[i])); } auto cName = ArbUt::StringView(name);
|
|
auto cGrowthRate = ArbUt::StringView(growthRate);
|
|
out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness,
|
|
eggGroups, conversedFlags);)
|
|
}
|
|
|
|
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }
|
|
|
|
SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t);
|
|
export void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); }
|
|
|
|
export size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); }
|
|
|
|
export uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) {
|
|
Try(out = p->GetEvolutions().At(index).GetRaw());
|
|
}
|
|
|
|
export uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p, const EvolutionData* const*& out) {
|
|
Try(out = p->GetEvolutions().RawData());
|
|
}
|
|
|
|
export size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); }
|
|
export const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) {
|
|
return p->GetEggGroups()[index].c_str();
|
|
} |