using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;
[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: AssemblyCompany("bitmotte.MauriceLegger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0d41dde593cd1a98103f3f15e07102b9ac96802e")]
[assembly: AssemblyProduct("MauriceLegger")]
[assembly: AssemblyTitle("bitmotte.MauriceLegger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MauriceLegger
{
public static class AccessibleConfigs
{
public static float legSpeed = 256f;
public static bool armLegs = true;
public static bool mauriceLegs = true;
public static bool thighs = true;
}
public static class MauriceConfigurator
{
[CompilerGenerated]
private static class <>O
{
public static PostFloatValueChangeEvent <0>__UpdateLegSpeed;
public static PostBoolValueChangeEvent <1>__UpdateArms;
public static PostBoolValueChangeEvent <2>__UpdateMaurice;
public static PostBoolValueChangeEvent <3>__UpdateThighs;
}
public static PluginConfigurator CreateConfigurator()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//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_0113: Expected O, but got Unknown
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
PluginConfigurator val = PluginConfigurator.Create("MauriceLegger", "bitmotte.MauriceLegger");
Texture2D val2 = LoadPNG(Pathing.GetPluginPath() + "/DONTDELETE_icon.png");
Sprite image = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
val.image = image;
FloatField val3 = new FloatField(val.rootPanel, "Leg Speed", "mleg.legspeed", 256f);
ConfigPanel val4 = new ConfigPanel(val.rootPanel, "Secret Variations ( 3 )", "mleg.secretvars");
BoolField val5 = new BoolField(val4, "Arm Legs", "mleg.arms", true);
BoolField val6 = new BoolField(val4, "Maurice Legs", "mleg.maurice", true);
BoolField val7 = new BoolField(val4, "Thigh Highs", "mleg.thighs", true);
object obj = <>O.<0>__UpdateLegSpeed;
if (obj == null)
{
PostFloatValueChangeEvent val8 = UpdateLegSpeed;
<>O.<0>__UpdateLegSpeed = val8;
obj = (object)val8;
}
val3.postValueChangeEvent += (PostFloatValueChangeEvent)obj;
object obj2 = <>O.<1>__UpdateArms;
if (obj2 == null)
{
PostBoolValueChangeEvent val9 = UpdateArms;
<>O.<1>__UpdateArms = val9;
obj2 = (object)val9;
}
val5.postValueChangeEvent += (PostBoolValueChangeEvent)obj2;
object obj3 = <>O.<2>__UpdateMaurice;
if (obj3 == null)
{
PostBoolValueChangeEvent val10 = UpdateMaurice;
<>O.<2>__UpdateMaurice = val10;
obj3 = (object)val10;
}
val6.postValueChangeEvent += (PostBoolValueChangeEvent)obj3;
object obj4 = <>O.<3>__UpdateThighs;
if (obj4 == null)
{
PostBoolValueChangeEvent val11 = UpdateThighs;
<>O.<3>__UpdateThighs = val11;
obj4 = (object)val11;
}
val7.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
val3.TriggerPostValueChangeEvent();
val5.TriggerPostValueChangeEvent();
val6.TriggerPostValueChangeEvent();
val7.TriggerPostValueChangeEvent();
return val;
}
private static void UpdateLegSpeed(float value)
{
Plugin.Logger.LogInfo((object)$"Update leg speed to {value}! ! ! ! ! !");
AccessibleConfigs.legSpeed = value;
}
private static void UpdateArms(bool value)
{
Plugin.Logger.LogInfo((object)$"Update arm legs to {value}! ! ! ! ! !");
AccessibleConfigs.armLegs = value;
}
private static void UpdateMaurice(bool value)
{
Plugin.Logger.LogInfo((object)$"Update maurice legs to {value}! ! ! ! ! !");
AccessibleConfigs.mauriceLegs = value;
}
private static void UpdateThighs(bool value)
{
Plugin.Logger.LogInfo((object)$"Update thigh highs to {value}! ! ! ! ! !");
AccessibleConfigs.thighs = value;
}
public static Texture2D LoadPNG(string filePath)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
Texture2D val = null;
if (File.Exists(filePath))
{
byte[] array = File.ReadAllBytes(filePath);
val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
}
return val;
}
}
[HarmonyPatch(typeof(SpiderBody), "Awake")]
public class MauriceDeathPatch : MonoBehaviour
{
[HarmonyPatch(typeof(SpiderBody), "Enrage")]
public class MauriceEnragePatch : MonoBehaviour
{
private static void Postfix(SpiderBody __instance)
{
EnemySimplifier component = ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent<EnemySimplifier>();
component.ChangeMaterialNew((MaterialState)2, component.enragedMaterial);
}
}
[HarmonyPatch(typeof(SpiderBody), "UnEnrage")]
public class MauriceUnEnragePatch : MonoBehaviour
{
private static void Postfix(SpiderBody __instance)
{
EnemySimplifier component = ((Component)((Component)__instance).transform.GetChild(3).GetChild(0)).GetComponent<EnemySimplifier>();
component.ChangeMaterialNew((MaterialState)0, component.originalMaterial);
}
}
[HarmonyPatch(typeof(SpiderBody), "GetHurt")]
public class MauriceWoundPatch : MonoBehaviour
{
private static void Postfix(SpiderBody __instance)
{
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Expected O, but got Unknown
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Expected O, but got Unknown
EnemyIdentifier component = ((Component)__instance).GetComponent<EnemyIdentifier>();
if (component.dead)
{
return;
}
Traverse val = Traverse.Create((object)__instance);
float num = (float)val.Field("health").GetValue();
float num2 = (float)val.Field("maxHealth").GetValue();
GameObject gameObject = ((Component)((Component)__instance).transform.GetChild(3)).gameObject;
FollowSpeed component2 = gameObject.GetComponent<FollowSpeed>();
bool wounded = component2.wounded;
if (num < num2 / 2f && !wounded)
{
Shader shader = ((Renderer)((Component)((Component)__instance).transform.GetChild(0).GetChild(5)).GetComponent<SkinnedMeshRenderer>()).material.shader;
SkinnedMeshRenderer component3 = ((Component)gameObject.transform.GetChild(0)).GetComponent<SkinnedMeshRenderer>();
Mesh sharedMesh = ((Component)LoadBundle.legsDamaged.transform.GetChild(0)).GetComponent<SkinnedMeshRenderer>().sharedMesh;
if (component2.special != 0)
{
EnemySimplifier component4 = ((Component)gameObject.transform.GetChild(0)).gameObject.GetComponent<EnemySimplifier>();
((Renderer)component3).material = component4.originalMaterial;
return;
}
component3.sharedMesh = sharedMesh;
Material val2 = new Material(shader)
{
mainTexture = (Texture)(object)LoadBundle.texDamaged
};
val2.EnableKeyword("ENEMY");
val2.EnableKeyword("VERTEX_LIGHTING");
val2.EnableKeyword("_FOG_ON");
val2.EnableKeyword("_USEALBEDOASEMISSIVE_ON");
val2.EnableKeyword("_VERTEXCOLORS_ON");
val2.EnableKeyword("_VERTEXLIGHTING_ON");
val2.EnableKeyword("_ZWRITE_ON");
((Renderer)component3).material = val2;
EnemySimplifier component5 = ((Component)gameObject.transform.GetChild(0)).gameObject.GetComponent<EnemySimplifier>();
component5.originalMaterial = val2;
component5.simplifiedMaterial = val2;
Material val3 = new Material(shader)
{
mainTexture = (Texture)(object)LoadBundle.texEnragedDamaged
};
val3.EnableKeyword("ENEMY");
val3.EnableKeyword("VERTEX_LIGHTING");
val3.EnableKeyword("_FOG_ON");
val3.EnableKeyword("_USEALBEDOASEMISSIVE_ON");
val3.EnableKeyword("_VERTEXCOLORS_ON");
val3.EnableKeyword("_VERTEXLIGHTING_ON");
val3.EnableKeyword("_ZWRITE_ON");
component5.enragedMaterial = val3;
component5.enragedSimplifiedMaterial = val3;
FollowSpeed component6 = gameObject.GetComponent<FollowSpeed>();
component6.wounded = true;
((Component)gameObject.transform.GetChild(0)).gameObject.layer = 25;
}
}
}
[HarmonyPatch(typeof(SpiderBody), "Die")]
public class MauriceBallerDeathPatch : MonoBehaviour
{
private static void Prefix(SpiderBody __instance)
{
FollowSpeed component = ((Component)((Component)__instance).transform.GetChild(3)).GetComponent<FollowSpeed>();
component.setRot = false;
}
}
private static void Prefix(SpiderBody __instance)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Expected O, but got Unknown
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Expected O, but got Unknown
LineRenderer[] componentsInChildren = ((Component)((Component)__instance).transform.parent).GetComponentsInChildren<LineRenderer>();
Color val = default(Color);
((Color)(ref val))..ctor(0f, 0f, 0f, 0f);
LineRenderer[] array = componentsInChildren;
foreach (LineRenderer val2 in array)
{
val2.startColor = val;
val2.endColor = val;
}
Random random = new Random();
int num = random.Next(100);
GameObject val3 = new GameObject();
Specials specials = Specials.normal;
Texture2D texHealthy = LoadBundle.texHealthy;
Texture2D texEnraged = LoadBundle.texEnraged;
switch (num)
{
case 0:
if (!AccessibleConfigs.armLegs)
{
val3 = LoadBundle.legs;
specials = Specials.normal;
texHealthy = LoadBundle.texHealthy;
texEnraged = LoadBundle.texEnraged;
}
else
{
val3 = LoadBundle.arms;
specials = Specials.arms;
texHealthy = LoadBundle.texHealthy;
texEnraged = LoadBundle.texEnraged;
}
break;
case 1:
if (!AccessibleConfigs.mauriceLegs)
{
val3 = LoadBundle.legs;
specials = Specials.normal;
texHealthy = LoadBundle.texHealthy;
texEnraged = LoadBundle.texEnraged;
}
else
{
val3 = LoadBundle.maurice;
specials = Specials.maurice;
texHealthy = LoadBundle.texMaurice;
texEnraged = LoadBundle.texEnragedMaurice;
}
break;
case 2:
if (!AccessibleConfigs.thighs)
{
val3 = LoadBundle.legs;
specials = Specials.normal;
texHealthy = LoadBundle.texHealthy;
texEnraged = LoadBundle.texEnraged;
}
else
{
val3 = LoadBundle.legs;
specials = Specials.thighs;
texHealthy = LoadBundle.texThighs;
texEnraged = LoadBundle.texThighsEnraged;
}
break;
default:
val3 = LoadBundle.legs;
specials = Specials.normal;
texHealthy = LoadBundle.texHealthy;
texEnraged = LoadBundle.texEnraged;
break;
}
GameObject val4 = Object.Instantiate<GameObject>(val3);
val4.transform.parent = ((Component)__instance).transform;
val4.transform.localPosition = new Vector3(0f, -0.96f, 0f);
val4.transform.localScale = new Vector3(0.1f, 0.12f, 0.1f);
Shader shader = ((Renderer)((Component)((Component)__instance).transform.GetChild(0).GetChild(5)).GetComponent<SkinnedMeshRenderer>()).material.shader;
SkinnedMeshRenderer component = ((Component)val4.transform.GetChild(0)).GetComponent<SkinnedMeshRenderer>();
Material val5 = new Material(shader)
{
mainTexture = (Texture)(object)texHealthy
};
val5.EnableKeyword("ENEMY");
val5.EnableKeyword("VERTEX_LIGHTING");
val5.EnableKeyword("_FOG_ON");
val5.EnableKeyword("_USEALBEDOASEMISSIVE_ON");
val5.EnableKeyword("_VERTEXCOLORS_ON");
val5.EnableKeyword("_VERTEXLIGHTING_ON");
val5.EnableKeyword("_ZWRITE_ON");
((Renderer)component).material = val5;
EnemySimplifier val6 = ((Component)val4.transform.GetChild(0)).gameObject.AddComponent<EnemySimplifier>();
val6.originalMaterial = val5;
val6.simplifiedMaterial = val5;
Material val7 = new Material(shader)
{
mainTexture = (Texture)(object)texEnraged
};
val7.EnableKeyword("ENEMY");
val7.EnableKeyword("VERTEX_LIGHTING");
val7.EnableKeyword("_FOG_ON");
val7.EnableKeyword("_USEALBEDOASEMISSIVE_ON");
val7.EnableKeyword("_VERTEXCOLORS_ON");
val7.EnableKeyword("_VERTEXLIGHTING_ON");
val7.EnableKeyword("_ZWRITE_ON");
val6.enragedMaterial = val7;
val6.enragedSimplifiedMaterial = val7;
FollowSpeed followSpeed = val4.AddComponent<FollowSpeed>();
followSpeed.follow = ((Component)__instance).gameObject;
followSpeed.special = specials;
((Component)val4.transform.GetChild(0)).gameObject.layer = 25;
GameObject[] targets = (GameObject[])(object)new GameObject[2]
{
((Component)((Component)__instance).transform.GetChild(0).GetChild(5)).gameObject,
((Component)val4.transform.GetChild(0)).gameObject
};
OutdoorsChecker componentInChildren = ((Component)__instance).GetComponentInChildren<OutdoorsChecker>();
componentInChildren.targets = targets;
}
}
public class FollowSpeed : MonoBehaviour
{
public GameObject follow;
public bool wounded;
public Specials special;
public bool setRot = true;
private Animator animator;
private Vector3 prevPos = new Vector3(0f, 0f, 0f);
private float legSpeed;
private void Awake()
{
animator = ((Component)this).GetComponent<Animator>();
legSpeed = AccessibleConfigs.legSpeed;
SlowUpdate();
}
private void Update()
{
//IL_0008: 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_007d: 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_0056: 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)
animator.speed = Vector3.Distance(prevPos, follow.transform.position) * legSpeed;
if (setRot)
{
((Component)this).transform.eulerAngles = new Vector3(0f, follow.transform.GetChild(0).eulerAngles.y, 0f);
}
prevPos = follow.transform.position;
}
private void SlowUpdate()
{
((MonoBehaviour)this).Invoke("SlowUpdate", 1f);
if (!setRot)
{
legSpeed = AccessibleConfigs.legSpeed / 4f;
}
else
{
legSpeed = AccessibleConfigs.legSpeed;
}
}
}
public enum Specials
{
normal,
arms,
maurice,
thighs
}
[BepInPlugin("bitmotte.MauriceLegger", "MauriceLegger", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static PluginConfigurator config;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin bitmotte.MauriceLegger is loaded!");
Harmony val = new Harmony("bitmotte.MauriceLegger");
val.PatchAll();
config = MauriceConfigurator.CreateConfigurator();
SceneManager.sceneLoaded += OnSceneLoad;
}
public static void OnSceneLoad(Scene scene, LoadSceneMode mode)
{
LoadBundle.Load();
}
}
public static class LoadBundle
{
public static GameObject legs;
public static Texture2D texHealthy;
public static Texture2D texEnraged;
public static GameObject legsDamaged;
public static Texture2D texDamaged;
public static Texture2D texEnragedDamaged;
public static GameObject arms;
public static GameObject maurice;
public static Texture2D texMaurice;
public static Texture2D texEnragedMaurice;
public static Texture2D texThighs;
public static Texture2D texThighsEnraged;
public static void Load()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
AssetBundle val = AssetBundle.LoadFromFile(Pathing.GetPluginPath() + "/leg.bundle");
legs = (GameObject)val.LoadAsset("Assets/legs.prefab");
texHealthy = (Texture2D)val.LoadAsset("Assets/T_Cerberus.png");
texEnraged = (Texture2D)val.LoadAsset("Assets/T_CerberusEnraged.png");
legsDamaged = (GameObject)val.LoadAsset("Assets/legs_cracked.prefab");
texDamaged = (Texture2D)val.LoadAsset("Assets/T_Cerberus_Damaged.png");
texEnragedDamaged = (Texture2D)val.LoadAsset("Assets/T_CerberusEnragedDamaged.png");
maurice = (GameObject)val.LoadAsset("Assets/maurice.prefab");
texMaurice = (Texture2D)val.LoadAsset("Assets/T_MaliciousFace.png");
texEnragedMaurice = (Texture2D)val.LoadAsset("Assets/T_MaliciousFaceEnraged.png");
texThighs = (Texture2D)val.LoadAsset("Assets/T_CerberusThighs.png");
texThighsEnraged = (Texture2D)val.LoadAsset("Assets/T_CerberusThighsEnraged.png");
arms = (GameObject)val.LoadAsset("Assets/arms.prefab");
val.Unload(false);
}
}
public static class Pathing
{
public static string GetPluginPath()
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uriBuilder = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uriBuilder.Path);
return Path.GetDirectoryName(path);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "bitmotte.MauriceLegger";
public const string PLUGIN_NAME = "MauriceLegger";
public const string PLUGIN_VERSION = "1.0.0";
}
}