using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.AddressableAssets;
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: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BigSillyGutterman;
internal class BeamID : MonoBehaviour
{
}
[BepInPlugin("plonk.bigsillygutterman", "BigSillyGutterman", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
[HarmonyPatch]
public class Patches
{
private static bool injectedEndless;
private static bool injectedSpawnmenu;
[HarmonyPrefix]
[HarmonyPatch(typeof(BeamgunBeam), "FixedUpdate")]
public static bool BeamFixedUpdatePatch(BeamgunBeam __instance)
{
if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<BeamID>()))
{
return true;
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(BeamgunBeam), "Update")]
public static bool BeamUpdatePatch(BeamgunBeam __instance)
{
//IL_001d: 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_005c: 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)
//IL_006e: 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_007d: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: 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_0117: 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_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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<BeamID>()))
{
return true;
}
if (__instance.fakeStartPoint != Vector3.zero)
{
__instance.line.SetPosition(0, __instance.fakeStartPoint);
}
else
{
__instance.line.SetPosition(0, ((Component)__instance.line).transform.position);
}
Vector3 forward = ((Component)__instance).transform.forward * -1f;
LayerMask val = LayerMaskDefaults.Get((LMD)3);
if (__instance.canHitPlayer && __instance.playerDamageCooldown <= 0f)
{
val = LayerMaskDefaults.Get((LMD)6);
}
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val2, float.PositiveInfinity, LayerMask.op_Implicit(val), (QueryTriggerInteraction)1))
{
__instance.hitPosition = ((RaycastHit)(ref val2)).point;
forward = ((RaycastHit)(ref val2)).normal;
}
else
{
__instance.hitPosition = ((Component)__instance).transform.position + ((Component)__instance).transform.forward * 100f;
}
__instance.line.SetPosition(1, __instance.hitPosition);
((Component)__instance.hitParticle).transform.position = __instance.hitPosition;
((Component)__instance.hitParticle).transform.forward = forward;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Gutterman), "SetSpeed")]
public static bool CrabbyPatch(Gutterman __instance)
{
if (((Component)__instance).GetComponent<EnemyIdentifier>().overrideFullName == "Crabbytank")
{
__instance.GetValues();
if (__instance.difficulty == 0)
{
__instance.anim.speed = 0.8f;
__instance.defaultMovementSpeed = 40f;
__instance.windupSpeed = 0.5f;
}
else if (__instance.difficulty == 1)
{
__instance.anim.speed = 0.9f;
__instance.defaultMovementSpeed = 45f;
__instance.windupSpeed = 0.75f;
}
else
{
__instance.anim.speed = 1f;
__instance.defaultMovementSpeed = 50f;
__instance.windupSpeed = 1f;
}
Animator anim = __instance.anim;
anim.speed *= __instance.eid.totalSpeedModifier;
__instance.defaultMovementSpeed *= __instance.eid.totalSpeedModifier;
__instance.nma.speed = (__instance.slowMode ? (__instance.defaultMovementSpeed / 2f) : __instance.defaultMovementSpeed);
__instance.windupSpeed *= __instance.eid.totalSpeedModifier;
if (__instance.difficulty > 2)
{
__instance.trackingSpeedMultiplier = 1f;
}
else if (__instance.difficulty == 2)
{
__instance.trackingSpeedMultiplier = 0.8f;
}
else if (__instance.difficulty == 1)
{
__instance.trackingSpeedMultiplier = 0.5f;
}
else
{
__instance.trackingSpeedMultiplier = 0.35f;
}
__instance.defaultTrackingSpeed = 1f;
if (__instance.trackingSpeed < __instance.defaultTrackingSpeed)
{
__instance.trackingSpeed = __instance.defaultTrackingSpeed;
}
return false;
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(EndlessGrid), "Start")]
public static void OnStart(EndlessGrid __instance, ref PrefabDatabase ___prefabs)
{
bool flag = injectedEndless;
Debug.Log((object)"try inject gutter");
if (!flag)
{
injectedEndless = true;
EndlessEnemy[] specialEnemies = ___prefabs.specialEnemies;
EndlessEnemy[] array = (EndlessEnemy[])(object)new EndlessEnemy[specialEnemies.Length + 1];
Array.Copy(specialEnemies, array, specialEnemies.Length);
array[specialEnemies.Length] = MainCode.FetchFromBundle<EndlessEnemy>("CrabbyTankData.asset", autofill: true);
___prefabs.specialEnemies = array;
Debug.Log((object)("injected gutter: " + (object)MainCode.FetchFromBundle<EndlessEnemy>("CrabbyTankData.asset", autofill: true).prefab));
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SpawnMenu), "Awake")]
public static void InjectSpawnmenu(ref SpawnableObjectsDatabase ___objects)
{
SpawnableObject[] enemies = ___objects.enemies;
SpawnableObject[] array = (SpawnableObject[])(object)new SpawnableObject[enemies.Length + 1];
Array.Copy(enemies, array, enemies.Length);
array[^1] = MainCode.FetchFromBundle<SpawnableObject>("CrabbySpawnable.asset", autofill: true);
___objects.enemies = array;
}
}
public static GameObject beam;
public static BeamgunBeam bgbeam;
public static AssetBundle tcbundle;
private static bool candoshit;
private static bool canswitchstate = true;
private bool cansendmessage = true;
public static void SendHudMessage(string msg, int delay, bool silent)
{
MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", delay, silent);
}
public static Type Fetch<Type>(string name)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<Type>((object)name).WaitForCompletion();
}
public static Type FetchFromBundle<Type>(string name, bool autofill = false) where Type : Object
{
if (!autofill)
{
return tcbundle.LoadAsset<Type>(name);
}
return tcbundle.LoadAsset<Type>("assets/formods/crabbytank/" + name);
}
public static void SetLayerRecursive(GameObject gobject, string layername)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
gobject.layer = LayerMask.NameToLayer(layername);
foreach (Transform item in gobject.transform)
{
Transform val = item;
((Component)val).gameObject.layer = LayerMask.NameToLayer(layername);
Transform componentInChildren = ((Component)val).GetComponentInChildren<Transform>();
if ((Object)(object)componentInChildren != (Object)null)
{
SetLayerRecursive(((Component)val).gameObject, layername);
}
}
}
public Vector3 Shake(Vector3 originpos, Vector3 pos, float shakeamt)
{
//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)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0050: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_0085: 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_009c: 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)
Vector3 val = Vector3.zero;
val = pos + new Vector3(Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt), Random.Range(0f - shakeamt, shakeamt));
((Vector3)(ref val))..ctor(Mathf.Clamp(val.x, originpos.x - 0.01f, originpos.x + 0.01f), Mathf.Clamp(val.y, originpos.y - 0.01f, originpos.y + 0.01f), Mathf.Clamp(val.z, originpos.z - 0.01f, originpos.z + 0.01f));
return val;
}
public static void Log(string log, int type = 1)
{
switch (type)
{
case 1:
Debug.Log((object)log);
break;
case 2:
Debug.LogWarning((object)log);
break;
case 3:
Debug.LogError((object)log);
break;
}
}
public void Awake()
{
if ((Object)(object)tcbundle == (Object)null)
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
tcbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "bigsillygutter"));
Log("Got bundle " + (object)tcbundle);
for (int i = 0; i < tcbundle.GetAllAssetNames().Length; i++)
{
Log(tcbundle.GetAllAssetNames()[i].ToString());
}
}
if ((Object)(object)tcbundle == (Object)null)
{
Log("Failed to catch BigSillyGutter bundle", 3);
}
Log("kaboom (bigsillygutter loaded)");
SceneManager.sceneLoaded += OnLoaded;
}
public void OnLoaded(Scene scene, LoadSceneMode mode)
{
}
public void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("plonk.BigSillyGutterPatches");
val.PatchAll();
}
public void Update()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
if (!candoshit && SceneHelper.CurrentScene == "Main Menu")
{
if ((Object)(object)tcbundle != (Object)null)
{
candoshit = true;
}
else if (cansendmessage)
{
SendHudMessage("Bigsillygutter failed to load. Assetbundle does not exist or is in wrong folder. Please follow README install instructions.", 0, silent: false);
cansendmessage = false;
}
}
if (candoshit && SceneHelper.CurrentScene != "Main Menu" && (Object)(object)beam == (Object)null)
{
beam = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Unused/BeamgunBeam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation, ((Component)MonoSingleton<CameraController>.instance).transform);
bgbeam = beam.GetComponent<BeamgunBeam>();
bgbeam.beamWidth = 0f;
bgbeam.beamCheckSpeed = 0f;
beam.AddComponent<BeamID>();
}
}
}