Decompiled source of DampMineValuablesGeneric v0.0.1

DragonClawLib.dll

Decompiled 12 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("DragonClaw")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8b581406dea54b706ce28151e34aaeb014347d32")]
[assembly: AssemblyProduct("DragonClawLib")]
[assembly: AssemblyTitle("DragonClawLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
	[CompilerGenerated]
	[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;
		}
	}
}
public class CastingPot : MonoBehaviour, IPunObservable
{
	[Header("Pot Settings")]
	public Transform pivot;

	public HingeJoint pivotHinge;

	public float pourThresholdAngle = 60f;

	public bool hasPoured = false;

	[Header("Tray & Metal")]
	public CastingTray tray;

	public MoltenMetal moltenMetalPreset;

	private float initialRotation;

	public PhotonView photonView;

	private void Awake()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		photonView = ((Component)this).GetComponent<PhotonView>();
		if ((Object)(object)pivot != (Object)null)
		{
			initialRotation = pivot.localEulerAngles.x;
		}
	}

	private void Update()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		if (!CanPour())
		{
			return;
		}
		float x = pivot.localEulerAngles.x;
		float num = Mathf.DeltaAngle(initialRotation, x);
		if (!hasPoured && Mathf.Abs(num) >= pourThresholdAngle && tray.containedValuables.Count == 1)
		{
			if (SemiFunc.IsMultiplayer())
			{
				photonView.RPC("TriggerCasting", (RpcTarget)0, Array.Empty<object>());
			}
			else
			{
				TriggerCasting();
			}
		}
	}

	private bool CanPour()
	{
		return (Object)(object)pivot != (Object)null && (Object)(object)pivotHinge != (Object)null;
	}

	public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
	{
		if (stream.IsWriting)
		{
			stream.SendNext((object)hasPoured);
		}
		else
		{
			hasPoured = (bool)stream.ReceiveNext();
		}
	}

	[PunRPC]
	private void TriggerCasting()
	{
		if (!hasPoured)
		{
			hasPoured = true;
			tray.ApplyCastingToAll(moltenMetalPreset);
			tray.UpdateIndicatorColor();
			tray.PlayPouringVisuals();
			tray.DisableHurtCollider();
		}
	}
}
public class CastingTray : MonoBehaviour
{
	[Header("Allowed Volume Types")]
	public List<Type> allowedVolumeTypes = new List<Type>();

	public CastingPot castingPot;

	public string materialNameSkip;

	public GameObject hurtCollider;

	public List<ValuableObject> containedValuables = new List<ValuableObject>();

	private Dictionary<ValuableObject, int> colliderCounts = new Dictionary<ValuableObject, int>();

	[Header("Pour Visuals")]
	public List<GameObject> pourVisuals;

	public Transform liquidLayer;

	public float pourDepth = 0.5f;

	public float pourDuration = 1.5f;

	private Material instancedLiquidMaterial;

	private Material liquidLayerMaterialInstance;

	private Renderer liquidLayerRenderer;

	[SerializeField]
	private float fadeDuration = 0.5f;

	[SerializeField]
	private string transparencyProperty = "_Transparency";

	[Header("Indicator Lamps")]
	public List<Renderer> indicatorLampRenderers = new List<Renderer>();

	public Color redEmission = Color.red;

	public Color orangeEmission = new Color(1f, 0.5f, 0f);

	public Color greenEmission = Color.green;

	private Color lastAppliedEmission = Color.clear;

	private List<Material> indicatorMaterialInstances = new List<Material>();

	private void Start()
	{
		InitializeIndicatorLamps();
		UpdateIndicatorColor();
		PourVisualsInitialize();
	}

	private void InitializeIndicatorLamps()
	{
		indicatorMaterialInstances.Clear();
		foreach (Renderer indicatorLampRenderer in indicatorLampRenderers)
		{
			if (!((Object)(object)indicatorLampRenderer == (Object)null))
			{
				Material material = indicatorLampRenderer.material;
				indicatorMaterialInstances.Add(material);
			}
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		ValuableObject componentInParent = ((Component)other).GetComponentInParent<ValuableObject>();
		if ((Object)(object)componentInParent == (Object)null || (allowedVolumeTypes.Count > 0 && !allowedVolumeTypes.Contains(componentInParent.volumeType)))
		{
			return;
		}
		MeshRenderer[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<MeshRenderer>();
		MeshRenderer[] array = componentsInChildren;
		foreach (MeshRenderer val in array)
		{
			Material[] sharedMaterials = ((Renderer)val).sharedMaterials;
			foreach (Material val2 in sharedMaterials)
			{
				if (!((Object)(object)val2 == (Object)null) && ((Object)val2).name.StartsWith(materialNameSkip))
				{
					return;
				}
			}
		}
		if (!colliderCounts.ContainsKey(componentInParent))
		{
			colliderCounts[componentInParent] = 0;
		}
		colliderCounts[componentInParent]++;
		if (!containedValuables.Contains(componentInParent))
		{
			containedValuables.Add(componentInParent);
			ValuableDestructionWatcher valuableDestructionWatcher = ((Component)componentInParent).GetComponent<ValuableDestructionWatcher>();
			if ((Object)(object)valuableDestructionWatcher == (Object)null)
			{
				valuableDestructionWatcher = ((Component)componentInParent).gameObject.AddComponent<ValuableDestructionWatcher>();
			}
			if ((Object)(object)valuableDestructionWatcher.tray != (Object)(object)this)
			{
				valuableDestructionWatcher.tray = this;
			}
			valuableDestructionWatcher.valuable = componentInParent;
		}
		UpdateIndicatorColor();
	}

	private void OnTriggerExit(Collider other)
	{
		ValuableObject componentInParent = ((Component)other).GetComponentInParent<ValuableObject>();
		if (!((Object)(object)componentInParent == (Object)null) && colliderCounts.ContainsKey(componentInParent))
		{
			colliderCounts[componentInParent]--;
			if (colliderCounts[componentInParent] <= 0)
			{
				containedValuables.Remove(componentInParent);
				colliderCounts.Remove(componentInParent);
				UpdateIndicatorColor();
			}
		}
	}

	public void OnValuableDestroyed(ValuableObject valuable)
	{
		containedValuables.Remove(valuable);
		colliderCounts.Remove(valuable);
		UpdateIndicatorColor();
	}

	public void UpdateIndicatorColor()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: 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_0087: 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_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: 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_009d: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		if (indicatorMaterialInstances.Count == 0)
		{
			return;
		}
		Color val = (((Object)(object)castingPot != (Object)null && castingPot.hasPoured) ? Color.black : ((containedValuables.Count == 0) ? redEmission : ((containedValuables.Count != 1) ? orangeEmission : greenEmission)));
		if (val == lastAppliedEmission)
		{
			return;
		}
		lastAppliedEmission = val;
		foreach (Material indicatorMaterialInstance in indicatorMaterialInstances)
		{
			if (!((Object)(object)indicatorMaterialInstance == (Object)null))
			{
				indicatorMaterialInstance.SetColor("_Color", (val == Color.black) ? Color.white : val);
				indicatorMaterialInstance.SetColor("_EmissionColor", val);
			}
		}
	}

	public void ApplyCastingToAll(MoltenMetal metal)
	{
		foreach (ValuableObject containedValuable in containedValuables)
		{
			ApplyMoltenEffect(containedValuable, metal);
			UpdateImpactDetector(containedValuable);
		}
	}

	private void ApplyMoltenEffect(ValuableObject obj, MoltenMetal moltenMetalPreset)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		MeshRenderer[] componentsInChildren = ((Component)obj).GetComponentsInChildren<MeshRenderer>(true);
		MeshRenderer[] array = componentsInChildren;
		foreach (MeshRenderer val in array)
		{
			Material[] array2 = (Material[])(object)new Material[((Renderer)val).sharedMaterials.Length];
			for (int j = 0; j < array2.Length; j++)
			{
				Material val2 = ((Renderer)val).sharedMaterials[j];
				if ((Object)(object)val2 == (Object)null)
				{
					array2[j] = null;
					continue;
				}
				Material val3 = new Material(val2);
				((Object)val3).name = ((Object)moltenMetalPreset.castedMaterial).name;
				val3.shader = moltenMetalPreset.castedMaterial.shader;
				val3.SetFloat("_Overlay_Albedo_Intensity", moltenMetalPreset.castedMaterial.GetFloat("_Overlay_Albedo_Intensity"));
				val3.SetFloat("_Overlay_Effects_Intensity", moltenMetalPreset.castedMaterial.GetFloat("_Overlay_Effects_Intensity"));
				val3.SetTexture("_Overlay_Albedo", moltenMetalPreset.castedMaterial.GetTexture("_Overlay_Albedo"));
				val3.SetColor("_Overlay_Color", moltenMetalPreset.castedMaterial.GetColor("_Overlay_Color"));
				val3.SetTexture("_Overlay_Metallic", moltenMetalPreset.castedMaterial.GetTexture("_Overlay_Metallic"));
				val3.SetTexture("_Overlay_Normal", moltenMetalPreset.castedMaterial.GetTexture("_Overlay_Normal"));
				val3.SetTexture("_Overlay_Roughness", moltenMetalPreset.castedMaterial.GetTexture("_Overlay_Roughness"));
				val3.SetFloat("_Overlay_Emission_Strength", moltenMetalPreset.castedMaterial.GetFloat("_Overlay_Emission_Strength"));
				val3.SetTexture("_Overlay_Emission", moltenMetalPreset.castedMaterial.GetTexture("_Overlay_Emission"));
				val3.SetColor("_Overlay_EmissionColor", moltenMetalPreset.castedMaterial.GetColor("_Overlay_EmissionColor"));
				if (val3.HasProperty("_Brightness_Minimum"))
				{
					val3.SetFloat("_Brightness_Minimum", moltenMetalPreset.castedMaterial.GetFloat("_Brightness_Minimum"));
				}
				if (val3.HasProperty("_Brightness_Maximum"))
				{
					val3.SetFloat("_Brightness_Maximum", moltenMetalPreset.castedMaterial.GetFloat("_Brightness_Maximum"));
				}
				if (val3.HasProperty("_Pulse_Speed"))
				{
					val3.SetFloat("_Pulse_Speed", moltenMetalPreset.castedMaterial.GetFloat("_Pulse_Speed"));
				}
				if (val2.HasProperty("_Metallic"))
				{
					if (val2.GetFloat("_Metallic") > val3.GetFloat("_Metallic"))
					{
						val3.SetFloat("_Metallic", val2.GetFloat("_Metallic"));
					}
					else
					{
						val3.SetFloat("_Metallic", moltenMetalPreset.castedMaterial.GetFloat("_Metallic"));
					}
				}
				if (val2.HasProperty("_BumpScale"))
				{
					if (val2.GetFloat("_BumpScale") > val3.GetFloat("_BumpScale"))
					{
						val3.SetFloat("_BumpScale", val2.GetFloat("_BumpScale"));
					}
					else
					{
						val3.SetFloat("_BumpScale", moltenMetalPreset.castedMaterial.GetFloat("_BumpScale"));
					}
				}
				if (val2.HasProperty("_GlossMapScale"))
				{
					if (val2.GetFloat("_GlossMapScale") > val3.GetFloat("_GlossMapScale"))
					{
						val3.SetFloat("_GlossMapScale", val2.GetFloat("_GlossMapScale"));
					}
					else
					{
						val3.SetFloat("_GlossMapScale", moltenMetalPreset.castedMaterial.GetFloat("_GlossMapScale"));
					}
				}
				array2[j] = val3;
			}
			((Renderer)val).materials = array2;
		}
		obj.dollarValueCurrent *= moltenMetalPreset.valueMultiplier;
		obj.durabilityPreset = moltenMetalPreset.castedDurability;
		obj.audioPreset = moltenMetalPreset.castedAudioPreset;
		obj.particleColors = moltenMetalPreset.castedParticleGradient;
		if (obj.physAttributePreset.mass < moltenMetalPreset.castedPhysAttribute.mass)
		{
			obj.physAttributePreset = moltenMetalPreset.castedPhysAttribute;
			((Component)obj).gameObject.GetComponent<Rigidbody>().mass = obj.physAttributePreset.mass;
		}
	}

	private void UpdateImpactDetector(ValuableObject valuable)
	{
		PhysGrabObjectImpactDetector component = ((Component)valuable).GetComponent<PhysGrabObjectImpactDetector>();
		if (!((Object)(object)component == (Object)null))
		{
			component.durability = valuable.durabilityPreset.durability;
			component.fragility = valuable.durabilityPreset.fragility;
			component.impactAudio = valuable.audioPreset;
			component.impactAudioPitch = valuable.audioPresetPitch;
			if ((Object)(object)component.particles != (Object)null)
			{
				component.particles.gradient = valuable.particleColors;
			}
		}
	}

	public void DisableHurtCollider()
	{
		hurtCollider.SetActive(false);
	}

	public void PlayPouringVisuals()
	{
		((MonoBehaviour)this).StartCoroutine(PourVisualCoroutine());
	}

	private void PourVisualsInitialize()
	{
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		Renderer val = default(Renderer);
		foreach (GameObject pourVisual in pourVisuals)
		{
			if ((Object)(object)pourVisual != (Object)null && pourVisual.TryGetComponent<Renderer>(ref val))
			{
				if ((Object)(object)instancedLiquidMaterial == (Object)null)
				{
					instancedLiquidMaterial = new Material(val.sharedMaterial);
				}
				val.material = instancedLiquidMaterial;
			}
			if ((Object)(object)pourVisual != (Object)null)
			{
				pourVisual.SetActive(false);
			}
		}
		if ((Object)(object)liquidLayer != (Object)null)
		{
			liquidLayerRenderer = ((Component)liquidLayer).GetComponent<Renderer>();
			if ((Object)(object)liquidLayerRenderer != (Object)null)
			{
				liquidLayerMaterialInstance = new Material(liquidLayerRenderer.sharedMaterial);
				liquidLayerRenderer.material = liquidLayerMaterialInstance;
			}
		}
	}

	private IEnumerator PourVisualCoroutine()
	{
		foreach (GameObject obj in pourVisuals)
		{
			if ((Object)(object)obj != (Object)null)
			{
				obj.SetActive(true);
			}
		}
		if ((Object)(object)instancedLiquidMaterial != (Object)null)
		{
			float tFadeIn = 0f;
			while (tFadeIn < fadeDuration)
			{
				tFadeIn += Time.deltaTime;
				float alpha = Mathf.Lerp(0f, 1f, tFadeIn / fadeDuration);
				instancedLiquidMaterial.SetFloat(transparencyProperty, alpha);
				yield return null;
			}
			instancedLiquidMaterial.SetFloat(transparencyProperty, 1f);
		}
		if ((Object)(object)liquidLayer != (Object)null)
		{
			Vector3 start = liquidLayer.localPosition;
			Vector3 target = start - new Vector3(0f, pourDepth, 0f);
			float t = 0f;
			while (t < pourDuration)
			{
				t += Time.deltaTime;
				float progress = Mathf.Clamp01(t / pourDuration);
				liquidLayer.localPosition = Vector3.Lerp(start, target, progress);
				if ((Object)(object)instancedLiquidMaterial != (Object)null)
				{
					float alpha2 = Mathf.Lerp(1f, 0f, progress);
					instancedLiquidMaterial.SetFloat(transparencyProperty, alpha2);
				}
				if ((Object)(object)liquidLayerMaterialInstance != (Object)null)
				{
					float alpha3 = Mathf.Lerp(1f, 0f, progress);
					liquidLayerMaterialInstance.SetFloat(transparencyProperty, alpha3);
				}
				yield return null;
			}
			liquidLayer.localPosition = target;
			if ((Object)(object)instancedLiquidMaterial != (Object)null)
			{
				instancedLiquidMaterial.SetFloat(transparencyProperty, 0f);
			}
			if ((Object)(object)liquidLayerMaterialInstance != (Object)null)
			{
				liquidLayerMaterialInstance.SetFloat(transparencyProperty, 0f);
			}
		}
		yield return (object)new WaitForSeconds(1f);
		foreach (GameObject obj2 in pourVisuals)
		{
			if ((Object)(object)obj2 != (Object)null)
			{
				obj2.SetActive(false);
			}
		}
	}
}
public static class CoroutineRunner
{
	private class Runner : MonoBehaviour
	{
	}

	private static Runner _runner;

	public static Coroutine Run(IEnumerator coroutine)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		if ((Object)(object)_runner == (Object)null)
		{
			GameObject val = new GameObject("CoroutineRunner");
			Object.DontDestroyOnLoad((Object)(object)val);
			_runner = val.AddComponent<Runner>();
			((Object)_runner).hideFlags = (HideFlags)61;
		}
		return ((MonoBehaviour)_runner).StartCoroutine(coroutine);
	}
}
public class EntranceModuleAssetInjector : MonoBehaviour
{
	[Header("Mappings (assign in prefab / bundle)")]
	public RoomOutlineMappingAsset outlineMapping;

	public LevelAmbienceMappingAsset ambienceMapping;

	private bool injected;

	private void Awake()
	{
		TryInject();
	}

	private IEnumerator Start()
	{
		for (int i = 0; i < 20; i++)
		{
			if (TryInject())
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(0.25f);
		}
		Debug.LogWarning((object)"[EntranceInjector] Failed to inject after retries.");
	}

	private bool TryInject()
	{
		if (injected)
		{
			return true;
		}
		if ((Object)(object)Map.Instance == (Object)null || (Object)(object)AudioManager.instance == (Object)null)
		{
			return false;
		}
		int num = 0;
		int num2 = 0;
		if ((Object)(object)outlineMapping != (Object)null)
		{
			foreach (RoomVolumeOutlineCustom customOutline in outlineMapping.customOutlines)
			{
				if (!Map.Instance.RoomVolumeOutlineCustoms.Contains(customOutline))
				{
					Map.Instance.RoomVolumeOutlineCustoms.Add(customOutline);
					num++;
				}
			}
		}
		if ((Object)(object)ambienceMapping != (Object)null)
		{
			foreach (LevelAmbience customAmbience in ambienceMapping.customAmbiences)
			{
				if (!AudioManager.instance.levelAmbiences.Contains(customAmbience))
				{
					AudioManager.instance.levelAmbiences.Add(customAmbience);
					num2++;
				}
			}
		}
		injected = true;
		Debug.Log((object)$"[EntranceInjector] Injected {num} outlines, {num2} ambiences");
		return true;
	}
}
[CreateAssetMenu(menuName = "REPO Mod/Level Ambience Mapping", fileName = "LevelAmbienceMappingAsset")]
public class LevelAmbienceMappingAsset : ScriptableObject
{
	public List<LevelAmbience> customAmbiences = new List<LevelAmbience>();
}
[CreateAssetMenu(fileName = "NewMoltenMetal", menuName = "Phys Object/Molten Metal", order = 2)]
public class MoltenMetal : ScriptableObject
{
	[Header("Value Modification")]
	[Tooltip("Multiplier applied to the object's base value (e.g., 1.1 for +10%)")]
	public float valueMultiplier = 1.1f;

	[Header("Visual Replacement")]
	[Tooltip("Material that replaces the object's opaque parts")]
	public Material castedMaterial;

	[Header("Durability Replacement")]
	[Tooltip("Durability preset to replace the durability")]
	public Durability castedDurability;

	[Header("PhysAttribute Replacement")]
	[Tooltip("PhysAttribute to replace the physics properties like mass")]
	public PhysAttribute castedPhysAttribute;

	[Header("Audio Replacement")]
	[Tooltip("Audio replacement for physical properties")]
	public PhysAudio castedAudioPreset;

	[Header("Impact Particle Gradient Replacement")]
	[Tooltip("Gradient that replaces the particle colors for impacts")]
	public Gradient castedParticleGradient;
}
public class PotionWobble : MonoBehaviour
{
	[SerializeField]
	private Renderer rend;

	[SerializeField]
	private Rigidbody rb;

	[Header("Spring")]
	[Tooltip("How strongly the system pulls the wobble back toward its rest position. Higher values make the liquid respond faster and feel more rigid; lower values make it feel heavier and more sluggish.")]
	[SerializeField]
	private float stiffness = 35f;

	[Tooltip("How quickly motion energy is lost over time. Higher values dampen oscillations faster (less slosh), lower values allow longer, more fluid-like wobble.")]
	[SerializeField]
	private float damping = 6f;

	[Tooltip("Scales how much velocity/rotation is converted into wobble energy. Higher values make small movements cause stronger sloshing; lower values make the system more subtle.")]
	[SerializeField]
	private float inputStrength = 0.02f;

	[Tooltip("Maximum allowed wobble amplitude. Prevents extreme motion and keeps the effect visually stable and contained.")]
	[SerializeField]
	private float maxWobble = 0.05f;

	private Vector2 wobble;

	private Vector2 wobbleVelocity;

	private Vector2 target;

	private Vector3 lastPos;

	private Quaternion lastRot;

	private MaterialPropertyBlock mpb;

	private static readonly int WobbleID = Shader.PropertyToID("_Wobble");

	private void Awake()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0013: 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)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		mpb = new MaterialPropertyBlock();
		lastPos = ((Component)this).transform.position;
		lastRot = ((Component)this).transform.rotation;
	}

	private void Update()
	{
		//IL_005b: 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_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_0078: 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)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		float deltaTime = Time.deltaTime;
		if (!(deltaTime <= 0f))
		{
			Vector3 val;
			Vector3 val2;
			if (Object.op_Implicit((Object)(object)rb))
			{
				val = rb.velocity;
				val2 = rb.angularVelocity * 57.29578f;
			}
			else
			{
				val = (((Component)this).transform.position - lastPos) / deltaTime;
				Quaternion val3 = ((Component)this).transform.rotation * Quaternion.Inverse(lastRot);
				float num = default(float);
				Vector3 val4 = default(Vector3);
				((Quaternion)(ref val3)).ToAngleAxis(ref num, ref val4);
				val2 = val4 * num / deltaTime;
				lastPos = ((Component)this).transform.position;
				lastRot = ((Component)this).transform.rotation;
			}
			target += new Vector2(val.x + val2.z * 0.2f, val.z + val2.x * 0.2f) * inputStrength;
			target = Vector2.ClampMagnitude(target, maxWobble);
			Vector2 val5 = (target - wobble) * stiffness;
			wobbleVelocity += val5 * deltaTime;
			wobbleVelocity *= Mathf.Exp((0f - damping) * deltaTime);
			wobble += wobbleVelocity * deltaTime;
			target = Vector2.Lerp(target, Vector2.zero, 1.5f * deltaTime);
			rend.GetPropertyBlock(mpb);
			mpb.SetVector(WobbleID, Vector4.op_Implicit(wobble));
			rend.SetPropertyBlock(mpb);
		}
	}
}
[RequireComponent(typeof(Projector))]
public class ProjectorBoundsUpdater : MonoBehaviour
{
	private void Awake()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		//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_0036: 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)
		Projector component = ((Component)this).GetComponent<Projector>();
		component.material = new Material(component.material);
		Vector3 position = ((Component)this).transform.parent.position;
		component.material.SetFloat("_OffsetX", position.x);
		component.material.SetFloat("_OffsetZ", position.z);
	}
}
[CreateAssetMenu(menuName = "REPO Mod/Room Outline Mapping", fileName = "RoomOutlineMappingAsset")]
public class RoomOutlineMappingAsset : ScriptableObject
{
	public List<RoomVolumeOutlineCustom> customOutlines = new List<RoomVolumeOutlineCustom>();
}
public class StatsModifierPart : MonoBehaviour
{
	[Header("Value")]
	[Tooltip("Percentage that this part adds to the base value of the item.")]
	public float valueModifier = 0f;

	[Header("Particle Colors")]
	[Tooltip("Should this part override the particle colors?")]
	public bool overrideParticleColors = false;

	[Tooltip("Particle colors to use if overriding.")]
	public Gradient particleColors;
}
public class ValuableDestructionWatcher : MonoBehaviour
{
	public CastingTray tray;

	public ValuableObject valuable;

	private void OnDestroy()
	{
		if ((Object)(object)tray != (Object)null && (Object)(object)valuable != (Object)null)
		{
			tray.OnValuableDestroyed(valuable);
		}
	}
}
namespace DragonClawLib
{
	public class CustomValuableLogic : MonoBehaviour
	{
		public Material defaultMaterial;

		public Material heldMaterial;

		private Renderer objectRenderer;

		private PhysGrabObject physGrabObject;

		private PhotonView photonView;

		private bool isHeld = false;

		private void Start()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			objectRenderer = ((Component)this).GetComponentInChildren<Renderer>();
			ApplyMaterial(defaultMaterial);
		}

		private void Update()
		{
			if (!SemiFunc.IsMultiplayer())
			{
				UpdateHeldStateLocal();
			}
			else if (photonView.IsMine)
			{
				CheckHeldStateMultiplayer();
			}
		}

		private void UpdateHeldStateLocal()
		{
			bool flag = PhysGrabber.instance.grabbed && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject;
			if (flag != isHeld)
			{
				isHeld = flag;
				ApplyMaterial(isHeld ? heldMaterial : defaultMaterial);
			}
		}

		private void CheckHeldStateMultiplayer()
		{
			bool flag = PhysGrabber.instance.grabbed && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject;
			if (flag != isHeld)
			{
				isHeld = flag;
				photonView.RPC("SyncHeldMaterial", (RpcTarget)0, new object[1] { isHeld });
			}
		}

		[PunRPC]
		public void SyncHeldMaterial(bool held)
		{
			ApplyMaterial(held ? heldMaterial : defaultMaterial);
		}

		private void ApplyMaterial(Material mat)
		{
			if ((Object)(object)objectRenderer != (Object)null && (Object)(object)mat != (Object)null)
			{
				objectRenderer.material = mat;
			}
		}
	}
	public static class MeshGenerator
	{
		private static Mesh frustumMesh;

		public static Mesh GetFrustumMesh(float fov, float aspect, float near, float far)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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)
			if ((Object)(object)frustumMesh != (Object)null)
			{
				return frustumMesh;
			}
			frustumMesh = new Mesh();
			((Object)frustumMesh).name = "ProjectorFrustum";
			float num = Mathf.Tan(MathF.PI / 180f * fov * 0.5f);
			float num2 = num * near * 2f;
			float num3 = num2 * aspect;
			float num4 = num * far * 2f;
			float num5 = num4 * aspect;
			Vector3[] vertices = (Vector3[])(object)new Vector3[8]
			{
				new Vector3((0f - num3) / 2f, (0f - num2) / 2f, 0f - near),
				new Vector3(num3 / 2f, (0f - num2) / 2f, 0f - near),
				new Vector3(num3 / 2f, num2 / 2f, 0f - near),
				new Vector3((0f - num3) / 2f, num2 / 2f, 0f - near),
				new Vector3((0f - num5) / 2f, (0f - num4) / 2f, 0f - far),
				new Vector3(num5 / 2f, (0f - num4) / 2f, 0f - far),
				new Vector3(num5 / 2f, num4 / 2f, 0f - far),
				new Vector3((0f - num5) / 2f, num4 / 2f, 0f - far)
			};
			int[] triangles = new int[36]
			{
				0, 2, 1, 0, 3, 2, 4, 5, 6, 4,
				6, 7, 0, 1, 5, 0, 5, 4, 2, 3,
				7, 2, 7, 6, 1, 2, 6, 1, 6, 5,
				3, 0, 4, 3, 4, 7
			};
			frustumMesh.vertices = vertices;
			frustumMesh.triangles = triangles;
			frustumMesh.RecalculateNormals();
			return frustumMesh;
		}
	}
	public class ModularValuableBuilder : MonoBehaviourPun
	{
		private Rigidbody rb;

		[Header("Names of child parts (e.g., Valuable_Slot_Blade, Valuable_Slot_Guard, Valuable_Slot_Hilt)")]
		public List<string> partGroupNames = new List<string>();

		private bool buildOnAwake = true;

		private void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)rb != (Object)null)
			{
				rb.useGravity = false;
				rb.isKinematic = true;
			}
			if (buildOnAwake && SemiFunc.IsMasterClientOrSingleplayer())
			{
				BuildAndSyncParts();
			}
		}

		private void Start()
		{
			buildOnAwake = false;
			if ((Object)(object)rb != (Object)null)
			{
				rb.useGravity = true;
				rb.isKinematic = false;
			}
		}

		public void BuildAndSyncParts()
		{
			List<int> list = new List<int>();
			foreach (string partGroupName in partGroupNames)
			{
				Transform val = ((Component)this).transform.Find(partGroupName);
				if ((Object)(object)val == (Object)null || val.childCount == 0)
				{
					Debug.LogWarning((object)("[ModularBuilder] Missing or empty group '" + partGroupName + "'"));
					list.Add(-1);
				}
				else
				{
					int num = Random.Range(0, val.childCount);
					list.Add(num);
					EnableOnly(val, num);
				}
			}
			((MonoBehaviourPun)this).photonView.RPC("RPC_SyncParts", (RpcTarget)4, new object[1] { list.ToArray() });
			FinalizeBuild();
		}

		[PunRPC]
		private void RPC_SyncParts(int[] selectedIndexes)
		{
			for (int i = 0; i < partGroupNames.Count && i < selectedIndexes.Length; i++)
			{
				Transform val = ((Component)this).transform.Find(partGroupNames[i]);
				int num = selectedIndexes[i];
				if (!((Object)(object)val == (Object)null) && num >= 0 && num < val.childCount)
				{
					EnableOnly(val, num);
				}
			}
			FinalizeBuild();
		}

		private void EnableOnly(Transform group, int index)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			foreach (Transform item in group)
			{
				Transform val = item;
				((Component)val).gameObject.SetActive(false);
			}
			Transform child = group.GetChild(index);
			EnableRecursively(((Component)child).gameObject);
		}

		private void EnableRecursively(GameObject obj)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			obj.SetActive(true);
			foreach (Transform item in obj.transform)
			{
				Transform val = item;
				EnableRecursively(((Component)val).gameObject);
			}
		}

		private void FinalizeBuild()
		{
			((Component)this).GetComponent<ModularValuableLogic>()?.InitializeFromBuilder();
		}
	}
	public class ModularValuableLogic : MonoBehaviour
	{
		private ValuableObject valuableObject;

		private PhotonView photonView;

		private List<StatsModifierPart> parts = new List<StatsModifierPart>();

		private bool initialized = false;

		private void Awake()
		{
			valuableObject = ((Component)this).GetComponent<ValuableObject>();
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		public void InitializeFromBuilder()
		{
			if (!initialized)
			{
				((MonoBehaviour)this).StartCoroutine(InitializeRoutine());
			}
		}

		private bool HasParticleSystem()
		{
			PhysGrabObjectImpactDetector component = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			return (Object)(object)((Component)component).GetComponentInChildren<PhysObjectParticles>(true) != (Object)null;
		}

		private IEnumerator InitializeRoutine()
		{
			yield return null;
			parts = (from p in ((Component)this).GetComponentsInChildren<StatsModifierPart>(true)
				where ((Component)p).gameObject.activeInHierarchy
				select p).ToList();
			ApplyParticleGradientOverride();
			yield return (object)new WaitUntil((Func<bool>)(() => HasParticleSystem()));
			ApplyParticlePatch();
		}

		private void ApplyParticleGradientOverride()
		{
			foreach (StatsModifierPart part in parts)
			{
				if (!part.overrideParticleColors || part.particleColors == null)
				{
					continue;
				}
				valuableObject.particleColors = part.particleColors;
				break;
			}
		}

		private IEnumerator ApplyPartValuesLater()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => valuableObject.dollarValueSet));
			float baseValue = valuableObject.dollarValueOriginal;
			float modifierTotal = 1f + 0.1f * parts.Sum((StatsModifierPart p) => p.valueModifier);
			float finalValue = Mathf.Round(baseValue * modifierTotal);
			if (SemiFunc.IsMultiplayer())
			{
				if (SemiFunc.IsMasterClient())
				{
					valuableObject.dollarValueOriginal = finalValue;
					valuableObject.dollarValueCurrent = finalValue;
					photonView.RPC("SyncFinalValue", (RpcTarget)1, new object[1] { finalValue });
				}
			}
			else
			{
				valuableObject.dollarValueOriginal = finalValue;
				valuableObject.dollarValueCurrent = finalValue;
			}
		}

		private void ApplyParticlePatch()
		{
			PhysGrabObjectImpactDetector component = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			if (!((Object)(object)component == (Object)null))
			{
				PhysObjectParticles componentInChildren = ((Component)component).GetComponentInChildren<PhysObjectParticles>(true);
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					componentInChildren.gradient = valuableObject.particleColors;
				}
			}
		}

		[PunRPC]
		private void SyncFinalValue(float value)
		{
			valuableObject.dollarValueOriginal = value;
			valuableObject.dollarValueCurrent = value;
			valuableObject.dollarValueSet = true;
		}
	}
	[RequireComponent(typeof(PhotonView))]
	public class ModuleRandomizerManager : MonoBehaviourPun
	{
		private List<RandomChildActivator> randomizers = new List<RandomChildActivator>();

		private void Awake()
		{
			randomizers = ((Component)this).GetComponentsInChildren<RandomChildActivator>(true).ToList();
			randomizers = randomizers.OrderBy((RandomChildActivator r) => GetHierarchyPath(((Component)r).transform)).ToList();
		}

		private void Start()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				RandomizeAll();
			}
		}

		public void RandomizeAll()
		{
			if (randomizers.Count != 0)
			{
				int[] array = new int[randomizers.Count];
				for (int i = 0; i < randomizers.Count; i++)
				{
					int selectedIndex = (array[i] = randomizers[i].PickRandomIndex());
					randomizers[i].ActivateObject(selectedIndex);
				}
				if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient)
				{
					((MonoBehaviourPun)this).photonView.RPC("RPC_ApplyResults", (RpcTarget)4, new object[1] { array });
				}
			}
		}

		[PunRPC]
		private void RPC_ApplyResults(int[] results)
		{
			for (int i = 0; i < randomizers.Count && i < results.Length; i++)
			{
				randomizers[i].ActivateObject(results[i]);
			}
		}

		private string GetHierarchyPath(Transform t)
		{
			string text = ((Object)t).name;
			while ((Object)(object)t.parent != (Object)null && (Object)(object)t.parent != (Object)(object)((Component)this).transform)
			{
				t = t.parent;
				text = ((Object)t).name + "/" + text;
			}
			return text;
		}
	}
	public class MuralBreakInterceptor : MonoBehaviour
	{
		private MuralFragmentController fragments;

		private bool triggered = false;

		private void Awake()
		{
			fragments = ((Component)this).GetComponent<MuralFragmentController>();
		}

		private void OnDestroy()
		{
			TryIntercept();
		}

		private void TryIntercept()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!triggered && !((Object)(object)fragments == (Object)null) && SemiFunc.IsMasterClientOrSingleplayer())
			{
				triggered = true;
				fragments.TryFragment(((Component)this).transform.position);
			}
		}
	}
	public class MuralFragmentController : MonoBehaviour
	{
		[Header("Fragment pieces (disabled children under mural)")]
		public List<GameObject> fragments = new List<GameObject>();

		[Header("Spawn rules")]
		public int minPieces = 2;

		public int maxPieces = 5;

		public bool hasFragmented = false;

		public void TryFragment(Vector3 hitPoint)
		{
			if (!hasFragmented)
			{
				hasFragmented = true;
				int num = Random.Range(minPieces, maxPieces + 1);
				List<GameObject> list = fragments.Where((GameObject f) => (Object)(object)f != (Object)null).ToList();
				Shuffle(list);
				for (int num2 = 0; num2 < Mathf.Min(num, list.Count); num2++)
				{
					GameObject val = list[num2];
					val.transform.SetParent((Transform)null, true);
					val.SetActive(true);
				}
			}
		}

		private void Shuffle(List<GameObject> list)
		{
			for (int i = 0; i < list.Count; i++)
			{
				int num = Random.Range(i, list.Count);
				int index = i;
				int index2 = num;
				GameObject value = list[num];
				GameObject value2 = list[i];
				list[index] = value;
				list[index2] = value2;
			}
		}
	}
	public class RandomChildActivator : MonoBehaviour
	{
		[Tooltip("If true, allows the possibility that no object is enabled")]
		public bool allowNone = false;

		[Tooltip("Objects that can be randomly activated instead of all children")]
		public List<GameObject> objectsToChooseFrom;

		public int PickRandomIndex()
		{
			if (objectsToChooseFrom.Count == 0 && !allowNone)
			{
				return -1;
			}
			float num = 0f;
			List<float> list = new List<float>();
			foreach (GameObject item in objectsToChooseFrom)
			{
				if ((Object)(object)item == (Object)null)
				{
					list.Add(0f);
					continue;
				}
				WeightedRandom component = item.GetComponent<WeightedRandom>();
				float num2 = (((Object)(object)component != (Object)null) ? component.weight : 1f);
				list.Add(num2);
				num += num2;
			}
			if (allowNone)
			{
				float num3 = 1f;
				list.Add(num3);
				num += num3;
			}
			float num4 = Random.Range(0f, num);
			float num5 = 0f;
			for (int i = 0; i < list.Count; i++)
			{
				num5 += list[i];
				if (num4 <= num5)
				{
					return i;
				}
			}
			return list.Count - 1;
		}

		public void ActivateObject(int selectedIndex)
		{
			for (int i = 0; i < objectsToChooseFrom.Count; i++)
			{
				GameObject val = objectsToChooseFrom[i];
				if (!((Object)(object)val == (Object)null))
				{
					bool active = i == selectedIndex;
					val.SetActive(active);
				}
			}
			if (!allowNone || selectedIndex != objectsToChooseFrom.Count)
			{
				return;
			}
			foreach (GameObject item in objectsToChooseFrom)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.SetActive(false);
				}
			}
		}
	}
	public class RotatorComponent : MonoBehaviour
	{
		[Tooltip("Rotation speed in degrees per second")]
		public float RotationSpeedX = 0f;

		public float RotationSpeedY = 0f;

		public float RotationSpeedZ = 0f;

		private void Update()
		{
			((Component)this).transform.Rotate(RotationSpeedX * Time.deltaTime, RotationSpeedY * Time.deltaTime, RotationSpeedZ * Time.deltaTime);
		}
	}
	[ExecuteAlways]
	[RequireComponent(typeof(Projector))]
	public class ShaderGraphProjectorBinder : MonoBehaviour
	{
		private Projector projector;

		private Material mat;

		private void OnEnable()
		{
			projector = ((Component)this).GetComponent<Projector>();
			if ((Object)(object)projector.material != (Object)null)
			{
				mat = projector.material;
			}
		}

		private void LateUpdate()
		{
			//IL_0035: 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_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)projector) && Object.op_Implicit((Object)(object)mat))
			{
				Matrix4x4 worldToLocalMatrix = ((Component)projector).transform.worldToLocalMatrix;
				Matrix4x4 val = (projector.orthographic ? Matrix4x4.Ortho((0f - projector.orthographicSize) * projector.aspectRatio, projector.orthographicSize * projector.aspectRatio, 0f - projector.orthographicSize, projector.orthographicSize, projector.nearClipPlane, projector.farClipPlane) : Matrix4x4.Perspective(projector.fieldOfView, projector.aspectRatio, projector.nearClipPlane, projector.farClipPlane));
				Matrix4x4 gPUProjectionMatrix = GL.GetGPUProjectionMatrix(val, false);
				Matrix4x4 val2 = gPUProjectionMatrix * worldToLocalMatrix;
				Matrix4x4 val3 = val2;
				mat.SetMatrix("_Projector", val2);
				mat.SetMatrix("_ProjectorClip", val3);
			}
		}
	}
	[RequireComponent(typeof(Rigidbody))]
	public class SleepTweaker : MonoBehaviour
	{
		private void Awake()
		{
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			component.sleepThreshold = 0.2f;
		}
	}
	[ExecuteAlways]
	public class URPProjector : MonoBehaviour
	{
		[Header("Projector Material")]
		public Material material;

		[Header("Projection Settings")]
		public float fieldOfView = 45f;

		public float aspectRatio = 1f;

		public float nearClipPlane = 0.1f;

		public float farClipPlane = 20f;

		public LayerMask affectedLayers = LayerMask.op_Implicit(-1);

		[Header("Gizmos")]
		public bool drawGizmos = true;

		private Matrix4x4 _matrix;

		private void LateUpdate()
		{
			//IL_003c: 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_00d8: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)material))
			{
				float num = fieldOfView * (MathF.PI / 180f);
				float num2 = 1f / Mathf.Tan(num * 0.5f);
				Matrix4x4 val = default(Matrix4x4);
				((Matrix4x4)(ref val))[0, 0] = num2 / aspectRatio;
				((Matrix4x4)(ref val))[1, 1] = num2;
				((Matrix4x4)(ref val))[2, 2] = (farClipPlane + nearClipPlane) / (nearClipPlane - farClipPlane);
				((Matrix4x4)(ref val))[2, 3] = 2f * farClipPlane * nearClipPlane / (nearClipPlane - farClipPlane);
				((Matrix4x4)(ref val))[3, 2] = -1f;
				((Matrix4x4)(ref val))[3, 3] = 0f;
				Matrix4x4 worldToLocalMatrix = ((Component)this).transform.worldToLocalMatrix;
				_matrix = GL.GetGPUProjectionMatrix(val, false) * worldToLocalMatrix;
				material.SetMatrix("_Projector", _matrix);
				material.SetMatrix("_ProjectorClip", _matrix);
			}
		}

		private void OnRenderObject()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)material))
			{
				material.SetPass(0);
				Graphics.DrawMeshNow(MeshGenerator.GetFrustumMesh(fieldOfView, aspectRatio, nearClipPlane, farClipPlane), ((Component)this).transform.localToWorldMatrix);
			}
		}

		private void OnDrawGizmos()
		{
			//IL_0010: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			if (drawGizmos)
			{
				Gizmos.color = Color.yellow;
				Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
				Gizmos.DrawFrustum(Vector3.zero, fieldOfView, farClipPlane, nearClipPlane, aspectRatio);
			}
		}
	}
	public class ValuableDetacher : MonoBehaviour
	{
		[Tooltip("Name of the decorative object (e.g., Sword_Rack_01) to detach at runtime")]
		public string detachableName = "Holder";

		private Rigidbody rb;

		private Transform rack;

		private void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)rb != (Object)null)
			{
				rb.constraints = (RigidbodyConstraints)126;
			}
			rack = ((Component)this).transform.Find(detachableName);
			if ((Object)(object)rack != (Object)null)
			{
				rack.SetParent((Transform)null);
			}
		}

		private void Start()
		{
			if ((Object)(object)rb != (Object)null)
			{
				rb.constraints = (RigidbodyConstraints)0;
			}
		}
	}
	public class WeightedRandom : MonoBehaviour
	{
		[Range(0.05f, 1f)]
		public float weight = 1f;
	}
	[BepInPlugin("DragonClaw.DragonClawLib", "DragonClawLib", "1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DragonClawLib : BaseUnityPlugin
	{
		public static DragonClawLib Instance;

		private void Awake()
		{
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"DragonClawLib plugin has been loaded!");
		}
	}
}