Decompiled source of Debby Peam v0.0.7

BepInEx/plugins/DebbyPeam/DebbyPeam.dll

Decompiled a day 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DebbyPeam.Config;
using DebbyPeam.Misc;
using DebbyPeam.Patches;
using DebbyPeam.Utils;
using HarmonyLib;
using PEAKLib.Core;
using PEAKLib.Items;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DebbyPeam")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Scan Computers")]
[assembly: AssemblyProduct("DebbyPeam")]
[assembly: AssemblyCopyright("Copyright © Scan Computers 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a4fd09a5-2078-4f37-ae81-44c02af535da")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DebbyPeam
{
	[BepInPlugin("deB.DebbyPeam", "Debby Peam", "0.0.7")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DebbyPeam : BaseUnityPlugin
	{
		internal const string modGUID = "deB.DebbyPeam";

		internal const string modName = "Debby Peam";

		internal const string modVersion = "0.0.7";

		private readonly Harmony harmony = new Harmony("deB.DebbyPeam");

		internal ManualLogSource log;

		internal ModDefinition modDefinition;

		public DebbyPeamUtils utils;

		public static DebbyPeam instance;

		public List<Item> itemsList = new List<Item>();

		public List<GameObject> miscPrefabsList = new List<GameObject>();

		internal DebbyPeamConfig ModConfig { get; private set; }

		public void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			modDefinition = ModDefinition.GetOrCreate(((BaseUnityPlugin)this).Info.Metadata);
			log = ((BaseUnityPlugin)this).Logger;
			utils = new DebbyPeamUtils();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				for (int j = 0; j < methods.Length; j++)
				{
					object[] customAttributes;
					try
					{
						customAttributes = methods[j].GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					}
					catch
					{
						continue;
					}
					if (customAttributes.Length != 0)
					{
						methods[j].Invoke(null, null);
					}
				}
			}
			PropogateLists();
			HandleContent();
			DoPatches();
			log.LogInfo((object)"Debby Peam Successfully Loaded");
		}

		public void PropogateLists()
		{
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "debbypeam"));
			string[] allAssetNames = val.GetAllAssetNames();
			for (int i = 0; i < allAssetNames.Length; i++)
			{
				string text = allAssetNames[i].Substring(0, allAssetNames[i].LastIndexOf("/"));
				if (!(text == "assets/debby peam/resources/items"))
				{
					if (text == "assets/debby peam/resources/misc")
					{
						Object obj = val.LoadAsset(allAssetNames[i]);
						GameObject val2 = (GameObject)(object)((obj is GameObject) ? obj : null);
						if (val2 != null)
						{
							miscPrefabsList.Add(val2);
						}
						else
						{
							log.LogWarning((object)("\"" + allAssetNames[i] + "\" was not a valid type, skipping."));
						}
					}
					else
					{
						log.LogWarning((object)("\"" + text + "\" is not a known asset path, skipping."));
					}
				}
				else
				{
					itemsList.Add(val.LoadAsset<GameObject>(allAssetNames[i]).GetComponent<Item>());
				}
			}
		}

		public void HandleContent()
		{
			ModConfig = new DebbyPeamConfig(((BaseUnityPlugin)this).Config, itemsList);
			HandleItems();
			HandleMisc();
		}

		public void HandleItems()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < itemsList.Count; i++)
			{
				if (!ModConfig.isItemEnabled[i].Value)
				{
					log.LogInfo((object)(itemsList[i].UIData.itemName + " item was disabled!"));
					continue;
				}
				utils.FixShaders(((Component)itemsList[i]).gameObject);
				new ItemContent(itemsList[i]).Register(modDefinition);
				log.LogDebug((object)(itemsList[i].UIData.itemName + " item was loaded!"));
			}
		}

		public void HandleMisc()
		{
			for (int i = 0; i < miscPrefabsList.Count; i++)
			{
				NetworkPrefabManager.RegisterNetworkPrefab("Misc/" + ((Object)miscPrefabsList[i]).name, miscPrefabsList[i]);
				log.LogDebug((object)(((Object)miscPrefabsList[i]).name + " prefab was loaded!"));
			}
		}

		public void DoPatches()
		{
			log.LogDebug((object)"Patching Game");
			if (ModConfig.trouserRope.Value)
			{
				harmony.PatchAll(typeof(CharacterPatches));
				harmony.PatchAll(typeof(CharacterAfflictionsPatches));
				harmony.PatchAll(typeof(CharacterCustomizationPatches));
				harmony.PatchAll(typeof(RopePatches));
				harmony.PatchAll(typeof(RopeSegmentPatches));
			}
			else
			{
				log.LogInfo((object)"Trouser Rope is disabled, skipping related patches");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DebbyPeam";

		public const string PLUGIN_NAME = "DebbyPeam";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace DebbyPeam.Utils
{
	public class DebbyPeamUtils
	{
		private readonly ManualLogSource log = DebbyPeam.instance.log;

		public Character ClosestCharacter(Vector3 pos)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Character result = null;
			float num = float.MaxValue;
			for (int i = 0; i < Character.AllCharacters.Count; i++)
			{
				float num2 = Vector3.Distance(pos, Character.AllCharacters[i].Center);
				if (num2 < num)
				{
					num = num2;
					result = Character.AllCharacters[i];
				}
			}
			return result;
		}

		public void FixShaders(GameObject gameObject)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				for (int j = 0; j < componentsInChildren[i].materials.Length; j++)
				{
					if (ItemRegistrar.PeakShaders.TryGetValue(((Object)componentsInChildren[i].materials[j].shader).name, out var value))
					{
						componentsInChildren[i].materials[j].shader = value;
					}
					else
					{
						value = Shader.Find(((Object)componentsInChildren[i].materials[j].shader).name);
						if ((Object)(object)value != (Object)null)
						{
							componentsInChildren[i].materials[j].shader = value;
						}
					}
					log.LogDebug((object)$"Attempting to fix the shaders for material \"{j}\" on object \"{((Object)((Component)componentsInChildren[i]).gameObject).name}\"");
				}
			}
			ParticleSystem[] componentsInChildren2 = gameObject.GetComponentsInChildren<ParticleSystem>();
			for (int k = 0; k < componentsInChildren2.Length; k++)
			{
				ParticleSystemRenderer component = ((Component)componentsInChildren2[k]).GetComponent<ParticleSystemRenderer>();
				for (int l = 0; l < ((Renderer)component).materials.Length; l++)
				{
					if (ItemRegistrar.PeakShaders.TryGetValue(((Object)((Renderer)component).materials[l].shader).name, out var value2))
					{
						((Renderer)component).materials[l].shader = value2;
					}
					else
					{
						value2 = Shader.Find(((Object)((Renderer)component).materials[l].shader).name);
						if ((Object)(object)value2 != (Object)null)
						{
							((Renderer)component).materials[l].shader = value2;
						}
					}
					log.LogDebug((object)$"Attempting to fix the shaders for material \"{l}\" on object \"{((Object)((Component)component).gameObject).name}\"");
				}
			}
		}
	}
}
namespace DebbyPeam.Patches
{
	[HarmonyPatch(typeof(CharacterAfflictions))]
	public static class CharacterAfflictionsPatches
	{
		[HarmonyPatch("UpdateWeight")]
		[HarmonyPostfix]
		public static void RopeWeight(CharacterAfflictions __instance)
		{
			if (DebbyPeam.instance.ModConfig.trouserRope.Value && TrouserRope.trouserRopeDictionary.ContainsKey(__instance.character))
			{
				float weightAdded = TrouserRope.trouserRopeDictionary[__instance.character].weightAdded;
				if (weightAdded > 0f)
				{
					__instance.SetStatus((STATUSTYPE)7, __instance.character.refs.afflictions.currentStatuses[7] + weightAdded);
				}
			}
		}
	}
	[HarmonyPatch(typeof(CharacterCustomization))]
	public static class CharacterCustomizationPatches
	{
		[HarmonyPatch("OnPlayerDataChange")]
		[HarmonyPostfix]
		public static void ChangeRopeColour(CharacterCustomization __instance)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if (DebbyPeam.instance.ModConfig.trouserRope.Value && TrouserRope.trouserRopeDictionary.ContainsKey(__instance._character))
			{
				TrouserRope trouserRope = TrouserRope.trouserRopeDictionary[__instance._character];
				Material[] array = (Material[])(object)new Material[2]
				{
					((Renderer)trouserRope.rope.ropeBoneVisualizer.meshRenderer).sharedMaterial,
					((Renderer)((Component)trouserRope.ropeAnchorWithRope.anchor.normalPart.transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial
				};
				for (int i = 0; i < array.Length; i++)
				{
					array[i].SetTexture("_BaseTexture", (Texture)null);
					array[i].SetColor("_Tint", __instance.PlayerColor / 2f);
					array[i].SetFloat("_HueStr1", 0.2f);
					array[i].SetColor("_BaseColor", __instance.PlayerColor);
					array[i].SetColor("_Color1", __instance.PlayerColor);
					array[i].SetColor("_Color21", __instance.PlayerColor);
					array[i].SetColor("_Color3", __instance.PlayerColor);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Character))]
	public static class CharacterPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartAddRope(Character __instance)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (PhotonNetwork.IsMasterClient && DebbyPeam.instance.ModConfig.trouserRope.Value)
			{
				Vector3 position = ((Component)__instance.GetBodypart((BodypartType)0)).transform.position;
				NetworkPrefabManager.SpawnNetworkPrefab("Misc/RopeAnchorTrouser", new Vector3(position.x, position.y - 0.65f, position.z), Quaternion.identity, (byte)0, (object[])null).GetComponent<TrouserRope>().Initialize(((MonoBehaviourPun)__instance).photonView.ViewID);
			}
		}
	}
	[HarmonyPatch(typeof(Rope))]
	public static class RopePatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void FixRopeShaders(Rope __instance)
		{
			DebbyPeam.instance.utils.FixShaders(__instance.ropeSegmentPrefab);
			DebbyPeam.instance.utils.FixShaders(__instance.remoteSegmentPrefab);
		}

		[HarmonyPatch("OnPlayerEnteredRoom")]
		[HarmonyPostfix]
		public static void PlayerJoinSync(ref Player newPlayer)
		{
			if (!PhotonNetwork.IsMasterClient || TrouserRope.trouserRopeDictionary.Count <= 0)
			{
				return;
			}
			List<Character> allCharacters = Character.AllCharacters;
			for (int i = 0; i < allCharacters.Count; i++)
			{
				if (TrouserRope.trouserRopeDictionary.ContainsKey(allCharacters[i]))
				{
					TrouserRope trouserRope = TrouserRope.trouserRopeDictionary[allCharacters[i]];
					trouserRope.photonView.RPC("InitializeRPC", newPlayer, new object[1] { ((MonoBehaviourPun)allCharacters[i]).photonView.ViewID });
					trouserRope.photonView.RPC("GetRopeRPC", newPlayer, new object[1] { ((MonoBehaviourPun)trouserRope.rope).photonView.ViewID });
				}
			}
		}
	}
	[HarmonyPatch(typeof(RopeSegment))]
	public static class RopeSegmentPatches
	{
		[HarmonyPatch("IsInteractible")]
		[HarmonyPrefix]
		public static bool NoSelfInteraction(ref bool __result, RopeSegment __instance, ref Character interactor)
		{
			if (DebbyPeam.instance.ModConfig.trouserRope.Value && TrouserRope.trouserRopeDictionary.ContainsKey(interactor))
			{
				Rope rope = TrouserRope.trouserRopeDictionary[interactor].rope;
				if ((Object)(object)rope == (Object)null)
				{
					return true;
				}
				if (rope.GetRopeSegments().Contains(((Component)__instance).transform))
				{
					__result = false;
					return false;
				}
			}
			return true;
		}
	}
}
namespace DebbyPeam.Misc
{
	public class TrouserRope : MonoBehaviour
	{
		private readonly ManualLogSource log = DebbyPeam.instance.log;

		public static Dictionary<Character, TrouserRope> trouserRopeDictionary = new Dictionary<Character, TrouserRope>();

		public PhotonView photonView;

		public Character playerOwner;

		public RopeAnchorWithRope ropeAnchorWithRope;

		public Rope rope;

		public float weightAdded;

		public float playerDragForce = 100f;

		public bool prepared;

		public void Start()
		{
			GlobalEvents.OnCharacterOwnerDisconnected = (Action<Character>)Delegate.Combine(GlobalEvents.OnCharacterOwnerDisconnected, new Action<Character>(RopeOwnerDisconnect));
		}

		public void RopeOwnerDisconnect(Character character)
		{
			if (PhotonNetwork.IsMasterClient && (Object)(object)trouserRopeDictionary[character] == (Object)(object)this)
			{
				log.LogDebug((object)("Destroying \"" + character.characterName + "\"'s trouser rope!"));
				PhotonNetwork.Destroy(((Component)this).gameObject);
			}
		}

		public void Initialize(int id)
		{
			if (Character.GetCharacterWithPhotonID(id, ref playerOwner))
			{
				PrepareRope();
				photonView.RPC("InitializeRPC", (RpcTarget)1, new object[1] { id });
			}
			else
			{
				log.LogWarning((object)"Trouser Rope failed to spawn!");
				PhotonNetwork.Destroy(((Component)this).gameObject);
			}
		}

		[PunRPC]
		public void InitializeRPC(int id)
		{
			Character.GetCharacterWithPhotonID(id, ref playerOwner);
			PrepareRope();
		}

		public void PrepareRope()
		{
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if (trouserRopeDictionary.ContainsKey(playerOwner))
			{
				trouserRopeDictionary.Remove(playerOwner);
			}
			trouserRopeDictionary.Add(playerOwner, this);
			ropeAnchorWithRope = ((Component)this).GetComponent<RopeAnchorWithRope>();
			DebbyPeam.instance.utils.FixShaders(((Component)this).gameObject);
			DebbyPeam.instance.utils.FixShaders(ropeAnchorWithRope.ropePrefab);
			if (PhotonNetwork.IsMasterClient)
			{
				ropeAnchorWithRope.ropeSegmentLength = Random.Range(2f, 10f);
				ropeAnchorWithRope.spoolOutTime = 1.5f * Mathf.Clamp(ropeAnchorWithRope.ropeSegmentLength / 5f, 1f, 2f);
				log.LogDebug((object)$"Master Client spawning rope with length: \"{ropeAnchorWithRope.ropeSegmentLength}\" and spool time of: \"{ropeAnchorWithRope.spoolOutTime}\"");
				rope = ropeAnchorWithRope.SpawnRope();
				photonView.RPC("GetRopeRPC", (RpcTarget)1, new object[1] { ((MonoBehaviourPun)rope).photonView.ViewID });
			}
			((Component)this).transform.parent = ((Component)playerOwner.GetBodypart((BodypartType)0)).transform;
			((Component)this).transform.localPosition = new Vector3(0f, -2f, 0.5f);
			log.LogDebug((object)("Setting Rope parent to player: \"" + playerOwner.characterName + "\""));
			((MonoBehaviour)this).StartCoroutine(WaitForRopeSegments());
		}

		[PunRPC]
		public void GetRopeRPC(int viewID)
		{
			rope = ((Component)PhotonView.Find(viewID)).GetComponent<Rope>();
		}

		public IEnumerator WaitForRopeSegments()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)rope != (Object)null));
			if (PhotonNetwork.IsMasterClient)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => rope.GetRopeSegments().Count > 0));
				ConfigurableJoint component = ((Component)rope.GetRopeSegments()[0]).GetComponent<ConfigurableJoint>();
				((Joint)component).connectedBody = ((Component)ropeAnchorWithRope.anchor.anchorPoint).gameObject.AddComponent<Rigidbody>();
				((Joint)component).connectedBody.constraints = (RigidbodyConstraints)14;
				((Joint)component).connectedBody.angularDamping = 0.1f;
				((Joint)component).connectedBody.linearDamping = 0.1f;
			}
			Material[] array = (Material[])(object)new Material[2]
			{
				((Renderer)rope.ropeBoneVisualizer.meshRenderer).sharedMaterial,
				((Renderer)((Component)ropeAnchorWithRope.anchor.normalPart.transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial
			};
			CharacterCustomization customization = playerOwner.refs.customization;
			foreach (Material obj in array)
			{
				obj.SetTexture("_BaseTexture", (Texture)null);
				obj.SetColor("_Tint", customization.PlayerColor / 2f);
				obj.SetFloat("_HueStr1", 0.2f);
				obj.SetColor("_BaseColor", customization.PlayerColor);
				obj.SetColor("_Color1", customization.PlayerColor);
				obj.SetColor("_Color21", customization.PlayerColor);
				obj.SetColor("_Color3", customization.PlayerColor);
			}
			prepared = true;
		}

		public void Update()
		{
			if (prepared)
			{
				float num = 0f;
				List<Character> charactersClimbing = rope.charactersClimbing;
				for (int i = 0; i < charactersClimbing.Count; i++)
				{
					num += 0.2f + charactersClimbing[i].refs.afflictions.currentStatuses[7];
				}
				if (num != weightAdded)
				{
					weightAdded = num;
				}
				if (PhotonNetwork.IsMasterClient && (Object)(object)playerOwner == (Object)null)
				{
					PhotonNetwork.Destroy(((Component)this).gameObject);
				}
			}
		}

		public void FixedUpdate()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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)
			if (PhotonNetwork.IsMasterClient && prepared && rope.charactersClimbing.Count > 0)
			{
				Vector3 val = rope.GetRopeSegments()[0].position - ((Component)playerOwner.GetBodypart((BodypartType)0)).transform.position;
				val *= playerDragForce;
				playerOwner.AddForceToBodyPart(playerOwner.GetBodypartRig((BodypartType)0), val * 0.2f, val);
			}
		}

		public void OnDestroy()
		{
			if ((Object)(object)rope != (Object)null && PhotonNetwork.IsMasterClient)
			{
				PhotonNetwork.Destroy(((Component)rope).gameObject);
			}
			if (trouserRopeDictionary.ContainsKey(playerOwner))
			{
				trouserRopeDictionary.Remove(playerOwner);
			}
		}
	}
}
namespace DebbyPeam.Items
{
	public class DebbyItem : MonoBehaviour
	{
		private readonly ManualLogSource log = DebbyPeam.instance.log;

		public Item item;

		public SFX_Instance customSFX;

		public Animator animator;

		public List<RandomAnimation> randomTimeTriggers = new List<RandomAnimation>();

		public List<Collider> colliders = new List<Collider>();

		public Transform floatPoint;

		public float floatForce;

		public float floatHeight;

		public float balanceForce;

		public float glideForce;

		public string ItemName
		{
			get
			{
				if ((Object)(object)item == (Object)null)
				{
					return ((Object)((Component)this).gameObject).name.Replace("(Clone)", "");
				}
				return item.GetItemName((ItemInstanceData)null);
			}
		}

		public virtual void Awake()
		{
			List<string> list = new List<string>
			{
				item.UIData.mainInteractPrompt,
				item.UIData.secondaryInteractPrompt,
				item.UIData.scrollInteractPrompt
			};
			list.RemoveAll((string x) => x == "");
			AddLocalizedStrings(item.UIData.itemName, list);
			if (randomTimeTriggers.Count == 0)
			{
				GenerateEvents();
			}
			IterateEvents(invoke: false);
		}

		public virtual void AddLocalizedStrings(string nameToLocalize, List<string> interactStrings = null)
		{
			for (int i = 0; i < interactStrings.Count + 1; i++)
			{
				string key;
				string text;
				if (i == interactStrings.Count)
				{
					key = LocalizedText.GetNameIndex(nameToLocalize).ToUpperInvariant();
					text = nameToLocalize;
				}
				else
				{
					key = interactStrings[i].ToUpperInvariant();
					text = interactStrings[i];
				}
				if (!LocalizedText.MAIN_TABLE.ContainsKey(key))
				{
					List<string> list = new List<string>();
					Array values = Enum.GetValues(typeof(Language));
					for (int j = 0; j < values.Length; j++)
					{
						list.Add(text);
					}
					LocalizedText.MAIN_TABLE.Add(key, list);
				}
			}
		}

		public virtual void GenerateEvents()
		{
		}

		public virtual void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient || !((Object)(object)item.rig != (Object)null) || !((Object)(object)floatPoint != (Object)null))
			{
				return;
			}
			Quaternion val = Quaternion.FromToRotation(((Component)this).transform.up, Vector3.up);
			if (balanceForce != 0f)
			{
				item.rig.AddTorque(new Vector3(val.x, val.y, val.z) * balanceForce);
			}
			if (floatForce != 0f && floatHeight > 0f)
			{
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(floatPoint.position, -Vector3.up, ref val2, floatHeight, LayerMask.GetMask(new string[1] { "Terrain" }), (QueryTriggerInteraction)1) && !colliders.Contains(((RaycastHit)(ref val2)).collider))
				{
					item.rig.AddForce(Vector3.up * (floatForce / ((RaycastHit)(ref val2)).distance) * (1.1f - Quaternion.Angle(Quaternion.identity, val) / 360f));
				}
				else if (glideForce != 0f)
				{
					item.rig.AddForce(((Component)this).transform.up * glideForce * (1.1f - Quaternion.Angle(Quaternion.identity, val) / 360f));
				}
			}
		}

		public virtual void Update()
		{
			if (PhotonNetwork.IsMasterClient)
			{
				IterateEvents();
			}
		}

		public void IterateEvents(bool invoke = true)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < randomTimeTriggers.Count; i++)
			{
				RandomAnimation randomAnimation = randomTimeTriggers[i];
				if (!randomAnimation.triggerableStates.Contains(item.itemState))
				{
					continue;
				}
				randomAnimation.timer -= Time.deltaTime;
				if (randomAnimation.timer <= 0f)
				{
					if (invoke)
					{
						log.LogDebug((object)$"\"{ItemName}\" triggered timed effect \"{i}\" during state: \"{item.itemState}\"");
						AnimSync(randomAnimation);
					}
					randomAnimation.timer = Random.Range(randomAnimation.minimumTime, randomAnimation.maximumTime);
				}
			}
		}

		public void AnimSync(RandomAnimation trigger)
		{
			object obj = string.Empty;
			if ((Object)(object)animator != (Object)null)
			{
				switch (trigger.animationValueType)
				{
				case ValueType.Integer:
					if (trigger.animationValue == string.Empty)
					{
						trigger.animationValue = "0";
					}
					obj = int.Parse(trigger.animationValue);
					if (trigger.randomValue)
					{
						obj = Random.Range(Mathf.FloorToInt(trigger.randomMin), Mathf.CeilToInt(trigger.randomMax));
					}
					break;
				case ValueType.Float:
					if (trigger.animationValue == string.Empty)
					{
						trigger.animationValue = "0";
					}
					obj = float.Parse(trigger.animationValue);
					if (trigger.randomValue)
					{
						obj = Random.Range(trigger.randomMin, trigger.randomMax);
					}
					break;
				case ValueType.Boolean:
					if (trigger.animationValue == string.Empty)
					{
						trigger.animationValue = "false";
					}
					obj = bool.Parse(trigger.animationValue);
					if (trigger.randomValue)
					{
						obj = Random.Range(0, 2) == 1;
					}
					break;
				}
				((MonoBehaviourPun)item).photonView.RPC("AnimSyncRPC", (RpcTarget)0, new object[2] { trigger.animationName, obj });
			}
			else
			{
				log.LogWarning((object)("\"" + ItemName + "\" tried to use an animation but did not have an Animator!"));
			}
		}

		[PunRPC]
		public void AnimSyncRPC(string animName, object value = null)
		{
			if (!(value is bool flag))
			{
				if (!(value is int num))
				{
					if (value is float num2)
					{
						animator.SetFloat(animName, num2);
					}
					else
					{
						animator.SetTrigger(animName);
					}
				}
				else
				{
					animator.SetInteger(animName, num);
				}
			}
			else
			{
				animator.SetBool(animName, flag);
			}
			log.LogDebug((object)$"\"{ItemName}\" syncing animation \"{animName}\" with value \"{value}\"");
		}

		public virtual void PlaySFX()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			customSFX.Play(((Component)this).transform.position);
		}
	}
	[Serializable]
	public class RandomAnimation
	{
		public float timer;

		public float minimumTime = 1f;

		public float maximumTime = 2f;

		public List<ItemState> triggerableStates = new List<ItemState>();

		public ValueType animationValueType;

		public string animationName = "";

		public string animationValue = string.Empty;

		public bool randomValue;

		public float randomMin;

		public float randomMax = 1f;
	}
	public enum ValueType
	{
		None,
		Integer,
		Float,
		Boolean
	}
	public class Hellgato : DebbyItem
	{
		public Character closestCharacter;

		public float forceTowards = 20f;

		public override void GenerateEvents()
		{
			base.GenerateEvents();
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 3f,
				maximumTime = 7f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.None,
				animationName = "Ear Flick",
				animationValue = string.Empty,
				randomValue = false,
				randomMin = 0f,
				randomMax = 0f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 2f,
				maximumTime = 5f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.None,
				animationName = "Blink",
				animationValue = string.Empty,
				randomValue = false,
				randomMin = 0f,
				randomMax = 0f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 3f,
				maximumTime = 5f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.None,
				animationName = "Paw Twitch",
				animationValue = string.Empty,
				randomValue = false,
				randomMin = 0f,
				randomMax = 0f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 0.5f,
				maximumTime = 1f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.Integer,
				animationName = "Ear Side",
				animationValue = string.Empty,
				randomValue = true,
				randomMin = 0f,
				randomMax = 1.5f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 0.5f,
				maximumTime = 1f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.Integer,
				animationName = "Paw Side",
				animationValue = string.Empty,
				randomValue = true,
				randomMin = 0f,
				randomMax = 3.5f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 7.5f,
				maximumTime = 15f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.None,
				animationName = "Meow",
				animationValue = string.Empty,
				randomValue = false,
				randomMin = 0f,
				randomMax = 0f
			});
			randomTimeTriggers.Add(new RandomAnimation
			{
				timer = 0f,
				minimumTime = 5f,
				maximumTime = 10f,
				triggerableStates = new List<ItemState>
				{
					(ItemState)0,
					(ItemState)1,
					(ItemState)2
				},
				animationValueType = ValueType.None,
				animationName = "Closest Player Check",
				animationValue = string.Empty,
				randomValue = false,
				randomMin = 0f,
				randomMax = 0f
			});
		}

		public override void FixedUpdate()
		{
			//IL_003d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			if (PhotonNetwork.IsMasterClient && (Object)(object)item.rig != (Object)null && (Object)(object)closestCharacter != (Object)null)
			{
				Vector3 val = closestCharacter.Center - ((Component)this).transform.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				Quaternion val2 = Quaternion.FromToRotation(((Component)this).transform.forward, -normalized);
				item.rig.AddTorque(new Vector3(val2.x, val2.y, val2.z) * balanceForce);
				val = new Vector3(normalized.x, 0f, normalized.z);
				Vector3 normalized2 = ((Vector3)(ref val)).normalized;
				item.rig.AddForce(normalized2 * forceTowards);
			}
		}

		public void ClosestPlayerCheck()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			closestCharacter = DebbyPeam.instance.utils.ClosestCharacter(((Component)this).transform.position);
		}
	}
}
namespace DebbyPeam.Config
{
	public class DebbyPeamConfig
	{
		private readonly ManualLogSource log = DebbyPeam.instance.log;

		internal readonly ConfigEntry<bool> trouserRope;

		internal readonly List<ConfigEntry<bool>> isItemEnabled = new List<ConfigEntry<bool>>();

		internal DebbyPeamConfig(ConfigFile cfg, List<Item> itemsList)
		{
			cfg.SaveOnConfigSet = false;
			trouserRope = cfg.Bind<bool>("Miscellaneous", "Enable Trouser Ropes?", false, "When true players will spawn in with a rope attached to them");
			log.LogDebug((object)"Added config for Trouser Rope");
			for (int i = 0; i < itemsList.Count; i++)
			{
				isItemEnabled.Add(cfg.Bind<bool>("Items", "Enable " + itemsList[i].UIData.itemName + "?", true, (ConfigDescription)null));
				log.LogDebug((object)("Added config for \"" + itemsList[i].UIData.itemName + "\""));
			}
			ClearOrphanedEntries(cfg);
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			((Dictionary<ConfigDefinition, string>)AccessTools.Property(typeof(ConfigFile), "OrphanedEntries").GetValue(cfg)).Clear();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}