Fixed mimic compability
Updated to LLL 1.4.0 Fixed config syncing
This commit is contained in:
parent
f37cded831
commit
8e00725dd0
@ -25,10 +25,21 @@ namespace ScarletMansionMimicsPatch {
|
|||||||
|
|
||||||
public static void Activate() {
|
public static void Activate() {
|
||||||
MimicsAPI.GetAPI().RegisterMimicEventHandler(new Patch.SDMMimicEventHandler());
|
MimicsAPI.GetAPI().RegisterMimicEventHandler(new Patch.SDMMimicEventHandler());
|
||||||
//Mimics.Mimics.InteriorWhitelist.Add();
|
AddToWhiteList("sdmFoyer");
|
||||||
|
AddToWhiteList("sdmBasement");
|
||||||
|
|
||||||
|
Plugin.logger.LogError(string.Join(", ", Mimics.Mimics.InteriorWhitelist));
|
||||||
|
|
||||||
Plugin.Instance.harmony.PatchAll(typeof(Patch));
|
Plugin.Instance.harmony.PatchAll(typeof(Patch));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AddToWhiteList(string dungeonName){
|
||||||
|
dungeonName = dungeonName.ToLower().Trim();
|
||||||
|
if (!Mimics.Mimics.InteriorWhitelist.Contains(dungeonName)){
|
||||||
|
Mimics.Mimics.InteriorWhitelist.Add(dungeonName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class SDMMimicEventHandler : MimicEventHandler
|
public class SDMMimicEventHandler : MimicEventHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -73,6 +84,11 @@ namespace ScarletMansionMimicsPatch {
|
|||||||
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
|
[HarmonyPatch("Mimics.Mimics+RoundManagerPatch, Mimics", "SetExitIDsPatch")]
|
||||||
public static void SetExitIDsPatchPrefix(){
|
public static void SetExitIDsPatchPrefix(){
|
||||||
colorBlindModeLastValue = Mimics.Mimics.ColorBlindMode;
|
colorBlindModeLastValue = Mimics.Mimics.ColorBlindMode;
|
||||||
|
|
||||||
|
var whitelist = string.Join(", ", Mimics.Mimics.InteriorWhitelist);
|
||||||
|
// Plugin.logger.LogError();
|
||||||
|
//var
|
||||||
|
//Plugin.logger.LogError(string.Join(", ", Mimics.Mimics.InteriorWhitelist));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
|
@ -101,8 +101,6 @@ namespace ScarletMansion.Configs {
|
|||||||
logger.LogDebug("Successfully synced config with host.");
|
logger.LogDebug("Successfully synced config with host.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "ConnectClientToPlayerObject")]
|
|
||||||
[HarmonyPostfix]
|
|
||||||
public static void InitializeLocalPlayer(){
|
public static void InitializeLocalPlayer(){
|
||||||
if (IsHost){
|
if (IsHost){
|
||||||
MessageManager.RegisterNamedMessageHandler(GetRequestMessage, OnRequestSync);
|
MessageManager.RegisterNamedMessageHandler(GetRequestMessage, OnRequestSync);
|
||||||
@ -115,11 +113,6 @@ namespace ScarletMansion.Configs {
|
|||||||
RequestSync();
|
RequestSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
|
|
||||||
[HarmonyPostfix]
|
|
||||||
public static void PlayerLeave(){
|
|
||||||
RevertSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
var variables = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance);
|
var variables = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
30
ScarletMansion/ScarletMansion/Configs/ConfigPatch.cs
Normal file
30
ScarletMansion/ScarletMansion/Configs/ConfigPatch.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ScarletMansion.Configs
|
||||||
|
{
|
||||||
|
public class ConfigPatch {
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "ConnectClientToPlayerObject")]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void InitializeLocalPlayerPatch(){
|
||||||
|
ConfigMain.InitializeLocalPlayer();
|
||||||
|
ConfigDungeonFoyer.InitializeLocalPlayer();
|
||||||
|
ConfigDungeonBasement.InitializeLocalPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
|
||||||
|
[HarmonyPostfix]
|
||||||
|
public static void PlayerLeavePatch(){
|
||||||
|
ConfigMain.RevertSync();
|
||||||
|
ConfigDungeonFoyer.RevertSync();
|
||||||
|
ConfigDungeonBasement.RevertSync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -79,7 +79,9 @@ namespace ScarletMansion.GamePatch {
|
|||||||
[HarmonyPatch(typeof(RoundManager), "Start")]
|
[HarmonyPatch(typeof(RoundManager), "Start")]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
public static void RoundManagerStartPatch(ref RoundManager __instance) {
|
public static void RoundManagerStartPatch(ref RoundManager __instance) {
|
||||||
MyOwnCoroutine.AddCoroutine(UpdateNetworkConfig(__instance));
|
MyOwnCoroutine.AddCoroutine(UpdateConfigMain());
|
||||||
|
MyOwnCoroutine.AddCoroutine(UpdateConfigDungeon(ConfigDungeonFoyer.Instance));
|
||||||
|
MyOwnCoroutine.AddCoroutine(UpdateConfigDungeon(ConfigDungeonBasement.Instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GameReadNullCheck(object target, string targetString, string error) {
|
public static bool GameReadNullCheck(object target, string targetString, string error) {
|
||||||
@ -368,8 +370,8 @@ namespace ScarletMansion.GamePatch {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerator UpdateNetworkConfig(RoundManager roundManager){
|
private static IEnumerator UpdateConfigMain(){
|
||||||
while(ConfigMain.Synced == false || ConfigDungeonFoyer.Synced == false){
|
while(ConfigMain.Synced == false){
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,13 +379,20 @@ namespace ScarletMansion.GamePatch {
|
|||||||
scrap.UpdateItemValue();
|
scrap.UpdateItemValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDungeonFoyer.Instance.dungeon.Length = ConfigDungeonFoyer.Instance.mainPathLengthValue.GetDungenIntRange();
|
Plugin.logger.LogDebug("Config Main updated");
|
||||||
|
}
|
||||||
|
|
||||||
ConfigDungeonFoyer.Instance.dungeonExtended.OverrideKeyPrefab = Assets.key.GetConfigItemEntry().enabled ?
|
private static IEnumerator UpdateConfigDungeon<T>(ConfigDungeon<T> instance) where T: ConfigDungeon<T>{
|
||||||
Assets.key.item.spawnPrefab :
|
while(instance.SyncedLocal == false){
|
||||||
typeof(DungeonLoader).GetField("defaultKeyPrefab", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null) as GameObject;
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
Plugin.logger.LogDebug("Set networked config values");
|
var defaultKeyPrefab = typeof(DungeonLoader).GetField("defaultKeyPrefab", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null) as GameObject;
|
||||||
|
|
||||||
|
instance.dungeon.Length = instance.mainPathLengthValue.GetDungenIntRange();
|
||||||
|
instance.dungeonExtended.OverrideKeyPrefab = Assets.key.GetConfigItemEntry().enabled ? Assets.key.item.spawnPrefab : defaultKeyPrefab;
|
||||||
|
|
||||||
|
Plugin.logger.LogDebug($"Config {typeof(T)} updated");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ namespace ScarletMansion {
|
|||||||
|
|
||||||
[BepInPlugin(modGUID, modName, modVersion)]
|
[BepInPlugin(modGUID, modName, modVersion)]
|
||||||
|
|
||||||
[BepInDependency("imabatby.lethallevelloader", "1.3.13")]
|
[BepInDependency("imabatby.lethallevelloader", "1.4.0")]
|
||||||
[BepInDependency("evaisa.lethallib", "0.13.2")]
|
[BepInDependency("evaisa.lethallib", "0.13.2")]
|
||||||
[BepInDependency("dev.ladyalice.dungenplus", "1.3.3")]
|
[BepInDependency("dev.ladyalice.dungenplus", "1.3.4")]
|
||||||
[BepInDependency("dev.ladyalice.scarletmansion.foyer")]
|
[BepInDependency("dev.ladyalice.scarletmansion.foyer")]
|
||||||
[BepInDependency("dev.ladyalice.scarletmansion.basement")]
|
[BepInDependency("dev.ladyalice.scarletmansion.basement")]
|
||||||
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
//[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
@ -37,7 +37,7 @@ namespace ScarletMansion {
|
|||||||
public class Plugin : BaseUnityPlugin {
|
public class Plugin : BaseUnityPlugin {
|
||||||
public const string modGUID = "dev.ladyalice.scarletmansion";
|
public const string modGUID = "dev.ladyalice.scarletmansion";
|
||||||
private const string modName = "Scarlet Devil Mansion";
|
private const string modName = "Scarlet Devil Mansion";
|
||||||
private const string modVersion = "2.1.1";
|
private const string modVersion = "2.2.0";
|
||||||
|
|
||||||
public readonly Harmony harmony = new Harmony(modGUID);
|
public readonly Harmony harmony = new Harmony(modGUID);
|
||||||
|
|
||||||
@ -82,9 +82,7 @@ namespace ScarletMansion {
|
|||||||
|
|
||||||
harmony.PatchAll(typeof(GeneratePathPatch));
|
harmony.PatchAll(typeof(GeneratePathPatch));
|
||||||
|
|
||||||
harmony.PatchAll(typeof(ConfigMain));
|
harmony.PatchAll(typeof(ConfigPatch));
|
||||||
harmony.PatchAll(typeof(ConfigDungeonFoyer));
|
|
||||||
harmony.PatchAll(typeof(ConfigDungeonBasement));
|
|
||||||
|
|
||||||
SetupForNetcodePatcher();
|
SetupForNetcodePatcher();
|
||||||
|
|
||||||
|
@ -163,6 +163,7 @@
|
|||||||
<Compile Include="Configs\ConfigDungeonFoyer.cs" />
|
<Compile Include="Configs\ConfigDungeonFoyer.cs" />
|
||||||
<Compile Include="Configs\ConfigDungeon.cs" />
|
<Compile Include="Configs\ConfigDungeon.cs" />
|
||||||
<Compile Include="Configs\ConfigManagerData.cs" />
|
<Compile Include="Configs\ConfigManagerData.cs" />
|
||||||
|
<Compile Include="Configs\ConfigPatch.cs" />
|
||||||
<Compile Include="Configs\Enemies.cs" />
|
<Compile Include="Configs\Enemies.cs" />
|
||||||
<Compile Include="Configs\IConfigDungeon.cs" />
|
<Compile Include="Configs\IConfigDungeon.cs" />
|
||||||
<Compile Include="Configs\Items.cs" />
|
<Compile Include="Configs\Items.cs" />
|
||||||
|
@ -28,6 +28,8 @@ namespace ScarletMansion {
|
|||||||
|
|
||||||
public static bool Synced { get; internal set; }
|
public static bool Synced { get; internal set; }
|
||||||
|
|
||||||
|
public bool SyncedLocal => Synced;
|
||||||
|
|
||||||
protected void InitInstance(T instance) {
|
protected void InitInstance(T instance) {
|
||||||
Default = instance;
|
Default = instance;
|
||||||
Instance = instance;
|
Instance = instance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user