[Quest API] Add AreTasksCompleted() to Perl/Lua. (#4456)

* [Quest API] Add AreTasksCompleted() to Perl/Lua.

* Bool
This commit is contained in:
Alex King
2024-08-22 20:21:14 -04:00
committed by GitHub
parent b7f8d0f179
commit e2b545991a
10 changed files with 144 additions and 24 deletions
+32
View File
@@ -5604,6 +5604,37 @@ uint32 lua_get_zone_uptime()
return Timer::GetCurrentTime() / 1000;
}
int lua_are_tasks_completed(luabind::object task_ids)
{
if (luabind::type(task_ids) != LUA_TTABLE) {
return 0;
}
std::vector<int> v;
int index = 1;
while (luabind::type(task_ids[index]) != LUA_TNIL) {
auto current_id = task_ids[index];
int task_id = 0;
if (luabind::type(current_id) != LUA_TNIL) {
try {
task_id = luabind::object_cast<int>(current_id);
} catch(luabind::cast_failed &) {
}
} else {
break;
}
v.push_back(task_id);
++index;
}
if (v.empty()) {
return 0;
}
return quest_manager.aretaskscompleted(v);
}
#define LuaCreateNPCParse(name, c_type, default_value) do { \
cur = table[#name]; \
if(luabind::type(cur) != LUA_TNIL) { \
@@ -6410,6 +6441,7 @@ luabind::scope lua_register_general() {
luabind::def("get_zone_short_name_by_long_name", &lua_get_zone_short_name_by_long_name),
luabind::def("send_parcel", &lua_send_parcel),
luabind::def("get_zone_uptime", &lua_get_zone_uptime),
luabind::def("are_tasks_completed", &lua_are_tasks_completed),
/*
Cross Zone
*/