using System;
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 BepInEx.Logging;
using BluePrince.Misc;
using BluePrince.Objects;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[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("Arc059")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+8fae3983f69e3cffebfa16a2724f5feb9eecb83b")]
[assembly: AssemblyProduct("BluePrince")]
[assembly: AssemblyTitle("BluePrince")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace BluePrince
{
[BepInPlugin("Arc059.BluePrince", "BluePrince", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BluePrince : BaseUnityPlugin
{
internal static BluePrince Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
public class BluePrinceFunc : MonoBehaviour
{
public struct QueuedReagent
{
public string name;
public Reagent.ReagentID reagentID;
}
public static List<QueuedReagent> queuedReagents = new List<QueuedReagent>();
public static bool CompareLists<T>(List<T> aListA, List<T> aListB)
{
if (aListA == null || aListB == null || aListA.Count != aListB.Count)
{
return false;
}
if (aListA.Count == 0)
{
return true;
}
Dictionary<T, int> dictionary = new Dictionary<T, int>();
for (int i = 0; i < aListA.Count; i++)
{
int value = 0;
if (!dictionary.TryGetValue(aListA[i], out value))
{
dictionary.Add(aListA[i], 1);
}
else
{
dictionary[aListA[i]] = value + 1;
}
}
for (int j = 0; j < aListB.Count; j++)
{
int value2 = 0;
if (!dictionary.TryGetValue(aListB[j], out value2))
{
return false;
}
value2--;
if (value2 <= 0)
{
dictionary.Remove(aListB[j]);
}
else
{
dictionary[aListB[j]] = value2;
}
}
return dictionary.Count == 0;
}
public static void ValuableSpawn(PrefabRef valuablePrefab, Transform SpawnPoint)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && Valuables.AllValuables.Contains(valuablePrefab))
{
Valuables.SpawnValuable(valuablePrefab, SpawnPoint.position, SpawnPoint.rotation);
}
}
public static void PrefabSpawn(string Prefab, Transform SpawnPoint)
{
//IL_0024: 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)
PrefabRef val = default(PrefabRef);
if (SemiFunc.IsMasterClientOrSingleplayer() && NetworkPrefabs.TryGetNetworkPrefabRef(Prefab, ref val))
{
NetworkPrefabs.SpawnNetworkPrefab(val, SpawnPoint.position, SpawnPoint.rotation, (byte)0, (object[])null);
}
}
public static void RegisterIngredientByItemName(string itemName, Reagent.ReagentID reagentID)
{
QueuedReagent item = default(QueuedReagent);
item.name = itemName;
item.reagentID = reagentID;
queuedReagents.Add(item);
}
}
}
namespace BluePrince.Util
{
public class LevelPointVisualizer : MonoBehaviour
{
private LevelPoint[] levelPoints;
private BoxCollider levelPointTrigger;
private Vector3 offset = new Vector3(0.1f, 0f, 0.1f);
private void OnDrawGizmos()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: 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_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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_014a: 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)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
levelPoints = ((Component)this).GetComponentsInChildren<LevelPoint>();
if (levelPoints == null || levelPoints.Length == 0)
{
return;
}
LevelPoint[] array = levelPoints;
LevelPoint[] array2 = array;
foreach (LevelPoint val in array2)
{
levelPointTrigger = ((Component)val).gameObject.GetComponent<BoxCollider>();
if (val.ModuleConnect)
{
Gizmos.color = Color.yellow;
}
else
{
Gizmos.color = Color.green;
}
Gizmos.DrawCube(((Component)val).transform.position + levelPointTrigger.center, levelPointTrigger.size);
if (val.ConnectedPoints == null || levelPoints.Length == 0)
{
continue;
}
foreach (LevelPoint connectedPoint in val.ConnectedPoints)
{
List<LevelPoint> connectedPoints = connectedPoint.ConnectedPoints;
if (connectedPoints.Contains(val))
{
Gizmos.color = Color.green;
Gizmos.DrawLine(((Component)connectedPoint).transform.position + offset, ((Component)val).transform.position + offset);
Gizmos.DrawLine(((Component)val).transform.position - offset, ((Component)connectedPoint).transform.position - offset);
}
else
{
Gizmos.color = Color.red;
Gizmos.DrawLine(((Component)connectedPoint).transform.position, ((Component)val).transform.position);
}
}
}
}
}
public class ValuableVolumeVisualizer : MonoBehaviour
{
private void OnDrawGizmos()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00eb: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
BoxCollider component = ((Component)this).GetComponent<BoxCollider>();
Gizmos.color = new Color(1f, 1.18f, 0f, 6f);
Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
Gizmos.DrawWireCube(component.center, component.size);
Gizmos.color = new Color(1f, 1.18f, 0f, 0.2f);
Gizmos.DrawCube(component.center, component.size);
Gizmos.color = Color.white;
Gizmos.matrix = Matrix4x4.identity;
Bounds bounds = ((Collider)component).bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
Vector3 val = center + ((Component)this).transform.forward * 0.5f;
Gizmos.DrawLine(center, val);
Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, -((Component)this).transform.right, 0.5f) * 0.25f);
Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, ((Component)this).transform.right, 0.5f) * 0.25f);
}
}
}
namespace BluePrince.Objects
{
[CreateAssetMenu(menuName = "BluePrince/Recipe", order = 1, fileName = "Recipe - New Recipe")]
public class CraftingRecipe : ScriptableObject
{
public List<Reagent.ReagentID> inputReagents = new List<Reagent.ReagentID>();
public GameObject? outputItem;
}
[CreateAssetMenu(menuName = "REPOLib/Prefab", order = 5, fileName = "New Prefab")]
public class PrefabContent : Content
{
[SerializeField]
private GameObject? _prefab;
public GameObject? Prefab => _prefab;
public override string Name
{
get
{
GameObject? prefab = Prefab;
return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty;
}
}
public override void Initialize(Mod mod)
{
NetworkPrefabs.RegisterNetworkPrefab(Prefab);
}
}
}
namespace BluePrince.Misc
{
public class Reagent : MonoBehaviour
{
public enum ReagentID
{
Battery,
Shovel,
MetalDetector,
Lever,
Compass,
SledgeHammer,
LockPick,
CoinPurse,
MagnifyingGlass,
RabbitFoot
}
public ReagentID reagentID;
}
[RequireComponent(typeof(Collider))]
public class StepUI : MonoBehaviour
{
[Header("Step Setup")]
public int Steps = 13;
public int stepNumber = -1;
private int stepNumberOld;
private int stepsValue;
private int stepsPrevious;
private int remainingSteps;
private TMP_Text stepText;
[Header("Vignette")]
public float vignetteStartIntensity = 0.5f;
private bool isActive;
private void OnDrawGizmos()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0059: 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)
SphereCollider component = ((Component)this).GetComponent<SphereCollider>();
Gizmos.color = new Color(0.1f, 1f, 0.4f);
Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
Gizmos.DrawWireSphere(component.center, component.radius);
Gizmos.color = new Color(0.1f, 1f, 0.4f, 0.5f);
Gizmos.DrawSphere(component.center, component.radius);
}
private void Start()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
stepText = ((Component)this).GetComponentInChildren<TMP_Text>();
ChatManager.instance.PossessChatScheduleStart(10);
ChatManager.instance.PossessChat((PossessChatID)4, "I have been Cursed for Deadly is the Stone", 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
private void Update()
{
if (isActive)
{
stepsValue = remainingSteps;
if (stepsValue != stepsPrevious)
{
UpdateText(stepsValue);
VignetteOverride();
}
stepsPrevious = stepsValue;
if (stepNumber != stepNumberOld)
{
CalulateRemainingSteps();
CursedChat();
}
stepNumberOld = stepNumber;
}
if (!isActive)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
Debug.Log((object)"stepcounter is off");
}
}
private void OnTriggerEnter(Collider other)
{
if (((Component)other).gameObject.layer == LayerMask.NameToLayer("DirtFinderMap"))
{
RecordFootstep();
}
}
public void SetActive()
{
isActive = true;
}
public void SetInactive()
{
isActive = false;
}
private void VignetteOverride()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
float num = (1f - vignetteStartIntensity) / (float)Steps;
float num2 = vignetteStartIntensity + num * (float)stepNumber;
PostProcessing.Instance.VignetteOverride(new Color(0.7f, 0f, 0f), num2, 0.5f, 2f, 0.1f, 0.5f, ((Component)this).gameObject);
}
private void CursedChat()
{
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
switch (remainingSteps)
{
case 12:
ChatManager.instance.PossessChatScheduleStart(9);
ChatManager.instance.PossessChat((PossessChatID)4, "One pace Twelve more and I'll be dead.", 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
break;
case 5:
ChatManager.instance.PossessChatScheduleStart(5);
ChatManager.instance.PossessChat((PossessChatID)4, "Five more steps I'm scared", 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
break;
case 3:
ChatManager.instance.PossessChatScheduleStart(5);
ChatManager.instance.PossessChat((PossessChatID)4, "I need to break the Idol", 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
break;
case 1:
ChatManager.instance.PossessChatScheduleStart(5);
ChatManager.instance.PossessChat((PossessChatID)4, "My last step, I dont want to die", 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
break;
case 0:
if (SemiFunc.IsMultiplayer())
{
ChatManager.instance.PossessSelfDestruction();
}
else
{
PlayerAvatar.instance.playerHealth.health = 0;
PlayerAvatar.instance.playerHealth.Hurt(1, false, -1);
}
SetInactive();
break;
}
}
public void RecordFootstep()
{
stepNumber++;
Debug.Log((object)("Collision detected! Total collisions: " + stepNumber));
}
public void CalulateRemainingSteps()
{
remainingSteps = Steps - stepNumber;
}
private void UpdateText(int stepsValue)
{
stepText.text = stepsValue.ToString();
}
}
public class TalkingValuables : MonoBehaviour
{
public enum Valuables
{
Crown,
Scepter
}
private PhysGrabObject physGrabObject;
public Valuables valuables;
private bool speechToggle = true;
private void Start()
{
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
public void Update()
{
if (!Object.op_Implicit((Object)(object)PhysGrabber.instance) || !PhysGrabber.instance.grabbed || !Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) || !((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject))
{
return;
}
if (physGrabObject.grabbed && !ChatManager.instance.StateIsPossessed() && speechToggle)
{
speechToggle = false;
switch (valuables)
{
case Valuables.Crown:
CrownSpeak();
break;
case Valuables.Scepter:
ScepterSpeak();
break;
}
}
if (!physGrabObject.grabbed && !speechToggle)
{
speechToggle = true;
}
}
private void CrownSpeak()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (Random.Range(1, 10) == 1)
{
ChatManager.instance.PossessChatScheduleStart(10);
ChatManager.instance.PossessChat((PossessChatID)0, "Heavy is the Crown", 0.7f, Color.blue, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
}
private void ScepterSpeak()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (Random.Range(1, 10) == 1)
{
ChatManager.instance.PossessChatScheduleStart(10);
ChatManager.instance.PossessChat((PossessChatID)0, "Steady is the Scepter", 0.7f, Color.blue, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
}
}
public class Workbench : MonoBehaviour
{
public enum State
{
None,
Idle,
Success,
Building,
Cancel
}
private State stateSetTo;
internal State currentState = State.Idle;
private bool settingState;
private float stateTimer;
private bool stateEnd;
private bool stateStart = true;
private float initialStateTime;
private PhotonView photonView;
public Transform shopButton;
public AnimationCurve buttonPressAnimationCurve;
private float shopButtonAnimationEval;
private bool shopButtonAnimation;
[SerializeField]
private BoxCollider craftArea;
public GameObject craftVisuals;
private List<Reagent.ReagentID> reagents = new List<Reagent.ReagentID>();
private List<PhysGrabObject> reagentObjects = new List<PhysGrabObject>();
private List<Reagent.ReagentID> reagentsOld = new List<Reagent.ReagentID>();
private float reagentsUpdateTimer = 0.5f;
public List<CraftingRecipe> craftingRecipes = new List<CraftingRecipe>();
private CraftingRecipe? recipeOut;
private string? recipe;
private bool recipecheck;
public Transform spawnPoint;
public TextMeshPro emojiScreen;
public GameObject emojiScreenGlitch;
public Light emojiLight;
private float emojiLightIntensity;
private Color originalEmojiLightColor;
private float emojiScreenGlitchTimer;
private string prevEmoji;
private string currentEmoji;
public Sound soundButton;
public Sound soundCancel;
public Sound soundSuccess;
public Sound soundGreenLights;
public Sound soundEmojiGlitch;
public Sound soundBuilding1;
public Sound soundBuilding2;
private void Start()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
photonView = ((Component)this).GetComponent<PhotonView>();
StateSet(State.Idle);
emojiLightIntensity = emojiLight.intensity;
originalEmojiLightColor = emojiLight.color;
}
private void Update()
{
GetReagents();
ShopButtonAnimation();
StateCancel();
StateIdle();
StateSuccess();
StateBuilding();
EmojiScreenGlitchLogic();
reagentsOld = reagents.ToList();
stateEnd = false;
if (stateTimer > 0f)
{
if (initialStateTime == 0f)
{
initialStateTime = stateTimer;
}
stateTimer -= Time.deltaTime;
stateTimer = Mathf.Max(0f, stateTimer);
}
else if (!stateEnd && stateTimer != -123f)
{
stateEnd = true;
stateTimer = -123f;
initialStateTime = 0f;
}
if (stateSetTo != 0)
{
currentState = stateSetTo;
stateStart = true;
settingState = false;
stateEnd = false;
stateSetTo = State.None;
}
}
public void OnClick()
{
if (StateIs(State.Idle))
{
if (recipe == "?" || recipe == ":)")
{
StateSet(State.Cancel);
}
else
{
StateSet(State.Success);
}
}
}
private void GetReagents(bool timer = true)
{
//IL_0007: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007f: 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)
if (SemiFunc.PlayerNearestDistance(((Component)this).transform.position) > 12f)
{
return;
}
if (reagentsUpdateTimer > 0f && timer)
{
reagentsUpdateTimer -= Time.deltaTime;
return;
}
Collider[] array = Physics.OverlapBox(((Component)craftArea).transform.position + craftArea.center, craftArea.size / 2f, ((Component)craftArea).transform.rotation);
reagents.Clear();
reagentObjects.Clear();
Collider[] array2 = array;
foreach (Collider val in array2)
{
if (((Component)val).gameObject.layer == LayerMask.NameToLayer("PhysGrabObject"))
{
Reagent componentInParent = ((Component)val).GetComponentInParent<Reagent>();
PhysGrabObject componentInParent2 = ((Component)val).GetComponentInParent<PhysGrabObject>();
if (Object.op_Implicit((Object)(object)componentInParent) && !reagentObjects.Contains(componentInParent2))
{
reagents.Add(componentInParent.reagentID);
reagentObjects.Add(componentInParent2);
}
}
}
reagentsUpdateTimer = 0.5f;
}
private string GetRecipe()
{
List<Reagent.ReagentID> list = new List<Reagent.ReagentID>();
if (reagents.Count() == 0)
{
return ":)";
}
foreach (CraftingRecipe craftingRecipe in craftingRecipes)
{
foreach (Reagent.ReagentID inputReagent in craftingRecipe.inputReagents)
{
list.Add(inputReagent);
}
recipeOut = null;
if (BluePrinceFunc.CompareLists(reagents, list))
{
recipeOut = craftingRecipe;
break;
}
}
if ((Object)(object)recipeOut != (Object)null)
{
return ((Object)recipeOut.outputItem).name;
}
return "?";
}
private void ShopButtonAnimation()
{
//IL_007a: 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_0081: 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)
if (shopButtonAnimation)
{
shopButtonAnimationEval += Time.deltaTime * 2f;
shopButtonAnimationEval = Mathf.Clamp01(shopButtonAnimationEval);
float num = buttonPressAnimationCurve.Evaluate(shopButtonAnimationEval);
Color val = default(Color);
((Color)(ref val))..ctor(1f, 0.5f, 0f, 1f);
((Renderer)((Component)shopButton).GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", Color.Lerp(val, Color.white, num));
num = Mathf.Clamp(num, 0.5f, 1f);
shopButton.localScale = new Vector3(1f, num, 1f);
if (shopButtonAnimationEval >= 1f)
{
shopButtonAnimation = false;
shopButtonAnimationEval = 0f;
}
}
}
private void ShopButtonPushVisualsStart()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (!shopButtonAnimation)
{
shopButton.localScale = new Vector3(1f, 0.1f, 1f);
soundButton.Play(shopButton.position, 1f, 1f, 1f, 1f);
shopButtonAnimationEval = 0f;
shopButtonAnimation = true;
}
}
private void StateSet(State newState)
{
//IL_0075: 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)
if (settingState)
{
return;
}
if (SemiFunc.IsMultiplayer())
{
if (SemiFunc.IsMasterClient() && stateSetTo == State.None)
{
settingState = true;
photonView.RPC("StateSetRPC", (RpcTarget)0, new object[1] { newState });
}
}
else if (stateSetTo == State.None)
{
settingState = true;
StateSetRPC(newState);
}
}
[PunRPC]
public void StateSetRPC(State state, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info))
{
stateSetTo = state;
stateTimer = 0f;
stateEnd = true;
}
}
private bool StateIs(State state)
{
return currentState == state;
}
private void StateIdle()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (StateIs(State.Idle))
{
if (stateStart)
{
emojiLight.intensity = emojiLightIntensity;
emojiLight.color = originalEmojiLightColor;
craftVisuals.SetActive(false);
recipecheck = true;
stateStart = false;
}
if (recipecheck || !BluePrinceFunc.CompareLists(reagentsOld, reagents))
{
recipe = GetRecipe();
SetEmojiScreen("<sprite name=" + recipe + ">");
recipecheck = false;
}
}
}
private void StateSuccess()
{
//IL_005b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: 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)
if (StateIs(State.Success))
{
if (stateStart)
{
ShopButtonPushVisualsStart();
emojiLight.intensity = emojiLightIntensity;
craftVisuals.SetActive(false);
SetEmojiScreen("<sprite name=check>");
emojiLight.color = Color.green;
EmojiScreenGlitch(Color.green);
soundSuccess.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
soundGreenLights.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
stateStart = false;
stateTimer = 1f;
GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 8f, emojiScreen.transform.position, 0.1f);
GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 8f, emojiScreen.transform.position, 0.1f);
}
CancelBuild();
if (stateEnd)
{
StateSet(State.Building);
}
}
}
private void StateBuilding()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
if (StateIs(State.Building))
{
if (stateStart)
{
SetEmojiScreen("<sprite name=settings>");
soundBuilding1.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
craftVisuals.SetActive(true);
stateStart = false;
stateTimer = 3f;
}
CancelBuild();
if (stateEnd)
{
soundBuilding2.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
DestroyAllPhysObjectsInRecipe();
BluePrinceFunc.PrefabSpawn(recipe, spawnPoint);
StateSet(State.Idle);
}
}
}
private void StateCancel()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
if (StateIs(State.Cancel))
{
if (stateStart)
{
ShopButtonPushVisualsStart();
craftVisuals.SetActive(false);
SetEmojiScreen("<sprite name=X>");
emojiLight.color = Color.red;
emojiLight.intensity = emojiLightIntensity;
soundCancel.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
GameDirector.instance.CameraImpact.ShakeDistance(8f, 3f, 8f, emojiScreen.transform.position, 0.1f);
GameDirector.instance.CameraShake.ShakeDistance(8f, 3f, 8f, emojiScreen.transform.position, 0.1f);
stateStart = false;
stateTimer = 1f;
}
if (stateEnd)
{
StateSet(State.Idle);
}
}
}
private bool CancelBuild()
{
if (!BluePrinceFunc.CompareLists(reagentsOld, reagents))
{
StateSet(State.Cancel);
return true;
}
return false;
}
private void SetEmojiScreen(string emoji)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)emojiScreen).text = "<size=100>|</size>" + emoji + "<size=100>|</size>";
((Graphic)emojiScreen).color = new Color(1f, 1f, 1f, 0f);
}
private void EmojiScreenGlitchLogic()
{
//IL_0035: 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_0070: 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)
currentEmoji = ((TMP_Text)emojiScreen).text;
if (prevEmoji != currentEmoji)
{
prevEmoji = currentEmoji;
EmojiScreenGlitch(Color.yellow);
}
if (!(emojiScreenGlitchTimer <= 0f))
{
Vector2 textureOffset = ((Renderer)emojiScreenGlitch.GetComponent<MeshRenderer>()).material.GetTextureOffset("_MainTex");
textureOffset.y += Time.deltaTime * 15f;
((Renderer)emojiScreenGlitch.GetComponent<MeshRenderer>()).material.SetTextureOffset("_MainTex", textureOffset);
emojiScreenGlitchTimer -= Time.deltaTime;
if (emojiScreenGlitchTimer <= 0f)
{
emojiScreenGlitch.SetActive(false);
((Behaviour)emojiScreen).enabled = true;
}
}
}
private void EmojiScreenGlitch(Color color)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (emojiScreenGlitchTimer <= 0f)
{
soundEmojiGlitch.Play(emojiScreen.transform.position, 1f, 1f, 1f, 1f);
}
emojiScreenGlitchTimer = 0.2f;
emojiScreenGlitch.SetActive(true);
((Behaviour)emojiScreen).enabled = false;
((Renderer)emojiScreenGlitch.GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", color);
}
private void DestroyAllPhysObjectsInRecipe()
{
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
foreach (PhysGrabObject reagentObject in reagentObjects)
{
reagentObject.DestroyPhysGrabObject();
}
}
}
}
namespace BluePrince.BPValuables
{
public class ValuableCursedIdol : Trap
{
public GameObject stepEffect;
private PlayerAvatar? player;
private StepUI? stepUI;
public AudioClip seenSound;
private bool localSeen;
private bool localSeenEffect;
private float localSeenEffectTime = 2f;
private float localSeenEffectTimer;
public override void Start()
{
((Trap)this).Start();
localSeen = false;
localSeenEffectTimer = localSeenEffectTime;
}
public override void Update()
{
//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_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_0197: 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_0086: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
((Trap)this).Update();
if (!localSeen && !PlayerController.instance.playerAvatarScript.isDisabled)
{
Vector3 position = ((Component)PlayerController.instance.playerAvatarScript.localCamera).transform.position;
float num = Vector3.Distance(((Component)this).transform.position, position);
if (num <= 10f && SemiFunc.OnScreen(((Component)this).transform.position, -0.15f, -0.15f))
{
Vector3 val = position - ((Component)this).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
RaycastHit val2 = default(RaycastHit);
if (!Physics.Raycast(base.physGrabObject.centerPoint, normalized, ref val2, num, LayerMask.GetMask(new string[1] { "Default" })))
{
localSeenEffect = true;
localSeen = true;
GameDirector.instance.CameraImpact.Shake(2f, 0.5f);
GameDirector.instance.CameraShake.Shake(2f, 1f);
AudioScare.instance.PlayCustom(seenSound, 0.3f, 60f);
ValuableDiscover.instance.New(base.physGrabObject, (State)2);
}
}
}
if (localSeenEffect)
{
localSeenEffectTimer -= Time.deltaTime;
CameraZoom.Instance.OverrideZoomSet(75f, 0.1f, 0.25f, 0.25f, ((Component)this).gameObject, 150);
PostProcessing.Instance.VignetteOverride(Color.black, 0.4f, 1f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
PostProcessing.Instance.SaturationOverride(-50f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
PostProcessing.Instance.ContrastOverride(5f, 1f, 0.5f, 0.1f, ((Component)this).gameObject);
GameDirector.instance.CameraImpact.Shake(10f * Time.deltaTime, 0.1f);
GameDirector.instance.CameraShake.Shake(10f * Time.deltaTime, 1f);
if (localSeenEffectTimer <= 0f)
{
localSeenEffect = false;
}
}
if (Object.op_Implicit((Object)(object)PhysGrabber.instance) && PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)base.physGrabObject)
{
StepCounterOn();
}
}
private void StepCounterOn()
{
//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_0078: 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)
player = PhysGrabber.instance.playerAvatar;
if (player.isLocal && !((Object)(object)((Component)((Component)player.localCamera).transform).GetComponentInChildren<StepUI>() != (Object)null))
{
Transform transform = ((Component)player.localCamera).transform;
GameObject val = Object.Instantiate<GameObject>(stepEffect, ((Component)this).transform.position, Quaternion.identity, transform);
val.transform.localPosition = Vector3.zero;
val.transform.localRotation = Quaternion.identity;
stepUI = val.GetComponent<StepUI>();
stepUI.SetActive();
Debug.Log((object)"stepcounter is on");
}
}
private void StepCounterOff()
{
stepUI?.SetInactive();
}
private void Reset()
{
localSeen = false;
}
private void OnDestroy()
{
Reset();
StepCounterOff();
}
}
public class ValuableCursedTrunk : MonoBehaviour
{
public Transform SpawnPoint;
public GameObject valuablePrefab;
public void OminousChat()
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
List<string> list = new List<string>
{
"This feels ominous", "I have a bad feeling about this", "I don't think we should be doing this", "I'm scared", "I think we should just leave it", "I feel like something bad's about to happen", "Guys I don't know about this", "That sent a chill through my circuits", "We shouldn't break this open", "It feels... angry",
"Ow why does it feel like this thing is mad at me", "I don't think the treasure inside is worth it", "Today feels a little worse"
};
string text = list[Random.Range(0, list.Count)];
ChatManager.instance.PossessChatScheduleStart(10);
ChatManager.instance.PossessChat((PossessChatID)4, text, 0.7f, Color.red, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
public void Spawn()
{
BluePrinceFunc.PrefabSpawn(((Object)valuablePrefab).name, SpawnPoint);
}
}
public class ValuableLuckyPurse : MonoBehaviour
{
private ValuableObject valuableObject;
private PhysGrabObject physGrabObject;
private List<PhysGrabObject> valuablesInRadius = new List<PhysGrabObject>();
public Transform checkCenter;
private int haulCurrent;
private int haulPrevious;
private bool isShop;
private float valuableCheckTimer;
private void Start()
{
isShop = SemiFunc.RunIsShop();
valuableObject = ((Component)this).GetComponent<ValuableObject>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
valuableObject.dollarValueOverride = 100;
}
private void Update()
{
if (!isShop)
{
SphereCheck(2f);
if (haulPrevious != haulCurrent)
{
valuableObject.dollarValueOriginal = haulCurrent;
valuableObject.dollarValueCurrent = haulCurrent;
haulPrevious = haulCurrent;
}
}
}
private void SphereCheck(float _radius)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.PlayerNearestDistance(((Component)this).transform.position) > 12f)
{
return;
}
if (valuableCheckTimer > 0f)
{
valuableCheckTimer -= Time.deltaTime;
return;
}
Collider[] array = Physics.OverlapSphere(((Component)checkCenter).transform.position, _radius);
valuablesInRadius.Clear();
haulCurrent = 0;
Collider[] array2 = array;
Collider[] array3 = array2;
foreach (Collider val in array3)
{
if (((Component)val).gameObject.layer != LayerMask.NameToLayer("PhysGrabObject"))
{
continue;
}
PhysGrabObject componentInParent = ((Component)val).GetComponentInParent<PhysGrabObject>();
ValuableLuckyPurse componentInParent2 = ((Component)val).GetComponentInParent<ValuableLuckyPurse>();
if (Object.op_Implicit((Object)(object)componentInParent) && !valuablesInRadius.Contains(componentInParent) && !Object.op_Implicit((Object)(object)componentInParent2))
{
valuablesInRadius.Add(componentInParent);
ValuableObject componentInParent3 = ((Component)val).GetComponentInParent<ValuableObject>();
if (Object.op_Implicit((Object)(object)componentInParent3))
{
haulCurrent += (int)componentInParent3.dollarValueCurrent;
}
}
}
valuableCheckTimer = 0.5f;
}
}
}