using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Unity.Mono;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Shooterlatro.Core;
using Shooterlatro.Game;
using Shooterlatro.Gameplay;
using Shooterlatro.Shop;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreAmmo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lucky Shot More Ammo Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreAmmo")]
[assembly: AssemblyTitle("MoreAmmo")]
[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 MoreAmmo
{
[BepInPlugin("com.example.moreammo", "MoreAmmo", "1.3.2")]
public class MoreAmmoPlugin : BaseUnityPlugin
{
private Harmony harmony;
public static BulletItemData blackHoleBulletData;
public static BulletItemData c4BulletData;
public static BulletItemData splitterBulletData;
public static BulletItemData teslaBulletData;
public static GameObject explosionPrefab;
private void Awake()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
CreateBulletInstances();
harmony = new Harmony("com.example.moreammo");
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreAmmo loaded successfully! Added Black Hole, C4, Splitter, and Tesla Ammo.");
}
public static void CreateBulletInstances()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Expected O, but got Unknown
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: 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_023d: Expected O, but got Unknown
//IL_023f: 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)
if (!((Object)(object)blackHoleBulletData != (Object)null))
{
blackHoleBulletData = ScriptableObject.CreateInstance<BulletItemData>();
((Object)blackHoleBulletData).name = "black_hole_ammo";
blackHoleBulletData.bulletUIColor = new Color(0.5f, 0f, 1f, 1f);
blackHoleBulletData.isNormalBullet = false;
blackHoleBulletData.isUnmissable = false;
ShopItemData val = new ShopItemData();
val.type = (ShopItemType)6;
val.rarity = (ItemRarity)2;
val.cost = 30f;
val.sellValue = 15f;
val.nameKey = "Black Hole Ammo";
val.descriptionKey = "Creates a temporary black hole that draws nearby targets in on impact";
blackHoleBulletData.shopItem = val;
c4BulletData = ScriptableObject.CreateInstance<BulletItemData>();
((Object)c4BulletData).name = "c4_ammo";
c4BulletData.bulletUIColor = new Color(1f, 0.4f, 0f, 1f);
c4BulletData.isNormalBullet = false;
c4BulletData.isUnmissable = false;
ShopItemData val2 = new ShopItemData();
val2.type = (ShopItemType)6;
val2.rarity = (ItemRarity)2;
val2.cost = 30f;
val2.sellValue = 15f;
val2.nameKey = "C4 Ammo";
val2.descriptionKey = "Attaches sticky charge. Hit again to trigger massive explosion!";
c4BulletData.shopItem = val2;
splitterBulletData = ScriptableObject.CreateInstance<BulletItemData>();
((Object)splitterBulletData).name = "splitter_ammo";
splitterBulletData.bulletUIColor = new Color(0f, 1f, 1f, 1f);
splitterBulletData.isNormalBullet = false;
splitterBulletData.isUnmissable = false;
ShopItemData val3 = new ShopItemData();
val3.type = (ShopItemType)6;
val3.rarity = (ItemRarity)2;
val3.cost = 30f;
val3.sellValue = 15f;
val3.nameKey = "Splitter Ammo";
val3.descriptionKey = "Splits into two extra hitscan shots towards nearby targets on impact";
splitterBulletData.shopItem = val3;
teslaBulletData = ScriptableObject.CreateInstance<BulletItemData>();
((Object)teslaBulletData).name = "tesla_ammo";
teslaBulletData.bulletUIColor = new Color(0.9f, 0.9f, 0f, 1f);
teslaBulletData.isNormalBullet = false;
teslaBulletData.isUnmissable = false;
ShopItemData val4 = new ShopItemData();
val4.type = (ShopItemType)6;
val4.rarity = (ItemRarity)2;
val4.cost = 35f;
val4.sellValue = 17f;
val4.nameKey = "Tesla Ammo";
val4.descriptionKey = "Fires an electrical arc that automatically chains to multiple targets sequentially";
teslaBulletData.shopItem = val4;
}
}
public static void InitializeCustomBulletAssets(List<ScriptableObject> shopItemAssets)
{
CreateBulletInstances();
BulletItemData val = null;
foreach (ScriptableObject shopItemAsset in shopItemAssets)
{
BulletItemData val2 = (BulletItemData)(object)((shopItemAsset is BulletItemData) ? shopItemAsset : null);
if ((Object)(object)val2 != (Object)null && !val2.isNormalBullet && val2.shopItem != null)
{
val = val2;
break;
}
}
BulletItemData[] array;
if ((Object)(object)val == (Object)null)
{
array = Resources.FindObjectsOfTypeAll<BulletItemData>();
foreach (BulletItemData val3 in array)
{
if ((Object)(object)val3 != (Object)null && !val3.isNormalBullet && val3.shopItem != null)
{
val = val3;
break;
}
}
}
if (!((Object)(object)val != (Object)null))
{
return;
}
explosionPrefab = val.explosionVFXPrefab;
array = (BulletItemData[])(object)new BulletItemData[4] { blackHoleBulletData, c4BulletData, splitterBulletData, teslaBulletData };
foreach (BulletItemData val4 in array)
{
if ((Object)(object)val4 != (Object)null && val4.shopItem != null && (Object)(object)val4.shopItem.icon == (Object)null)
{
val4.shopItem.icon = val.shopItem.icon;
val4.shopItem.animationProfile = val.shopItem.animationProfile;
val4.bulletPrefabOverride = val.bulletPrefabOverride;
val4.explosionVFXPrefab = val.explosionVFXPrefab;
}
}
}
public static List<ScriptableObject> GetShopItemAssets(ShopManager instance)
{
if ((Object)(object)instance == (Object)null)
{
return null;
}
FieldInfo field = typeof(ShopManager).GetField("shopItemAssets", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
return field.GetValue(instance) as List<ScriptableObject>;
}
return null;
}
public static void PublishKilledReflected(Target target, ShotHitContext ctx)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)target == (Object)null))
{
MethodInfo method = typeof(Target).GetMethod("PublishKilled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(target, new object[1] { ctx });
}
}
}
public unsafe static void SpawnBlackHole(Vector3 pos)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0011: 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_001f: 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_0098: 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_0083: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("BlackHoleEffect");
val.transform.position = pos;
BlackHoleComponent blackHoleComponent = val.AddComponent<BlackHoleComponent>();
blackHoleComponent.center = pos;
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)val2.GetComponent<Collider>());
val2.transform.SetParent(val.transform, false);
val2.transform.localScale = Vector3.zero;
Renderer component = val2.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material.shader = Shader.Find("Legacy Shaders/Diffuse");
component.material.color = Color.black;
}
blackHoleComponent.visualSphere = val2;
Vector3 val3 = pos;
Debug.Log((object)("[MoreAmmo] Spawned black hole at " + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString()));
}
public unsafe static void DetonateC4(Vector3 pos)
{
//IL_0005: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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)
//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)
Vector3 val = pos;
Debug.Log((object)("[MoreAmmo] Detonating C4 at " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString()));
Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
foreach (Target val2 in array)
{
if (!((Object)(object)val2 != (Object)null) || !val2.IsAlive || !(Vector3.Distance(((Component)val2).transform.position, pos) <= 12f))
{
continue;
}
FieldInfo field = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
if (!(field != null))
{
continue;
}
object? value = field.GetValue(val2);
TargetLifetime val3 = (TargetLifetime)((value is TargetLifetime) ? value : null);
if ((Object)(object)val3 != (Object)null)
{
C4Component component = ((Component)val2).GetComponent<C4Component>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
val3.ApplyDamage(9999f);
PublishKilledReflected(val2, new ShotHitContext
{
damage = 9999f,
hitPoint = ((Component)val2).transform.position
});
}
}
if ((Object)(object)explosionPrefab != (Object)null)
{
Object.Instantiate<GameObject>(explosionPrefab, pos, Quaternion.identity);
}
}
public static void TriggerSplitter(Target hitTarget)
{
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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)
if ((Object)(object)hitTarget == (Object)null)
{
return;
}
Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
List<Target> list = new List<Target>();
Target[] array2 = array;
foreach (Target val in array2)
{
if ((Object)(object)val != (Object)null && val.IsAlive && (Object)(object)val != (Object)(object)hitTarget)
{
list.Add(val);
}
}
list.Sort((Target a, Target b) => Vector3.Distance(((Component)a).transform.position, ((Component)hitTarget).transform.position).CompareTo(Vector3.Distance(((Component)b).transform.position, ((Component)hitTarget).transform.position)));
int num = Mathf.Min(2, list.Count);
for (int num2 = 0; num2 < num; num2++)
{
Target val2 = list[num2];
FieldInfo field = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(val2);
TargetLifetime val3 = (TargetLifetime)((value is TargetLifetime) ? value : null);
if ((Object)(object)val3 != (Object)null)
{
val3.ApplyDamage(1f);
PublishKilledReflected(val2, new ShotHitContext
{
damage = 1f,
hitPoint = ((Component)val2).transform.position
});
}
}
DrawTracerLine(((Component)hitTarget).transform.position, ((Component)val2).transform.position);
}
}
public static void DrawTracerLine(Vector3 start, Vector3 end)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
ElectricChainTracer electricChainTracer = new GameObject("SplitterTracer").AddComponent<ElectricChainTracer>();
electricChainTracer.start = start;
electricChainTracer.end = end;
}
public static void TriggerTeslaChain(Target hitTarget, Vector3 hitPoint)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)hitTarget == (Object)null)
{
return;
}
HashSet<Target> hashSet = new HashSet<Target>();
hashSet.Add(hitTarget);
Vector3 val = hitPoint;
int num = 4;
float num2 = 10f;
for (int i = 0; i < num; i++)
{
Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
Target val2 = null;
float num3 = float.MaxValue;
Target[] array2 = array;
foreach (Target val3 in array2)
{
if ((Object)(object)val3 != (Object)null && val3.IsAlive && !hashSet.Contains(val3))
{
float num4 = Vector3.Distance(((Component)val3).transform.position, val);
if (num4 <= num2 && num4 < num3)
{
num3 = num4;
val2 = val3;
}
}
}
if ((Object)(object)val2 == (Object)null)
{
break;
}
hashSet.Add(val2);
FieldInfo field = typeof(Target).GetField("_lifetime", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(val2);
TargetLifetime val4 = (TargetLifetime)((value is TargetLifetime) ? value : null);
if ((Object)(object)val4 != (Object)null)
{
val4.ApplyDamage(1f);
PublishKilledReflected(val2, new ShotHitContext
{
damage = 1f,
hitPoint = ((Component)val2).transform.position
});
}
}
DrawTeslaTracerLine(val, ((Component)val2).transform.position);
val = ((Component)val2).transform.position;
}
}
public static void DrawTeslaTracerLine(Vector3 start, Vector3 end)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
ElectricChainTracer electricChainTracer = new GameObject("TeslaTracer").AddComponent<ElectricChainTracer>();
electricChainTracer.start = start;
electricChainTracer.end = end;
electricChainTracer.color = new Color(0.9f, 0.9f, 0.1f);
}
private void OnDestroy()
{
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public class ElectricChainTracer : MonoBehaviour
{
public Vector3 start;
public Vector3 end;
public Color color = Color.cyan;
private LineRenderer lr;
private float elapsed;
private float lifetime = 0.2f;
private int segments = 6;
private float jitterAmount = 0.2f;
private void Start()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0052: 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)
lr = ((Component)this).gameObject.AddComponent<LineRenderer>();
lr.startWidth = 0.12f;
lr.endWidth = 0.02f;
((Renderer)lr).material = new Material(Shader.Find("Legacy Shaders/Particles/Additive"));
lr.startColor = color;
lr.endColor = Color.white;
lr.positionCount = segments + 1;
UpdateLightning();
}
private void Update()
{
elapsed += Time.deltaTime;
if (elapsed >= lifetime)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
float num = elapsed / lifetime;
lr.startWidth = Mathf.Lerp(0.12f, 0f, num);
lr.endWidth = Mathf.Lerp(0.02f, 0f, num);
UpdateLightning();
}
private void UpdateLightning()
{
//IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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)
//IL_00ac: 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)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = end - start;
Vector3 val2 = Vector3.Cross(val, Vector3.up);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
if (((Vector3)(ref normalized)).sqrMagnitude < 0.01f)
{
val2 = Vector3.Cross(val, Vector3.right);
normalized = ((Vector3)(ref val2)).normalized;
}
for (int i = 0; i <= segments; i++)
{
float num = (float)i / (float)segments;
Vector3 val3 = Vector3.Lerp(start, end, num);
if (i > 0 && i < segments)
{
float num2 = Random.Range(0f - jitterAmount, jitterAmount);
float num3 = Random.Range(0f - jitterAmount, jitterAmount);
val2 = Vector3.Cross(val, normalized);
Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
val3 += normalized * num2 + normalized2 * num3;
}
lr.SetPosition(i, val3);
}
}
}
public class BlackHoleParticle
{
public GameObject go;
public float radius;
public float angle;
public float height;
public float orbitSpeed;
public float radialSpeed;
}
public class BlackHoleComponent : MonoBehaviour
{
public Vector3 center;
public float duration = 2f;
public float radius = 8f;
public float pullStrength = 6f;
public GameObject visualSphere;
private float elapsed;
private List<BlackHoleParticle> particles = new List<BlackHoleParticle>();
private int maxParticles = 25;
private Color[] particleColors = (Color[])(object)new Color[4]
{
new Color(0.5f, 0f, 1f),
new Color(0f, 1f, 1f),
new Color(1f, 0f, 1f),
Color.white
};
private void Start()
{
for (int i = 0; i < maxParticles; i++)
{
SpawnParticle(Random.Range(1f, radius));
}
}
private void SpawnParticle(float initialRadius)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
val.transform.SetParent(((Component)this).transform, true);
float num = Random.Range(0.08f, 0.18f);
val.transform.localScale = new Vector3(num, num, num);
Renderer component = val.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material.shader = Shader.Find("Legacy Shaders/Self-Illumin/Diffuse");
component.material.color = particleColors[Random.Range(0, particleColors.Length)];
}
BlackHoleParticle item = new BlackHoleParticle
{
go = val,
radius = initialRadius,
angle = Random.Range(0f, MathF.PI * 2f),
height = Random.Range(-0.8f, 0.8f) * (initialRadius / radius),
orbitSpeed = Random.Range(4f, 8f) / (initialRadius + 0.1f),
radialSpeed = Random.Range(2f, 3.5f)
};
particles.Add(item);
}
private void Update()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: 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_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: 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)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: 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)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: 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_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
elapsed += Time.deltaTime;
if (elapsed >= duration)
{
foreach (BlackHoleParticle particle in particles)
{
if ((Object)(object)particle.go != (Object)null)
{
Object.Destroy((Object)(object)particle.go);
}
}
particles.Clear();
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
if ((Object)(object)visualSphere != (Object)null)
{
float num = Mathf.Sin(elapsed / duration * MathF.PI) * 1.5f;
visualSphere.transform.localScale = new Vector3(num, num, num);
}
for (int num2 = particles.Count - 1; num2 >= 0; num2--)
{
BlackHoleParticle blackHoleParticle = particles[num2];
if ((Object)(object)blackHoleParticle.go == (Object)null)
{
particles.RemoveAt(num2);
}
else
{
blackHoleParticle.angle += blackHoleParticle.orbitSpeed * Time.deltaTime;
blackHoleParticle.radius -= blackHoleParticle.radialSpeed * Time.deltaTime;
blackHoleParticle.height = Mathf.MoveTowards(blackHoleParticle.height, 0f, blackHoleParticle.radialSpeed * 0.5f * Time.deltaTime);
if (blackHoleParticle.radius <= 0.15f)
{
Object.Destroy((Object)(object)blackHoleParticle.go);
particles.RemoveAt(num2);
SpawnParticle(radius);
}
else
{
blackHoleParticle.go.transform.position = center + new Vector3(Mathf.Cos(blackHoleParticle.angle) * blackHoleParticle.radius, blackHoleParticle.height, Mathf.Sin(blackHoleParticle.angle) * blackHoleParticle.radius);
float num3 = Mathf.Clamp01(blackHoleParticle.radius / 2f);
float num4 = 0.15f * num3;
blackHoleParticle.go.transform.localScale = new Vector3(num4, num4, num4);
}
}
}
Target[] array = Object.FindObjectsByType<Target>((FindObjectsSortMode)0);
foreach (Target val in array)
{
if (!((Object)(object)val != (Object)null) || !val.IsAlive)
{
continue;
}
float num5 = Vector3.Distance(((Component)val).transform.position, center);
if (num5 < radius && num5 > 0.05f)
{
Vector3 val2 = center - ((Component)val).transform.position;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
val2 = Vector3.Cross(normalized, Vector3.up);
Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
if (((Vector3)(ref normalized2)).sqrMagnitude < 0.01f)
{
val2 = Vector3.Cross(normalized, Vector3.right);
normalized2 = ((Vector3)(ref val2)).normalized;
}
float num6 = 0.8f;
val2 = normalized + normalized2 * num6;
Vector3 normalized3 = ((Vector3)(ref val2)).normalized;
float num7 = pullStrength * (1f - num5 / radius);
Transform transform = ((Component)val).transform;
transform.position += normalized3 * num7 * Time.deltaTime;
}
}
}
}
public class C4Component : MonoBehaviour
{
public bool isArmed = true;
private SpriteRenderer sr;
private Color originalColor;
private GameObject blinkLight;
private void Start()
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
sr = ((Component)this).GetComponentInChildren<SpriteRenderer>();
if ((Object)(object)sr != (Object)null)
{
originalColor = sr.color;
sr.color = new Color(1f, 0.3f, 0f, 1f);
}
blinkLight = GameObject.CreatePrimitive((PrimitiveType)0);
Object.Destroy((Object)(object)blinkLight.GetComponent<Collider>());
blinkLight.transform.SetParent(((Component)this).transform, false);
blinkLight.transform.localPosition = new Vector3(0f, 0f, -0.1f);
blinkLight.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
Renderer component = blinkLight.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material.shader = Shader.Find("Legacy Shaders/Self-Illumin/Diffuse");
component.material.color = Color.red;
}
}
private void Update()
{
//IL_0044: 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)
if ((Object)(object)blinkLight != (Object)null)
{
Renderer component = blinkLight.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material.color = ((Mathf.FloorToInt(Time.time * 6f) % 2 == 0) ? Color.red : Color.black);
}
}
}
private void OnDisable()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)sr != (Object)null)
{
sr.color = originalColor;
}
if ((Object)(object)blinkLight != (Object)null)
{
Object.Destroy((Object)(object)blinkLight);
}
Object.Destroy((Object)(object)this);
}
}
[HarmonyPatch(typeof(ShopManager), "RebuildRuntimeItems")]
internal class ShopManagerRebuildRuntimeItemsPatch
{
private static void Prefix(ShopManager __instance)
{
if (!((Object)(object)__instance != (Object)null))
{
return;
}
List<ScriptableObject> shopItemAssets = MoreAmmoPlugin.GetShopItemAssets(__instance);
if (shopItemAssets == null)
{
return;
}
MoreAmmoPlugin.InitializeCustomBulletAssets(shopItemAssets);
BulletItemData[] array = (BulletItemData[])(object)new BulletItemData[4]
{
MoreAmmoPlugin.blackHoleBulletData,
MoreAmmoPlugin.c4BulletData,
MoreAmmoPlugin.splitterBulletData,
MoreAmmoPlugin.teslaBulletData
};
foreach (BulletItemData val in array)
{
if ((Object)(object)val != (Object)null && !shopItemAssets.Contains((ScriptableObject)(object)val))
{
shopItemAssets.Add((ScriptableObject)(object)val);
Debug.Log((object)("[MoreAmmo] Injected " + ((Object)val).name + " into shopItemAssets."));
}
}
}
}
[HarmonyPatch(typeof(GameManager), "BuildSpecialBulletPool")]
internal class BuildSpecialBulletPoolPatch
{
private static void Postfix(ref List<BulletItemData> __result)
{
if (__result == null)
{
return;
}
MoreAmmoPlugin.CreateBulletInstances();
BulletItemData[] array = (BulletItemData[])(object)new BulletItemData[4]
{
MoreAmmoPlugin.blackHoleBulletData,
MoreAmmoPlugin.c4BulletData,
MoreAmmoPlugin.splitterBulletData,
MoreAmmoPlugin.teslaBulletData
};
foreach (BulletItemData val in array)
{
if ((Object)(object)val != (Object)null && !__result.Contains(val))
{
__result.Add(val);
Debug.Log((object)("[MoreAmmo] Injected " + ((Object)val).name + " into BuildSpecialBulletPool."));
}
}
}
}
[HarmonyPatch(typeof(Target), "OnShotHit")]
internal class TargetOnShotHitPatch
{
private static void Postfix(Target __instance, ShotHitContext context)
{
//IL_0009: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null || (Object)(object)context.bulletData == (Object)null)
{
return;
}
switch (((Object)context.bulletData).name)
{
case "black_hole_ammo":
MoreAmmoPlugin.SpawnBlackHole(context.hitPoint);
break;
case "c4_ammo":
if ((Object)(object)((Component)__instance).GetComponent<C4Component>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<C4Component>();
Debug.Log((object)"[MoreAmmo] Attached C4 to target.");
}
else
{
MoreAmmoPlugin.DetonateC4(context.hitPoint);
}
break;
case "splitter_ammo":
MoreAmmoPlugin.TriggerSplitter(__instance);
break;
case "tesla_ammo":
MoreAmmoPlugin.TriggerTeslaChain(__instance, context.hitPoint);
break;
}
}
}
}