[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
+12
View File
@@ -1192,6 +1192,8 @@ bool Zone::Init(bool is_static) {
petition_list.ClearPetitions();
petition_list.ReadDatabase();
LoadDynamicZoneTemplates();
LogInfo("Loading dynamic zones");
DynamicZone::CacheAllFromDatabase();
@@ -2812,3 +2814,13 @@ void Zone::SendDiscordMessage(const std::string& webhook_name, const std::string
LogDiscord("[SendDiscordMessage] Did not find valid webhook by webhook name [{}]", webhook_name);
}
}
void Zone::LoadDynamicZoneTemplates()
{
dz_template_cache.clear();
auto dz_templates = DynamicZoneTemplatesRepository::All(content_db);
for (const auto& dz_template : dz_templates)
{
dz_template_cache[dz_template.id] = dz_template;
}
}