blob: 6b5d0c89864fd3ec043b9be72f5b4b74b680de22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "Game/AI/Query/queryHasSetItem.h"
#include <evfl/Query.h>
#include "KingSystem/GameData/gdtManager.h"
namespace uking::query {
HasSetItem::HasSetItem(const InitArg& arg) : ksys::act::ai::Query(arg) {}
HasSetItem::~HasSetItem() = default;
int HasSetItem::doQuery() {
auto* gdm = ksys::gdt::Manager::instance();
if (gdm != nullptr) {
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) {
loadInt(arg.param_accessor, "Count");
loadString(arg.param_accessor, "ItemName");
}
void HasSetItem::loadParams() {
getDynamicParam(&mCount, "Count");
getDynamicParam(&mItemName, "ItemName");
}
} // namespace uking::query
|