internal static void ApplyBepInExConfigs(ISpawnerConfigurationCollection spawnerConfigs)
    {
        var configs = CreatureSpawnerConfigurationManager.CreatureSpawnerConfig?.Subsections;

        if ((configs?.Count ?? 0) == 0)
        {
            return;
        }

        foreach (var locationConfig in configs)
        {
            foreach (var creatureConfig in locationConfig.Value.Subsections)
            {
                if (!creatureConfig.Value.TemplateEnabled.Value)
                {
                    continue;
                }

                // BepInEx configs are not set up to distinguish between rooms and locations in config path.
                // Instead, the first matching name is used. Therefore, two builders are configured to leave
                // it up to the first and most specific identified to be used.
                var roomBuilder     = spawnerConfigs.ConfigureLocalSpawnerByRoomAndCreature(locationConfig.Key, creatureConfig.Key);
                var locationBuilder = spawnerConfigs.ConfigureLocalSpawnerByLocationAndCreature(locationConfig.Key, creatureConfig.Key);

                ApplyConfigToBuilder(creatureConfig.Value, roomBuilder);
                ApplyConfigToBuilder(creatureConfig.Value, locationBuilder);
            }
        }
    }
Ejemplo n.º 2
0
 private static void ConfigureLocalSpawnerWithIntegration(ISpawnerConfigurationCollection config)
 {
     config.ConfigureLocalSpawnerByLocationAndCreature("StoneTowerRuins08", "Skeleton")
     .SetMinLevel(5)
     .SetMaxLevel(10)
     .SetSpawnInterval(TimeSpan.FromSeconds(1))
     .SetCllcModifierInfusion(CllcCreatureInfusion.Fire)
     .SetEpicLootConditionNearbyPlayersCarryItemWithRarity(100, EpicLootRarity.Magic, EpicLootRarity.Epic, EpicLootRarity.Rare);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// TODO: Add an automatically created test cfg to configs. Currently just assumes a cfg exists which sets [Runestone_Boars.Boar].
 /// </summary>
 private static void ConfigureLocalSpawnerOverridenByFile(ISpawnerConfigurationCollection config)
 {
     try
     {
         config.ConfigureLocalSpawnerByLocationAndCreature("Runestone_Boars", "Boar")
         .SetPrefabName("Skeleton");
     }
     catch (Exception e)
     {
         Log.LogError(e);
     }
 }