Decompiled source of linkssy2 ScrapPack v2.0.5

LethalGym.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8783459d-c18b-47c1-8ab8-33850c35c096")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LethalGym
{
	[BepInPlugin("LethalGym", "LethalGym", "1.0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "LethalGym";

		private const string modName = "LethalGym";

		private const string modVersion = "1.0.1.0";

		private readonly Harmony harmony = new Harmony("LethalGym");

		private static Plugin Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("LethalGym");
			mls.LogInfo((object)"The Lethal Gym Is Open");
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalgym");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item item = val.LoadAsset<Item>("assets/scraps/dumbell.asset");
			Item item2 = val.LoadAsset<Item>("assets/scraps/dumbellbig.asset");
			RegisterScrapByPlanet(item, new int[8] { 18, 25, 19, 36, 34, 46, 50, 47 });
			RegisterScrapByPlanet(item2, new int[8] { 0, 0, 0, 14, 15, 34, 33, 30 });
			TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
			harmony.PatchAll(typeof(Plugin));
		}

		private void RegisterScrapByPlanet(Item item, int[] weights)
		{
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Items.RegisterScrap(item, weights[0], (LevelTypes)4);
			Items.RegisterScrap(item, weights[1], (LevelTypes)8);
			Items.RegisterScrap(item, weights[2], (LevelTypes)16);
			Items.RegisterScrap(item, weights[3], (LevelTypes)32);
			Items.RegisterScrap(item, weights[4], (LevelTypes)64);
			Items.RegisterScrap(item, weights[5], (LevelTypes)128);
			Items.RegisterScrap(item, weights[6], (LevelTypes)256);
			Items.RegisterScrap(item, weights[7], (LevelTypes)512);
		}
	}
}
namespace LethalGym.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}
	}
}

NeutronStarSample.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NeutronStarSample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NeutronStarSample")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f60b80b1-a5ce-484d-9415-11dd066f8999")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NeutronStarSample;

[BepInPlugin("nihl.NeutronStarSample", "NeutronStarSample", "1.0.0.0")]
public class NeutronStarSampleBase : BaseUnityPlugin
{
	private const string modGUID = "nihl.NeutronStarSample";

	private const string modName = "NeutronStarSample";

	private const string modVersion = "1.0.0.0";

	private readonly Harmony harmony = new Harmony("nihl.NeutronStarSample");

	private static NeutronStarSampleBase instance;

	internal ManualLogSource MLS;

	private void Awake()
	{
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
		}
		MLS = Logger.CreateLogSource("nihl.NeutronStarSample");
		AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NeutronStarSample"));
		Item val2 = val.LoadAsset<Item>("Assets/NeutronStarSample.asset");
		if ((Object)(object)val2 == (Object)null)
		{
			MLS.LogInfo((object)"Failed to load Star prefab,");
		}
		else
		{
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, 3, (LevelTypes)510);
		}
		MLS.LogInfo((object)"NeutronStarSample Loaded!");
	}
}

CapriSunReplacer.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CapriSunReplacer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CapriSunReplacer")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cd148226-4604-45af-a09c-62e71c1fc8fc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CapriSunReplacer
{
	[BepInPlugin("Poseidon.CapriSunReplacer", "CapriSunReplacer", "1.0.0")]
	public class CapriSunReplacer : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.CapriSunReplacer";

		private const string modName = "CapriSunReplacer";

		private const string modVersion = "1.0.0";

		private static CapriSunReplacer Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "caprisun");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/CapriSun.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 30, (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched CapriSun Item");
		}
	}
}
namespace CapriSunReplacer.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}
	}
}

BepInEx/plugins/GroanTubeScrap.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LaserTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LaserTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4963e0ea-7a99-4390-9cae-a4bdd01b6b43")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace GroanTubeScrap
{
	public class Assets
	{
		public static AssetBundle MainAssetBundle;

		public static Item Item;

		internal static Stream GetEmbededResource(string name)
		{
			return Assembly.GetExecutingAssembly().GetManifestResourceStream("GroanTubeScrap." + name);
		}

		public static void Init()
		{
			MainAssetBundle = AssetBundle.LoadFromStream(GetEmbededResource("groantube.bundle"));
			Item = MainAssetBundle.LoadAsset<Item>("Assets/Mods/GroanTubeScrap/GroanTube.asset");
		}
	}
	internal class GroanTubeItem : NoisemakerProp
	{
		private bool localState;

		[Header("Horrible Color Sync")]
		[Tooltip("Seekers made me do this. Look at implementation of (Item.materialVariants)")]
		public Material[] altMaterials;

		public int altSelect = -1;

		public override int GetItemDataToSave()
		{
			return altSelect;
		}

		public override void LoadItemSaveData(int saveData)
		{
			altSelect = Mathf.Clamp(saveData, 0, altMaterials.Length - 1);
			Material sharedMaterial = altMaterials[altSelect];
			((Renderer)((GrabbableObject)this).mainObjectRenderer).sharedMaterial = sharedMaterial;
		}

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			if (((NetworkBehaviour)this).IsOwner && altMaterials.Length != 0)
			{
				if (altSelect < 0)
				{
					altSelect = Random.Range(0, altMaterials.Length);
				}
				((GrabbableObject)this).SyncBatteryServerRpc(altSelect);
			}
		}

		public override void ChargeBatteries()
		{
			if (!(((GrabbableObject)this).insertedBattery.charge < 0f))
			{
				int num = Mathf.RoundToInt(((GrabbableObject)this).insertedBattery.charge * 100f);
				num = Mathf.Clamp(num, 0, altMaterials.Length - 1);
				((GrabbableObject)this).LoadItemSaveData(num);
				((GrabbableObject)this).insertedBattery.charge = -1f;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					buttonDown = !localState;
					((GrabbableObject)this).isSendingItemRPC = ((GrabbableObject)this).isSendingItemRPC + 1;
					((GrabbableObject)this).ActivateItemServerRpc(false, buttonDown);
				}
				OnItemUseLocal(buttonDown);
			}
		}

		private void OnItemUseLocal(bool state)
		{
			localState = state;
			base.triggerAnimator.SetTrigger("Spin");
			PlayAudio((!state) ? 1 : 0);
		}

		private void PlayAudio(int index)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = base.noiseSFX[index];
			float num = (float)base.noisemakerRandom.Next((int)(base.minLoudness * 100f), (int)(base.maxLoudness * 100f)) / 100f;
			float pitch = (float)base.noisemakerRandom.Next((int)(base.minPitch * 100f), (int)(base.maxPitch * 100f)) / 100f;
			base.noiseAudio.pitch = pitch;
			base.noiseAudio.PlayOneShot(val, num);
			WalkieTalkie.TransmitOneShotAudio(base.noiseAudio, val, num);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, base.noiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			if (base.minLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
			}
		}
	}
	[BepInPlugin("Kittenji.GroanTubeScrap", "Groan Tube Scrap", "1.0.0")]
	public class Loader : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(GameNetworkManager))]
		internal class GameNetworkManagerPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPostfix]
			private static void StartPatch()
			{
				((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.Item.spawnPrefab);
			}
		}

		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			private static void AwakePatch(ref StartOfRound __instance)
			{
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Expected O, but got Unknown
				SelectableLevel[] levels = __instance.levels;
				foreach (SelectableLevel val in levels)
				{
					if (val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)Assets.Item))
					{
						continue;
					}
					int num = SpawnRateOverride.Value;
					if (num < 1)
					{
						SpawnableItemWithRarity val2 = val.spawnableScrap.Find((SpawnableItemWithRarity s) => Object.op_Implicit((Object)(object)s.spawnableItem) && Object.op_Implicit((Object)(object)s.spawnableItem.spawnPrefab) && ((Object)s.spawnableItem.spawnPrefab).name == "RobotToy");
						if (val2 != null)
						{
							num = val2.rarity;
						}
						else if (val.spawnableScrap.Count > 0)
						{
							int num2 = int.MaxValue;
							foreach (SpawnableItemWithRarity item2 in val.spawnableScrap)
							{
								if (item2.rarity < num2)
								{
									num2 = item2.rarity;
								}
							}
							num = num2;
						}
					}
					num = Mathf.Clamp(num, 1, 100);
					SpawnableItemWithRarity item = new SpawnableItemWithRarity
					{
						spawnableItem = Assets.Item,
						rarity = num
					};
					val.spawnableScrap.Add(item);
				}
				if (!__instance.allItemsList.itemsList.Contains(Assets.Item))
				{
					__instance.allItemsList.itemsList.Add(Assets.Item);
				}
			}
		}

		private const string modGUID = "Kittenji.GroanTubeScrap";

		private readonly Harmony harmony = new Harmony("Kittenji.GroanTubeScrap");

		private static ConfigEntry<int> SpawnRateOverride;

		private const string ItemReferenceName = "RobotToy";

		private void Awake()
		{
			Assets.Init();
			SpawnRateOverride = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rate Override", -1, "Override the spawn rate for this item, this affects all moons. By default, it uses the spawn rate of the Toy Cube item so it spawns in coordination with other toys.");
			harmony.PatchAll();
		}
	}
}