MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / CustomAct

Function CustomAct

source/binding/NodeJS/src/apis/callback.cpp:121–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121MaaBool CustomAct(
122 MaaContext* context,
123 MaaTaskId task_id,
124 const char* node_name,
125 const char* custom_action_name,
126 const char* custom_action_param,
127 MaaRecoId reco_id,
128 const MaaRect* box,
129 void* trans_arg)
130{
131 using Ret = bool;
132 auto ctx = reinterpret_cast<maajs::CallbackContext*>(trans_arg);
133 return ctx->Call<Ret>([&](maajs::FunctionType func) {
134 auto env = func.Env();
135 auto self = maajs::ObjectType::New(env);
136
137 self["context"] = ContextImpl::locate_object(env, context);
138 self["id"] = maajs::JSConvert<MaaTaskId>::to_value(env, task_id);
139 self["task"] = maajs::StringType::New(env, node_name);
140 self["name"] = maajs::StringType::New(env, custom_action_name);
141 self["param"] = maajs::JsonParse(env, custom_action_param);
142 self["recoId"] = maajs::JSConvert<MaaRecoId>::to_value(env, reco_id);
143 self["box"] = maajs::JSConvert<MaaRect>::to_value(env, *box);
144
145 return func.Call(self, { self });
146 });
147}
148
149MaaBool CustomConnect(void* trans_arg)
150{

Callers

nothing calls this directly

Calls 3

JsonParseFunction · 0.85
EnvMethod · 0.45
CallMethod · 0.45

Tested by

no test coverage detected