mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Dynamic Zones] Implement dz templates (#2345)
This allows shared tasks to create dz instances automatically through the `dz_template_id` field instead of using quest scripts. Quest apis were also added to create expeditions from template ids.
This commit is contained in:
@@ -177,6 +177,8 @@ void SharedTaskManager::AttemptSharedTaskCreation(
|
||||
// check if task should immediately lock
|
||||
HandleCompletedActivities(&inserted);
|
||||
|
||||
LoadDynamicZoneTemplate(&inserted);
|
||||
|
||||
LogTasks(
|
||||
"[AttemptSharedTaskCreation] shared_task_id [{}] created successfully | task_id [{}] member_count [{}] activity_count [{}] current tasks in state [{}]",
|
||||
new_shared_task.GetDbSharedTask().id,
|
||||
@@ -1145,6 +1147,27 @@ void SharedTaskManager::CreateDynamicZone(SharedTask *shared_task, DynamicZone &
|
||||
}
|
||||
}
|
||||
|
||||
void SharedTaskManager::LoadDynamicZoneTemplate(SharedTask* s)
|
||||
{
|
||||
const auto& task = s->GetTaskData();
|
||||
if (task.dz_template_id != 0)
|
||||
{
|
||||
auto it = dynamic_zone_manager.GetTemplates().find(task.dz_template_id);
|
||||
if (it != dynamic_zone_manager.GetTemplates().end())
|
||||
{
|
||||
DynamicZone dz(DynamicZoneType::Mission);
|
||||
dz.LoadTemplate(it->second);
|
||||
dz.SetMinPlayers(task.min_players);
|
||||
dz.SetMaxPlayers(task.max_players);
|
||||
if (task.duration > dz.GetDuration())
|
||||
{
|
||||
dz.SetDuration(task.duration);
|
||||
}
|
||||
CreateDynamicZone(s, dz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SharedTaskManager::SendLeaderMessage(SharedTask *shared_task, int chat_type, const std::string &message)
|
||||
{
|
||||
if (!shared_task) {
|
||||
|
||||
Reference in New Issue
Block a user