Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HardMode v1.0.0
HardMode.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Commands; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Teplovozovich")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cfd8edba681674641f512d11ad7cbdb8316e2e96")] [assembly: AssemblyProduct("HardMode")] [assembly: AssemblyTitle("HardMode")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HardMode { [BepInPlugin("Teplovozovich.HardMode", "HardMode", "1.0.0")] public class HardModePlugin : BaseUnityPlugin { public static ManualLogSource mls; public static Dictionary<string, PlayerHealthData> PlayerHealthDatabase = new Dictionary<string, PlayerHealthData>(); private void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown ModConfig.BaseMaxHealth = ((BaseUnityPlugin)this).Config.Bind<int>("General", "BaseMaxHealth", 31, "Player starting HP. Only odd numbers work"); ModConfig.EnemySpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<int>("General", "EnemySpawnMultiplier", 3, "How many enemies spawn per original (gnomes may cause lag)"); mls = ((BaseUnityPlugin)this).Logger; mls.LogInfo((object)"HardMode загружен!"); Harmony val = new Harmony("Teplovozovich.HardMode"); val.PatchAll(typeof(PlayerHealthPatch)); val.PatchAll(typeof(PlayerAvatarPatch)); val.PatchAll(typeof(LevelGeneratorMonsterMultiplier)); } } [HarmonyPatch(typeof(LevelGenerator))] public class LevelGeneratorMonsterMultiplier { private static int MonsterMultiplier = ModConfig.EnemySpawnMultiplier.Value; [HarmonyPatch("EnemySpawn")] [HarmonyPostfix] private static void Postfix(LevelGenerator __instance, EnemySetup enemySetup, Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) try { HardModePlugin.mls.LogInfo((object)$"Оригинальный спавн: {((Object)enemySetup).name} на {position}"); for (int i = 1; i < MonsterMultiplier; i++) { Vector3 validSpawnPosition = GetValidSpawnPosition(position); HardModePlugin.mls.LogInfo((object)$"Дублирование #{i}: {((Object)enemySetup).name} на {validSpawnPosition}"); foreach (PrefabRef spawnObject in enemySetup.spawnObjects) { GameObject enemyObj = (GameManager.Multiplayer() ? PhotonNetwork.InstantiateRoomObject(spawnObject.ResourcePath, validSpawnPosition, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(spawnObject.Prefab, validSpawnPosition, Quaternion.identity)); SetupEnemyComponents(__instance, enemyObj, validSpawnPosition); } } } catch (Exception ex) { HardModePlugin.mls.LogError((object)("Ошибка при дублировании: " + ex.Message)); } } private static Vector3 GetValidSpawnPosition(Vector3 originalPosition) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(-10f, 10f); float num2 = Random.Range(-10f, 10f); return originalPosition + new Vector3(num, 0f, num2); } private static void SetupEnemyComponents(LevelGenerator __instance, GameObject enemyObj, Vector3 position) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) try { EnemyParent component = enemyObj.GetComponent<EnemyParent>(); if ((Object)(object)component != (Object)null) { component.SetupDone = true; Enemy componentInChildren = enemyObj.GetComponentInChildren<Enemy>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.EnemyTeleported(position); __instance.EnemiesSpawnTarget++; EnemyDirector.instance.FirstSpawnPointAdd(component); HardModePlugin.mls.LogInfo((object)("Дублированный монстр создан: " + ((Object)enemyObj).name)); } else { HardModePlugin.mls.LogWarning((object)("Не найден компонент Enemy у " + ((Object)enemyObj).name)); } } else { HardModePlugin.mls.LogWarning((object)("Не найден компонент EnemyParent у " + ((Object)enemyObj).name)); } } catch (Exception ex) { HardModePlugin.mls.LogError((object)("Ошибка настройки компонентов: " + ex.Message)); } } } public static class ModConfig { public static ConfigEntry<int> BaseMaxHealth { get; set; } public static ConfigEntry<int> EnemySpawnMultiplier { get; set; } } public class PlayerHealthData { public int CurrentHealth { get; set; } public int MaxHealth { get; set; } public PlayerHealthData(int currentHealth, int maxHealth) { CurrentHealth = currentHealth; MaxHealth = maxHealth; } } public static class SharedData { public static string LastCallSource = "unknown"; public static bool IsApplyingPatch = false; public static int NewMaxHealth = ModConfig.BaseMaxHealth.Value; } [HarmonyPatch(typeof(PlayerAvatar))] public class PlayerAvatarPatch { private static int originalHealAmount; [HarmonyPatch("FinalHealRPC")] [HarmonyPrefix] private static void Prefix(PlayerAvatar __instance) { HardModePlugin.mls.LogInfo((object)("FinalHealRPCPrefix " + __instance.playerName)); SharedData.LastCallSource = "FinalHealRPCPrefix"; } [HarmonyPatch("FinalHealRPC")] [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance) { HardModePlugin.mls.LogInfo((object)("FinalHealRPCPostfix " + __instance.playerName)); if (__instance.isLocal && (Object)(object)__instance.playerHealth != (Object)null) { int health = __instance.playerHealth.health; int maxHealth = __instance.playerHealth.maxHealth; HardModePlugin.mls.LogInfo((object)$"После лечения грузовиком: {health}/{maxHealth}"); } } } [HarmonyPatch(typeof(PlayerHealth))] public class PlayerHealthPatch { [CompilerGenerated] private sealed class <Postfix>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator __result; public PlayerHealth __instance; private int <newMaxHealth>5__1; private List<PlayerAvatar> <allPlayers>5__2; private List<PlayerAvatar>.Enumerator <>s__3; private PlayerAvatar <player>5__4; private PlayerHealth <playerHealth>5__5; private string <steamId>5__6; private int <currentHealth>5__7; private int <currenMaxtHealth>5__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Postfix>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <allPlayers>5__2 = null; <>s__3 = default(List<PlayerAvatar>.Enumerator); <player>5__4 = null; <playerHealth>5__5 = null; <steamId>5__6 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = __result; <>1__state = 1; return true; case 1: <>1__state = -1; if (!PhotonNetwork.IsMasterClient) { return false; } <newMaxHealth>5__1 = SharedData.NewMaxHealth; <allPlayers>5__2 = SemiFunc.PlayerGetAll(); SharedData.LastCallSource = "Postfix Fetch"; <>s__3 = <allPlayers>5__2.GetEnumerator(); try { while (<>s__3.MoveNext()) { <player>5__4 = <>s__3.Current; if (!((Object)(object)<player>5__4 == (Object)null) && !((Object)(object)<player>5__4.playerHealth == (Object)null)) { <playerHealth>5__5 = <player>5__4.playerHealth; <steamId>5__6 = SemiFunc.PlayerGetSteamID(<player>5__4); <currentHealth>5__7 = StatsManager.instance.GetPlayerHealth(<steamId>5__6); <currenMaxtHealth>5__8 = StatsManager.instance.GetPlayerMaxHealth(<steamId>5__6); HardModePlugin.PlayerHealthDatabase[<steamId>5__6] = new PlayerHealthData(<currentHealth>5__7, <currenMaxtHealth>5__8); HardModePlugin.mls.LogInfo((object)$"ТЕСТ Postfix FETCH: для {<steamId>5__6} текущее здоровье {<currentHealth>5__7}/{<currentHealth>5__7 + <currenMaxtHealth>5__8}"); StatsManager.instance.SetPlayerHealth(<steamId>5__6, Mathf.Min(<currentHealth>5__7, <currenMaxtHealth>5__8 + <newMaxHealth>5__1), false); if ((Object)(object)<playerHealth>5__5.photonView != (Object)null) { <playerHealth>5__5.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { Mathf.Min(<currentHealth>5__7, <currenMaxtHealth>5__8 + <newMaxHealth>5__1), <newMaxHealth>5__1 + <currenMaxtHealth>5__8, true }); UpdatePlayerHealthData(<steamId>5__6, Mathf.Min(<currentHealth>5__7, <currenMaxtHealth>5__8 + <newMaxHealth>5__1), <newMaxHealth>5__1 + <currenMaxtHealth>5__8); } <playerHealth>5__5 = null; <steamId>5__6 = null; <player>5__4 = null; } } } finally { ((IDisposable)<>s__3).Dispose(); } <>s__3 = default(List<PlayerAvatar>.Enumerator); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static int newMaxHealth = SharedData.NewMaxHealth; private static bool isApplyingPatch = false; [HarmonyPatch("Fetch")] [HarmonyPrefix] private static void Prefix(PlayerHealth __instance) { HardModePlugin.mls.LogInfo((object)("[Fetch Prefix] BEFORE ваниллы: " + $"health={__instance.health}, max={__instance.maxHealth}")); } private static void LogAllPlayerHealthData() { HardModePlugin.mls.LogInfo((object)"=== ВЫВОД ВСЕХ ИГРОКОВ ==="); if (HardModePlugin.PlayerHealthDatabase.Count == 0) { HardModePlugin.mls.LogInfo((object)"База данных пуста!"); return; } foreach (KeyValuePair<string, PlayerHealthData> item in HardModePlugin.PlayerHealthDatabase) { string key = item.Key; PlayerHealthData value = item.Value; HardModePlugin.mls.LogInfo((object)$" {key}: {value.CurrentHealth}/{value.MaxHealth}"); } HardModePlugin.mls.LogInfo((object)$"Всего игроков: {HardModePlugin.PlayerHealthDatabase.Count}"); } [IteratorStateMachine(typeof(<Postfix>d__4))] [HarmonyPatch("Fetch")] [HarmonyPostfix] private static IEnumerator Postfix(IEnumerator __result, PlayerHealth __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Postfix>d__4(0) { __result = __result, __instance = __instance }; } public static PlayerHealthData GetPlayerHealthData(string steamId) { if (HardModePlugin.PlayerHealthDatabase.TryGetValue(steamId, out PlayerHealthData value)) { return value; } return null; } public static void UpdatePlayerHealthData(string steamId, int currentHealth, int maxHealth) { HardModePlugin.mls.LogInfo((object)"До:"); LogAllPlayerHealthData(); HardModePlugin.PlayerHealthDatabase[steamId] = new PlayerHealthData(currentHealth, maxHealth); HardModePlugin.mls.LogInfo((object)"После:"); LogAllPlayerHealthData(); } [HarmonyPatch("UpdateHealthRPC")] [HarmonyPrefix] private static bool PrefixUpdateHealthRPC(PlayerHealth __instance, ref int healthNew, ref int healthMax, bool effect, PhotonMessageInfo _info) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) if (isApplyingPatch) { int num = 0; int num2 = 0; string steamID = GetSteamID(__instance); num = StatsManager.instance.GetPlayerMaxHealth(steamID); num2 = StatsManager.instance.GetPlayerHealth(steamID); ManualLogSource mls = HardModePlugin.mls; object[] obj = new object[6] { steamID, healthNew, healthMax, num2, num, null }; Player sender = _info.Sender; obj[5] = ((sender != null) ? new int?(sender.ActorNumber) : null); mls.LogInfo((object)string.Format("[-0 isApplyingPatch] {0} - Здоровье: {1}/{2} ИЗ GET: {3}/{4} (Отправитель: {5})", obj)); return false; } isApplyingPatch = true; try { int num3 = 0; int num4 = 0; string steamID2 = GetSteamID(__instance); num3 = StatsManager.instance.GetPlayerMaxHealth(steamID2); num4 = StatsManager.instance.GetPlayerHealth(steamID2); int num5 = newMaxHealth + num3 / 2; int num6 = healthNew - GetPlayerHealthData(steamID2).CurrentHealth; if (SharedData.LastCallSource == "Postfix" && healthNew >= num4) { SharedData.LastCallSource = "UpdateHealthRPC"; return false; } if (SharedData.LastCallSource == "FinalHealRPCPrefix") { SharedData.LastCallSource = "UpdateHealthRPC"; ManualLogSource mls2 = HardModePlugin.mls; object[] obj2 = new object[6] { steamID2, healthNew, healthMax, num4, num3, null }; Player sender2 = _info.Sender; obj2[5] = ((sender2 != null) ? new int?(sender2.ActorNumber) : null); mls2.LogInfo((object)string.Format("[IF FinalHealRPCPrefix] {0} - Здоровье: {1}/{2} ИЗ GET: {3}/{4} (Отправитель: {5})", obj2)); if (healthNew - num4 >= 1) { if (healthNew <= 51) { HardModePlugin.mls.LogInfo((object)"[IF IF if >= 51 FinalHealRPCPrefix]"); SendHealthRPC(__instance, num4 + 15, num5, effect: true); StatsManager.instance.SetPlayerHealth(steamID2, num4 + 15, false); healthNew = num4 + 15; healthMax = num5; return false; } HardModePlugin.mls.LogInfo((object)"[IF IF >= 1 FinalHealRPCPrefix]"); SendHealthRPC(__instance, num4 + 15, num5, effect: true); StatsManager.instance.SetPlayerHealth(steamID2, num4 + 15, false); healthNew = num4 + 15; healthMax = num5; return false; } HardModePlugin.mls.LogInfo((object)"[IF FinalHealRPCPrefix]"); SendHealthRPC(__instance, num4 + 15, num5, effect: true); StatsManager.instance.SetPlayerHealth(steamID2, num4 + 15, false); healthNew = num4 + 15; healthMax = num5; return false; } HardModePlugin.mls.LogInfo((object)("[lastCallSource] " + SharedData.LastCallSource)); ManualLogSource mls3 = HardModePlugin.mls; object[] obj3 = new object[6] { steamID2, healthNew, healthMax, num4, num3, null }; Player sender3 = _info.Sender; obj3[5] = ((sender3 != null) ? new int?(sender3.ActorNumber) : null); mls3.LogInfo((object)string.Format("[1 ТЕСТ PrefixUpdateHealthRPC] {0} - Здоровье: {1}/{2} ИЗ GET: {3}/{4} (Отправитель: {5})", obj3)); if (healthMax % 2 == 0) { HardModePlugin.mls.LogInfo((object)$"[2 IF] PrefixUpdateHealthRPC if {steamID2} - Установлено: {Mathf.Min(healthNew, num5)}/{num5}"); SharedData.LastCallSource = "UpdateHealthRPC"; SendHealthRPC(__instance, Mathf.Min(healthNew, num5), num5, effect: true); StatsManager.instance.SetPlayerHealth(steamID2, Mathf.Min(healthNew, num5), false); healthNew = Mathf.Min(healthNew, num5); healthMax = num5; HardModePlugin.mls.LogInfo((object)"[2.1 IF] А ПОСЛЕ SendHealthRPC ВООБЩЕ СРАБАТЫВАЕТ??"); } else { HardModePlugin.mls.LogInfo((object)"[3 ELSE] PrefixUpdateHealthRPC"); if (healthMax != num5) { SharedData.LastCallSource = "UpdateHealthRPC"; HardModePlugin.mls.LogInfo((object)"[3.1 ELSE IF] PrefixUpdateHealthRPC"); SendHealthRPC(__instance, Mathf.Min(healthNew, num5), num5, effect: true); StatsManager.instance.SetPlayerHealth(steamID2, Mathf.Min(healthNew, num5), false); healthNew = Mathf.Min(healthNew, num5); healthMax = num5; HardModePlugin.mls.LogInfo((object)"[3.2 ELSE IF] А ПОСЛЕ SendHealthRPC ВООБЩЕ СРАБАТЫВАЕТ??"); } } SharedData.LastCallSource = "UpdateHealthRPC"; return true; } finally { isApplyingPatch = false; } } [HarmonyPatch("Heal")] [HarmonyPrefix] private static bool PrefixHeal(PlayerHealth __instance, ref int healAmount, ref bool effect) { int num = 0; int num2 = 0; int num3 = 0; string steamID = GetSteamID(__instance); num = StatsManager.instance.GetPlayerMaxHealth(steamID); num2 = StatsManager.instance.GetPlayerHealth(steamID); num3 = StatsManager.instance.GetPlayerHealth(steamID); int num4 = newMaxHealth + num / 2; HardModePlugin.mls.LogInfo((object)$"[PrefixHeal] {steamID} - Лечение: {healAmount}, Здоровье из __instance: {__instance.health}/{__instance.maxHealth}, Здоровье из Get: {num3}/{num},"); if (healAmount == 100) { SharedData.LastCallSource = "PrefixHeal 30"; SendHealthRPC(__instance, num3 + 30, num, effect); return false; } if (healAmount == 50) { SharedData.LastCallSource = "PrefixHeal 15"; SendHealthRPC(__instance, num3 + 15, num, effect); return false; } if (healAmount == 25) { SharedData.LastCallSource = "PrefixHeal 7"; SendHealthRPC(__instance, num3 + 7, num, effect); return false; } if (healAmount == 1) { SharedData.LastCallSource = "PrefixHeal 1"; SendHealthRPC(__instance, num3 + 10, num, effect); return false; } SharedData.LastCallSource = "PrefixHeal"; return true; } [HarmonyPatch("Hurt")] [HarmonyPrefix] private static bool PrefixHurt(PlayerHealth __instance, ref int damage, bool savingGrace, int enemyIndex = -1) { string steamID = GetSteamID(__instance); SharedData.LastCallSource = "PrefixHurt"; HardModePlugin.mls.LogInfo((object)$"[PrefixHurt] {steamID} - Урон: {damage}, savingGrace: {savingGrace}, enemyIndex: {enemyIndex}, Здоровье: {__instance.health}/{__instance.maxHealth}"); return true; } [HarmonyPatch("HealOtherRPC")] [HarmonyPrefix] private static bool PrefixHealOtherRPC(PlayerHealth __instance, ref int healAmount, ref bool effect) { int num = 0; int num2 = 0; int num3 = 0; string steamID = GetSteamID(__instance); num = StatsManager.instance.GetPlayerMaxHealth(steamID); num2 = StatsManager.instance.GetPlayerHealth(steamID); num3 = StatsManager.instance.GetPlayerHealth(steamID); int num4 = newMaxHealth + num / 2; HardModePlugin.mls.LogInfo((object)$"[PrefixHealOtherRPC] {steamID} - Лечение: {healAmount}, Здоровье из __instance: {__instance.health}/{__instance.maxHealth}, Здоровье из Get: {num3}/{num},"); if (healAmount == 100) { SharedData.LastCallSource = "PrefixHealOtherRPC 30"; SendHealthRPC(__instance, num3 + 30, num, effect); return false; } if (healAmount == 50) { SharedData.LastCallSource = "PrefixHealOtherRPC 15"; SendHealthRPC(__instance, num3 + 15, num, effect); return false; } if (healAmount == 25) { SharedData.LastCallSource = "PrefixHealOtherRPC 7"; SendHealthRPC(__instance, num3 + 7, num, effect); return false; } SharedData.LastCallSource = "PrefixHealOtherRPC"; return true; } [HarmonyPatch("HealOtherRPC")] [HarmonyPostfix] private static void PostfixHealOtherRPC(PlayerHealth __instance, int healAmount, bool effect) { SharedData.LastCallSource = "Postfix"; HardModePlugin.mls.LogInfo((object)"[Postfix HealOtherRPC] СРАБОТАЛ,"); } [HarmonyPatch("Death")] [HarmonyPrefix] private static bool PrefixDeath(PlayerHealth __instance) { string steamID = GetSteamID(__instance); SharedData.LastCallSource = "PrefixDeath"; HardModePlugin.mls.LogInfo((object)$"[PrefixDeath] {steamID}, хп: {__instance.health}/{__instance.maxHealth}"); return true; } private static string GetSteamID(PlayerHealth playerHealth) { if ((Object)(object)playerHealth.playerAvatar == (Object)null) { return "unknown"; } return SemiFunc.PlayerGetSteamID(playerHealth.playerAvatar); } private static void SendHealthRPC(PlayerHealth playerHealth, int health, int maxHealth, bool effect) { if (GameManager.Multiplayer() && (Object)(object)playerHealth.photonView != (Object)null) { playerHealth.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[3] { health, maxHealth, effect }); } } } public static class YourCommand { [CommandInitializer] public static void Initialize() { } [CommandExecution("Your Command Name", "Description of what the command does and how to use it.", true, false)] [CommandAlias("yourcommand")] [CommandAlias("yourcmd")] public static void Execute(string args) { } } [BepInPlugin("You.YourMod", "YourMod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class YourMod : BaseUnityPlugin { } [BepInPlugin("Teplovozovich.HardMode", "HardMode", "1.0")] public class HardMode : BaseUnityPlugin { internal static HardMode Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }