Fixed knight ghost to sprint when you ain't looking Fixed Gohei to detect enemies
159 lines
6.8 KiB
C#
159 lines
6.8 KiB
C#
using System.Threading.Tasks;
|
|
using BepInEx;
|
|
using HarmonyLib;
|
|
using BepInEx.Logging;
|
|
using BepInEx.Configuration;
|
|
using UnityEngine;
|
|
using System.Reflection;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using UnityEngine.Networking;
|
|
using System.Collections;
|
|
using LethalLib.Modules;
|
|
using LethalLevelLoader;
|
|
using ScarletMansion.GamePatch;
|
|
using ScarletMansion.ModPatch;
|
|
using ScarletMansion.DunGenPatch;
|
|
using ScarletMansion.GamePatch.Managers;
|
|
using ScarletMansion.Configs;
|
|
using DunGen.Graph;
|
|
|
|
namespace ScarletMansion {
|
|
|
|
[BepInPlugin(modGUID, modName, modVersion)]
|
|
|
|
[BepInDependency("imabatby.lethallevelloader", "1.3.13")]
|
|
[BepInDependency("evaisa.lethallib", "0.13.2")]
|
|
[BepInDependency("dev.ladyalice.dungenplus", "1.3.3")]
|
|
[BepInDependency("dev.ladyalice.scarletmansion.foyer")]
|
|
[BepInDependency("dev.ladyalice.scarletmansion.basement")]
|
|
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
|
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
|
[BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
|
[BepInDependency(ModCompability.reserveFlashlightGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
|
[BepInDependency(ModCompability.reserveKeyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
|
[BepInProcess("Lethal Company.exe")]
|
|
public class Plugin : BaseUnityPlugin {
|
|
public const string modGUID = "dev.ladyalice.scarletmansion";
|
|
private const string modName = "Scarlet Devil Mansion";
|
|
private const string modVersion = "2.1.1";
|
|
|
|
public readonly Harmony harmony = new Harmony(modGUID);
|
|
|
|
public static Plugin Instance {get; private set;}
|
|
|
|
public static ConfigMain ConfigMain { get; internal set; }
|
|
public static ConfigDungeonFoyer ConfigFoyer { get; internal set; }
|
|
public static ConfigDungeonBasement ConfigBasement { get; internal set; }
|
|
|
|
public static IConfigDungeon CurrentConfigDungeon { get; internal set; }
|
|
|
|
public static ManualLogSource logger { get; internal set; }
|
|
|
|
void Awake(){
|
|
if (Instance == null) Instance = this;
|
|
|
|
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
|
|
logger.LogInfo($"Plugin {modName} has been added!");
|
|
|
|
ConfigMain = new ConfigMain(Config);
|
|
|
|
var foyerFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.foyer.cfg"), true);
|
|
ConfigFoyer = new ConfigDungeonFoyer(foyerFile);
|
|
|
|
var basementFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.basement.cfg"), true);
|
|
ConfigBasement = new ConfigDungeonBasement(basementFile);
|
|
|
|
ModCompability.GetActiveMods();
|
|
ModCompability.ActivateActiveMods();
|
|
|
|
//harmony.PatchAll(typeof(MenuManagerPatch));
|
|
harmony.PatchAll(typeof(InitPatch));
|
|
harmony.PatchAll(typeof(RoundManagerPatch));
|
|
harmony.PatchAll(typeof(LoadAssetsIntoLevelPatch));
|
|
harmony.PatchAll(typeof(EnemyVentPatch));
|
|
harmony.PatchAll(typeof(JesterAIPatch));
|
|
harmony.PatchAll(typeof(PlayerControllerBPatch));
|
|
|
|
harmony.PatchAll(typeof(DoorLockPatch));
|
|
harmony.PatchAll(typeof(ShotgunItemPatch));
|
|
harmony.PatchAll(typeof(ShovelPatch));
|
|
|
|
harmony.PatchAll(typeof(GeneratePathPatch));
|
|
|
|
harmony.PatchAll(typeof(ConfigMain));
|
|
harmony.PatchAll(typeof(ConfigDungeonFoyer));
|
|
harmony.PatchAll(typeof(ConfigDungeonBasement));
|
|
|
|
SetupForNetcodePatcher();
|
|
|
|
Assets.LoadAssetBundle();
|
|
|
|
var dungeonMatchPropeties = ScriptableObject.CreateInstance<DungeonMatchingProperties>();
|
|
dungeonMatchPropeties.authorNames.Add(new StringWithRarity("Alice", 10));
|
|
|
|
var extendedContent = new List<ExtendedContent>();
|
|
|
|
ExtendedDungeonFlow CreateExtendedDungeonFlow<T>(T configDungeon, string dungeonName, int dineWeight, int rendWeight, int titanWeight) where T: ConfigDungeon<T> {
|
|
var extendedDungeon = ScriptableObject.CreateInstance<ExtendedDungeonFlow>();
|
|
extendedDungeon.name = dungeonName;
|
|
extendedDungeon.DungeonName = dungeonName;
|
|
extendedDungeon.DungeonFlow = configDungeon.dungeon;
|
|
extendedDungeon.FirstTimeDungeonAudio = Assets.entranceAudioClip;
|
|
|
|
var sdmLevelMatchProperties = ScriptableObject.CreateInstance<LevelMatchingProperties>();
|
|
sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Dine", dineWeight));
|
|
sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Rend", rendWeight));
|
|
sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Titan", titanWeight));
|
|
sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Sanguine", 900));
|
|
sdmLevelMatchProperties.planetNames.Add(new StringWithRarity("Scarlet Devil Mansion", 900));
|
|
extendedDungeon.LevelMatchingProperties = sdmLevelMatchProperties;
|
|
|
|
extendedDungeon.DynamicDungeonSizeMinMax = new Vector2(1f, 2f);
|
|
extendedDungeon.DynamicDungeonSizeLerpRate = 0f;
|
|
|
|
extendedDungeon.GenerateAutomaticConfigurationOptions = true;
|
|
|
|
configDungeon.dungeonExtended = extendedDungeon;
|
|
|
|
extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(GeneratePathPatch.GeneratePatch);
|
|
extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsLocal);
|
|
extendedDungeon.DungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddEnemiesLocal);
|
|
|
|
DunGenPlus.API.AddDunGenExtender(configDungeon.dungeon, configDungeon.dunGenExtender);
|
|
configDungeon.dunGenExtender.Events.OnModifyDunGenExtenderProperties.AddListener((props, callback) => DunGenPatch.Patch.UpdateDunGenExtenderProperties(configDungeon, props, callback));
|
|
|
|
return extendedDungeon;
|
|
}
|
|
|
|
extendedContent.Add(CreateExtendedDungeonFlow(ConfigFoyer, "Scarlet Foyer", 200, 100, 30));
|
|
extendedContent.Add(CreateExtendedDungeonFlow(ConfigBasement, "Scarlet Basement", 100, 200, 30));
|
|
|
|
var extendedMod = ExtendedMod.Create("Scarlet Devil Mansion", "Alice", extendedContent.ToArray());
|
|
|
|
PatchedContent.RegisterExtendedMod(extendedMod);
|
|
|
|
Assets.extendedMod = extendedMod;
|
|
|
|
DungeonManager.GlobalDungeonEvents.onBeforeDungeonGenerate.AddListener(LoadAssetsIntoLevelPatch.AddItemsGlobal);
|
|
}
|
|
|
|
void SetupForNetcodePatcher(){
|
|
var types = Assembly.GetExecutingAssembly().GetTypes();
|
|
foreach (var type in types) {
|
|
//Debug.Log(type);
|
|
var methods = type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
|
|
foreach (var method in methods) {
|
|
var attributes = method.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), false);
|
|
if (attributes.Length > 0)
|
|
{
|
|
method.Invoke(null, null);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|