diff options
| author | theo3 <arisstephenson2@gmail.com> | 2021-07-01 19:28:09 -0700 |
|---|---|---|
| committer | theo3 <arisstephenson2@gmail.com> | 2021-07-01 21:05:10 -0700 |
| commit | 60dd80779a92120c74e7bda9e1ccf2695e2c7c19 (patch) | |
| tree | 4d76dc03072740a41634893a9062d6a7e4626f68 /src/Game/AI/Query/queryHasSetItem.cpp | |
| parent | 112c1f987d3831df97f46c0f9e4ae977fba59484 (diff) | |
match some ai::Query
Diffstat (limited to 'src/Game/AI/Query/queryHasSetItem.cpp')
| -rw-r--r-- | src/Game/AI/Query/queryHasSetItem.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/Game/AI/Query/queryHasSetItem.cpp b/src/Game/AI/Query/queryHasSetItem.cpp index aff0ede7..7b8ccd7d 100644 --- a/src/Game/AI/Query/queryHasSetItem.cpp +++ b/src/Game/AI/Query/queryHasSetItem.cpp @@ -1,5 +1,6 @@ #include "Game/AI/Query/queryHasSetItem.h" #include <evfl/Query.h> +#include "KingSystem/GameData/gdtManager.h" namespace uking::query { @@ -7,9 +8,24 @@ HasSetItem::HasSetItem(const InitArg& arg) : ksys::act::ai::Query(arg) {} HasSetItem::~HasSetItem() = default; -// FIXME: implement +// NON_MATCHING: temp duplication int HasSetItem::doQuery() { - return -1; + auto* gdm = ksys::gdt::Manager::instance(); + if (gdm == nullptr) + return 0; + + auto flag_type = gdm->getParam().get1().getBuffer()->getFlagType(mItemName); + + if (flag_type == ksys::gdt::FlagType::Bool) { + bool value = false; + if (gdm->getParamBypassPerm().get().getBool(&value, mItemName)) + return value; + } else if (flag_type == ksys::gdt::FlagType::S32) { + s32 value = 0; + if (gdm->getParamBypassPerm().get().getS32(&value, mItemName)) + return value >= *mCount; + } + return 0; } void HasSetItem::loadParams(const evfl::QueryArg& arg) { |
