24 lines
941 B
C++
24 lines
941 B
C++
#ifndef PKMNLIB_ITEMLIBRARY_HPP
|
|
#define PKMNLIB_ITEMLIBRARY_HPP
|
|
|
|
#include <CreatureLib/Library/ItemLibrary.hpp>
|
|
#include "Item.hpp"
|
|
namespace PkmnLib::Library {
|
|
class ItemLibrary final : public CreatureLib::Library::ItemLibrary {
|
|
public:
|
|
inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr<const Item>& item) const {
|
|
auto v = item.As<const CreatureLib::Library::Item>();
|
|
auto res = CreatureLib::Library::ItemLibrary::TryGet(name.GetHash(), v);
|
|
item = v.ForceAs<const Item>();
|
|
return res;
|
|
}
|
|
|
|
inline ArbUt::BorrowedPtr<const Item> Get(const ArbUt::BasicStringView& name) const {
|
|
return CreatureLib::Library::ItemLibrary::Get(name).ForceAs<const Item>();
|
|
}
|
|
inline ArbUt::BorrowedPtr<const Item> operator[](const ArbUt::BasicStringView& name) const { return Get(name); }
|
|
};
|
|
}
|
|
|
|
#endif // PKMNLIB_ITEMLIBRARY_HPP
|