28 lines
1.1 KiB
C++
28 lines
1.1 KiB
C++
#ifndef CREATURELIB_GROWTHRATELIBRARY_HPP
|
|
#define CREATURELIB_GROWTHRATELIBRARY_HPP
|
|
|
|
#include "GrowthRate.hpp"
|
|
|
|
namespace CreatureLib::Library {
|
|
class GrowthRateLibrary {
|
|
private:
|
|
std::unordered_map<uint32_t, std::unique_ptr<const GrowthRate>> _growthRates;
|
|
|
|
public:
|
|
GrowthRateLibrary(size_t initialCapacity = 10)
|
|
: _growthRates(std::unordered_map<uint32_t, std::unique_ptr<const GrowthRate>>(initialCapacity)) {}
|
|
|
|
virtual ~GrowthRateLibrary() = default;
|
|
|
|
[[nodiscard]] uint8_t CalculateLevel(const ArbUt::BasicStringView& growthRate, uint32_t experience) const;
|
|
[[nodiscard]] uint8_t CalculateLevel(uint32_t hash, uint32_t experience) const;
|
|
[[nodiscard]] uint32_t CalculateExperience(const ArbUt::BasicStringView& growthRate, level_int_t level) const;
|
|
[[nodiscard]] uint32_t CalculateExperience(uint32_t hash, level_int_t level) const;
|
|
|
|
void AddGrowthRate(uint32_t hash, GrowthRate* rate);
|
|
void AddGrowthRate(const ArbUt::StringView& name, GrowthRate* rate);
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_GROWTHRATELIBRARY_HPP
|