Initial
This commit is contained in:
parent
7a77b79dc5
commit
cdadd75ee9
104 changed files with 9416 additions and 0 deletions
60
ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
Normal file
60
ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using GameNetcodeStuff;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Logging;
|
||||
using UnityEngine;
|
||||
using ScarletMansion.GamePatch.Managers;
|
||||
|
||||
namespace ScarletMansion.GamePatch {
|
||||
public class RoundManagerPatch {
|
||||
|
||||
public static InjectionDictionary scrapInjection = new InjectionDictionary(
|
||||
"Scrap",
|
||||
typeof(RoundManagerPatch).GetMethod("ModifyScrapCount", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public),
|
||||
new CodeInstruction(OpCodes.Ldfld, typeof(RoundManager).GetField("scrapAmountMultiplier"))
|
||||
);
|
||||
|
||||
public static InjectionDictionary mapHazardInjection = new InjectionDictionary(
|
||||
"Map Hazard",
|
||||
typeof(RoundManagerPatch).GetMethod("ModifyMapCount", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public),
|
||||
new CodeInstruction(OpCodes.Callvirt, typeof(AnimationCurve).GetMethod("Evaluate", BindingFlags.Instance | BindingFlags.Public))
|
||||
);
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
|
||||
public static IEnumerable<CodeInstruction> SpawnScrapInLevelPatch(IEnumerable<CodeInstruction> instructions){
|
||||
return TranspilerUtilities.InjectMethod(instructions, scrapInjection, "SpawnScrapInLevel", 1);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")]
|
||||
public static IEnumerable<CodeInstruction> SpawnMapObjectsPatch(IEnumerable<CodeInstruction> instructions){
|
||||
return TranspilerUtilities.InjectMethod(instructions, mapHazardInjection, "SpawnMapObjects", 1);
|
||||
}
|
||||
|
||||
public static float ModifyScrapCount(float count){
|
||||
if (DunGenPatch.Patch.active == false) return count;
|
||||
Plugin.logger.LogInfo($"Scrap: {count} -> {count * PluginConfig.Instance.lootMultiplierValue}");
|
||||
return count * PluginConfig.Instance.lootMultiplierValue;
|
||||
}
|
||||
|
||||
public static float ModifyMapCount(float count){
|
||||
if (DunGenPatch.Patch.active == false) return count;
|
||||
Plugin.logger.LogInfo($"Map Hazards: {count} -> {count * PluginConfig.Instance.mapHazardsMultiplierValue}");
|
||||
return count * PluginConfig.Instance.mapHazardsMultiplierValue;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(RoundManager), "SetPowerOffAtStart")]
|
||||
public static void SetPowerOffAtStartPatch(){
|
||||
DoorwayManager.onMainEntranceTeleportSpawnedEvent.Call();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue