using System;
using System.Collections.Generic;
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 Configgy;
using HarmonyLib;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
[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 ThundergunRevised;
internal class LassoIdentifier : MonoBehaviour
{
public bool islasso = true;
}
[BepInPlugin("plonk.thundergun2", "Thundergun revised", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class WeaponMakerScript : BaseUnityPlugin
{
[HarmonyPatch]
public class BeamPatch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ContinuousBeam), "Update")]
public static bool BeamgunRemoveStyle(ContinuousBeam __instance)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_00d7: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03af: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<LassoIdentifier>()))
{
Vector3 zero = Vector3.zero;
RaycastHit val = default(RaycastHit);
zero = ((!Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val, float.PositiveInfinity, LayerMask.op_Implicit(__instance.environmentMask))) ? (((Component)__instance).transform.position + ((Component)__instance).transform.forward * 999f) : ((RaycastHit)(ref val)).point);
__instance.lr.SetPosition(1, zero);
__instance.lr.widthMultiplier = __instance.beamWidth * 3f;
if (Object.op_Implicit((Object)(object)__instance.impactEffect))
{
__instance.impactEffect.transform.position = zero;
}
RaycastHit[] array = Physics.SphereCastAll(((Component)__instance).transform.position + ((Component)__instance).transform.forward * __instance.beamWidth, __instance.beamWidth, ((Component)__instance).transform.forward, Vector3.Distance(((Component)__instance).transform.position, zero) - __instance.beamWidth, LayerMask.op_Implicit(__instance.hitMask));
if (array != null && array.Length != 0)
{
Bleeder val3 = default(Bleeder);
for (int i = 0; i < array.Length; i++)
{
if (__instance.canHitPlayer && __instance.playerCooldown <= 0f && ((Component)((RaycastHit)(ref array[i])).collider).gameObject.CompareTag("Player"))
{
__instance.playerCooldown = 0.5f;
if (!Physics.Raycast(((Component)__instance).transform.position, ((RaycastHit)(ref array[i])).point - ((Component)__instance).transform.position, ((RaycastHit)(ref array[i])).distance, LayerMask.op_Implicit(__instance.environmentMask)))
{
MonoSingleton<NewMovement>.Instance.GetHurt(Mathf.RoundToInt(__instance.damage), true, 1f, false, false, 1f, true);
}
}
else if ((((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 10 || ((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 11) && __instance.canHitEnemy)
{
EnemyIdentifierIdentifier component = ((Component)((RaycastHit)(ref array[i])).transform).GetComponent<EnemyIdentifierIdentifier>();
if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.eid) || (__instance.enemy && (component.eid.enemyType == __instance.safeEnemyType || EnemyIdentifier.CheckHurtException(__instance.safeEnemyType, component.eid.enemyType, __instance.target))))
{
continue;
}
EnemyIdentifier eid = component.eid;
bool flag = false;
if (__instance.hitEnemies.Contains(eid))
{
flag = true;
}
if (!flag || __instance.enemyCooldowns[__instance.hitEnemies.IndexOf(eid)] <= 0f)
{
if (!flag)
{
__instance.hitEnemies.Add(eid);
__instance.enemyCooldowns.Add(0.5f);
}
else
{
__instance.enemyCooldowns[__instance.hitEnemies.IndexOf(eid)] = 0.5f;
}
eid.hitter = "nailgun";
GameObject gameObject = ((Component)((RaycastHit)(ref array[i])).transform).gameObject;
Vector3 val2 = zero - ((Component)__instance).transform.position;
eid.DeliverDamage(gameObject, ((Vector3)(ref val2)).normalized * 1000f, ((RaycastHit)(ref array[i])).point, __instance.damage / 10f, true, 0f, (GameObject)null, false);
if (!eid.dead)
{
MonoSingleton<StyleHUD>.instance.AddPoints(20, "LASER", greentc, eid, 1, "", "-CUT");
}
}
}
else if (((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 8 || ((Component)((RaycastHit)(ref array[i])).transform).gameObject.layer == 24)
{
Breakable component2 = ((Component)((RaycastHit)(ref array[i])).transform).GetComponent<Breakable>();
if (Object.op_Implicit((Object)(object)component2) && !component2.playerOnly && !component2.precisionOnly)
{
component2.Break();
}
if (((Component)((RaycastHit)(ref array[i])).transform).gameObject.TryGetComponent<Bleeder>(ref val3))
{
val3.GetHit(((RaycastHit)(ref array[i])).point, (GoreType)3);
}
}
}
}
if (__instance.playerCooldown > 0f)
{
__instance.playerCooldown = Mathf.MoveTowards(__instance.playerCooldown, 0f, Time.deltaTime);
}
if (__instance.enemyCooldowns.Count > 0)
{
for (int j = 0; j < __instance.enemyCooldowns.Count; j++)
{
__instance.enemyCooldowns[j] = Mathf.MoveTowards(__instance.enemyCooldowns[j], 0f, Time.deltaTime);
}
}
return false;
}
return true;
}
}
[Configgable("", "Thundercannons enabled", 0, "Self explanatory")]
private static ConfigToggle tcenabled = new ConfigToggle(true);
[Configgable("", "Thundercannon slot", 0, "The slot in which your weapons reside. cannot be higher than 6.")]
private static ConfigInputField<int> tcslot = new ConfigInputField<int>(6, (Func<int, bool>)null, (Func<string, ValueTuple<bool, int>>)null);
public static GameObject bluetc;
public static GameObject bluetcprefab;
public static GameObject bluetcmodel;
public static GameObject greentc;
public static GameObject greentcprefab;
public static GameObject greentcmodel;
public static GameObject goldtc;
public static GameObject goldtcprefab;
public static GameObject goldtcmodel;
public static AssetBundle tcbundle;
private static bool candoshit;
public static ConfigBuilder ConfigBuilder { get; private set; }
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/thundercannonbundle/" + 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)
{
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()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
ConfigBuilder = new ConfigBuilder("plonk.thundergun2", "Thundercannon");
ConfigBuilder.Build();
Log("kaboom (thundergun loaded)", 1);
if ((Object)(object)tcbundle == (Object)null)
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
tcbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "thundercanon"));
Log("Got bundle " + (object)tcbundle, 1);
for (int i = 0; i < tcbundle.GetAllAssetNames().Length; i++)
{
Log(tcbundle.GetAllAssetNames()[i].ToString(), 1);
}
if ((Object)(object)bluetcprefab == (Object)null)
{
bluetcprefab = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/thundergunbluevar.prefab");
bluetcprefab.AddComponent<BlueThundergun>();
}
if ((Object)(object)bluetcmodel == (Object)null)
{
bluetcmodel = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/beamcutter variant.prefab");
}
if ((Object)(object)greentcprefab == (Object)null)
{
greentcprefab = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/thundergungreenvar.prefab");
greentcprefab.AddComponent<GreenThundergun>();
}
if ((Object)(object)greentcmodel == (Object)null)
{
greentcmodel = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/beamcutter variant 1.prefab");
}
if ((Object)(object)goldtcprefab == (Object)null)
{
goldtcprefab = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/thundergunyellowvar.prefab");
goldtcprefab.AddComponent<GoldThundergun>();
}
if ((Object)(object)goldtcmodel == (Object)null)
{
goldtcmodel = tcbundle.LoadAsset<GameObject>("assets/formods/thundercannonbundle/beamcutter variant 2.prefab");
}
}
}
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.thundergun2");
val.PatchAll();
}
public void Update()
{
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: 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
{
SendHudMessage("Thundercannon mod failed to load.\r\n<color=green>The asset bundle (thundercanon) is missing or in the wrong place. please place it where the mod's .dll is located.</color>", 0, silent: true);
}
}
if (!candoshit || !(SceneHelper.CurrentScene != "Main Menu"))
{
return;
}
if (((ConfigValueElement<bool>)(object)tcenabled).Value)
{
if ((Object)(object)MonoSingleton<RailcannonMeter>.instance != (Object)null && ((Behaviour)MonoSingleton<RailcannonMeter>.instance).enabled)
{
((Behaviour)MonoSingleton<RailcannonMeter>.instance.self).enabled = true;
}
if ((Object)(object)bluetc == (Object)null && (Object)(object)bluetcprefab != (Object)null && (Object)(object)bluetcmodel != (Object)null)
{
bluetc = MakeThundergun("Railcannon Charge", ((ConfigValueElement<int>)(object)tcslot).Value, 1);
}
if ((Object)(object)bluetcprefab == (Object)null && (Object)(object)bluetcmodel == (Object)null)
{
Log("Failed to load model and gun for blue thundergun", 1);
}
if ((Object)(object)greentc == (Object)null && (Object)(object)greentcprefab != (Object)null)
{
greentc = MakeThundergun("Railcannon Lasso", ((ConfigValueElement<int>)(object)tcslot).Value, 2);
}
if ((Object)(object)goldtc == (Object)null && (Object)(object)goldtcprefab != (Object)null)
{
goldtc = MakeThundergun("Railcannon Bombardment", ((ConfigValueElement<int>)(object)tcslot).Value, 3);
}
if ((Object)(object)bluetc != (Object)null && !bluetc.activeSelf)
{
BlueThundergun component = bluetc.GetComponent<BlueThundergun>();
((Component)component).transform.localRotation = Quaternion.Euler(component.rot, 0f, 0f);
component.charge = 0f;
component.rot = 90f;
component.rotspeed = 300f;
component.delay = 0.25f;
}
if ((Object)(object)greentc != (Object)null && !greentc.activeSelf)
{
GreenThundergun component2 = greentc.GetComponent<GreenThundergun>();
((Component)component2).transform.localRotation = Quaternion.Euler(component2.rot, 0f, 0f);
component2.rot = 90f;
component2.rotspeed = 300f;
if ((Object)(object)component2.lassobeam != (Object)null)
{
component2.lassobeam.beamWidth = 0f;
}
}
if ((Object)(object)goldtc != (Object)null && !goldtc.activeSelf)
{
GoldThundergun component3 = goldtc.GetComponent<GoldThundergun>();
((Component)component3).transform.localRotation = Quaternion.Euler(component3.rot, 0f, 0f);
component3.rot = 90f;
component3.rotspeed = 300f;
}
}
else
{
if ((Object)(object)bluetc != (Object)null)
{
MonoSingleton<GunControl>.Instance.slots[Mathf.Clamp(((ConfigValueElement<int>)(object)tcslot).Value, 1, 6) - 1].Remove(bluetc);
MonoSingleton<GunControl>.Instance.allWeapons.Remove(bluetc);
MonoSingleton<GunControl>.Instance.slotDict.Remove(bluetc);
MonoSingleton<StyleHUD>.Instance.weaponFreshness.Remove(bluetc);
Object.Destroy((Object)(object)bluetc);
}
if ((Object)(object)greentc != (Object)null)
{
MonoSingleton<GunControl>.Instance.slots[Mathf.Clamp(((ConfigValueElement<int>)(object)tcslot).Value, 1, 6) - 1].Remove(greentc);
MonoSingleton<GunControl>.Instance.allWeapons.Remove(greentc);
MonoSingleton<GunControl>.Instance.slotDict.Remove(greentc);
MonoSingleton<StyleHUD>.Instance.weaponFreshness.Remove(greentc);
Object.Destroy((Object)(object)greentc);
}
if ((Object)(object)goldtc != (Object)null)
{
MonoSingleton<GunControl>.Instance.slots[Mathf.Clamp(((ConfigValueElement<int>)(object)tcslot).Value, 1, 6) - 1].Remove(goldtc);
MonoSingleton<GunControl>.Instance.allWeapons.Remove(goldtc);
MonoSingleton<GunControl>.Instance.slotDict.Remove(goldtc);
MonoSingleton<StyleHUD>.Instance.weaponFreshness.Remove(goldtc);
Object.Destroy((Object)(object)goldtc);
}
}
}
public static GameObject MakeThundergun(string name, int slot, int variant)
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null && (Object)(object)MonoSingleton<StyleHUD>.Instance != (Object)null)
{
if (((Behaviour)MonoSingleton<GunControl>.Instance).enabled && ((Behaviour)MonoSingleton<StyleHUD>.Instance).enabled)
{
slot = Mathf.Clamp(slot, 1, 6);
GameObject val = null;
switch (variant)
{
case 1:
val = Object.Instantiate<GameObject>(bluetcprefab);
break;
case 2:
val = Object.Instantiate<GameObject>(greentcprefab);
break;
case 3:
val = Object.Instantiate<GameObject>(goldtcprefab);
break;
}
if ((Object)(object)val != (Object)null)
{
val.transform.parent = ((Component)MonoSingleton<GunControl>.Instance).transform;
val.transform.position = ((Component)MonoSingleton<GunControl>.Instance).transform.position;
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
if (slot <= MonoSingleton<GunControl>.Instance.slots.Count)
{
MonoSingleton<GunControl>.Instance.slots[slot - 1].Add(val);
}
MonoSingleton<GunControl>.Instance.allWeapons.Add(val);
MonoSingleton<GunControl>.Instance.slotDict.Add(val, slot - 1);
((Object)val).name = name;
MonoSingleton<StyleHUD>.Instance.weaponFreshness.Add(val, 10f);
switch (variant)
{
case 1:
{
BlueThundergun component3 = val.GetComponent<BlueThundergun>();
GameObject val4 = Object.Instantiate<GameObject>(bluetcmodel, Vector3.zero, Quaternion.identity, val.transform);
val4.transform.localPosition = new Vector3(0.1621f, -0.3047f, 0.4479f);
val4.transform.localRotation = Quaternion.Euler(0f, 270f, 180f);
((Component)component3).transform.localScale = new Vector3(5f, 5f, 5f);
component3.model = val4;
break;
}
case 2:
{
GreenThundergun component2 = val.GetComponent<GreenThundergun>();
GameObject val3 = Object.Instantiate<GameObject>(greentcmodel, Vector3.zero, Quaternion.identity, val.transform);
val3.transform.localPosition = new Vector3(0.1621f, -0.3047f, 0.4479f);
val3.transform.localRotation = Quaternion.Euler(0f, 270f, 180f);
((Component)component2).transform.localScale = new Vector3(5f, 5f, 5f);
component2.model = val3;
break;
}
case 3:
{
GoldThundergun component = val.GetComponent<GoldThundergun>();
GameObject val2 = Object.Instantiate<GameObject>(goldtcmodel, Vector3.zero, Quaternion.identity, val.transform);
val2.transform.localPosition = new Vector3(0.1621f, -0.3047f, 0.4479f);
val2.transform.localRotation = Quaternion.Euler(0f, 270f, 180f);
((Component)component).transform.localScale = new Vector3(5f, 5f, 5f);
component.model = val2;
break;
}
}
val.SetActive(false);
return val;
}
Log("Failed to create Thundergun. Variation not found.", 3);
return null;
}
return null;
}
return null;
}
}
internal class GoldThundergun : MonoBehaviour
{
public GameObject model;
public GameObject visbeam;
public GameObject barrelbone;
private Vector3 modeloriginpos;
public float rot;
public float rotspeed = 50f;
private bool canshoot;
private float maxrot = 8f;
private float wobblespeed = 300f;
private float wobblerot;
private bool canwobble;
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;
}
private void Start()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
rot = 90f;
rotspeed = 300f;
modeloriginpos = model.transform.localPosition;
}
private void Update()
{
//IL_0039: 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_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
rot = Mathf.MoveTowards(rot, 0f, Time.deltaTime * rotspeed);
((Component)this).transform.localRotation = Quaternion.Euler(rot, 0f, 0f);
if (MonoSingleton<InputManager>.instance.InputSource.Fire1.IsPressed && canshoot && MonoSingleton<WeaponCharges>.instance.raicharge == 5f)
{
Fire();
canshoot = false;
}
if (!MonoSingleton<InputManager>.instance.InputSource.Fire1.IsPressed && !canshoot)
{
canshoot = true;
}
if ((Object)(object)barrelbone == (Object)null)
{
barrelbone = ((Component)model.transform.Find("Bone/Bone.001")).gameObject;
}
else
{
barrelbone.transform.localRotation = Quaternion.Euler(0f, wobblerot, 0f);
}
if (MonoSingleton<WeaponCharges>.instance.raicharge == 5f)
{
if ((Object)(object)visbeam == (Object)null)
{
visbeam = ((Component)model.transform.Find("Bone/Bone.001/effect")).gameObject;
}
else
{
visbeam.SetActive(true);
}
if (canwobble && wobblerot < maxrot)
{
wobblerot = Mathf.MoveTowards(wobblerot, maxrot, Time.deltaTime * wobblespeed);
}
if (canwobble && wobblerot >= maxrot)
{
model.transform.localPosition = Shake(modeloriginpos, model.transform.localPosition, 0.007f);
canwobble = false;
}
if (!canwobble && wobblerot > 0f - maxrot)
{
wobblerot = Mathf.MoveTowards(wobblerot, 0f - maxrot, Time.deltaTime * wobblespeed);
}
if (!canwobble && wobblerot <= 0f - maxrot)
{
model.transform.localPosition = Shake(modeloriginpos, model.transform.localPosition, 0.007f);
canwobble = true;
}
}
else
{
if ((Object)(object)visbeam == (Object)null)
{
visbeam = ((Component)model.transform.Find("Bone/Bone.001/effect")).gameObject;
}
else
{
visbeam.SetActive(false);
}
model.transform.localPosition = modeloriginpos;
wobblerot = 0f;
}
}
private void Fire()
{
//IL_001e: 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_00b4: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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)
Vector3 val2 = default(Vector3);
for (int i = 0; i < 8; i++)
{
GameObject val = Object.Instantiate<GameObject>(WeaponMakerScript.FetchFromBundle<GameObject>("assets/formods/thundercannonbundle/grenade.prefab", autofill: false), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
val.GetComponent<Grenade>().sourceWeapon = ((Component)this).gameObject;
rot = -30f;
rotspeed = 50f;
if (NoWeaponCooldown.NoCooldown)
{
MonoSingleton<WeaponCharges>.instance.raicharge = 5f;
}
((Vector3)(ref val2))..ctor(Random.Range(-10f, 10f), Random.Range(-10f, 10f), Random.Range(-10f, 10f));
Transform transform = val.transform;
transform.rotation *= Quaternion.Euler(val2);
val.GetComponent<Rigidbody>().AddForce(val.transform.forward * 100f, (ForceMode)2);
}
Object.Instantiate<GameObject>(WeaponMakerScript.FetchFromBundle<GameObject>("goldtcshoot.prefab", autofill: true));
MonoSingleton<CameraController>.instance.CameraShake(1f);
MonoSingleton<TimeController>.Instance.ParryFlash();
MonoSingleton<WeaponCharges>.instance.raicharge = 0f;
}
}
internal class GreenThundergun : MonoBehaviour
{
private InputManager inman = MonoSingleton<InputManager>.Instance;
private PlayerInput source = MonoSingleton<InputManager>.Instance.InputSource;
private WeaponCharges charges = MonoSingleton<WeaponCharges>.instance;
private GameObject beam;
private GameObject lasso;
public GameObject model;
private float shakeamt = 0.033f;
private float shaketimer = 0.1f;
private AudioSource audsource;
public float rot;
public float rotspeed = 50f;
public float charge;
public float delay;
private Vector3 modeloriginpos;
private List<EnemyIdentifier> hiteidsbefore;
public ContinuousBeam lassobeam;
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 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)
{
switch (type)
{
case 1:
Debug.Log((object)log);
break;
case 2:
Debug.LogWarning((object)log);
break;
case 3:
Debug.LogError((object)log);
break;
}
}
private void Start()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
beam = WeaponMakerScript.FetchFromBundle<GameObject>("assets/formods/thundercannonbundle/tclasso.prefab", autofill: false);
modeloriginpos = model.transform.localPosition;
}
private void Update()
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: 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_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
rot = Mathf.MoveTowards(rot, 0f, Time.deltaTime * rotspeed);
((Component)this).transform.localRotation = Quaternion.Euler(rot, 0f, 0f);
if (inman.InputSource.Fire1.IsPressed)
{
if ((Object)(object)lasso == (Object)null)
{
lasso = Object.Instantiate<GameObject>(beam, ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)this).transform.rotation, ((Component)this).transform);
lasso.AddComponent<LassoIdentifier>();
lassobeam = lasso.GetComponent<ContinuousBeam>();
lassobeam.beamWidth = 0f;
}
else if ((Object)(object)lasso != (Object)null)
{
lassobeam.beamWidth = Mathf.MoveTowards(lassobeam.beamWidth, 0.35f, Time.deltaTime / 5f);
lasso.SetActive(true);
}
}
else if ((Object)(object)lasso != (Object)null)
{
lassobeam.beamWidth = Mathf.MoveTowards(lassobeam.beamWidth, 0f, Time.deltaTime / 2f);
if (lassobeam.beamWidth <= 0f)
{
lasso.SetActive(false);
}
}
if (!((Object)(object)lassobeam != (Object)null))
{
return;
}
lassobeam.damage = 150f * lassobeam.beamWidth;
lassobeam.lr.SetPosition(0, model.transform.GetChild(3).position);
((Component)lasso.transform.FindChild("Ring")).transform.position = model.transform.GetChild(3).position;
((Component)lasso.transform.FindChild("Particle System")).transform.position = model.transform.GetChild(3).position;
lasso.GetComponent<AudioSource>().pitch = lassobeam.beamWidth * 3f;
if (lassobeam.beamWidth > 0f)
{
shaketimer = Mathf.MoveTowards(shaketimer, 0f, Time.deltaTime * 10f);
if (shaketimer <= 0f)
{
model.transform.localPosition = Shake(modeloriginpos, model.transform.localPosition, shakeamt * lassobeam.beamWidth * 3f);
MonoSingleton<CameraController>.instance.CameraShake(0.1f * lassobeam.beamWidth * 3f);
shaketimer = 0.1f;
}
}
else
{
model.transform.localPosition = modeloriginpos;
}
}
}
internal class BlueThundergun : MonoBehaviour
{
private InputManager inman = MonoSingleton<InputManager>.Instance;
private PlayerInput source = MonoSingleton<InputManager>.Instance.InputSource;
private WeaponCharges charges = MonoSingleton<WeaponCharges>.instance;
private GameObject beam;
public GameObject model;
private float shakeamt = 0.1f;
private float shaketimer = 0.1f;
private AudioSource audsource;
public float rot;
public float rotspeed = 50f;
public float charge;
public float delay;
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 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)
{
switch (type)
{
case 1:
Debug.Log((object)log);
break;
case 2:
Debug.LogWarning((object)log);
break;
case 3:
Debug.LogError((object)log);
break;
}
}
private void Start()
{
beam = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam.prefab");
audsource = ((Component)this).gameObject.GetComponent<AudioSource>();
rot = 90f;
rotspeed = 300f;
}
private void Update()
{
//IL_0039: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
rot = Mathf.MoveTowards(rot, 0f, Time.deltaTime * rotspeed);
((Component)this).transform.localRotation = Quaternion.Euler(rot, 0f, 0f);
if (source.Fire1.IsPressed && delay <= 0f && charges.raicharge >= 5f)
{
shakeamt = 0.1f * charge;
shaketimer = Mathf.MoveTowards(shaketimer, 0f, Time.deltaTime * 10f);
if (shaketimer <= 0f)
{
((Component)this).transform.localPosition = Shake(Vector3.zero, ((Component)this).transform.localPosition, shakeamt);
shaketimer = 0.25f;
}
charge = Mathf.MoveTowards(charge, 3f, Time.deltaTime);
}
if (((!source.Fire1.IsPressed && delay <= 0f && charges.raicharge >= 5f && charge >= 1f) || (delay <= 0f && charges.raicharge >= 5f && charge >= 3f)) && ((Behaviour)MonoSingleton<GunControl>.instance).enabled)
{
Fire();
}
if (charges.raicharge >= 5f && !source.Fire1.IsPressed && delay <= 0f)
{
charge = Mathf.MoveTowards(charge, 0f, Time.deltaTime * 4f);
((Component)this).transform.localPosition = Vector3.zero;
}
if (charges.raicharge < 5f || delay > 0f)
{
charge = Mathf.MoveTowards(charge, 0f, Time.deltaTime * 10f);
((Component)this).transform.localPosition = Vector3.zero;
}
delay = Mathf.MoveTowards(delay, 0f, Time.deltaTime);
audsource.pitch = charge;
if (!audsource.isPlaying)
{
audsource.Play();
}
if (charges.raicharge < 5f)
{
((Component)model.transform.GetChild(2)).gameObject.SetActive(false);
}
else
{
((Component)model.transform.GetChild(2)).gameObject.SetActive(true);
}
((Component)model.transform.GetChild(1)).GetComponentInChildren<Slider>().normalizedValue = charge / 3f;
}
public void Fire()
{
//IL_003c: 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_0072: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
charges.raicharge = 0f;
delay = 1f;
Debug.Log((object)"pew");
for (int i = 0; (float)i < Mathf.Round(charge * 2f); i++)
{
GameObject val = Object.Instantiate<GameObject>(beam, ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
val.GetComponent<RevolverBeam>().alternateStartPoint = ((Component)model.transform.GetChild(3)).transform.position;
val.GetComponent<RevolverBeam>().sourceWeapon = ((Component)this).gameObject;
}
MonoSingleton<TimeController>.instance.HitStop(0.1f);
Object.Instantiate<GameObject>(WeaponMakerScript.FetchFromBundle<GameObject>("assets/formods/thundercannonbundle/tcshoot.prefab", autofill: false));
Object.Instantiate<GameObject>(WeaponMakerScript.FetchFromBundle<GameObject>("assets/formods/thundercannonbundle/thundergunmuzzleflash.prefab", autofill: false), model.transform.GetChild(4).position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
MonoSingleton<CameraController>.instance.CameraShake(charge);
rotspeed = 50f;
rot = -30f;
if (charge >= 2.5f)
{
MonoSingleton<TimeController>.Instance.ParryFlash();
}
if (NoWeaponCooldown.NoCooldown)
{
charge = 0f;
}
}
}