mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 00:58:26 +00:00
[Tasks] Make Task Selector Cooldown Optional (#2420)
Some live npcs ignore the request cooldown timer (tutorialb) A separate function had to be used for perl because the apis use an array instead of array reference which won't allow a bool overload This also replaces the fixed array and count args with a vector
This commit is contained in:
+16
-9
@@ -597,30 +597,35 @@ bool lua_bury_player_corpse(uint32 char_id) {
|
||||
return quest_manager.buryplayercorpse(char_id);
|
||||
}
|
||||
|
||||
void lua_task_selector(luabind::adl::object table) {
|
||||
void lua_task_selector(luabind::adl::object table, bool ignore_cooldown) {
|
||||
if(luabind::type(table) != LUA_TTABLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
int tasks[MAXCHOOSERENTRIES] = { 0 };
|
||||
int count = 0;
|
||||
|
||||
std::vector<int> tasks;
|
||||
for (int i = 1; i <= MAXCHOOSERENTRIES; ++i)
|
||||
{
|
||||
if (luabind::type(table[i]) == LUA_TNUMBER)
|
||||
{
|
||||
tasks[i - 1] = luabind::object_cast<int>(table[i]);
|
||||
++count;
|
||||
tasks.push_back(luabind::object_cast<int>(table[i]));
|
||||
}
|
||||
}
|
||||
|
||||
quest_manager.taskselector(count, tasks);
|
||||
quest_manager.taskselector(tasks, ignore_cooldown);
|
||||
}
|
||||
|
||||
void lua_task_selector(luabind::adl::object table) {
|
||||
lua_task_selector(table, false);
|
||||
}
|
||||
|
||||
void lua_task_set_selector(int task_set) {
|
||||
quest_manager.tasksetselector(task_set);
|
||||
}
|
||||
|
||||
void lua_task_set_selector(int task_set, bool ignore_cooldown) {
|
||||
quest_manager.tasksetselector(task_set, ignore_cooldown);
|
||||
}
|
||||
|
||||
void lua_enable_task(luabind::adl::object table) {
|
||||
if(luabind::type(table) != LUA_TTABLE) {
|
||||
return;
|
||||
@@ -3703,8 +3708,10 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("get_player_corpse_count_by_zone_id", &lua_get_player_corpse_count_by_zone_id),
|
||||
luabind::def("get_player_buried_corpse_count", &lua_get_player_buried_corpse_count),
|
||||
luabind::def("bury_player_corpse", &lua_bury_player_corpse),
|
||||
luabind::def("task_selector", &lua_task_selector),
|
||||
luabind::def("task_set_selector", &lua_task_set_selector),
|
||||
luabind::def("task_selector", (void(*)(luabind::adl::object))&lua_task_selector),
|
||||
luabind::def("task_selector", (void(*)(luabind::adl::object, bool))&lua_task_selector),
|
||||
luabind::def("task_set_selector", (void(*)(int))&lua_task_set_selector),
|
||||
luabind::def("task_set_selector", (void(*)(int, bool))&lua_task_set_selector),
|
||||
luabind::def("enable_task", &lua_enable_task),
|
||||
luabind::def("disable_task", &lua_disable_task),
|
||||
luabind::def("is_task_enabled", &lua_is_task_enabled),
|
||||
|
||||
Reference in New Issue
Block a user