mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 02:31:03 +00:00
[Quest API] Add apis to end shared tasks (#2521)
This required some minor shared task refactoring - Shared task expiration handling was moved to world. Previously this was handled by zone and had clients self remove when a shared task expired. This resulted in wrong messages when a task ended. - FailTask is now implemented for shared tasks which previously only made the client quit the shared task. It now fails the task for all members by ending the shared task. The `Client::EndSharedTask` api will end the client's current shared task (removing all members). This is similiar to the `FailTask` api except it doesn't require a `task_id` and the red task fail banner is optional (live doesn't use it for shared tasks). The global `end_dz_task` api was added for when a client context isn't available. This will end a shared task if the current zone is a dynamic zone for a shared task mission. Currently only shared tasks use dynamic zones but this api can be expanded if support is added for tasks/quests. The global `get_dz_task_id` was added to conveniently get the task id for the current dynamic zone if it's used for a mission. Note this is a database hit since that information is not available at zone level.
This commit is contained in:
@@ -760,6 +760,18 @@ std::string lua_get_task_name(uint32 task_id) {
|
||||
return quest_manager.gettaskname(task_id);
|
||||
}
|
||||
|
||||
int lua_get_dz_task_id() {
|
||||
return quest_manager.GetCurrentDzTaskID();
|
||||
}
|
||||
|
||||
void lua_end_dz_task() {
|
||||
quest_manager.EndCurrentDzTask();
|
||||
}
|
||||
|
||||
void lua_end_dz_task(bool send_fail) {
|
||||
quest_manager.EndCurrentDzTask(send_fail);
|
||||
}
|
||||
|
||||
void lua_popup(const char *title, const char *text, uint32 id, uint32 buttons, uint32 duration) {
|
||||
quest_manager.popup(title, text, id, buttons, duration);
|
||||
}
|
||||
@@ -3759,6 +3771,9 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("completed_tasks_in_set", &lua_completed_tasks_in_set),
|
||||
luabind::def("is_task_appropriate", &lua_is_task_appropriate),
|
||||
luabind::def("get_task_name", (std::string(*)(uint32))&lua_get_task_name),
|
||||
luabind::def("get_dz_task_id", &lua_get_dz_task_id),
|
||||
luabind::def("end_dz_task", (void(*)())&lua_end_dz_task),
|
||||
luabind::def("end_dz_task", (void(*)(bool))&lua_end_dz_task),
|
||||
luabind::def("popup", &lua_popup),
|
||||
luabind::def("clear_spawn_timers", &lua_clear_spawn_timers),
|
||||
luabind::def("zone_emote", &lua_zone_emote),
|
||||
|
||||
Reference in New Issue
Block a user