Decompiled source of StalkerGoku v1.0.1

StalkerGoku.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("StalkerGoku")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StalkerGoku")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("37892a43-6bf0-4b0f-af25-0f36400bcdaa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StalkerGoku
{
	[BepInPlugin("SteamBlizzard.StalkerGoku", "Stalker Goku", "1.0.0")]
	public class StalkerGokuBase : BaseUnityPlugin
	{
		private const string modUID = "SteamBlizzard.StalkerGoku";

		private const string modName = "Stalker Goku";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("SteamBlizzard.StalkerGoku");

		internal static StalkerGokuBase instance;

		internal ManualLogSource logger;

		internal static AudioClip[] SoundNotice;

		internal static AudioClip[] SoundTeleportIn;

		internal static AudioClip[] SoundTeleportOut;

		internal static AudioClip[] SoundHey;

		internal static AudioClip[] SoundNone;

		internal static GameObject GokuModel;

		internal static Material GokuMaterial;

		internal static Texture2D GokuTexture;

		internal static Texture2D GokuNormal;

		private void Awake()
		{
			logger = Logger.CreateLogSource("Stalker Goku");
			logger.LogInfo((object)"Loading Stalker Goku mod...");
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)this);
			}
			harmony.PatchAll();
			string location = ((BaseUnityPlugin)instance).Info.Location;
			location = location.TrimEnd("StalkerGoku.dll".ToCharArray());
			AssetBundle val = AssetBundle.LoadFromFile(location + "stalkergoku");
			if ((Object)(object)val == (Object)null)
			{
				logger.LogError((object)"Failed to load asset bundle!");
				return;
			}
			SoundNotice = (AudioClip[])(object)new AudioClip[2]
			{
				val.LoadAsset<AudioClip>("goku_ui"),
				val.LoadAsset<AudioClip>("prowler")
			};
			SoundTeleportIn = (AudioClip[])(object)new AudioClip[1] { val.LoadAsset<AudioClip>("teleport_in") };
			SoundTeleportOut = (AudioClip[])(object)new AudioClip[1] { val.LoadAsset<AudioClip>("teleport_out") };
			SoundNone = (AudioClip[])(object)new AudioClip[1] { val.LoadAsset<AudioClip>("no_sound") };
			SoundHey = (AudioClip[])(object)new AudioClip[1] { val.LoadAsset<AudioClip>("its_me_goku") };
			GokuModel = val.LoadAsset<GameObject>("goku");
			GokuMaterial = val.LoadAsset<Material>("goku_material");
			logger.LogInfo((object)"Successfully loaded assets and started Stalker Goku mod!");
		}
	}
}
namespace StalkerGoku.Patches
{
	[HarmonyPatch(typeof(EnemyThinMan))]
	internal class EnemyThinManPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void ReplaceAssets(EnemyThinMan __instance, ref EnemyThinManAnim ___anim)
		{
			//IL_0083: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			StalkerGokuBase.instance.logger.LogInfo((object)"Attempting to replace assets for EnemyThinMan...");
			if ((Object)(object)StalkerGokuBase.GokuModel == (Object)null)
			{
				StalkerGokuBase.instance.logger.LogError((object)"Failed to load visuals for EnemyThinMan! Aborting asset replacement...");
				return;
			}
			Transform transform = ((Component)__instance).transform;
			if ((Object)(object)transform == (Object)null)
			{
				StalkerGokuBase.instance.logger.LogError((object)"Failed to find transform for EnemyThinMan! Aborting asset replacement...");
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(StalkerGokuBase.GokuModel, transform);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			Transform transform2 = val.transform;
			transform2.localScale *= 7f;
			Transform child = ((Component)__instance).transform.parent.GetChild(2).GetChild(4).GetChild(0);
			Renderer[] componentsInChildren = ((Component)child.GetChild(0)).gameObject.GetComponentsInChildren<Renderer>();
			Renderer[] componentsInChildren2 = ((Component)child.GetChild(1)).gameObject.GetComponentsInChildren<Renderer>();
			Renderer[] components = ((Component)child.GetChild(0).GetChild(1).GetChild(0)).gameObject.GetComponents<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val2 in array)
			{
				val2.enabled = false;
			}
			Renderer[] array2 = componentsInChildren2;
			foreach (Renderer val3 in array2)
			{
				val3.enabled = false;
			}
			Renderer[] array3 = components;
			foreach (Renderer val4 in array3)
			{
				val4.enabled = false;
			}
			___anim.notice.Sounds = StalkerGokuBase.SoundNotice;
			___anim.notice.PitchRandom = 0f;
			___anim.teleportIn.Sounds = StalkerGokuBase.SoundTeleportIn;
			___anim.teleportOut.Sounds = StalkerGokuBase.SoundTeleportOut;
			___anim.screamLocal.Sounds = StalkerGokuBase.SoundHey;
			___anim.screamLocal.PitchRandom = 0f;
			___anim.screamGlobal.Sounds = StalkerGokuBase.SoundHey;
			___anim.screamGlobal.PitchRandom = 0f;
			___anim.attack.Sounds = StalkerGokuBase.SoundNone;
			___anim.growLoop.Sounds = StalkerGokuBase.SoundNone;
			GameObject gameObject = ((Component)((Component)__instance).transform.parent.GetChild(2).GetChild(3)).gameObject;
			PropLight component = gameObject.GetComponent<PropLight>();
			component.lightRangeMultiplier = 0f;
			StalkerGokuBase.instance.logger.LogInfo((object)"Replaced assets for EnemyThinMan");
		}
	}
}