2020-03-03 18:37:21 +00:00
|
|
|
#include "../../src/Library/Items/Item.hpp"
|
2020-07-31 08:51:03 +00:00
|
|
|
#include "../Core.hpp"
|
2020-03-03 18:37:21 +00:00
|
|
|
using namespace CreatureLib::Library;
|
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func Item* CreatureLib_Item_Construct(const char* name, ItemCategory category, BattleItemCategory battleCategory,
|
|
|
|
i32 price, const char* effectName, EffectParameter* effectParameters[],
|
|
|
|
size_t effectParameterCount, const char* battleTriggerEffectName,
|
|
|
|
EffectParameter* battleTriggerEffectParameters[],
|
|
|
|
size_t battleTriggerEffectParameterCount, const char* flags[],
|
|
|
|
size_t flagsCount) {
|
2022-03-23 12:56:45 +00:00
|
|
|
std::unordered_set<u32> conversedFlags(flagsCount);
|
2020-03-03 18:37:21 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-03-07 10:56:07 +00:00
|
|
|
return new Item(
|
|
|
|
ArbUt::StringView(name), category, battleCategory, price,
|
|
|
|
new SecondaryEffect(100, effectName,
|
|
|
|
ArbUt::List<EffectParameter*>(effectParameters, effectParameters + effectParameterCount)),
|
2022-02-19 11:19:03 +00:00
|
|
|
new SecondaryEffect(
|
|
|
|
100, battleTriggerEffectName,
|
|
|
|
ArbUt::List<EffectParameter*>(battleTriggerEffectParameters,
|
|
|
|
battleTriggerEffectParameters + battleTriggerEffectParameterCount)),
|
2021-03-07 10:56:07 +00:00
|
|
|
conversedFlags);
|
2020-03-03 18:37:21 +00:00
|
|
|
};
|
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func void CreatureLib_Item_Destruct(const Item* p) { delete p; }
|
2020-03-03 18:37:21 +00:00
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func const char* CreatureLib_Item_GetName(const Item* p) { return p->GetName().c_str(); }
|
2020-03-03 18:37:21 +00:00
|
|
|
SIMPLE_GET_FUNC(Item, GetCategory, ItemCategory);
|
|
|
|
SIMPLE_GET_FUNC(Item, GetBattleCategory, BattleItemCategory);
|
2022-03-23 12:56:45 +00:00
|
|
|
SIMPLE_GET_FUNC(Item, GetPrice, i32);
|
2020-03-03 18:37:21 +00:00
|
|
|
|
2022-04-02 10:33:26 +00:00
|
|
|
export_func bool CreatureLib_Item_HasFlag(const Item* p, const char* key) {
|
2020-06-26 15:08:23 +00:00
|
|
|
return p->HasFlag(ArbUt::StringView::CalculateHash(key));
|
2020-07-07 13:33:43 +00:00
|
|
|
}
|