Decompiled source of Hellmod v1.0.0

Hellmod.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 Pigeon;
using Pigeon.Movement;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Hellmod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Turn Mycopunk into a roguelike with brutal difficulty")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6f316c30a56ff2fa8b011fc6ec2aabe7183f1191")]
[assembly: AssemblyProduct("Hellmod")]
[assembly: AssemblyTitle("Hellmod")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Hellmod
{
	[BepInPlugin("Hellmod", "Hellmod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GearData), "AddXP")]
		public static class Patch_AddXP_ConditionalSkillPoints
		{
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Expected O, but got Unknown
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				MethodInfo methodInfo = AccessTools.Method(typeof(PlayerData), "AddResource", (Type[])null, (Type[])null);
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].opcode == OpCodes.Callvirt && list[i].operand == methodInfo)
					{
						Label label = ((list[i].labels.Count > 0) ? list[i].labels[0] : default(Label));
						list[i].labels.Clear();
						List<CodeInstruction> list2 = new List<CodeInstruction>();
						list2.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "ProfileCheck", (Type[])null, (Type[])null)));
						list2.Add(new CodeInstruction(OpCodes.Brtrue_S, (object)label));
						list2.Add(list[i]);
						list2[list2.Count - 1].labels.Add(label);
						list.RemoveAt(i);
						list.InsertRange(i, list2);
						break;
					}
				}
				return list.AsEnumerable();
			}
		}

		[HarmonyPatch(typeof(Global), "Initialize")]
		public class Patch_Global_Initialize
		{
			private static void Postfix(Global __instance)
			{
				if (ProfileCheck() && (Object)(object)__instance == (Object)null)
				{
					Logger.LogWarning((object)"[BigMonoLobby] Global instance was null in Start");
				}
			}
		}

		[HarmonyPatch(typeof(PlayerData), "OnMissionFailed")]
		public class Patch_PlayerData_OnMissionFailed
		{
			private static void Postfix()
			{
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Invalid comparison between Unknown and I4
				if (!ProfileCheck())
				{
					return;
				}
				Logger.LogWarning((object)"YOU FAILLED GET RECKT");
				GearInfo[] array = Resources.FindObjectsOfTypeAll<GearInfo>();
				UpgradeEnumerator val2 = default(UpgradeEnumerator);
				EquippedUpgradeEnumerator val3 = default(EquippedUpgradeEnumerator);
				SkinEnumerator val4 = default(SkinEnumerator);
				EquippedSkinEnumerator val5 = default(EquippedSkinEnumerator);
				foreach (GearInfo val in array)
				{
					if ((Object)(object)val == (Object)null)
					{
						Logger.LogWarning((object)"Null GearInfo item found.");
						continue;
					}
					Logger.LogDebug((object)("GearInfo: " + val.Name));
					GearData gearData = PlayerData.GetGearData(val);
					if (gearData == null)
					{
						Logger.LogWarning((object)("GearData is null for " + val.Name));
						continue;
					}
					gearData.Reset();
					gearData.UnequipAllUpgrades();
					IUpgradable gear = gearData.Gear;
					Logger.LogDebug((object)$"Gear: {gear}");
					if (gear == null)
					{
						continue;
					}
					((UpgradeEnumerator)(ref val2))..ctor(gear);
					((UpgradeEnumerator)(ref val2)).Reset();
					((EquippedUpgradeEnumerator)(ref val3))..ctor(gear);
					((EquippedUpgradeEnumerator)(ref val3)).Reset();
					((SkinEnumerator)(ref val4))..ctor(gear);
					((SkinEnumerator)(ref val4)).Reset();
					((EquippedSkinEnumerator)(ref val5))..ctor(gear);
					((EquippedSkinEnumerator)(ref val5)).Reset();
					List<UpgradeInfo> allUpgrades = PlayerData.GetAllUpgrades(gear);
					if (allUpgrades == null)
					{
						Logger.LogWarning((object)$"Upgrades is null for Gear {gear}");
						continue;
					}
					Logger.LogDebug((object)$"Found {allUpgrades.Count} upgrades for {gear}");
					foreach (UpgradeInfo item in allUpgrades)
					{
						if (item == null)
						{
							Logger.LogWarning((object)$"Null UpgradeInfo in upgrade list for {gear}");
							continue;
						}
						item.Clear();
						if ((item.Upgrade.Flags & 2) > 0)
						{
							Logger.LogWarning((object)$"Skill Tree Upgrade for {item}");
							continue;
						}
						FieldInfo field = typeof(UpgradeInfo).GetField("totalInstancesCollected", BindingFlags.Instance | BindingFlags.NonPublic);
						if (field != null)
						{
							Logger.LogDebug((object)$"Setting totalInstancesCollected = 10 for {item}");
							field.SetValue(item, 10);
						}
						else
						{
							Logger.LogError((object)"Field totalInstancesCollected not found via reflection.");
						}
					}
				}
				for (int j = 0; j < Global.Instance.PlayerResources.Length; j++)
				{
					if (PlayerData.Instance.GetResource(Global.Instance.PlayerResources[j]) > 0)
					{
						PlayerData.Instance.TryRemoveResource(Global.Instance.PlayerResources[j], PlayerData.Instance.GetResource(Global.Instance.PlayerResources[j]));
					}
				}
				PlayerData.Instance.TotalSkillPointsSpent = 0;
				PlayerData.Instance.dropPodDoorNumber = 0;
			}
		}

		[HarmonyPatch(typeof(GameManager), "Start")]
		public static class Patch_GameManager_Start
		{
			private static void Postfix()
			{
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0833: Unknown result type (might be due to invalid IL or missing references)
				//IL_065f: Unknown result type (might be due to invalid IL or missing references)
				//IL_077d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0725: Unknown result type (might be due to invalid IL or missing references)
				//IL_0859: Unknown result type (might be due to invalid IL or missing references)
				//IL_0793: Unknown result type (might be due to invalid IL or missing references)
				//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0846: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0675: Unknown result type (might be due to invalid IL or missing references)
				//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_070f: Unknown result type (might be due to invalid IL or missing references)
				//IL_060a: Unknown result type (might be due to invalid IL or missing references)
				//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_080d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0751: Unknown result type (might be due to invalid IL or missing references)
				//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_068b: Unknown result type (might be due to invalid IL or missing references)
				//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_073b: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0767: Unknown result type (might be due to invalid IL or missing references)
				//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0820: Unknown result type (might be due to invalid IL or missing references)
				//IL_061d: Unknown result type (might be due to invalid IL or missing references)
				//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0633: Unknown result type (might be due to invalid IL or missing references)
				//IL_0649: Unknown result type (might be due to invalid IL or missing references)
				//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b8b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b93: Invalid comparison between Unknown and I4
				if (!ProfileCheck())
				{
					return;
				}
				PlayerData instance = PlayerData.Instance;
				if (instance == null)
				{
					Logger.LogWarning((object)"PlayerData.Instance is null!");
					return;
				}
				Global instance2 = Global.Instance;
				if ((Object)(object)instance2 == (Object)null)
				{
					Logger.LogWarning((object)"[Hellmod] Global instance was null in Start");
					return;
				}
				instance2.MissionModifierChance = 1000f;
				Logger.LogInfo((object)"MissionModifierChance set to 1");
				Keyframe[] keys = instance2.MissionModifierCountCurve.keys;
				for (int i = 0; i < keys.Length; i++)
				{
					((Keyframe)(ref keys[i])).value = (i + 1) * 6 * (i + 1);
				}
				WeightedArray<MissionModifier> missionModifiers = instance2.MissionModifiers;
				for (int j = 0; j < missionModifiers.Length; j++)
				{
					int num = 0;
					float num2 = 1f;
					ModifierFlags val = (ModifierFlags)0;
					int weight = missionModifiers.GetWeight(j);
					float num3 = 0f;
					ModifierFlags val2 = (ModifierFlags)0;
					switch (missionModifiers[j].ModifierName)
					{
					case "Amalgamation Hunt":
						num = 600;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "//ERROR_REDACTED//":
						num = 600;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Dave vs Goliath":
						num = 10;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Bullet Hell":
						num = 600;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Macrowave":
						num = 600;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Fairy Tale":
						num = 600;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Eclipse":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Corrosive Coating":
						num = 500;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Rot":
						num = 250;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "BEES":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Unhealthy Charging":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Warranty Expiration":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Explodungus":
						num = 300;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Fungal Workout":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Overheated Cores":
						num = 500;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Burn":
						num = 300;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Fog":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Horde":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Powder Keg":
						num = 700;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Meteor Shower":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Mitosis":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Tread Carefully":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Overclocker":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Gallbladder":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Saxonite Storm":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Sharpshooter":
						num = 1;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Conductive Machinery":
						num = 500;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Electrified":
						num = 500;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Tussle":
						num = 250;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					case "Weak Link":
						num = 1000;
						num2 = 1.05f;
						val = (ModifierFlags)3;
						break;
					default:
						num = 0;
						break;
					}
					missionModifiers.SetWeight(j, num);
					MissionModifier obj = missionModifiers[j];
					FieldInfo field = typeof(MissionModifier).GetField("flags", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field != null)
					{
						ModifierFlags val3 = (ModifierFlags)field.GetValue(obj);
						val2 = val3;
						val3 = val;
						field.SetValue(obj, val3);
					}
					FieldInfo field2 = typeof(MissionModifier).GetField("incompatibleModifiers", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field2 != null)
					{
						field2.SetValue(obj, new MissionModifier[0]);
					}
					FieldInfo field3 = typeof(MissionModifier).GetField("incompatibleMissions", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field3 != null)
					{
						field3.SetValue(obj, new Mission[0]);
					}
					FieldInfo field4 = typeof(MissionModifier).GetField("xpMultiplier", BindingFlags.Instance | BindingFlags.NonPublic);
					if (field4 != null)
					{
						num3 = (float)field4.GetValue(obj);
						field4.SetValue(obj, num2);
					}
					missionModifiers.SetWeight(j, num);
					Logger.LogInfo((object)$"Modifier[{j,2}] {missionModifiers[j].ModifierName,-24} | Weight: {missionModifiers.GetWeight(j),4} (Def: {weight,4}) | XP: {num2,4} (Def: {num3,4}) | Flags: {val,-40} (Def: {val2})");
				}
				instance2.MissionModifiers = missionModifiers;
				instance2.MissionModifierCountCurve.keys = keys;
				GearInfo[] array = Resources.FindObjectsOfTypeAll<GearInfo>();
				foreach (GearInfo val4 in array)
				{
					if ((Object)(object)val4 == (Object)null)
					{
						Logger.LogWarning((object)"Null GearInfo item found.");
						continue;
					}
					Logger.LogDebug((object)("GearInfo: " + val4.Name));
					GearData gearData = PlayerData.GetGearData(val4);
					if (gearData == null)
					{
						Logger.LogWarning((object)("GearData is null for " + val4.Name));
						continue;
					}
					IUpgradable gear = gearData.Gear;
					Logger.LogDebug((object)$"Gear: {gear}");
					if (gear == null)
					{
						continue;
					}
					List<UpgradeInfo> allUpgrades = PlayerData.GetAllUpgrades(gear);
					if (allUpgrades == null)
					{
						Logger.LogWarning((object)$"Upgrades is null for Gear {gear}");
						continue;
					}
					Logger.LogDebug((object)$"Found {allUpgrades.Count} upgrades for {gear}");
					foreach (UpgradeInfo item in allUpgrades)
					{
						if (item == null)
						{
							Logger.LogWarning((object)$"Null UpgradeInfo in upgrade list for {gear}");
							continue;
						}
						if ((item.Upgrade.Flags & 2) > 0)
						{
							Logger.LogWarning((object)$"Skill Tree Upgrade for {item}");
							continue;
						}
						FieldInfo field5 = typeof(UpgradeInfo).GetField("totalInstancesCollected", BindingFlags.Instance | BindingFlags.NonPublic);
						if (field5 != null)
						{
							Logger.LogDebug((object)$"Setting totalInstancesCollected = 10 for {item}");
							field5.SetValue(item, 10);
						}
						else
						{
							Logger.LogError((object)"Field totalInstancesCollected not found via reflection.");
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(ObjectiveBase), "GiveSideObjectiveRewards")]
		public static class Patch_ObjectiveBase_GiveSideObjectiveRewards
		{
			private static void Postfix()
			{
				if (ProfileCheck())
				{
					PlayerData.Instance.AddResource(Global.Instance.SkillPointResource, 1);
				}
			}
		}

		[HarmonyPatch(typeof(UpgradeCollectable), "TryCollect")]
		public static class Patch_UpgradeCollectable_TryCollect
		{
			private static bool Prefix(UpgradeCollectable __instance, ref Player player)
			{
				if (!ProfileCheck())
				{
					return true;
				}
				if (!Traverse.Create((object)__instance).Field("canCollect").GetValue<bool>())
				{
					return false;
				}
				UpgradeInstance value = Traverse.Create((object)__instance).Field("upgrade").GetValue<UpgradeInstance>();
				PlayerResource[] array = Resources.FindObjectsOfTypeAll<PlayerResource>();
				foreach (PlayerResource val in array)
				{
					Logger.LogDebug((object)val.Name.ToLower());
					Logger.LogDebug((object)value.Upgrade.RarityName.ToLower());
					if (val.Name.Contains("Scrap") && val.Name.ToLower().Contains(value.Upgrade.RarityName.ToLower()))
					{
						PlayerData.Instance.AddResource(val, 1);
					}
				}
				Traverse.Create((object)__instance).Field("upgrade").SetValue((object)null);
				Object.Destroy((Object)(object)((Component)__instance).gameObject);
				return false;
			}
		}

		[HarmonyPatch(typeof(StartMenu), "Start")]
		public static class Patch_StartMenu_Start
		{
			private static void Postfix()
			{
				((TMP_Text)((Component)((Component)StartMenu.Instance).transform.GetChild(1).GetChild(21).GetChild(8)).GetComponent<TextMeshProUGUI>()).text = "<color=\"red\">HELLMOD";
				if (!ProfileCheck())
				{
					return;
				}
				if ((Object)(object)lg == (Object)null)
				{
					LoadEmbeddedAssetBundle();
				}
				if ((Object)(object)StartMenu.Instance == (Object)null)
				{
					return;
				}
				((Component)((Component)StartMenu.Instance).transform.GetChild(1).GetChild(9)).GetComponent<Image>().sprite = lg;
				((TMP_Text)((Component)((Component)StartMenu.Instance).transform.GetChild(1).GetChild(14).GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "<color=\"red\">HELLMOD";
				if (ChangeBuildID.Value)
				{
					FieldInfo field = typeof(Global).GetField("_buildID", BindingFlags.Static | BindingFlags.NonPublic);
					if (field != null)
					{
						field.SetValue(null, "Hellmod - 1.0.0 - " + Online.GetBuildID());
					}
				}
			}
		}

		public class UpdateBehaviour : MonoBehaviour
		{
			public Vector3 size;

			private void Update()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: Unknown result type (might be due to invalid IL or missing references)
				if (!ProfileCheck())
				{
					return;
				}
				if ((Object)(object)fuck != (Object)null)
				{
					Vector3 val = Vector3.zero;
					int num = 0;
					for (int i = 0; i < GameManager.players.Count; i++)
					{
						if (!((Object)(object)GameManager.players[i] == (Object)null))
						{
							val += ((Component)GameManager.players[i]).transform.position;
							num++;
						}
					}
					if (num > 0)
					{
						val /= (float)num;
						fuck.transform.position = val;
						fuck.transform.localScale = DivVectors(size, Vector3.one + new Vector3(0.05f, 0.05f, 0.05f) * (float)num);
					}
				}
				if ((Object)(object)fuck == (Object)null && GameManager.players != null && GameManager.players.Count > 0 && (Object)(object)GameManager.players[0] != (Object)null)
				{
					SafetyBubble[] array = Resources.FindObjectsOfTypeAll<SafetyBubble>();
					if (array == null || array.Length == 0 || (Object)(object)array[0] == (Object)null)
					{
						Debug.LogError((object)"SafetyBubble not found");
						return;
					}
					fuck = Object.Instantiate<GameObject>(((Component)array[0]).gameObject);
					fuck.layer = LayerMask.NameToLayer("Bubble");
					size = fuck.transform.localScale;
				}
			}

			public Vector3 DivVectors(Vector3 a, Vector3 b)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				return new Vector3(a.x / b.x, a.y / b.y, a.z / b.z);
			}
		}

		internal static ManualLogSource Logger;

		public static ConfigEntry<bool> ChangeBuildID;

		private GameObject updaterGO;

		public static AssetBundle assets;

		public static Sprite lg;

		public static GameObject fuck;

		private void Awake()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin Hellmod is loaded!");
			ChangeBuildID = ((BaseUnityPlugin)this).Config.Bind<bool>("Hellmod", "ChangeBuildID", true, "Lockout non-modded players");
			Harmony val = new Harmony("com.catalyss.hellmod");
			val.PatchAll();
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			if (ProfileCheck())
			{
				LostLootMachine[] array = Object.FindObjectsByType<LostLootMachine>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				foreach (LostLootMachine val in array)
				{
					((Component)val).gameObject.SetActive(false);
				}
				if ((Object)(object)updaterGO == (Object)null)
				{
					updaterGO = new GameObject("CustomSceneLoaderUpdater");
					updaterGO.AddComponent<UpdateBehaviour>();
					Object.DontDestroyOnLoad((Object)(object)updaterGO);
				}
			}
		}

		public static void CustomSkillPointLogic()
		{
		}

		public static bool ProfileCheck()
		{
			ProfileConfig instance = ProfileConfig.Instance;
			if (instance == null)
			{
				Logger.LogWarning((object)"PlayerData.ProfileConfig is null!");
				return false;
			}
			FieldInfo field = typeof(ProfileConfig).GetField("profileIndex", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				Logger.LogWarning((object)"Could not find private field 'profileIndex'");
				return false;
			}
			int num = (int)field.GetValue(instance);
			if (num < 7)
			{
				Logger.LogWarning((object)$"profileIndex = {num}, skipping");
				return false;
			}
			return true;
		}

		public static void LoadEmbeddedAssetBundle()
		{
			Logger.LogInfo((object)"Loading embedded AssetBundle...");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string name) => name.EndsWith("hellmod"));
			if (text == null)
			{
				Logger.LogError((object)"Embedded resource 'hellmod' not found!");
				return;
			}
			using (Stream stream = executingAssembly.GetManifestResourceStream(text))
			{
				if (stream == null)
				{
					Logger.LogError((object)"Failed to get stream for embedded AssetBundle 'hellmod'.");
					return;
				}
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				assets = AssetBundle.LoadFromMemory(memoryStream.ToArray());
			}
			if ((Object)(object)assets == (Object)null)
			{
				Logger.LogError((object)"Failed to load AssetBundle from memory.");
				return;
			}
			Logger.LogInfo((object)"AssetBundle 'hellmod' loaded successfully.");
			lg = assets.LoadAsset<Sprite>("hellmod_logo");
			if ((Object)(object)lg == (Object)null)
			{
				Logger.LogError((object)"Failed to load 'hellmod_logo' prefab from AssetBundle.");
			}
			else
			{
				Logger.LogInfo((object)"Prefab 'hellmod_logo' loaded successfully.");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Hellmod";

		public const string PLUGIN_NAME = "Hellmod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}