[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:
hg
2022-07-30 22:25:43 -04:00
committed by GitHub
parent 5e7e255d72
commit 53b599518a
26 changed files with 756 additions and 5 deletions
+16
View File
@@ -9842,6 +9842,19 @@ Expedition* Client::CreateExpedition(
return Expedition::TryCreate(this, dz, disable_messages);
}
Expedition* Client::CreateExpeditionFromTemplate(uint32_t dz_template_id)
{
Expedition* expedition = nullptr;
auto it = zone->dz_template_cache.find(dz_template_id);
if (it != zone->dz_template_cache.end())
{
DynamicZone dz(DynamicZoneType::Expedition);
dz.LoadTemplate(it->second);
expedition = Expedition::TryCreate(this, dz, false);
}
return expedition;
}
void Client::CreateTaskDynamicZone(int task_id, DynamicZone& dz_request)
{
if (task_state)
@@ -11332,6 +11345,9 @@ void Client::SendReloadCommandMessages() {
).c_str()
);
auto dztemplates_link = Saylink::Create("#reload dztemplates", false, "#reload dztemplates");
Message(Chat::White, fmt::format("Usage: {} - Reloads Dynamic Zone Templates globally", dztemplates_link).c_str());
auto ground_spawns_link = Saylink::Create(
"#reload ground_spawns",
false,