using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using RoloPogo.Utilities;
using RoloPogo.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("GizmoReloaded")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GizmoReloaded")]
[assembly: AssemblyCopyright("Copyright © M3TO 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("83d75858-7663-4c9b-abef-75ffd7e692e0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RoloPogo.Utils
{
internal static class ResourceUtils
{
public static byte[] GetResource(Assembly asm, string ResourceName)
{
Stream manifestResourceStream = asm.GetManifestResourceStream(ResourceName);
byte[] array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
return array;
}
}
}
namespace RoloPogo.Utilities
{
public static class ReflectionUtil
{
private const BindingFlags _allBindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
public static void SetField(this object obj, string fieldName, object value, Type targetType)
{
FieldInfo? field = targetType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (field == null)
{
throw new InvalidOperationException(fieldName + " is not a member of " + targetType.Name);
}
field.SetValue(obj, value);
}
public static object GetField(this object obj, string fieldName, Type targetType)
{
FieldInfo? field = targetType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (field == null)
{
throw new InvalidOperationException(fieldName + " is not a member of " + targetType.Name);
}
return field.GetValue(obj);
}
public static void SetPrivateField(this object obj, string fieldName, object value, Type targetType)
{
FieldInfo? field = targetType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field == null)
{
throw new InvalidOperationException(fieldName + " is not a member of " + targetType.Name);
}
field.SetValue(obj, value);
}
public static T GetPrivateField<T>(this object obj, string fieldName, Type targetType)
{
FieldInfo? field = targetType.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
throw new InvalidOperationException(fieldName + " is not a member of " + targetType.Name);
}
return (T)field.GetValue(obj);
}
public static void SetProperty(this object obj, string propertyName, object value, Type targetType)
{
PropertyInfo? property = targetType.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (property == null)
{
throw new InvalidOperationException(propertyName + " is not a member of " + targetType.Name);
}
property.SetValue(obj, value);
}
public static object GetProperty(this object obj, string propertyName, Type targetType)
{
PropertyInfo? property = targetType.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (property == null)
{
throw new InvalidOperationException(propertyName + " is not a member of " + targetType.Name);
}
return property.GetValue(obj);
}
public static void SetPrivateField(this object obj, string fieldName, object value)
{
obj.SetPrivateField(fieldName, value, obj.GetType());
}
public static T GetPrivateField<T>(this object obj, string fieldName)
{
return obj.GetPrivateField<T>(fieldName, obj.GetType());
}
public static void SetField(this object obj, string fieldName, object value)
{
obj.SetField(fieldName, value, obj.GetType());
}
public static object GetField(this object obj, string fieldName)
{
return obj.GetField(fieldName, obj.GetType());
}
public static T GetField<T>(this object obj, string fieldName, Type targetType)
{
return (T)obj.GetField(fieldName, targetType);
}
public static T GetField<T>(this object obj, string fieldName)
{
return (T)obj.GetField(fieldName, obj.GetType());
}
public static void SetProperty(this object obj, string propertyName, object value)
{
obj.SetProperty(propertyName, value, obj.GetType());
}
public static object GetProperty(this object obj, string propertyName)
{
return obj.GetProperty(propertyName, obj.GetType());
}
public static T GetProperty<T>(this object obj, string propertyName)
{
return (T)obj.GetProperty(propertyName);
}
public static T InvokeMethod<T>(this object obj, string methodName, params object[] methodParams)
{
return (T)obj.InvokeMethod(methodName, methodParams);
}
public static object InvokeMethod(this object obj, string methodName, params object[] methodParams)
{
MethodInfo? method = obj.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (method == null)
{
throw new InvalidOperationException(methodName + " is not a member of " + obj.GetType().Name);
}
return method.Invoke(obj, methodParams);
}
public static object InvokeConstructor(this object obj, params object[] constructorParams)
{
Type[] array = new Type[constructorParams.Length];
for (int i = 0; i < constructorParams.Length; i++)
{
array[i] = constructorParams[i].GetType();
}
return ((obj is Type) ? ((Type)obj) : obj.GetType()).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, array, null).Invoke(constructorParams);
}
public static Type GetStaticType(string clazz)
{
return Type.GetType(clazz);
}
public static IEnumerable<Assembly> ListLoadedAssemblies()
{
return AppDomain.CurrentDomain.GetAssemblies();
}
public static IEnumerable<string> ListNamespacesInAssembly(Assembly assembly)
{
return Enumerable.Empty<string>().Concat(from n in (from t in assembly.GetTypes()
select t.Namespace).Distinct()
where n != null
select n).Distinct();
}
public static IEnumerable<string> ListClassesInNamespace(string ns)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if ((from t in assembly.GetTypes()
where t.Namespace == ns
select t).Any())
{
return from t in assembly.GetTypes()
where t.IsClass
select t.Name;
}
}
return null;
}
public static Behaviour CopyComponent(Behaviour original, Type originalType, Type overridingType, GameObject destination)
{
Behaviour val = null;
try
{
Component obj = destination.AddComponent(overridingType);
val = (Behaviour)(object)((obj is Behaviour) ? obj : null);
}
catch (Exception)
{
}
val.enabled = false;
Type type = originalType;
while (type != typeof(MonoBehaviour))
{
CopyForType(type, (Component)(object)original, (Component)(object)val);
type = type.BaseType;
}
val.enabled = true;
return val;
}
private static void CopyForType(Type type, Component source, Component destination)
{
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField);
foreach (FieldInfo fieldInfo in fields)
{
fieldInfo.SetValue(destination, fieldInfo.GetValue(source));
}
}
}
}
namespace GizmoReloaded
{
[BepInPlugin("m3to.mods.GizmoReloaded", "Gizmo Reloaded", "1.3.2")]
public class Plugin : BaseUnityPlugin
{
public static Plugin instance;
public const string PluginId = "m3to.mods.GizmoReloaded";
public const string DisplayName = "Gizmo Reloaded";
public const string Version = "1.3.2";
private Transform gizmoRoot;
private Transform xGizmo;
private Transform yGizmo;
private Transform zGizmo;
private ConfigEntry<string> snapDivisions;
private ConfigEntry<string> xKey;
private ConfigEntry<string> zKey;
private ConfigEntry<string> resetKey;
private ConfigEntry<string> cyclePrevSnapKey;
private ConfigEntry<string> cycleNextSnapKey;
private ConfigEntry<string> displayMode;
private ConfigEntry<string> cycleDisplayModeKey;
private ConfigEntry<string> blockedTools;
public int snapIndex;
public int snapDivision;
public float snapAngle;
public List<int> snapDivs;
public int snapCount;
public List<string> blocklistTools;
private GameObject gizmoPrefab;
private void Awake()
{
instance = this;
snapDivisions = ((BaseUnityPlugin)this).Config.Bind<string>("General", "SnapDivisions", "8, 16, 32, 64, 128", "The different Snap Divisions per 360° you can cycle through (Vanilla is 16)");
cyclePrevSnapKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CyclePrevSnapKey", "KeypadMinus", "Press this key to go to the previous Snap Division");
cycleNextSnapKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CycleNextSnapKey", "KeypadPlus", "Press this key to go to the next Snap Division");
xKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "xKey", "LeftControl", "Hold this key to rotate in the x plane (red circle)");
zKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "zKey", "LeftAlt", "Hold this key to rotate in the z plane (blue circle)");
resetKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ResetKey", "V", "Press this key to reset all axes to zero rotation");
displayMode = ((BaseUnityPlugin)this).Config.Bind<string>("General", "DisplayMode", "ShowAll", "The default visuals mode - Options are ShowAll, OnlySelected, None");
cycleDisplayModeKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CycleDisplayModeKey", "KeypadEnter", "Press this key to cycle through the different axis Display Modes");
blockedTools = ((BaseUnityPlugin)this).Config.Bind<string>("General", "BlockedTools", "item_hoe", "Tools which are blocked from using Gizmos");
AssetBundle val = AssetBundle.LoadFromMemory(ResourceUtils.GetResource(Assembly.GetExecutingAssembly(), "GizmoReloaded.Resources.gizmos"));
gizmoPrefab = val.LoadAsset<GameObject>("GizmoRoot");
val.Unload(false);
Harmony.CreateAndPatchAll(typeof(UpdatePlacementGhost_Patch), (string)null);
Harmony.CreateAndPatchAll(typeof(UpdatePlacement_Patch), (string)null);
snapDivs = snapDivisions.Value.Split(new char[1] { ',' }).Select(int.Parse).ToList();
snapCount = snapDivs.Count();
snapIndex = 1;
snapDivision = snapDivs[snapIndex];
snapAngle = 360f / (float)snapDivs[snapIndex];
blocklistTools = (from t in blockedTools.Value.Split(new char[1] { ',' })
select t.Trim().Insert(0, "$")).ToList();
}
public void UpdatePlacement(Player player, GameObject placementGhost, bool takeInput)
{
//IL_0192: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: 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_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_038c: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_0440: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_046a: Unknown result type (might be due to invalid IL or missing references)
//IL_0474: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_055d: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player != (Object)(object)Player.m_localPlayer)
{
return;
}
if (!Object.op_Implicit((Object)(object)gizmoRoot))
{
gizmoRoot = Object.Instantiate<GameObject>(gizmoPrefab).transform;
xGizmo = gizmoRoot.Find("YRoot/ZRoot/XRoot/X");
yGizmo = gizmoRoot.Find("YRoot/Y");
zGizmo = gizmoRoot.Find("YRoot/ZRoot/Z");
Shader val = Shader.Find("Standard");
if ((Object)(object)val == (Object)null)
{
return;
}
((Component)xGizmo).GetComponent<Renderer>().material = new Material(val);
((Component)yGizmo).GetComponent<Renderer>().material = new Material(val);
((Component)zGizmo).GetComponent<Renderer>().material = new Material(val);
((Renderer)((Component)xGizmo).GetComponent<MeshRenderer>()).material.color = new Color(1f, 0f, 0f, 1f);
((Renderer)((Component)yGizmo).GetComponent<MeshRenderer>()).material.color = new Color(0f, 1f, 0f, 1f);
((Renderer)((Component)zGizmo).GetComponent<MeshRenderer>()).material.color = new Color(0f, 0f, 1f, 1f);
}
GameObject privateField = player.GetPrivateField<GameObject>("m_placementMarkerInstance");
if (Object.op_Implicit((Object)(object)privateField))
{
((Component)gizmoRoot).gameObject.SetActive(privateField.activeSelf);
gizmoRoot.position = privateField.transform.position + Vector3.up * 0.5f;
}
if (!((Character)player).InPlaceMode() || !takeInput)
{
return;
}
bool flag = !blocklistTools.Contains(((Humanoid)Player.m_localPlayer).GetRightItem().m_shared.m_name) && !IsPieceSlectionVisible();
switch (displayMode.Value)
{
case "ShowAll":
xGizmo.localScale = Vector3.one * 0.9f;
yGizmo.localScale = Vector3.one * 0.9f;
zGizmo.localScale = Vector3.one * 0.9f;
break;
case "OnlySelected":
case "None":
xGizmo.localScale = new Vector3(0f, 0f, 0f);
yGizmo.localScale = new Vector3(0f, 0f, 0f);
zGizmo.localScale = new Vector3(0f, 0f, 0f);
break;
}
if (Enum.TryParse<KeyCode>(cycleDisplayModeKey.Value, out KeyCode result) && Input.GetKeyUp(result) && flag)
{
switch (displayMode.Value)
{
case "ShowAll":
xGizmo.localScale = new Vector3(0f, 0f, 0f);
yGizmo.localScale = new Vector3(0f, 0f, 0f);
zGizmo.localScale = new Vector3(0f, 0f, 0f);
displayMode.Value = "OnlySelected";
notifyUser("Display Mode is \"OnlySelected\"", (MessageType)1);
break;
case "OnlySelected":
xGizmo.localScale = new Vector3(0f, 0f, 0f);
yGizmo.localScale = new Vector3(0f, 0f, 0f);
zGizmo.localScale = new Vector3(0f, 0f, 0f);
displayMode.Value = "None";
notifyUser("Display Mode is \"None\"", (MessageType)1);
break;
case "None":
xGizmo.localScale = Vector3.one * 0.9f;
yGizmo.localScale = Vector3.one * 0.9f;
zGizmo.localScale = Vector3.one * 0.9f;
displayMode.Value = "ShowAll";
notifyUser("Display Mode is \"ShowAll\"", (MessageType)1);
break;
}
}
if (Enum.TryParse<KeyCode>(cyclePrevSnapKey.Value, out KeyCode result2) && Input.GetKeyUp(result2) && flag)
{
snapIndex = ((snapIndex - 1 < 0) ? (snapCount - 1) : (snapIndex - 1));
SetSnaps(snapIndex);
}
if (Enum.TryParse<KeyCode>(cycleNextSnapKey.Value, out KeyCode result3) && Input.GetKeyUp(result3) && flag)
{
snapIndex = ((snapIndex + 1 != snapCount) ? (snapIndex + 1) : 0);
SetSnaps(snapIndex);
}
int scrollWheelInput = Math.Sign(Input.GetAxis("Mouse ScrollWheel"));
KeyCode result5;
if (Enum.TryParse<KeyCode>(xKey.Value, out KeyCode result4) && Input.GetKey(result4) && flag)
{
HandleAxisInput(scrollWheelInput, xGizmo, "X");
}
else if (Enum.TryParse<KeyCode>(zKey.Value, out result5) && Input.GetKey(result5) && flag)
{
HandleAxisInput(scrollWheelInput, zGizmo, "Z");
}
else if (flag)
{
HandleAxisInput(scrollWheelInput, yGizmo, "Y");
}
if (Enum.TryParse<KeyCode>(resetKey.Value, out KeyCode result6) && Input.GetKeyUp(result6) && flag)
{
ResetRotation();
}
static bool IsPieceSlectionVisible()
{
if (!((Object)(object)Hud.instance == (Object)null) && Hud.instance.m_buildHud.activeSelf)
{
return Hud.instance.m_pieceSelectionWindow.activeSelf;
}
return false;
}
}
private void HandleAxisInput(int scrollWheelInput, Transform gizmo, string axis)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
if (displayMode.Value == "ShowAll")
{
gizmo.localScale = Vector3.one * 1.1f;
}
else if (displayMode.Value == "OnlySelected")
{
gizmo.localScale = Vector3.one * 1.1f;
switch (axis)
{
case "X":
yGizmo.localScale = new Vector3(0f, 0f, 0f);
zGizmo.localScale = new Vector3(0f, 0f, 0f);
break;
case "Y":
xGizmo.localScale = new Vector3(0f, 0f, 0f);
zGizmo.localScale = new Vector3(0f, 0f, 0f);
break;
case "Z":
xGizmo.localScale = new Vector3(0f, 0f, 0f);
yGizmo.localScale = new Vector3(0f, 0f, 0f);
break;
}
}
UpdateRotation(scrollWheelInput, axis);
}
private void SetSnaps(int snapIndex)
{
snapDivision = snapDivs[snapIndex];
snapAngle = 360f / (float)snapDivision;
ResetRotation();
notifyUser("Current snap divisions: " + snapDivision, (MessageType)1);
}
private void UpdateRotation(int scrollWheelinput, string axis = "X")
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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)
//IL_002c: 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_0059: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_009a: Unknown result type (might be due to invalid IL or missing references)
switch (axis)
{
case "X":
{
Transform obj3 = gizmoRoot;
obj3.rotation *= Quaternion.AngleAxis((float)scrollWheelinput * snapAngle, Vector3.right);
break;
}
case "Y":
{
Transform obj2 = gizmoRoot;
obj2.rotation *= Quaternion.AngleAxis((float)scrollWheelinput * snapAngle, Vector3.up);
break;
}
case "Z":
{
Transform obj = gizmoRoot;
obj.rotation *= Quaternion.AngleAxis((float)scrollWheelinput * snapAngle, Vector3.forward);
break;
}
}
}
private void ResetRotation()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
gizmoRoot.rotation = Quaternion.AngleAxis(0f, Vector3.up);
gizmoRoot.rotation = Quaternion.AngleAxis(0f, Vector3.right);
gizmoRoot.rotation = Quaternion.AngleAxis(0f, Vector3.forward);
}
private static Quaternion GetPlacementAngle(float x, float y, float z)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return instance.gizmoRoot.rotation;
}
private static void notifyUser(string Message, MessageType position = 1)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
MessageHud.instance.ShowMessage(position, "GizmoReloaded: " + Message, 0, (Sprite)null);
}
}
[HarmonyPatch(typeof(Player), "UpdatePlacementGhost")]
public static class UpdatePlacementGhost_Patch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
bool flag = false;
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
for (int i = 0; i < list.Count; i++)
{
if (!flag && list[i].opcode == OpCodes.Stfld && list[i + 1].opcode == OpCodes.Ldc_R4 && list[i + 2].opcode == OpCodes.Ldarg_0 && list[i + 3].opcode == OpCodes.Ldfld && list[i + 4].opcode == OpCodes.Ldarg_0 && list[i + 5].opcode == OpCodes.Ldfld && list[i + 6].opcode == OpCodes.Conv_R4 && list[i + 7].opcode == OpCodes.Mul && list[i + 8].opcode == OpCodes.Ldc_R4 && list[i + 9].opcode == OpCodes.Call)
{
list[i + 9] = CodeInstruction.Call(typeof(Plugin), "GetPlacementAngle", (Type[])null, (Type[])null);
flag = true;
}
}
return list.AsEnumerable();
}
}
internal class UpdatePlacement_Patch
{
[HarmonyPatch(typeof(Player), "UpdatePlacement", new Type[]
{
typeof(bool),
typeof(float)
})]
[HarmonyPostfix]
private static void Player_UpdatePlacement(Player __instance, GameObject ___m_placementGhost, bool takeInput, float dt)
{
Plugin.instance.UpdatePlacement(__instance, ___m_placementGhost, takeInput);
}
}
}