Decompiled source of ArtemPO v1.1.1

Loader/ArtemPO.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using UnityEngine;
using UnityEngine.Events;

[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: AssemblyCompany("ArtemPO")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtemPO")]
[assembly: AssemblyTitle("ArtemPO")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
[BepInPlugin("WaterGun.APO", "ArtemP.O", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EnemyHunter), "Awake")]
	internal class Hunter_Patch
	{
		[HarmonyPostfix]
		public static void HunterInstance(EnemyHunter __instance)
		{
			if (EnableHunterSounds.Value)
			{
				__instance.soundShoot.Sounds[0] = HunterShootSound;
				__instance.soundDeath.Sounds[0] = HunterDeathSound;
				__instance.soundDeath.Sounds[1] = HunterDeathSound;
				__instance.soundDeath.Sounds[2] = HunterDeathSound;
			}
		}
	}

	private const string GUID = "WaterGun.APO";

	private const string NAME = "ArtemP.O";

	private const string VER = "1.1.0";

	private static AssetBundle bundle;

	private static ConfigEntry<bool> EnableWaterGun;

	private static ConfigEntry<bool> EnableAnalBeads;

	private static ConfigEntry<bool> EnableDildo;

	private static ConfigEntry<bool> EnableHeadShoulders;

	private static ConfigEntry<bool> EnableSexDoll;

	private static ConfigEntry<bool> EnablePenetrator;

	private static ConfigEntry<bool> EnableHunterSounds;

	private static AudioClip HunterShootSound;

	private static AudioClip HunterDeathSound;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("WaterGun.APO");
		val.PatchAll(typeof(Plugin));
		EnableWaterGun = ((BaseUnityPlugin)this).Config.Bind<bool>("Valuables", "EnableWaterGun", true, "Enables Water Gun");
		EnableAnalBeads = ((BaseUnityPlugin)this).Config.Bind<bool>("Valuables", "EnableAnalBeads", true, "Enables Anal Beads");
		EnableDildo = ((BaseUnityPlugin)this).Config.Bind<bool>("Valuables", "EnableDildo", true, "Enables Dildo");
		EnableHeadShoulders = ((BaseUnityPlugin)this).Config.Bind<bool>("Valuables", "EnableHeadShoulders", true, "Enables Head & Shoulders");
		EnableSexDoll = ((BaseUnityPlugin)this).Config.Bind<bool>("Valuables", "EnableSexDoll", true, "Enables Sex Doll");
		EnablePenetrator = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "EnablePenetrator", true, "Enables Penetrator");
		EnableHunterSounds = ((BaseUnityPlugin)this).Config.Bind<bool>("Sounds", "EnableHunterSounds", true, "Enables HunterSounds");
		string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "apoassets");
		bundle = AssetBundle.LoadFromFile(text);
		if (EnableWaterGun.Value)
		{
			GameObject val2 = bundle.LoadAsset<GameObject>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Valuables/WaterGun/WaterGun.prefab");
			val2.AddComponent<WaterGunItem>();
			PrefabRef val3 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPOWaterGun", val2);
			Utilities.FixAudioMixerGroups(val3.Prefab);
			Valuables.RegisterValuable(val3.Prefab);
		}
		if (EnableAnalBeads.Value)
		{
			GameObject val4 = bundle.LoadAsset<GameObject>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Valuables/AnalBeads/AnalBeads.prefab");
			PrefabRef val5 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPOAnalBeads", val4);
			Utilities.FixAudioMixerGroups(val5.Prefab);
			Valuables.RegisterValuable(val5.Prefab);
		}
		if (EnableDildo.Value)
		{
			GameObject val6 = bundle.LoadAsset<GameObject>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Valuables/Dildo/Dildo.prefab");
			PrefabRef val7 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPODildo", val6);
			Utilities.FixAudioMixerGroups(val7.Prefab);
			Valuables.RegisterValuable(val7.Prefab);
		}
		if (EnableHeadShoulders.Value)
		{
			GameObject val8 = bundle.LoadAsset<GameObject>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Valuables/HeadShoulders/HeadShoulders.prefab");
			PrefabRef val9 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPOHeadShoulders", val8);
			Utilities.FixAudioMixerGroups(val9.Prefab);
			Valuables.RegisterValuable(val9.Prefab);
		}
		if (EnableSexDoll.Value)
		{
			GameObject val10 = bundle.LoadAsset<GameObject>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Valuables/SexDoll/SexDoll.prefab");
			val10.AddComponent<SexDollItem>();
			PrefabRef val11 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPOSexDoll", val10);
			Utilities.FixAudioMixerGroups(val11.Prefab);
			Valuables.RegisterValuable(val11.Prefab);
		}
		if (EnablePenetrator.Value)
		{
			ItemContent val12 = bundle.LoadAsset<ItemContent>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Items/Penetrator/PenetratorItem.asset");
			PrefabRef val13 = NetworkPrefabs.RegisterNetworkPrefab("ArtemPOPenetratorItem", ((Component)val12.Prefab).gameObject);
			Utilities.FixAudioMixerGroups(((Component)val12.Prefab).gameObject);
			Items.RegisterItem(val12);
		}
		HunterShootSound = bundle.LoadAsset<AudioClip>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Sounds/Hunter/ShootSfx.wav");
		HunterDeathSound = bundle.LoadAsset<AudioClip>("Assets/REPO/Mods/WaterGunMods/Artem.P.O/Sounds/Hunter/HunterDie.wav");
		((BaseUnityPlugin)this).Logger.LogInfo((object)("ArtemPO Finished Loading config values:\n\nVALUABLES:\n\n" + $"EnableWaterGun: {EnableWaterGun.Value}\n" + $"EnableDildo: {EnableDildo.Value}\n" + $"EnableHeadShoulders: {EnableHeadShoulders.Value}\n" + $"EnableAnalBeads: {EnableAnalBeads.Value}\n" + $"EnableSexDoll: {EnableSexDoll.Value}\n\n" + "ITEMS:\n\n" + $"EnablePenetrator: {EnablePenetrator.Value}\n\n" + "SOUNDS:\n\n" + $"EnableHunterSounds: {EnableHunterSounds.Value}\n\n"));
	}
}
public class SexDollItem : MonoBehaviour
{
	private bool Clothes = true;

	public GameObject Wearings;

	public AudioSource Audio;

	public PhysGrabObjectImpactDetector SexDoll;

	private void Awake()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		SexDoll = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
		Audio = ((Component)this).GetComponent<AudioSource>();
		Wearings = ((Component)((Component)this).transform.Find("Wearings")).gameObject;
		SexDoll.onImpactMedium.AddListener((UnityAction)delegate
		{
			DisableClothes();
		});
		SexDoll.onImpactHeavy.AddListener((UnityAction)delegate
		{
			DisableClothes();
		});
	}

	public void DisableClothes()
	{
		if (Clothes)
		{
			Clothes = false;
			Audio.Play();
			Wearings.SetActive(false);
			Debug.Log((object)"Disabled Clothes");
		}
	}
}
public class WaterGunItem : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <ShootWater>d__4 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public WaterGunItem <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ShootWater>d__4(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.WaterParticles.Play();
				<>4__this.Audio.Play();
				Debug.Log((object)"ShootStarted");
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.WaterParticles.Stop();
				<>4__this.Audio.Stop();
				Debug.Log((object)"ShootComplete");
				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 PhysGrabObjectImpactDetector WaterGun;

	private ParticleSystem WaterParticles;

	private AudioSource Audio;

	private void Awake()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		WaterGun = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
		WaterParticles = ((Component)((Component)this).transform.Find("WaterParticles")).GetComponent<ParticleSystem>();
		Audio = ((Component)this).GetComponent<AudioSource>();
		WaterGun.onAllImpacts.AddListener((UnityAction)delegate
		{
			((MonoBehaviour)this).StartCoroutine(ShootWater());
		});
	}

	[IteratorStateMachine(typeof(<ShootWater>d__4))]
	public IEnumerator ShootWater()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ShootWater>d__4(0)
		{
			<>4__this = this
		};
	}
}