blob: aeb019591300082af82d2024ce86a795e131c978 (
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
39
40
41
42
43
44
45
46
47
48
|
#include "Game/AI/Query/queryCheckGameDataInt.h"
#include <evfl/Query.h>
#include "KingSystem/GameData/gdtManager.h"
namespace uking::query {
CheckGameDataInt::CheckGameDataInt(const InitArg& arg) : ksys::act::ai::Query(arg) {}
CheckGameDataInt::~CheckGameDataInt() = default;
int CheckGameDataInt::doQuery() {
int flag_value = 0;
const auto value = *mValue;
auto* gdt = ksys::gdt::Manager::instance();
if (!gdt || !gdt->getParamBypassPerm().get().getS32(&flag_value, mGameDataIntName))
return 0;
sead::FixedSafeString<32> op = mOperator;
if (op == "Equal")
return value == flag_value;
if (op == "NotEqual")
return value != flag_value;
if (op == "GreaterThan")
return value < flag_value;
if (op == "GreaterThanOrEqualTo")
return value <= flag_value;
if (op == "LessThan")
return value > flag_value;
if (op == "LessThanOrEqualTo")
return value >= flag_value;
return 0;
}
void CheckGameDataInt::loadParams(const evfl::QueryArg& arg) {
loadInt(arg.param_accessor, "Value");
loadString(arg.param_accessor, "GameDataIntName");
loadString(arg.param_accessor, "Operator");
}
void CheckGameDataInt::loadParams() {
getDynamicParam(&mValue, "Value");
getDynamicParam(&mGameDataIntName, "GameDataIntName");
getDynamicParam(&mOperator, "Operator");
}
} // namespace uking::query
|