Decompiled source of Rampage v1.4.0

plugins/Rampage/Rampage.dll

Decompiled 15 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
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: OptIn]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Rampage")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")]
[assembly: AssemblyProduct("Rampage")]
[assembly: AssemblyTitle("Rampage")]
[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 Rampage
{
	internal static class Assets
	{
		internal static ItemDef BiscoLeashItemDef;

		internal static GameObject LightningProjectilePrefab;

		internal static GameObject FireProjectilePrefab;

		internal static GameObject InvisibleStickyBombPrefab;

		internal static GameObject BackupDroneMasterPrefab;

		internal static CharacterSpawnCard BeetleGuardAllySpawnCard;

		internal static void Load()
		{
			LoadItem();
			LoadGameAssets();
		}

		private static void LoadItem()
		{
			//IL_00d2: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: 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_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: 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_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected O, but got Unknown
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Expected O, but got Unknown
			AssetBundle val;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Rampage.rampage_assets"))
			{
				using MemoryStream memoryStream = new MemoryStream();
				stream.CopyTo(memoryStream);
				val = AssetBundle.LoadFromMemory(memoryStream.ToArray());
			}
			GameObject val2 = val.LoadAsset<GameObject>("Assets/Import/belt/belt.prefab");
			Sprite pickupIconSprite = val.LoadAsset<Sprite>("Assets/Import/belt_icon/belt_icon.png");
			ItemDisplay val3 = val2.GetComponent<ItemDisplay>() ?? val2.AddComponent<ItemDisplay>();
			val3.rendererInfos = ((IEnumerable<Renderer>)val2.GetComponentsInChildren<Renderer>()).Select((Func<Renderer, RendererInfo>)((Renderer renderer) => new RendererInfo
			{
				renderer = renderer,
				defaultMaterial = renderer.sharedMaterial
			})).ToArray();
			BiscoLeashItemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)BiscoLeashItemDef).name = "BiscosLeash";
			BiscoLeashItemDef._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)RoR2_Base_Common.Tier3Def_asset).WaitForCompletion();
			BiscoLeashItemDef.pickupModelPrefab = val2;
			BiscoLeashItemDef.pickupIconSprite = pickupIconSprite;
			BiscoLeashItemDef.nameToken = "ITEM_BISCOSLEASH_NAME";
			BiscoLeashItemDef.pickupToken = "ITEM_BISCOSLEASH_PICKUP";
			BiscoLeashItemDef.descriptionToken = "ITEM_BISCOSLEASH_DESC";
			BiscoLeashItemDef.loreToken = "ITEM_BISCOSLEASH_LORE";
			BiscoLeashItemDef.canRemove = true;
			ItemDef biscoLeashItemDef = BiscoLeashItemDef;
			ItemTag[] array = new ItemTag[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			biscoLeashItemDef.tags = (ItemTag[])(object)array;
			LanguageAPI.Add("ITEM_BISCOSLEASH_NAME", "Bisco's Leash");
			LanguageAPI.Add("ITEM_BISCOSLEASH_PICKUP", "Grants <style=cDeath>RAMPAGE</style> on kill. Reaching kill streaks unleashes special rewards.");
			LanguageAPI.Add("ITEM_BISCOSLEASH_DESC", "Grants <style=cDeath>RAMPAGE</style> on kill.\n<style=cDeath>RAMPAGE</style> : Specifics rewards for reaching kill streaks.\nIncreases <style=cIsUtility>movement speed</style> by <style=cIsUtility>1%</style> <style=cStack>(+1% per item stack)</style> every 10 Rampage Stacks.\nIncreases <style=cIsDamage>damage</style> by <style=cIsDamage>1%</style> <style=cStack>(+1% per item stack)</style> every 10 Rampage Stacks.");
			LanguageAPI.Add("ITEM_BISCOSLEASH_LORE", "You were always there, by my side, whether we sat or played. Our friendship was a joyful ride, I wish you could have stayed.");
			ItemDisplayRuleDict val4 = new ItemDisplayRuleDict((ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = val2,
					childName = "Chest",
					localPos = new Vector3(-0.35f, -0.1f, 0f),
					localAngles = new Vector3(0f, 180f, 0f),
					localScale = new Vector3(0.15f, 0.15f, 0.15f)
				}
			});
			ItemAPI.Add(new CustomItem(BiscoLeashItemDef, val4));
		}

		private static void LoadGameAssets()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			LightningProjectilePrefab = CloneOrbProjectile(RoR2_Base_ElectricWorm.ElectricOrbProjectile_prefab, "RampageLightningProjectilePrefab");
			FireProjectilePrefab = CloneOrbProjectile(RoR2_Base_MagmaWorm.MagmaOrbProjectile_prefab, "RampageFireProjectilePrefab");
			InvisibleStickyBombPrefab = PrefabAPI.InstantiateClone(Load<GameObject>(RoR2_Base_StickyBomb.StickyBomb_prefab), "RampageInvisibleStickyBombPrefab", true);
			GameObject val = PrefabAPI.InstantiateClone(Load<GameObject>(RoR2_Base_StickyBomb.StickyBombGhost_prefab), "RampageInvisibleStickyBombGhostPrefab", false);
			val.transform.localScale = new Vector3(1E-09f, 1E-09f, 1E-09f);
			ProjectileController component = InvisibleStickyBombPrefab.GetComponent<ProjectileController>();
			component.ghostPrefabAddress = new AssetReferenceT<GameObject>("");
			component.ghostPrefab = val;
			ContentAddition.AddProjectile(InvisibleStickyBombPrefab);
			BackupDroneMasterPrefab = Load<GameObject>(RoR2_Base_Drones.DroneBackupMaster_prefab);
			BeetleGuardAllySpawnCard = Load<CharacterSpawnCard>(RoR2_Base_BeetleGland.cscBeetleGuardAlly_asset);
		}

		private static GameObject CloneOrbProjectile(string assetGuid, string name)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Load<GameObject>(assetGuid), name, true);
			val.GetComponent<Rigidbody>().useGravity = false;
			ProjectileSimple component = val.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 100f;
			component.lifetime = 1.6f;
			ProjectileImpactExplosion component2 = val.GetComponent<ProjectileImpactExplosion>();
			component2.transformSpace = (TransformSpace)0;
			((ProjectileExplosion)component2).minAngleOffset = new Vector3(-20f, -20f, -20f);
			((ProjectileExplosion)component2).maxAngleOffset = new Vector3(20f, 20f, 20f);
			component2.lifetime = 1.5f;
			ContentAddition.AddProjectile(val);
			return val;
		}

		private static T Load<T>(string assetGuid)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)assetGuid).WaitForCompletion();
		}
	}
	internal static class Configuration
	{
		internal static ConfigEntry<int> RampageResetTimer;

		internal static void Init(ConfigFile file)
		{
			RampageResetTimer = file.Bind<int>("Rampage", "Timer", 12, "Number of seconds before the Rampage streak reset to 0.");
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("Rampage");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "Rampage".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogDebug((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Debug_NoCallerPrefix(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("iDeathHD.Rampage", "Rampage", "1.4.0")]
	public class Main : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<DamageReport> <0>__GrantRampageStack;

			public static StatHookEventHandler <1>__GiveStatsFromRampageStacks;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Awake <>9__8_0;

			internal void <Awake>b__8_0(orig_Awake orig, HUD self)
			{
				orig.Invoke(self);
				RampageCounterUI.Create(self);
			}
		}

		public const string PluginGUID = "iDeathHD.Rampage";

		public const string PluginAuthor = "iDeathHD";

		public const string PluginName = "Rampage";

		public const string PluginVersion = "1.4.0";

		internal static Main Instance { get; private set; }

		public void Awake()
		{
			//IL_005d: 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_0068: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Configuration.Init(((BaseUnityPlugin)this).Config);
			Assets.Load();
			NetworkingAPI.RegisterMessageType<RampageStackMessage>();
			GlobalEventManager.onDeathProcServer += GrantRampageStack;
			object obj = <>O.<1>__GiveStatsFromRampageStacks;
			if (obj == null)
			{
				StatHookEventHandler val = GiveStatsFromRampageStacks;
				<>O.<1>__GiveStatsFromRampageStacks = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			object obj2 = <>c.<>9__8_0;
			if (obj2 == null)
			{
				hook_Awake val2 = delegate(orig_Awake orig, HUD self)
				{
					orig.Invoke(self);
					RampageCounterUI.Create(self);
				};
				<>c.<>9__8_0 = val2;
				obj2 = (object)val2;
			}
			HUD.Awake += (hook_Awake)obj2;
		}

		private static void GrantRampageStack(DamageReport damageReport)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.attackerBody) && Object.op_Implicit((Object)(object)damageReport.attackerMaster) && damageReport.victimTeamIndex != damageReport.attackerTeamIndex)
			{
				CharacterMaster val = (Object.op_Implicit((Object)(object)damageReport.attackerMaster.minionOwnership) ? damageReport.attackerMaster.minionOwnership.ownerMaster : null);
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : damageReport.attackerBody);
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory) && val2.inventory.GetItemCountEffective(Assets.BiscoLeashItemDef) > 0)
				{
					NetMessageExtensions.Send((INetMessage)(object)new RampageStackMessage(((NetworkBehaviour)val2).netId), (NetworkDestination)3);
				}
			}
		}

		private static void GiveStatsFromRampageStacks(CharacterBody body, StatHookEventArgs args)
		{
			RampageTracker component = ((Component)body).GetComponent<RampageTracker>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCountEffective(Assets.BiscoLeashItemDef) > 0)
			{
				args.moveSpeedMultAdd += component.ExtraMoveSpeed;
				args.damageMultAdd += component.ExtraDamage;
			}
		}
	}
	internal class RampageCounterUI : MonoBehaviour
	{
		private HUD _hud;

		private GameObject _counterRoot;

		private HGTextMeshProUGUI _counterText;

		private int _shownCounter = -1;

		private int _shownSeconds = -1;

		internal static void Create(HUD hud)
		{
			//IL_00b3: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)hud).transform.Find("MainContainer/MainUIArea/SpringCanvas/UpperLeftCluster");
			Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.Find("LunarCoinRoot") : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Log.Warning("Could not find the lunar coin counter in the HUD, the Rampage counter will not be shown.", "D:\\Games\\LostItems\\rampagerevived\\RampageRevived\\Rampage\\RampageCounterUI.cs", "Create", 25);
				return;
			}
			Transform val3 = Object.Instantiate<Transform>(val2, val);
			((Object)val3).name = "Rampage Counter UI";
			((Component)val3).gameObject.SetActive(false);
			Object.Destroy((Object)(object)((Component)val3).GetComponent<MoneyText>());
			Transform val4 = val3.Find("BackgroundPanel");
			RawImage val5 = default(RawImage);
			if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).TryGetComponent<RawImage>(ref val5))
			{
				((Graphic)val5).color = Color32.op_Implicit(new Color32((byte)180, (byte)8, (byte)8, (byte)100));
			}
			Transform val6 = val3.Find("LunarCoinSign");
			if (Object.op_Implicit((Object)(object)val6))
			{
				((Component)val6).gameObject.SetActive(false);
			}
			Transform val7 = val3.Find("ValueText");
			HGTextMeshProUGUI val8 = (Object.op_Implicit((Object)(object)val7) ? ((Component)val7).GetComponent<HGTextMeshProUGUI>() : null);
			if (!Object.op_Implicit((Object)(object)val8))
			{
				Log.Warning("Could not find the value text of the cloned lunar coin counter, the Rampage counter will not be shown.", "D:\\Games\\LostItems\\rampagerevived\\RampageRevived\\Rampage\\RampageCounterUI.cs", "Create", 50);
				Object.Destroy((Object)(object)((Component)val3).gameObject);
				return;
			}
			((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
			((Graphic)val8).color = Color32.op_Implicit(new Color32((byte)227, (byte)12, (byte)17, byte.MaxValue));
			((TMP_Text)val8).fontSize = 24f;
			RampageCounterUI rampageCounterUI = ((Component)hud).gameObject.AddComponent<RampageCounterUI>();
			rampageCounterUI._hud = hud;
			rampageCounterUI._counterRoot = ((Component)val3).gameObject;
			rampageCounterUI._counterText = val8;
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)_counterRoot))
			{
				return;
			}
			CharacterBody val = (Object.op_Implicit((Object)(object)_hud.targetBodyObject) ? _hud.targetBodyObject.GetComponent<CharacterBody>() : null);
			RampageTracker rampageTracker = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<RampageTracker>() : null);
			int num = (Object.op_Implicit((Object)(object)rampageTracker) ? rampageTracker.RampageCounter : 0);
			bool flag = (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory) && val.inventory.GetItemCountEffective(Assets.BiscoLeashItemDef) > 0) || num > 0;
			if (_counterRoot.activeSelf != flag)
			{
				_counterRoot.SetActive(flag);
			}
			if (flag)
			{
				int num2 = ((num > 0) ? Mathf.CeilToInt(rampageTracker.RampageTimer) : 0);
				if (num != _shownCounter || num2 != _shownSeconds)
				{
					_shownCounter = num;
					_shownSeconds = num2;
					((TMP_Text)_counterText).text = ((num > 0) ? $"Rampage : {num} ({num2})" : "Rampage : 0");
				}
			}
		}
	}
	internal static class RampageEffects
	{
		private const int ProjectilesPerWave = 15;

		private const float ArcingWaveSpacing = 1.5f;

		private const float ArcingProjectileSpacing = 0.1f;

		private static readonly Vector3 NovaOffset = new Vector3(0f, 1.1f, 0f);

		internal static IEnumerator FireNova(CharacterBody userBody, GameObject projectilePrefab, int waveCount, bool arcing, float waveDelay = 0f)
		{
			float damage = userBody.damage * 2f;
			float spacing = waveDelay + (arcing ? 1.5f : 0f);
			for (int wave = 0; wave < waveCount; wave++)
			{
				if (wave > 0 && spacing > 0f)
				{
					yield return (object)new WaitForSeconds(spacing);
				}
				for (int i = 0; i < 15; i++)
				{
					if (!Object.op_Implicit((Object)(object)userBody))
					{
						yield break;
					}
					if (arcing && i > 0)
					{
						yield return (object)new WaitForSeconds(0.1f);
					}
					FireNovaProjectile(userBody, projectilePrefab, 1f + (float)i * 24f, damage);
				}
			}
		}

		private static void FireNovaProjectile(CharacterBody userBody, GameObject projectilePrefab, float angle, float damage)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			Vector3 val = (Object.op_Implicit((Object)(object)userBody.inputBank) ? userBody.inputBank.aimDirection : userBody.transform.forward);
			Vector3 val2 = Quaternion.Euler(0f, angle, 0f) * val;
			ProjectileManager.instance.FireProjectile(projectilePrefab, userBody.transform.position + NovaOffset, Util.QuaternionSafeLookRotation(val2), ((Component)userBody).gameObject, damage, 0f, Util.CheckRoll(userBody.crit, userBody.master), (DamageColorIndex)3, (GameObject)null, -1f, (DamageTypeCombo?)null);
		}

		internal static void DetonateAlive(CharacterBody userBody, float damage, float radius)
		{
			//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_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Invalid comparison between Unknown and I4
			//IL_0028: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_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_009a: 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)
			//IL_00a0: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = userBody.transform.position;
			TeamMask enemyTeams = TeamMask.GetEnemyTeams(userBody.teamComponent.teamIndex);
			TeamIndex val = (TeamIndex)0;
			while ((int)val < 6)
			{
				if (((TeamMask)(ref enemyTeams)).HasTeam(val))
				{
					foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(val))
					{
						if (Object.op_Implicit((Object)(object)teamMember.body))
						{
							Vector3 val2 = ((Component)teamMember).transform.position - position;
							if (!(((Vector3)(ref val2)).sqrMagnitude > radius * radius))
							{
								Vector3 val3 = teamMember.body.corePosition - position;
								Quaternion val4 = ((((Vector3)(ref val3)).magnitude != 0f) ? Util.QuaternionSafeLookRotation(val3) : Random.rotationUniform);
								ProjectileManager.instance.FireProjectile(Assets.InvisibleStickyBombPrefab, ((Component)teamMember).transform.position, val4, ((Component)userBody).gameObject, damage * 40f, 1000f, Util.CheckRoll(userBody.crit, userBody.master), (DamageColorIndex)3, (GameObject)null, ((Vector3)(ref val3)).magnitude * 60f, (DamageTypeCombo?)null);
							}
						}
					}
				}
				val = (TeamIndex)(sbyte)(val + 1);
			}
		}

		internal unsafe static void SummonDrones(CharacterBody userBody, int amount)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0025: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0061: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			Vector3 val;
			if (!Object.op_Implicit((Object)(object)userBody.inputBank))
			{
				val = userBody.transform.forward;
			}
			else
			{
				Ray aimRay = userBody.inputBank.GetAimRay();
				val = ((Ray)(ref aimRay)).direction;
			}
			Vector3 val2 = val;
			Quaternion val3 = Quaternion.LookRotation(val2);
			float y = ((Quaternion)(ref val3)).eulerAngles.y;
			DegreeSlices val4 = new DegreeSlices(amount, 0.5f);
			Enumerator enumerator = ((DegreeSlices)(ref val4)).GetEnumerator();
			try
			{
				while (((Enumerator)(ref enumerator)).MoveNext())
				{
					float current = ((Enumerator)(ref enumerator)).Current;
					Vector3 position = userBody.transform.position + Quaternion.Euler(0f, y + current, 0f) * (Vector3.forward * 3f);
					CharacterMaster val5 = new MasterSummon
					{
						masterPrefab = Assets.BackupDroneMasterPrefab,
						position = position,
						rotation = Quaternion.Euler(0f, y + current + 180f, 0f),
						summonerBodyObject = ((Component)userBody).gameObject,
						ignoreTeamMemberLimit = false,
						useAmbientLevel = true
					}.Perform();
					if (Object.op_Implicit((Object)(object)val5))
					{
						((Component)val5).gameObject.AddComponent<MasterSuicideOnTimer>().lifeTimer = 25f + Random.Range(0f, 3f);
					}
				}
			}
			finally
			{
				((IDisposable)(*(Enumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		internal static void SummonBeetles(CharacterBody userBody, int amount)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return;
			}
			for (int i = 0; i < amount; i++)
			{
				DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)Assets.BeetleGuardAllySpawnCard, new DirectorPlacementRule
				{
					placementMode = (PlacementMode)1,
					minDistance = 3f,
					maxDistance = 40f,
					spawnOnTarget = userBody.transform
				}, RoR2Application.rng)
				{
					summonerBodyObject = ((Component)userBody).gameObject,
					teamIndexOverride = userBody.teamComponent.teamIndex
				};
				GameObject val2 = DirectorCore.instance.TrySpawnObject(val);
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.AddComponent<MasterSuicideOnTimer>().lifeTimer = 30f;
					CharacterMaster component = val2.GetComponent<CharacterMaster>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.inventory.GiveItemPermanent(Items.BoostDamage, 30);
						component.inventory.GiveItemPermanent(Items.BoostHp, 10);
					}
					BaseAI component2 = val2.GetComponent<BaseAI>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.leader.gameObject = ((Component)userBody).gameObject;
					}
				}
			}
		}
	}
	internal struct RampageStackMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId _attackerBodyNetId;

		internal RampageStackMessage(NetworkInstanceId attackerBodyNetId)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			_attackerBodyNetId = attackerBodyNetId;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(_attackerBodyNetId);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			_attackerBodyNetId = reader.ReadNetworkId();
		}

		public void OnReceived()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Util.FindNetworkObject(_attackerBodyNetId);
			CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return;
			}
			foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
			{
				if ((Object)(object)readOnlyInstances.GetCurrentBody() == (Object)(object)val2)
				{
					RampageTracker rampageTracker = ((Component)val2).GetComponent<RampageTracker>() ?? ((Component)val2).gameObject.AddComponent<RampageTracker>();
					rampageTracker.GrantStack();
					break;
				}
			}
		}
	}
	internal class RampageTracker : MonoBehaviour
	{
		private static readonly int[] RampageTiers = new int[13]
		{
			15, 30, 45, 70, 100, 135, 175, 220, 270, 325,
			385, 450, 520
		};

		private static readonly string[] StreakMessages = new string[5] { "<style=cDeath>{0}</style> is on <style=cDeath>FIRE !</style> {1} <style=cDeath>kills RAMPAGE</style>", "<style=cDeath>{0}</style> is on a {1} <style=cDeath>RAMPAGE streak !!!</style> ", "<style=cDeath>DIE ! DIE ! DIE ! {0}</style> has killed {1} souls already !", "<style=cDeath>BOOOOM !</style> {1} kills for <style=cDeath>{0}</style>", "<style=cDeath>HAHAHAHAHA !</style> {1} kills for <style=cDeath>{0}</style> and counting !" };

		private CharacterBody _characterBody;

		private int _currentTier;

		public float ExtraDamage;

		public float ExtraMoveSpeed;

		internal int RampageCounter { get; private set; }

		internal float RampageTimer { get; private set; }

		private void Awake()
		{
			_characterBody = ((Component)this).GetComponent<CharacterBody>();
		}

		public void GrantStack()
		{
			int num = (Object.op_Implicit((Object)(object)_characterBody.inventory) ? _characterBody.inventory.GetItemCountEffective(Assets.BiscoLeashItemDef) : 0);
			RampageTimer = Configuration.RampageResetTimer.Value;
			RampageCounter++;
			ExtraDamage = (ExtraMoveSpeed = (float)RampageCounter / 10f * (0.01f * (float)num));
			_characterBody.RecalculateStats();
			if (NetworkServer.active && CheckThreshold())
			{
				ExecuteTier();
			}
		}

		private void Update()
		{
			if (RampageCounter != 0)
			{
				RampageTimer -= Time.deltaTime;
				if (RampageTimer <= 0f)
				{
					RampageTimer = 0f;
					RampageCounter = 0;
					_currentTier = 0;
					ExtraDamage = 0f;
					ExtraMoveSpeed = 0f;
					_characterBody.RecalculateStats();
				}
			}
		}

		private bool CheckThreshold()
		{
			//IL_005b: 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_0087: Expected O, but got Unknown
			int i;
			for (i = 0; i < RampageTiers.Length && RampageCounter >= RampageTiers[i]; i++)
			{
			}
			if (i == _currentTier)
			{
				return false;
			}
			_currentTier = i;
			string format = StreakMessages[Random.Range(0, StreakMessages.Length)];
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = string.Format(format, _characterBody.GetUserName(), RampageCounter)
			});
			return true;
		}

		private void ExecuteTier()
		{
			switch (_currentTier)
			{
			case 1:
				((MonoBehaviour)this).StartCoroutine(RampageEffects.FireNova(_characterBody, Assets.FireProjectilePrefab, 2, arcing: true));
				break;
			case 2:
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				break;
			case 3:
				RampageEffects.SummonBeetles(_characterBody, 1);
				break;
			case 4:
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				RampageEffects.SummonDrones(_characterBody, 5);
				break;
			case 5:
				((MonoBehaviour)this).StartCoroutine(RampageEffects.FireNova(_characterBody, Assets.LightningProjectilePrefab, 2, arcing: true));
				break;
			case 6:
				RampageEffects.SummonDrones(_characterBody, 10);
				break;
			case 7:
				((MonoBehaviour)this).StartCoroutine(RampageEffects.FireNova(_characterBody, Assets.FireProjectilePrefab, 5, arcing: false, 1f));
				break;
			case 8:
				RampageEffects.SummonBeetles(_characterBody, 2);
				break;
			case 9:
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				break;
			case 10:
				RampageEffects.SummonBeetles(_characterBody, 2);
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				break;
			case 11:
				((MonoBehaviour)this).StartCoroutine(RampageEffects.FireNova(_characterBody, Assets.LightningProjectilePrefab, 5, arcing: true, 0.001f));
				break;
			case 12:
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				break;
			case 13:
				((MonoBehaviour)this).StartCoroutine(RampageEffects.FireNova(_characterBody, Assets.FireProjectilePrefab, 5, arcing: false, 0.5f));
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				RampageEffects.DetonateAlive(_characterBody, _characterBody.damage, 100f);
				RampageEffects.SummonDrones(_characterBody, 10);
				break;
			}
		}
	}
}