2020-03-03 18:37:21 +00:00
|
|
|
#include "../../src/Library/Items/Item.hpp"
|
2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-03-03 18:37:21 +00:00
|
|
|
using namespace CreatureLib::Library;
|
|
|
|
|
|
|
|
export Item* CreatureLib_Item_Construct(const char* name, ItemCategory category, BattleItemCategory battleCategory,
|
|
|
|
int32_t price, const char* flags[], size_t flagsCount) {
|
|
|
|
std::unordered_set<uint32_t> conversedFlags(flagsCount);
|
|
|
|
for (size_t i = 0; i < flagsCount; i++) {
|
2020-06-26 15:08:23 +00:00
|
|
|
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
|
2020-03-03 18:37:21 +00:00
|
|
|
}
|
|
|
|
|
2020-06-26 15:08:23 +00:00
|
|
|
return new Item(ArbUt::StringView(name), category, battleCategory, price, conversedFlags);
|
2020-03-03 18:37:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export void CreatureLib_Item_Destruct(const Item* p) { delete p; }
|
|
|
|
|
|
|
|
export const char* CreatureLib_Item_GetName(const Item* p) { return p->GetName().c_str(); }
|
|
|
|
SIMPLE_GET_FUNC(Item, GetCategory, ItemCategory);
|
|
|
|
SIMPLE_GET_FUNC(Item, GetBattleCategory, BattleItemCategory);
|
|
|
|
SIMPLE_GET_FUNC(Item, GetPrice, int32_t);
|
|
|
|
|
2020-06-26 15:08:23 +00:00
|
|
|
export bool CreatureLib_Item_HasFlag(const Item* p, const char* key) {
|
|
|
|
return p->HasFlag(ArbUt::StringView::CalculateHash(key));
|
2020-07-07 13:33:43 +00:00
|
|
|
}
|