using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PutUpPaintings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PutUpPaintings")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("86b5c81d-6cd5-403d-ba89-f68862e964f6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public class PaintingObject : PhysicsProp
{
public bool isUp = false;
public static LayerMask layer = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Default", "Room", "Colliders" }));
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
isUp = !isUp;
if (isUp)
{
((GrabbableObject)this).itemProperties = LC_PutUpPaintings.putUpProp;
}
else
{
((GrabbableObject)this).itemProperties = LC_PutUpPaintings.defaultProp;
}
HUDManager.Instance.ChangeControlTip(1, ((GrabbableObject)this).itemProperties.toolTips[0], false);
}
public override void DiscardItem()
{
//IL_0022: 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_0037: 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_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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0095: 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_00a4: 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)
((GrabbableObject)this).DiscardItem();
if (isUp)
{
Ray val = default(Ray);
((Ray)(ref val))..ctor(((Component)this).transform.position, ((Component)this).transform.right);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 1f, LayerMask.op_Implicit(layer)))
{
((GrabbableObject)this).startFallingPosition = ((Component)this).transform.parent.InverseTransformPoint(((RaycastHit)(ref val2)).point) + ((RaycastHit)(ref val2)).normal * 0.05f;
((GrabbableObject)this).targetFloorPosition = ((GrabbableObject)this).startFallingPosition;
Quaternion val3 = Quaternion.LookRotation(-((RaycastHit)(ref val2)).normal);
((GrabbableObject)this).floorYRot = (int)((Quaternion)(ref val3)).eulerAngles.y;
}
}
}
}
[BepInPlugin("Mellowdy.Paintings", "Paintings", "0.0.1")]
public class LC_PutUpPaintings : BaseUnityPlugin
{
private const string modGUID = "Mellowdy.Paintings";
private const string modName = "Paintings";
private const string modVersion = "0.0.1";
public static ManualLogSource mls;
private static LC_PutUpPaintings instance;
private readonly Harmony harmony = new Harmony("Mellowdy.Paintings");
public static Item defaultProp;
public static Item putUpProp;
public const bool debug = true;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("Mellowdy.Paintings");
harmony.PatchAll();
harmony.PatchAll(typeof(LC_PutUpPaintings));
mls.LogWarning((object)"Paintings has been loaded");
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
public static void ReplacePainting(AllItemsList ___allItemsList)
{
//IL_0108: 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_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
Item val = null;
string text = "Painting";
mls.LogWarning((object)("ITEMS:" + ___allItemsList.itemsList.Count));
Item[] array = ___allItemsList.itemsList.ToArray();
foreach (Item val2 in array)
{
bool flag = true;
mls.LogMessage((object)val2.itemName);
if (val2.itemName == text)
{
val = val2;
break;
}
}
if ((Object)(object)val == (Object)null)
{
mls.LogWarning((object)"Could not find painting item among items");
return;
}
GameObject spawnPrefab = val.spawnPrefab;
GrabbableObject component = (GrabbableObject)(object)spawnPrefab.GetComponent<PhysicsProp>();
PaintingObject paintingObject = spawnPrefab.AddComponent<PaintingObject>();
((Object)paintingObject).name = ((Object)component).name;
((GrabbableObject)paintingObject).itemProperties = component.itemProperties;
((GrabbableObject)paintingObject).radarIcon = component.radarIcon;
((GrabbableObject)paintingObject).grabbable = component.grabbable;
((GrabbableObject)paintingObject).grabbableToEnemies = component.grabbableToEnemies;
((GrabbableObject)paintingObject).originalScale = component.originalScale;
((GrabbableObject)paintingObject).mainObjectRenderer = component.mainObjectRenderer;
Object.Destroy((Object)(object)component);
((GrabbableObject)paintingObject).useCooldown = 0.2f;
defaultProp = val;
putUpProp = Object.Instantiate<Item>(val);
defaultProp.toolTips = new string[1] { "Stand Up : [LMB]" };
putUpProp.toolTips = new string[1] { "Stand Down : [LMB]" };
putUpProp.restingRotation = new Vector3(-90f, 0f, 180f);
putUpProp.rotationOffset = new Vector3(0f, 100f, 90f);
putUpProp.positionOffset = new Vector3(-0.3f, 0.07f, -0.6f);
}
}