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 BaguetteRocketLauncher.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BaguetteRocketLauncher")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BaguetteRocketLauncher")]
[assembly: AssemblyTitle("BaguetteRocketLauncher")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BaguetteRocketLauncher
{
public class AssetStorage : MonoBehaviour
{
private static AssetStorage _instance;
private AssetBundle _bundle;
public static AssetStorage Instance => _instance;
private void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
_bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "baguette"));
if ((Object)(object)_bundle == (Object)null)
{
BaguetteRocketLaucher.Logger.LogError((object)"Failed to load bundle");
}
}
public T LoadAsset<T>(string path) where T : Object
{
return _bundle.LoadAsset<T>(path);
}
}
[BepInPlugin("com.d4navi0.TetoRocketExpansion", "Teto Rocket Expansion", "1.0.0")]
public class BaguetteRocketLaucher : BaseUnityPlugin
{
internal class BaguetteRocketLauncherInfo
{
internal const string NAME = "Teto Rocket Expansion";
internal const string GUID = "com.d4navi0.TetoRocketExpansion";
internal const string VERSION = "1.0.0";
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static BoolValueChangeEventDelegate <>9__4_0;
public static BoolValueChangeEventDelegate <>9__4_1;
public static ColorValueChangeEventDelegate <>9__4_3;
internal void <Awake>b__4_0(BoolValueChangeEvent e)
{
RocketLauncher_Start_Patch.baguette = e.value;
}
internal void <Awake>b__4_1(BoolValueChangeEvent e)
{
Explosion_Update_Patch.tetoExplosions = e.value;
}
internal void <Awake>b__4_3(ColorValueChangeEvent e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Cannonball_Start_Patch.canonballColor = e.value;
}
}
internal static ManualLogSource Logger;
private readonly Harmony harmony = new Harmony("com.d4navi0.TetoRocketExpansion");
internal static PluginConfigurator config;
private void Awake()
{
//IL_0070: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Expected O, but got Unknown
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"waluigi launcher (ball knowledge)");
((Component)this).gameObject.AddComponent<AssetStorage>();
config = PluginConfigurator.Create("Teto Rocket Expansion", "com.d4navi0.TetoRocketExpansion");
Sprite image = AssetStorage.Instance.LoadAsset<Sprite>("tetoicon_scaled");
config.image = image;
BoolField val = new BoolField(config.rootPanel, "Baguette rocket launcher (requires restart)", "baguette", true);
RocketLauncher_Start_Patch.baguette = val.value;
object obj = <>c.<>9__4_0;
if (obj == null)
{
BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent e)
{
RocketLauncher_Start_Patch.baguette = e.value;
};
<>c.<>9__4_0 = val2;
obj = (object)val2;
}
val.onValueChange += (BoolValueChangeEventDelegate)obj;
BoolField val3 = new BoolField(config.rootPanel, "Add Teto to explosions", "teto_explosions", true);
Explosion_Update_Patch.tetoExplosions = val3.value;
object obj2 = <>c.<>9__4_1;
if (obj2 == null)
{
BoolValueChangeEventDelegate val4 = delegate(BoolValueChangeEvent e)
{
Explosion_Update_Patch.tetoExplosions = e.value;
};
<>c.<>9__4_1 = val4;
obj2 = (object)val4;
}
val3.onValueChange += (BoolValueChangeEventDelegate)obj2;
ConfigDivision cannonConfigPanel = new ConfigDivision(config.rootPanel, "cannon_config");
BoolField val5 = new BoolField(config.rootPanel, "Teto cannonballs", "teto_cannonball", true);
Cannonball_Start_Patch.tetoCannonball = val5.value;
((ConfigField)cannonConfigPanel).interactable = val5.value;
val5.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
((ConfigField)cannonConfigPanel).interactable = e.value;
Cannonball_Start_Patch.tetoCannonball = e.value;
};
ColorField val6 = new ColorField((ConfigPanel)(object)cannonConfigPanel, "Teto cannonball color", "cannon_color", new Color(0.4f, 0.4f, 0.4f));
Cannonball_Start_Patch.canonballColor = val6.value;
object obj3 = <>c.<>9__4_3;
if (obj3 == null)
{
ColorValueChangeEventDelegate val7 = delegate(ColorValueChangeEvent e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Cannonball_Start_Patch.canonballColor = e.value;
};
<>c.<>9__4_3 = val7;
obj3 = (object)val7;
}
val6.onValueChange += (ColorValueChangeEventDelegate)obj3;
harmony.PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BaguetteRocketLauncher";
public const string PLUGIN_NAME = "BaguetteRocketLauncher";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BaguetteRocketLauncher.Patches
{
[HarmonyPatch(typeof(RocketLauncher), "Start")]
public class RocketLauncher_Start_Patch
{
public static bool baguette = true;
private static void Postfix(RocketLauncher __instance)
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
if (baguette)
{
BaguetteRocketLaucher.Logger.LogInfo((object)"replacing with baguette");
Transform obj = ((Component)__instance).transform.Find("RocketLauncher");
Transform obj2 = obj.Find("RocketLauncher");
Material material = ((Renderer)((Component)obj2).GetComponent<SkinnedMeshRenderer>()).material;
Object.Destroy((Object)(object)((Component)obj2).gameObject);
Transform parent = obj.Find("Armature").Find("Body_Bone");
GameObject obj3 = Object.Instantiate<GameObject>(AssetStorage.Instance.LoadAsset<GameObject>("baguette"));
Transform val = obj3.transform.Find("default");
MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
Material material2 = ((Renderer)component).material;
material.mainTexture = material2.mainTexture;
((Renderer)component).material = material;
obj3.transform.parent = parent;
obj3.transform.localPosition = new Vector3(-0.0516f, 0.0785f, 0f);
obj3.transform.localEulerAngles = new Vector3(339.4521f, 279.5856f, 84.3798f);
((Component)val).gameObject.layer = 13;
}
}
}
[HarmonyPatch(typeof(Cannonball), "Start")]
public class Cannonball_Start_Patch
{
public static bool tetoCannonball = true;
public static Color canonballColor = Color.black;
private static void Postfix(Cannonball __instance)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (tetoCannonball)
{
BaguetteRocketLaucher.Logger.LogInfo((object)"replacing cannonball with teto");
MeshRenderer component = ((Component)__instance).GetComponent<MeshRenderer>();
Shader shader = ((Renderer)component).material.shader;
Object.Destroy((Object)(object)((Component)__instance).GetComponent<MeshFilter>());
Object.Destroy((Object)(object)component);
GameObject obj = Object.Instantiate<GameObject>(AssetStorage.Instance.LoadAsset<GameObject>("teto"));
MeshRenderer component2 = ((Component)obj.transform.Find("default")).GetComponent<MeshRenderer>();
((Renderer)component2).material.shader = shader;
((Renderer)component2).material.SetColor("_Color", canonballColor);
((Object)obj).name = "teto";
obj.transform.parent = ((Component)__instance).transform;
obj.transform.localPosition = new Vector3(0f, -1.2f, 0f);
}
}
}
[HarmonyPatch(typeof(Cannonball), "FixedUpdate")]
public class Cannonball_Update_Patch
{
private static void Postfix(Cannonball __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_003e: Unknown result type (might be due to invalid IL or missing references)
if (Cannonball_Start_Patch.tetoCannonball)
{
Vector3 velocity = __instance.Rigidbody.velocity;
if (!(((Vector3)(ref velocity)).magnitude <= 0.0001f))
{
((Component)__instance).transform.Find("teto").rotation = Quaternion.LookRotation(__instance.Rigidbody.velocity);
}
}
}
}
[HarmonyPatch(typeof(Explosion), "Start")]
public class Explosion_Start_Patch
{
private static void Postfix(Explosion __instance)
{
//IL_0031: 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)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (Explosion_Update_Patch.tetoExplosions)
{
BaguetteRocketLaucher.Logger.LogInfo((object)"adding teto to explosion");
GameObject obj = Object.Instantiate<GameObject>(AssetStorage.Instance.LoadAsset<GameObject>("teto"));
((Component)__instance).transform.eulerAngles = Vector3.zero;
((Object)obj.transform).name = "teto";
Vector3 val = -((Component)__instance).transform.up;
obj.transform.parent = ((Component)__instance).transform;
obj.transform.localPosition = 0.2348f * val;
obj.transform.localEulerAngles = Vector3.zero;
obj.transform.localScale = new Vector3(0.2f, 0.15f, 0.2f);
}
}
}
[HarmonyPatch(typeof(Explosion), "Update")]
public class Explosion_Update_Patch
{
public static bool tetoExplosions = true;
private static void Postfix(Explosion __instance)
{
if (tetoExplosions)
{
((Renderer)((Component)((Component)__instance).transform.Find("teto").Find("default")).GetComponent<MeshRenderer>()).material = ((Renderer)((Component)__instance).GetComponent<MeshRenderer>()).material;
}
}
}
}