Decompiled source of PajamalandSurvivor v0.1.0

plugins/PajamalandSurvivor.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using HG.Reflection;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Pajamaland.Berz;
using Pajamaland.Berz.Components;
using Pajamaland.Berz.SkillStates;
using Pajamaland.Modules;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Networking;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: IgnoresAccessChecksTo("RoR2")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PajamalandSurvivor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PajamalandSurvivor")]
[assembly: AssemblyTitle("PajamalandSurvivor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 Pajamaland
{
	internal static class DevAutoLobby
	{
		private static ConfigEntry<bool> autoLobby;

		private static ConfigEntry<float> delaySeconds;

		private static ConfigEntry<bool> autoStartRun;

		private static ConfigEntry<string> onStageCommands;

		private static ConfigEntry<string> hotkeyF9;

		private static ConfigEntry<string> hotkeyF10;

		private static ConfigEntry<string> hotkeyF11;

		private static bool lobbyFired;

		private static bool runFired;

		public static void Update()
		{
			if (hotkeyF9 == null || !Object.op_Implicit((Object)(object)Console.instance))
			{
				return;
			}
			string text = null;
			if (Input.GetKeyDown((KeyCode)290))
			{
				text = hotkeyF9.Value;
			}
			else if (Input.GetKeyDown((KeyCode)291))
			{
				text = hotkeyF10.Value;
			}
			else if (Input.GetKeyDown((KeyCode)292))
			{
				text = hotkeyF11.Value;
			}
			if (string.IsNullOrWhiteSpace(text))
			{
				return;
			}
			NetworkUser val = ((NetworkUser.readOnlyLocalPlayersList.Count > 0) ? NetworkUser.readOnlyLocalPlayersList[0] : null);
			string[] array = text.Split(';');
			for (int i = 0; i < array.Length; i++)
			{
				string text2 = array[i].Trim();
				if (text2.Length != 0)
				{
					PajamalandPlugin.Log.LogMessage((object)("Dev hotkey: " + text2));
					Console.instance.SubmitCmd(val, text2, false);
				}
			}
		}

		public static void Init(ConfigFile config)
		{
			autoLobby = config.Bind<bool>("Dev", "AutoOpenLobby", false, "If true, automatically open a private lobby (character select) once the title screen has loaded. Development only.");
			delaySeconds = config.Bind<float>("Dev", "AutoOpenLobbyDelay", 4f, "Seconds to wait after the title scene loads before opening the lobby.");
			autoStartRun = config.Bind<bool>("Dev", "AutoStartRun", false, "If true, select Berz in the lobby and start the run automatically (pregame_start_run). Development only.");
			onStageCommands = config.Bind<string>("Dev", "OnStageCommands", "", "Console commands to run when a stage starts, separated by ';'. Development only.");
			hotkeyF9 = config.Bind<string>("Dev", "HotkeyF9", "", "Console command(s) to run when F9 is pressed. Development only.");
			hotkeyF10 = config.Bind<string>("Dev", "HotkeyF10", "", "Console command(s) to run when F10 is pressed. Development only.");
			hotkeyF11 = config.Bind<string>("Dev", "HotkeyF11", "", "Console command(s) to run when F11 is pressed. Development only.");
			if (autoLobby.Value || autoStartRun.Value)
			{
				SceneManager.sceneLoaded += OnSceneLoaded;
			}
			if (!string.IsNullOrWhiteSpace(onStageCommands.Value))
			{
				Stage.onServerStageBegin += OnServerStageBegin;
			}
			if (autoLobby.Value)
			{
				PajamalandPlugin.Log.LogWarning((object)"Dev.AutoOpenLobby is ON: the game will open a private lobby by itself.");
			}
			if (autoStartRun.Value)
			{
				PajamalandPlugin.Log.LogWarning((object)"Dev.AutoStartRun is ON: the lobby will start a run as Berz by itself.");
			}
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == "title" && autoLobby.Value)
			{
				lobbyFired = true;
				((MonoBehaviour)PajamalandPlugin.Instance).StartCoroutine(OpenLobbyAfterDelay());
			}
			else if (((Scene)(ref scene)).name == "lobby" && autoStartRun.Value)
			{
				runFired = true;
				((MonoBehaviour)PajamalandPlugin.Instance).StartCoroutine(StartRunAfterDelay());
			}
		}

		private static IEnumerator OpenLobbyAfterDelay()
		{
			yield return (object)new WaitForSeconds(delaySeconds.Value);
			float timeout = 60f;
			while ((LocalUserManager.readOnlyLocalUsersList.Count == 0 || !Object.op_Implicit((Object)(object)Console.instance)) && timeout > 0f)
			{
				timeout -= Time.deltaTime;
				yield return null;
			}
			if (!Object.op_Implicit((Object)(object)Console.instance))
			{
				PajamalandPlugin.Log.LogError((object)"Dev.AutoOpenLobby: no RoR2.Console instance.");
				yield break;
			}
			PajamalandPlugin.Log.LogMessage((object)"Dev.AutoOpenLobby: submitting transition_command to host a private ClassicRun lobby.");
			Console.instance.SubmitCmd((NetworkUser)null, "transition_command \"gamemode ClassicRun; host 0;\"", false);
		}

		private static IEnumerator StartRunAfterDelay()
		{
			yield return (object)new WaitForSeconds(3f);
			SurvivorDef val = SurvivorCatalog.FindSurvivorDef("Berz");
			NetworkUser val2 = ((NetworkUser.readOnlyLocalPlayersList.Count > 0) ? NetworkUser.readOnlyLocalPlayersList[0] : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
			{
				PajamalandPlugin.Log.LogError((object)$"Dev.AutoStartRun: berz={Object.op_Implicit((Object)(object)val)} user={Object.op_Implicit((Object)(object)val2)}");
				yield break;
			}
			val2.SetSurvivorPreferenceClient(val);
			PajamalandPlugin.Log.LogMessage((object)"Dev.AutoStartRun: selected Berz, starting run in 2 s.");
			yield return (object)new WaitForSeconds(2f);
			Console.instance.SubmitCmd((NetworkUser)null, "pregame_start_run", false);
		}

		private static void OnServerStageBegin(Stage stage)
		{
			if (NetworkServer.active)
			{
				((MonoBehaviour)PajamalandPlugin.Instance).StartCoroutine(RunStageCommands());
			}
		}

		private static IEnumerator RunStageCommands()
		{
			yield return (object)new WaitForSeconds(4f);
			NetworkUser user = ((NetworkUser.readOnlyLocalPlayersList.Count > 0) ? NetworkUser.readOnlyLocalPlayersList[0] : null);
			string[] array = onStageCommands.Value.Split(';');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length != 0)
				{
					PajamalandPlugin.Log.LogMessage((object)("Dev.OnStageCommands: " + text));
					Console.instance.SubmitCmd(user, text, false);
					yield return (object)new WaitForSeconds(0.5f);
				}
			}
		}
	}
	internal sealed class PajamalandContentProvider : IContentPackProvider
	{
		private readonly ContentPack contentPack = new ContentPack();

		internal readonly List<GameObject> bodyPrefabs = new List<GameObject>();

		internal readonly List<GameObject> masterPrefabs = new List<GameObject>();

		internal readonly List<GameObject> projectilePrefabs = new List<GameObject>();

		internal readonly List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		internal readonly List<SkillDef> skillDefs = new List<SkillDef>();

		internal readonly List<SkillFamily> skillFamilies = new List<SkillFamily>();

		internal readonly List<Type> entityStateTypes = new List<Type>();

		internal readonly List<BuffDef> buffDefs = new List<BuffDef>();

		internal readonly List<EffectDef> effectDefs = new List<EffectDef>();

		internal readonly List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public static PajamalandContentProvider Instance { get; private set; }

		public string identifier => "com.pajamaland.PajamalandSurvivor";

		public void Register()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Instance = this;
			ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)delegate(AddContentPackProviderDelegate add)
			{
				add.Invoke((IContentPackProvider)(object)this);
			};
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			BerzSurvivorBuilder.Build(this);
			contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
			contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.survivorDefs.Add(survivorDefs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			contentPack.entityStateTypes.Add(entityStateTypes.ToArray());
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.pajamaland.PajamalandSurvivor", "PajamalandSurvivor", "0.1.0")]
	public sealed class PajamalandPlugin : BaseUnityPlugin
	{
		public const string GUID = "com.pajamaland.PajamalandSurvivor";

		public const string NAME = "PajamalandSurvivor";

		public const string VERSION = "0.1.0";

		public const string TOKEN_PREFIX = "PAJAMALAND_";

		public static PajamalandPlugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new PajamalandContentProvider().Register();
			BerzHooks.Install();
			((ResourceAvailability)(ref SurvivorCatalog.availability)).CallWhenAvailable((Action)LogSurvivorCatalog);
			BerzFeedback.Init(((BaseUnityPlugin)this).Config);
			BerzTuning.Init(((BaseUnityPlugin)this).Config);
			BerzVoltageHud.Install();
			DevAutoLobby.Init(((BaseUnityPlugin)this).Config);
			Log.LogInfo((object)"PajamalandSurvivor 0.1.0 loaded; waiting for content load.");
		}

		private void Update()
		{
			DevAutoLobby.Update();
		}

		private static void LogSurvivorCatalog()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected I4, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected I4, but got Unknown
			//IL_00ea: 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_00f9: Expected I4, but got Unknown
			foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs)
			{
				string text = (Object.op_Implicit((Object)(object)orderedSurvivorDef.bodyPrefab) ? ((Object)orderedSurvivorDef.bodyPrefab).name : "<null>");
				Log.LogInfo((object)string.Format("SurvivorCatalog[{0}] {1} body={2} sort={3} hidden={4} unlock={5}", (int)orderedSurvivorDef.survivorIndex, orderedSurvivorDef.cachedName, text, orderedSurvivorDef.desiredSortPosition, orderedSurvivorDef.hidden, Object.op_Implicit((Object)(object)orderedSurvivorDef.unlockableDef) ? orderedSurvivorDef.unlockableDef.cachedName : "none"));
			}
			SurvivorDef val = SurvivorCatalog.FindSurvivorDef("Berz");
			if (Object.op_Implicit((Object)(object)val))
			{
				Log.LogMessage((object)$"Berz registered as SurvivorIndex {(int)val.survivorIndex}, BodyIndex {(int)SurvivorCatalog.GetBodyIndexFromSurvivorIndex(val.survivorIndex)}.");
			}
			else
			{
				Log.LogError((object)"Berz is NOT in SurvivorCatalog.");
			}
		}
	}
}
namespace Pajamaland.Modules
{
	internal static class SkillHelper
	{
		public static void ClearGenericSkills(GameObject bodyPrefab)
		{
			GenericSkill[] components = bodyPrefab.GetComponents<GenericSkill>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
		}

		public static GenericSkill AddSlot(GameObject bodyPrefab, SkillSlot slot, string familyName)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected I4, but got Unknown
			SkillLocator component = bodyPrefab.GetComponent<SkillLocator>();
			GenericSkill val = bodyPrefab.AddComponent<GenericSkill>();
			val.skillName = familyName;
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)bodyPrefab).name + familyName + "Family";
			val2.variants = Array.Empty<Variant>();
			val._skillFamily = val2;
			PajamalandContentProvider.Instance.skillFamilies.Add(val2);
			switch ((int)slot)
			{
			case 0:
				component.primary = val;
				break;
			case 1:
				component.secondary = val;
				break;
			case 2:
				component.utility = val;
				break;
			case 3:
				component.special = val;
				break;
			}
			return val;
		}

		public static void AddVariant(SkillFamily family, SkillDef def, UnlockableDef unlockable = null)
		{
			//IL_0027: 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_0051: Expected O, but got Unknown
			//IL_0051: 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)
			Array.Resize(ref family.variants, family.variants.Length + 1);
			Variant[] variants = family.variants;
			int num = family.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = def,
				unlockableDef = unlockable
			};
			((Variant)(ref val)).viewableNode = new Node(def.skillNameToken, false, (Node)null);
			variants[num] = val;
		}

		public static T CreateSkillDef<T>(string name, string nameToken, string descToken, Sprite icon, Type stateType, string machine, float cooldown, int stock, InterruptPriority priority = (InterruptPriority)1, bool combat = true, bool forceSprint = false, bool cancelSprint = true, bool mustKeyPress = false, string[] keywords = null) where T : SkillDef
		{
			//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_0067: 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)
			T val = ScriptableObject.CreateInstance<T>();
			((SkillDef)val).skillName = name;
			((Object)(object)val).name = name;
			((SkillDef)val).skillNameToken = nameToken;
			((SkillDef)val).skillDescriptionToken = descToken;
			((SkillDef)val).icon = icon;
			((SkillDef)val).activationState = new SerializableEntityStateType(stateType);
			((SkillDef)val).activationStateMachineName = machine;
			((SkillDef)val).interruptPriority = priority;
			((SkillDef)val).baseRechargeInterval = cooldown;
			((SkillDef)val).baseMaxStock = stock;
			((SkillDef)val).rechargeStock = 1;
			((SkillDef)val).requiredStock = 1;
			((SkillDef)val).stockToConsume = 1;
			((SkillDef)val).fullRestockOnAssign = true;
			((SkillDef)val).resetCooldownTimerOnUse = false;
			((SkillDef)val).beginSkillCooldownOnSkillEnd = false;
			((SkillDef)val).isCombatSkill = combat;
			((SkillDef)val).forceSprintDuringState = forceSprint;
			((SkillDef)val).cancelSprintingOnActivation = cancelSprint;
			((SkillDef)val).canceledFromSprinting = false;
			((SkillDef)val).mustKeyPress = mustKeyPress;
			((SkillDef)val).keywordTokens = keywords ?? Array.Empty<string>();
			PajamalandContentProvider.Instance.skillDefs.Add((SkillDef)(object)val);
			return val;
		}

		public static SkillDef CreateSkillDef(string name, string nameToken, string descToken, Sprite icon, Type stateType, string machine, float cooldown, int stock, InterruptPriority priority = (InterruptPriority)1, bool combat = true, bool forceSprint = false, bool cancelSprint = true, bool mustKeyPress = false, string[] keywords = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return SkillHelper.CreateSkillDef<SkillDef>(name, nameToken, descToken, icon, stateType, machine, cooldown, stock, priority, combat, forceSprint, cancelSprint, mustKeyPress, keywords);
		}

		public static void RegisterState(Type stateType)
		{
			PajamalandContentProvider.Instance.entityStateTypes.Add(stateType);
		}

		public static HitBoxGroup AddHitBoxGroup(GameObject modelObject, string groupName, Vector3 localPosition, Vector3 localScale)
		{
			//IL_000b: 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_0022: 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)
			//IL_002e: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			GameObject val = new GameObject(groupName + "HitBox");
			val.transform.SetParent(modelObject.transform, false);
			val.transform.localPosition = localPosition;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = localScale;
			val.layer = LayerIndex.projectile.intVal;
			HitBox val2 = val.AddComponent<HitBox>();
			HitBoxGroup val3 = modelObject.AddComponent<HitBoxGroup>();
			val3.groupName = groupName;
			val3.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 };
			return val3;
		}
	}
}
namespace Pajamaland.Berz
{
	internal static class BerzAI
	{
		public static void Setup(GameObject master)
		{
			AISkillDriver[] components = master.GetComponents<AISkillDriver>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)components[i]);
			}
			Driver(master, "CablesHold", (SkillSlot)0, delegate(AISkillDriver d)
			{
				//IL_0026: 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_0034: Unknown result type (might be due to invalid IL or missing references)
				d.minDistance = 0f;
				d.maxDistance = 22f;
				d.selectionRequiresTargetLoS = true;
				d.activationRequiresTargetLoS = true;
				d.movementType = (MovementType)2;
				d.aimType = (AimType)2;
				d.buttonPressType = (ButtonPressType)0;
				d.driverUpdateTimerOverride = 3.2f;
			});
			Driver(master, "Thunderfall/Grid", (SkillSlot)3, delegate(AISkillDriver d)
			{
				//IL_0026: 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_0034: Unknown result type (might be due to invalid IL or missing references)
				d.requireSkillReady = true;
				d.minDistance = 0f;
				d.maxDistance = 18f;
				d.selectionRequiresTargetLoS = true;
				d.movementType = (MovementType)1;
				d.aimType = (AimType)2;
				d.buttonPressType = (ButtonPressType)2;
				d.driverUpdateTimerOverride = 0.6f;
			});
			Driver(master, "Rod/ArcFlash", (SkillSlot)1, delegate(AISkillDriver d)
			{
				//IL_002d: 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_003b: Unknown result type (might be due to invalid IL or missing references)
				d.requireSkillReady = true;
				d.minDistance = 6f;
				d.maxDistance = 40f;
				d.selectionRequiresTargetLoS = true;
				d.activationRequiresAimTargetLoS = true;
				d.movementType = (MovementType)1;
				d.aimType = (AimType)2;
				d.buttonPressType = (ButtonPressType)0;
				d.driverUpdateTimerOverride = 1.2f;
			});
			Driver(master, "LiveWireEngage", (SkillSlot)2, delegate(AISkillDriver d)
			{
				//IL_0026: 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_003b: Unknown result type (might be due to invalid IL or missing references)
				d.requireSkillReady = true;
				d.minDistance = 25f;
				d.maxDistance = 70f;
				d.selectionRequiresTargetLoS = true;
				d.movementType = (MovementType)1;
				d.aimType = (AimType)2;
				d.shouldSprint = true;
				d.buttonPressType = (ButtonPressType)3;
			});
			Driver(master, "Chase", (SkillSlot)(-1), delegate(AISkillDriver d)
			{
				//IL_0018: 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)
				d.minDistance = 0f;
				d.maxDistance = float.PositiveInfinity;
				d.movementType = (MovementType)1;
				d.aimType = (AimType)1;
				d.shouldSprint = true;
			});
			PajamalandPlugin.Log.LogInfo((object)("Berz AI: 5 skill drivers installed on " + ((Object)master).name));
		}

		private static void Driver(GameObject master, string name, SkillSlot slot, Action<AISkillDriver> configure)
		{
			//IL_000f: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			AISkillDriver val = master.AddComponent<AISkillDriver>();
			val.customName = name;
			val.skillSlot = slot;
			val.moveTargetType = (TargetType)0;
			configure(val);
		}
	}
	internal static class BerzArcs
	{
		private static readonly BullseyeSearch search = new BullseyeSearch();

		public static int ArcToEnemies(CharacterBody owner, Vector3 origin, float damage, int count, float range, bool crit, float procCoefficient, DamageTypeCombo damageType, GameObject excludeEntity = null)
		{
			//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)
			//IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00a4: 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)
			//IL_0101: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)OrbManager.instance))
			{
				return 0;
			}
			TeamIndex teamIndex = owner.teamComponent.teamIndex;
			search.viewer = owner;
			search.searchOrigin = origin;
			search.searchDirection = Vector3.up;
			search.minDistanceFilter = 0f;
			search.maxDistanceFilter = range;
			search.maxAngleFilter = 360f;
			search.teamMaskFilter = TeamMask.GetEnemyTeams(teamIndex);
			search.filterByLoS = false;
			search.filterByDistinctEntity = true;
			search.sortMode = (SortMode)1;
			search.RefreshCandidates();
			search.FilterOutGameObject(((Component)owner).gameObject);
			if (Object.op_Implicit((Object)(object)excludeEntity))
			{
				search.FilterOutGameObject(excludeEntity);
			}
			int num = 0;
			foreach (HurtBox result in search.GetResults())
			{
				if (num >= count)
				{
					break;
				}
				FireOrb(owner, origin, result, damage, crit, procCoefficient, damageType);
				num++;
			}
			GroundingRodController.RelayArcs(owner, origin, damage, crit, procCoefficient, damageType);
			return num;
		}

		public static void FireOrb(CharacterBody owner, Vector3 origin, HurtBox target, float damage, bool crit, float procCoefficient, DamageTypeCombo damageType)
		{
			//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_0027: 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)
			//IL_002d: 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_0040: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			if (NetworkServer.active && Object.op_Implicit((Object)(object)OrbManager.instance) && Object.op_Implicit((Object)(object)target))
			{
				OrbManager.instance.AddOrb((Orb)new LightningOrb
				{
					origin = origin,
					target = target,
					attacker = ((Component)owner).gameObject,
					inflictor = null,
					teamIndex = owner.teamComponent.teamIndex,
					damageValue = damage,
					isCrit = crit,
					procCoefficient = procCoefficient,
					damageType = damageType,
					damageColorIndex = (DamageColorIndex)0,
					bouncesRemaining = 0,
					bouncedObjects = new List<HealthComponent>(),
					lightningType = (LightningType)5,
					range = 18f,
					targetsToFindPerBounce = 1
				});
			}
		}
	}
	internal static class BerzContent
	{
		public const string TokenPrefix = "PAJAMALAND_BERZ_";

		public static BuffDef VoltageBuff;

		public static BuffDef ArcShieldBuff;

		public static BuffDef GridBuff;

		public static GameObject GroundingRodPrefab;

		public static GameObject CueEffect;

		private static readonly Dictionary<string, NetworkSoundEventDef> netSounds = new Dictionary<string, NetworkSoundEventDef>();

		public static GameObject SwingMuzzleEffect;

		public static GameObject ShotMuzzleEffect;

		public static GameObject MeleeHitEffect;

		public static GameObject LightningImpactEffect;

		public static GameObject NovaEffect;

		public static GameObject GroundSlamEffect;

		public static GameObject BoltTracerEffect;

		public static GameObject LightningStrikeEffect;

		public static Sprite PrimaryIcon;

		public static Sprite PrimaryAltIcon;

		public static Sprite SecondaryIcon;

		public static Sprite SecondaryAltIcon;

		public static Sprite UtilityIcon;

		public static Sprite SpecialIcon;

		public static Sprite SpecialAltIcon;

		public static NetworkSoundEventIndex NetSoundIndex(string eventName)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(eventName) || !netSounds.TryGetValue(eventName, out var value) || !Object.op_Implicit((Object)(object)value))
			{
				return (NetworkSoundEventIndex)(-1);
			}
			return value.index;
		}

		public static void Init(PajamalandContentProvider content)
		{
			//IL_006a: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_02eb: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Expected O, but got Unknown
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_062a: Expected O, but got Unknown
			//IL_062a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Expected O, but got Unknown
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = PajamalandPlugin.Log;
			BuffDef val = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Energized");
			BuffDef val2 = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/ArmorBoost");
			VoltageBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)VoltageBuff).name = "BerzVoltage";
			VoltageBuff.canStack = true;
			VoltageBuff.isDebuff = false;
			VoltageBuff.isHidden = false;
			VoltageBuff.buffColor = new Color(0.35f, 0.95f, 1f);
			VoltageBuff.iconSprite = (Object.op_Implicit((Object)(object)val) ? val.iconSprite : null);
			content.buffDefs.Add(VoltageBuff);
			ArcShieldBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)ArcShieldBuff).name = "BerzArcShield";
			ArcShieldBuff.canStack = false;
			ArcShieldBuff.isDebuff = false;
			ArcShieldBuff.buffColor = new Color(0.3f, 0.8f, 0.7f);
			ArcShieldBuff.iconSprite = (Object.op_Implicit((Object)(object)val2) ? val2.iconSprite : null);
			content.buffDefs.Add(ArcShieldBuff);
			BuffDef val3 = LegacyResourcesAPI.Load<BuffDef>("BuffDefs/TeslaField");
			GridBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)GridBuff).name = "BerzPowerGrid";
			GridBuff.canStack = false;
			GridBuff.isDebuff = false;
			GridBuff.buffColor = new Color(0.55f, 0.95f, 1f);
			GridBuff.iconSprite = (Object.op_Implicit((Object)(object)val3) ? val3.iconSprite : (Object.op_Implicit((Object)(object)val) ? val.iconSprite : null));
			content.buffDefs.Add(GridBuff);
			string[] array = new string[23]
			{
				"Play_loader_m1_swing", "Play_loader_m1_impact", "Play_loader_R_variant_slam", "Play_loader_R_toss", "Play_loader_m2_impact", "Play_loader_shift_release", "Play_mage_m1_impact_lightning", "Play_mage_R_lightningBlast", "Play_loader_m1_shield", "Play_captain_drone_zap",
				"Play_loader_R_activate", "Play_loader_R_active_loop", "Stop_loader_R_active_loop", "Play_loader_R_expire", "Play_item_proc_stickyBomb_countdown", "Play_captain_m2_tazer_impact", "Play_loader_m2_launch", "Play_loader_m2_impact", "Play_loader_shift_charge_loop", "Stop_loader_shift_charge_loop",
				"Play_captain_m2_tazer_bounce", "Play_item_proc_personal_shield_end", "Play_loader_R_variant_activate"
			};
			foreach (string text in array)
			{
				if (!netSounds.ContainsKey(text))
				{
					NetworkSoundEventDef val4 = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
					((Object)val4).name = "Berz_" + text;
					val4.eventName = text;
					netSounds[text] = val4;
					content.networkSoundEventDefs.Add(val4);
				}
			}
			GameObject val5 = new GameObject("BerzPrefabHolder");
			val5.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val5);
			CueEffect = new GameObject("BerzCueEffect");
			CueEffect.transform.SetParent(val5.transform, false);
			EffectComponent obj = CueEffect.AddComponent<EffectComponent>();
			obj.applyScale = false;
			obj.soundName = "";
			VFXAttributes obj2 = CueEffect.AddComponent<VFXAttributes>();
			obj2.vfxPriority = (VFXPriority)2;
			obj2.vfxIntensity = (VFXIntensity)0;
			obj2.DoNotPool = true;
			CueEffect.AddComponent<BerzCueBehaviour>();
			CueEffect.AddComponent<DestroyOnTimer>().duration = 1f;
			content.effectDefs.Add(new EffectDef(CueEffect));
			SwingMuzzleEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MuzzleFlashes/MuzzleflashLoader");
			MeleeHitEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OmniEffect/OmniImpactVFXLoaderLightning");
			LightningImpactEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/ImpactLightning");
			NovaEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/LightningStakeNova");
			GroundSlamEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/LoaderGroundSlam");
			BoltTracerEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerSmokeLine/TracerMageLightningLaser");
			LightningStrikeEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/LightningStrikeImpact");
			if (!Object.op_Implicit((Object)(object)LightningStrikeEffect))
			{
				log.LogWarning((object)"LightningStrikeImpact effect not found");
			}
			if (!Object.op_Implicit((Object)(object)GroundSlamEffect))
			{
				log.LogWarning((object)"LoaderGroundSlam effect not found");
			}
			if (!Object.op_Implicit((Object)(object)BoltTracerEffect))
			{
				log.LogWarning((object)"TracerMageLightningLaser effect not found");
			}
			PrimaryIcon = LoadIcon("SkillDefs/LoaderBody/FireHook");
			PrimaryAltIcon = LoadIcon("SkillDefs/LoaderBody/SwingFist");
			ShotMuzzleEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MuzzleFlashes/MuzzleflashMageLightning");
			if (!Object.op_Implicit((Object)(object)ShotMuzzleEffect))
			{
				log.LogWarning((object)"MuzzleflashMageLightning not found");
			}
			SecondaryIcon = LoadIcon("SkillDefs/LoaderBody/ThrowPylon");
			SecondaryAltIcon = LoadIcon("SkillDefs/LoaderBody/ChargeFist");
			SpecialAltIcon = LoadIcon("SkillDefs/LoaderBody/GroundSlam");
			UtilityIcon = LoadIcon("SkillDefs/MercBody/MercBodyAssaulter");
			SpecialIcon = LoadIcon("SkillDefs/LoaderBody/ChargeZapFist");
			GameObject val6 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoStickyGrenadeProjectile");
			if (Object.op_Implicit((Object)(object)val6))
			{
				GroundingRodPrefab = PrefabAPI.InstantiateClone(val6, "BerzGroundingRodProjectile");
				ProjectileImpactExplosion component = GroundingRodPrefab.GetComponent<ProjectileImpactExplosion>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.destroyOnEnemy = false;
					component.destroyOnWorld = false;
					component.impactOnWorld = false;
					component.timerAfterImpact = false;
					component.lifetimeAfterImpact = 0f;
					component.lifetime = 8.5f;
					((ProjectileExplosion)component).blastRadius = 8f;
					((ProjectileExplosion)component).blastDamageCoefficient = 1.5f;
					((ProjectileExplosion)component).falloffModel = (FalloffModel)0;
					((ProjectileExplosion)component).blastProcCoefficient = 0.7f;
					GameObject val7 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MageLightningBombExplosion");
					if (Object.op_Implicit((Object)(object)val7))
					{
						((ProjectileExplosion)component).explosionEffect = val7;
					}
				}
				ProjectileSimple component2 = GroundingRodPrefab.GetComponent<ProjectileSimple>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.lifetime = 11f;
				}
				ProjectileStickOnImpact obj3 = GroundingRodPrefab.GetComponent<ProjectileStickOnImpact>() ?? GroundingRodPrefab.AddComponent<ProjectileStickOnImpact>();
				obj3.ignoreImpact = false;
				obj3.ignoreWorld = false;
				obj3.ignoreCharacters = false;
				obj3.ignoreProjectiles = true;
				obj3.ignoreDeadCharacters = true;
				obj3.alignNormals = true;
				obj3.attachToCharacter = true;
				obj3.distanceFromGround = -1f;
				obj3.disableNetworkTransformOnStick = true;
				obj3.stickSoundString = "Play_loader_m2_impact";
				obj3.stickParticleSystem = Array.Empty<ParticleSystem>();
				obj3.stickEvent = new UnityEvent();
				obj3.detachEvent = new UnityEvent();
				ApplyTorqueOnStart component3 = GroundingRodPrefab.GetComponent<ApplyTorqueOnStart>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					Object.Destroy((Object)(object)component3);
				}
				Rigidbody component4 = GroundingRodPrefab.GetComponent<Rigidbody>();
				if (Object.op_Implicit((Object)(object)component4))
				{
					component4.useGravity = false;
				}
				GameObject val8 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/LoaderPylon");
				Transform val9 = (Object.op_Implicit((Object)(object)val8) ? val8.transform.Find("loader pylon") : null);
				ProjectileController component5 = GroundingRodPrefab.GetComponent<ProjectileController>();
				if (Object.op_Implicit((Object)(object)val9) && Object.op_Implicit((Object)(object)component5))
				{
					GameObject obj4 = Object.Instantiate<GameObject>(((Component)val9).gameObject, GroundingRodPrefab.transform);
					((Object)obj4).name = "GroundingRodVisual";
					obj4.transform.localPosition = Vector3.zero;
					obj4.transform.localRotation = Quaternion.identity;
					obj4.transform.localScale = Vector3.one * 0.45f;
					Component[] componentsInChildren = obj4.GetComponentsInChildren<Component>(true);
					foreach (Component val10 in componentsInChildren)
					{
						if (Object.op_Implicit((Object)(object)val10))
						{
							switch (((object)val10).GetType().Name)
							{
							case "AkEvent":
							case "AkGameObj":
							case "LoopSound":
							case "AkAmbient":
								Object.Destroy((Object)(object)val10);
								break;
							}
						}
					}
					component5.ghostPrefab = null;
					component5.ghostPrefabAddress = new AssetReferenceT<GameObject>("");
					log.LogDebug((object)"Grounding Rod visual: cloned 'loader pylon' from LoaderPylon, ghost removed");
				}
				else
				{
					log.LogWarning((object)"LoaderPylon model not found; Grounding Rod keeps the sticky-grenade ghost");
				}
				GroundingRodPrefab.AddComponent<GroundingRodController>();
				content.projectilePrefabs.Add(GroundingRodPrefab);
				DumpProjectile(GroundingRodPrefab);
			}
			else
			{
				log.LogError((object)"Could not load CommandoStickyGrenadeProjectile for the Grounding Rod.");
			}
			LanguageAPI.Add("PAJAMALAND_BERZ_NAME", "Berz");
			LanguageAPI.Add("PAJAMALAND_BERZ_SUBTITLE", "Bodyguard Brute");
			LanguageAPI.Add("PAJAMALAND_BERZ_DESCRIPTION", "Berz is a heavy who gets stronger by protecting people. Lightning is the circuit between him and his allies.<color=#CCD3E0>\n\n< ! > Melee hits and hurt allies build Voltage. Spend it with Grounding Rod and Power Grid before the breaker trips.\n\n< ! > Live Wire reaches any ally, drone or turret within 120 m and shields you both.\n\n< ! > Grounding Rods extend every arc you throw.</color>");
			LanguageAPI.Add("PAJAMALAND_BERZ_LORE", "Berz signed onto the UES Safe Travels as an electrical systems tech for one reason: the friend he had known since middle school was going, so he was going.");
			LanguageAPI.Add("PAJAMALAND_BERZ_OUTRO_FLAVOR", "...and so he left, bringing everyone home.");
			LanguageAPI.Add("PAJAMALAND_BERZ_OUTRO_FAILURE", "...and so he vanished, the circuit left open.");
			LanguageAPI.Add("PAJAMALAND_BERZ_PASSIVE_NAME", "Live Current");
			LanguageAPI.Add("PAJAMALAND_BERZ_PASSIVE_DESCRIPTION", "Your own hits and damaged allies within 40 m build <style=cIsUtility>Voltage</style>. Grounding Rod and Power Grid spend it for up to <style=cIsDamage>+100% damage</style>. At 100 Voltage a 4 s fuse starts; if it trips you are stunned and drop to zero.");
			LanguageAPI.Add("PAJAMALAND_BERZ_PRIMARY_NAME", "Jumper Cables");
			LanguageAPI.Add("PAJAMALAND_BERZ_PRIMARY_DESCRIPTION", "<style=cIsDamage>Shocking.</style> Hold to clamp a live cable onto an enemy within 25 m for <style=cIsDamage>250%</style> per second; everything the cable sweeps through takes <style=cIsDamage>150%</style> per second. Builds Voltage while clamped. Hold 2.5 s to <style=cIsDamage>jump-start</style>: a <style=cIsDamage>500%</style> burst that <style=cIsUtility>stuns</style>.");
			LanguageAPI.Add("PAJAMALAND_BERZ_PRIMARY_ALT_NAME", "Short Circuit");
			LanguageAPI.Add("PAJAMALAND_BERZ_PRIMARY_ALT_DESCRIPTION", "<style=cIsDamage>Shocking.</style> Quick jab and cross for <style=cIsDamage>220%</style> each. Every hit arcs to one nearby enemy per 33 Voltage for <style=cIsDamage>80%</style>. Press on the beat after a hit lands to <style=cIsUtility>charge</style> the next swing: <style=cIsDamage>+50% damage</style> and +10 Voltage.");
			LanguageAPI.Add("PAJAMALAND_BERZ_SECONDARY_NAME", "Grounding Rod");
			LanguageAPI.Add("PAJAMALAND_BERZ_SECONDARY_DESCRIPTION", "Throw a javelin for <style=cIsDamage>400%</style> that sticks for 8 s and acts as a lightning rod. It detonates for up to <style=cIsDamage>1200%</style> with full Voltage. Holds 2 charges.");
			LanguageAPI.Add("PAJAMALAND_BERZ_SECONDARY_ALT_NAME", "Arc Flash");
			LanguageAPI.Add("PAJAMALAND_BERZ_SECONDARY_ALT_DESCRIPTION", "<style=cIsUtility>Stunning.</style> Hold to charge for up to 1.5 s, then smash a cone in front of you for <style=cIsDamage>500%-1500%</style>. Spends all Voltage for up to <style=cIsDamage>+100% damage</style>.");
			LanguageAPI.Add("PAJAMALAND_BERZ_SPECIAL_ALT_NAME", "Thunderfall");
			LanguageAPI.Add("PAJAMALAND_BERZ_SPECIAL_ALT_DESCRIPTION", "<style=cIsUtility>Stunning.</style> Leap forward and come down as a lightning strike for <style=cIsDamage>1000%</style> in an 8 m radius. Spends all Voltage for up to <style=cIsDamage>+100% damage</style>.");
			LanguageAPI.Add("PAJAMALAND_BERZ_UTILITY_NAME", "Live Wire");
			LanguageAPI.Add("PAJAMALAND_BERZ_UTILITY_DESCRIPTION", "<style=cIsUtility>Agile.</style> Become lightning and hop forward 3 times, dealing <style=cIsDamage>200%</style> to enemies you pass. Aimed at an ally within 120 m, hop to them, burst for <style=cIsDamage>800%</style> and give you both an <style=cIsHealing>Arc Shield</style> barrier. Low-health allies double it and refund half the cooldown.");
			LanguageAPI.Add("PAJAMALAND_BERZ_SPECIAL_NAME", "Power Grid");
			LanguageAPI.Add("PAJAMALAND_BERZ_SPECIAL_DESCRIPTION", "For 8 s, live wires link you to every ally and Grounding Rod within 40 m. Enemies touching a wire take <style=cIsDamage>300%</style> per second. With nobody nearby, lash the 3 closest enemies instead. Voltage extends it to 12 s.");
		}

		private static void DumpProjectile(GameObject prefab)
		{
			StringBuilder stringBuilder = new StringBuilder("GroundingRod prefab components: ");
			Component[] components = prefab.GetComponents<Component>();
			foreach (Component val in components)
			{
				stringBuilder.Append(((object)val).GetType().Name).Append(' ');
			}
			ProjectileStickOnImpact component = prefab.GetComponent<ProjectileStickOnImpact>();
			if (Object.op_Implicit((Object)(object)component))
			{
				stringBuilder.Append($"| stick: ignoreImpact={component.ignoreImpact} ignoreWorld={component.ignoreWorld} ignoreCharacters={component.ignoreCharacters} ignoreProjectiles={component.ignoreProjectiles} alignNormals={component.alignNormals} attachToCharacter={component.attachToCharacter} distanceFromGround={component.distanceFromGround} ignoreSteepSlopes={component.ignoreSteepSlopes}");
			}
			ProjectileSimple component2 = prefab.GetComponent<ProjectileSimple>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				stringBuilder.Append($" | simple: lifetime={component2.lifetime} speed={component2.desiredForwardSpeed}");
			}
			Rigidbody component3 = prefab.GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				stringBuilder.Append($" | rb: gravity={component3.useGravity} kinematic={component3.isKinematic}");
			}
			ProjectileController component4 = prefab.GetComponent<ProjectileController>();
			if (Object.op_Implicit((Object)(object)component4))
			{
				stringBuilder.Append($" | controller: canImpactOnTrigger={component4.canImpactOnTrigger}");
			}
			Collider component5 = prefab.GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component5))
			{
				stringBuilder.Append($" | collider: {((object)component5).GetType().Name} trigger={component5.isTrigger}");
			}
			PajamalandPlugin.Log.LogInfo((object)stringBuilder.ToString());
		}

		private static Sprite LoadIcon(string legacyPath)
		{
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>(legacyPath);
			if (!Object.op_Implicit((Object)(object)val))
			{
				PajamalandPlugin.Log.LogWarning((object)("Icon source not found: " + legacyPath));
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			return val.icon;
		}
	}
	internal static class BerzDevCommands
	{
		private static int displayCandidate = -1;

		private static readonly string[] DisplayCandidates = new string[10] { "upper_arm.r:0:0:60", "upper_arm.r:0:0:-60", "upper_arm.r:60:0:0", "upper_arm.r:-60:0:0", "upper_arm.r:0:60:0", "upper_arm.r:0:-60:0", "lower_arm.r:0:0:60", "lower_arm.r:0:0:-60", "lower_arm.r:60:0:0", "lower_arm.r:-60:0:0" };

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCVoltage(ConCommandArgs args)
		{
			if (!NetworkServer.active)
			{
				((ConCommandArgs)(ref args)).Log((object)"server only");
				return;
			}
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			VoltageController voltageController = (Object.op_Implicit((Object)(object)senderBody) ? ((Component)senderBody).GetComponent<VoltageController>() : null);
			if (!Object.op_Implicit((Object)(object)voltageController))
			{
				((ConCommandArgs)(ref args)).Log((object)"sender is not Berz");
				return;
			}
			voltageController.SetVoltage(((ConCommandArgs)(ref args)).GetArgFloat(0));
			((ConCommandArgs)(ref args)).Log((object)$"voltage = {voltageController.Voltage:0}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCSpawn(ConCommandArgs args)
		{
			//IL_00ae: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00d8: 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_00e5: 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_00e8: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//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_0118: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				((ConCommandArgs)(ref args)).Log((object)"server only");
				return;
			}
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			string text = ((ConCommandArgs)(ref args)).TryGetArgString(0) ?? "LemurianMaster";
			int num = ((ConCommandArgs)(ref args)).TryGetArgInt(1) ?? 3;
			float num2 = ((ConCommandArgs)(ref args)).TryGetArgFloat(2) ?? 12f;
			GameObject val = MasterCatalog.FindMasterPrefab(text);
			if (!Object.op_Implicit((Object)(object)val))
			{
				((ConCommandArgs)(ref args)).Log((object)("unknown master " + text));
				return;
			}
			for (int i = 0; i < num; i++)
			{
				float num3 = 360f / (float)num * (float)i * (MathF.PI / 180f);
				Vector3 val2 = senderBody.footPosition + new Vector3(Mathf.Cos(num3), 0.5f, Mathf.Sin(num3)) * num2;
				new MasterSummon
				{
					masterPrefab = val,
					position = val2,
					rotation = Quaternion.LookRotation(senderBody.footPosition - val2),
					summonerBodyObject = null,
					teamIndexOverride = (TeamIndex)2,
					ignoreTeamMemberLimit = true
				}.Perform();
			}
			((ConCommandArgs)(ref args)).Log((object)$"spawned {num} x {text}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCAlly(ConCommandArgs args)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0093: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				((ConCommandArgs)(ref args)).Log((object)"server only");
				return;
			}
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			string text = ((ConCommandArgs)(ref args)).TryGetArgString(0) ?? "BeetleGuardAllyMaster";
			float num = ((ConCommandArgs)(ref args)).TryGetArgFloat(1) ?? 30f;
			GameObject val = MasterCatalog.FindMasterPrefab(text);
			if (!Object.op_Implicit((Object)(object)val))
			{
				((ConCommandArgs)(ref args)).Log((object)("unknown master " + text));
				return;
			}
			Vector3 val2 = senderBody.footPosition + senderBody.inputBank.aimDirection * num + Vector3.up;
			CharacterMaster val3 = new MasterSummon
			{
				masterPrefab = val,
				position = val2,
				rotation = Quaternion.identity,
				summonerBodyObject = ((Component)senderBody).gameObject,
				teamIndexOverride = senderBody.teamComponent.teamIndex,
				ignoreTeamMemberLimit = true
			}.Perform();
			((ConCommandArgs)(ref args)).Log((object)(Object.op_Implicit((Object)(object)val3) ? $"spawned ally {text} at {val2}" : "spawn failed"));
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCBurn(ConCommandArgs args)
		{
			if (!NetworkServer.active)
			{
				((ConCommandArgs)(ref args)).Log((object)"server only");
				return;
			}
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			int num = 0;
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive)
				{
					DotController.InflictDot(((Component)readOnlyInstances).gameObject, ((Component)senderBody).gameObject, (DotIndex)1, 6f, 0.1f, (uint?)null);
					num++;
				}
			}
			((ConCommandArgs)(ref args)).Log((object)$"burn on {num} bodies; dumping in 1.5 s");
			((MonoBehaviour)PajamalandPlugin.Instance).StartCoroutine(DumpBurnLater());
		}

		private static IEnumerator DumpBurnLater()
		{
			yield return (object)new WaitForSeconds(1.5f);
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (!Object.op_Implicit((Object)(object)readOnlyInstances) || !Object.op_Implicit((Object)(object)readOnlyInstances.modelLocator) || !Object.op_Implicit((Object)(object)readOnlyInstances.modelLocator.modelTransform))
				{
					continue;
				}
				Transform modelTransform = readOnlyInstances.modelLocator.modelTransform;
				ParticleSystem[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<ParticleSystem>(true);
				PajamalandPlugin.Log.LogInfo((object)$"BURN {((Object)readOnlyInstances).name}: model scale {modelTransform.lossyScale} {componentsInChildren.Length} particle systems");
				ParticleSystem[] array = componentsInChildren;
				foreach (ParticleSystem val in array)
				{
					MainModule main = val.main;
					ShapeModule shape = val.shape;
					ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>();
					string text = (Object.op_Implicit((Object)(object)((ShapeModule)(ref shape)).skinnedMeshRenderer) ? ((Object)((ShapeModule)(ref shape)).skinnedMeshRenderer).name : "-");
					object obj;
					if (!Object.op_Implicit((Object)(object)((ShapeModule)(ref shape)).skinnedMeshRenderer) || !Object.op_Implicit((Object)(object)((ShapeModule)(ref shape)).skinnedMeshRenderer.sharedMesh))
					{
						obj = "-";
					}
					else
					{
						string name = ((Object)((ShapeModule)(ref shape)).skinnedMeshRenderer.sharedMesh).name;
						Bounds val2 = ((ShapeModule)(ref shape)).skinnedMeshRenderer.sharedMesh.bounds;
						object arg = ((Bounds)(ref val2)).size;
						val2 = ((Renderer)((ShapeModule)(ref shape)).skinnedMeshRenderer).localBounds;
						obj = $"{name} b={arg} lb={((Bounds)(ref val2)).size}";
					}
					string text2 = (string)obj;
					NormalizeParticleScale component2 = ((Component)val).GetComponent<NormalizeParticleScale>();
					ManualLogSource log = PajamalandPlugin.Log;
					object[] obj2 = new object[18]
					{
						Path(((Component)val).transform, modelTransform),
						((Object)((Component)val).transform.parent).name,
						((Component)val).transform.lossyScale,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
					obj2[3] = ((MinMaxCurve)(ref startSize)).constantMin;
					startSize = ((MainModule)(ref main)).startSize;
					obj2[4] = ((MinMaxCurve)(ref startSize)).constantMax;
					startSize = ((MainModule)(ref main)).startSize;
					obj2[5] = ((MinMaxCurve)(ref startSize)).mode;
					obj2[6] = ((MainModule)(ref main)).scalingMode;
					obj2[7] = ((ShapeModule)(ref shape)).shapeType;
					obj2[8] = ((ShapeModule)(ref shape)).meshShapeType;
					obj2[9] = ((ShapeModule)(ref shape)).scale;
					obj2[10] = text;
					obj2[11] = text2;
					obj2[12] = ((ShapeModule)(ref shape)).normalOffset;
					obj2[13] = (Object.op_Implicit((Object)(object)component) ? ((object)component.renderMode/*cast due to .constrained prefix*/).ToString() : "-");
					obj2[14] = (Object.op_Implicit((Object)(object)component) ? component.minParticleSize : 0f);
					obj2[15] = (Object.op_Implicit((Object)(object)component) ? component.maxParticleSize : 0f);
					obj2[16] = (Object.op_Implicit((Object)(object)component2) ? (component2.normalizeWithSkinnedMeshRendererInstead + "/" + component2.skinnedMeshRendererMinScale) : "-");
					obj2[17] = val.particleCount;
					log.LogInfo((object)string.Format("BURN   {0}: parent={1} lossy={2} size={3:0.###}..{4:0.###} sizeMode={5} scaling={6} shape={7} meshType={8} shapeScale={9} smr={10} mesh={11} normOffset={12} render={13} min/max={14}/{15} norm={16} alive={17}", obj2));
				}
			}
		}

		private static string Path(Transform t, Transform root)
		{
			string text = ((Object)t).name;
			while (Object.op_Implicit((Object)(object)t.parent) && (Object)(object)t.parent != (Object)(object)root)
			{
				t = t.parent;
				text = ((Object)t).name + "/" + text;
			}
			return text;
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCDisplay(ConCommandArgs args)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			string text = ((((ConCommandArgs)(ref args)).Count > 0) ? string.Join(" ", args.userArgs) : "");
			if (text == "next" || text == "prev")
			{
				displayCandidate = (displayCandidate + ((text == "next") ? 1 : (DisplayCandidates.Length - 1))) % DisplayCandidates.Length;
				text = DisplayCandidates[displayCandidate];
				((ConCommandArgs)(ref args)).Log((object)$"candidate {displayCandidate}: {text}");
				PajamalandPlugin.Log.LogInfo((object)$"berz_display candidate {displayCandidate}: {text}");
			}
			int num = 0;
			BerzDisplayPose[] array = Object.FindObjectsOfType<BerzDisplayPose>();
			for (int i = 0; i < array.Length; i++)
			{
				array[i].Apply(text);
				num++;
			}
			((ConCommandArgs)(ref args)).Log((object)$"berz_display '{text}' on {num} display(s)");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCGod(ConCommandArgs args)
		{
			if (!NetworkServer.active)
			{
				((ConCommandArgs)(ref args)).Log((object)"server only");
				return;
			}
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody) || !Object.op_Implicit((Object)(object)senderBody.healthComponent))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			bool flag = (((ConCommandArgs)(ref args)).TryGetArgInt(0) ?? 1) != 0;
			senderBody.healthComponent.godMode = flag;
			((ConCommandArgs)(ref args)).Log((object)$"godMode = {flag}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCSound(ConCommandArgs args)
		{
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			string text = ((ConCommandArgs)(ref args)).TryGetArgString(0);
			if (!Object.op_Implicit((Object)(object)senderBody) || string.IsNullOrEmpty(text))
			{
				((ConCommandArgs)(ref args)).Log((object)"usage: berz_sound <event>");
				return;
			}
			uint num = Util.PlaySound(text, ((Component)senderBody).gameObject);
			((ConCommandArgs)(ref args)).Log((object)(text + " -> " + ((num == 0) ? "UNKNOWN" : num.ToString())));
			PajamalandPlugin.Log.LogDebug((object)$"berz_sound {text} -> {num}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCBones(ConCommandArgs args)
		{
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			ModelLocator val = (Object.op_Implicit((Object)(object)senderBody) ? ((Component)senderBody).GetComponent<ModelLocator>() : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.modelTransform))
			{
				((ConCommandArgs)(ref args)).Log((object)"no model");
				return;
			}
			StringBuilder stringBuilder = new StringBuilder("Model " + ((Object)val.modelTransform).name + ":\n");
			DumpTransform(val.modelTransform, 0, 12, stringBuilder);
			SkinnedMeshRenderer[] componentsInChildren = ((Component)val.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val2 in componentsInChildren)
			{
				stringBuilder.Append(string.Format("SkinnedMeshRenderer {0}: mesh={1} bones={2} root={3} material={4}\n  bones: ", ((Object)val2).name, Object.op_Implicit((Object)(object)val2.sharedMesh) ? ((Object)val2.sharedMesh).name : "null", val2.bones.Length, Object.op_Implicit((Object)(object)val2.rootBone) ? ((Object)val2.rootBone).name : "null", Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial) ? (((Object)((Renderer)val2).sharedMaterial).name + " / " + ((Object)((Renderer)val2).sharedMaterial.shader).name) : "null"));
				Transform[] bones = val2.bones;
				foreach (Transform val3 in bones)
				{
					stringBuilder.Append(Object.op_Implicit((Object)(object)val3) ? ((Object)val3).name : "null").Append(' ');
				}
				stringBuilder.Append('\n');
			}
			Animator component = ((Component)val.modelTransform).GetComponent<Animator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				stringBuilder.Append("Animator controller=" + (Object.op_Implicit((Object)(object)component.runtimeAnimatorController) ? ((Object)component.runtimeAnimatorController).name : "null") + " avatar=" + (Object.op_Implicit((Object)(object)component.avatar) ? (((Object)component.avatar).name + (component.avatar.isHuman ? " (humanoid)" : " (generic)")) : "null") + "\n");
			}
			componentsInChildren = ((Component)val.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val4 in componentsInChildren)
			{
				Material sharedMaterial = ((Renderer)val4).sharedMaterial;
				stringBuilder.Append(string.Format("MAT {0} enabled={1} material={2} shader={3}", ((Object)val4).name, ((Renderer)val4).enabled, Object.op_Implicit((Object)(object)sharedMaterial) ? ((Object)sharedMaterial).name : "null", Object.op_Implicit((Object)(object)sharedMaterial) ? ((Object)sharedMaterial.shader).name : "-"));
				if (Object.op_Implicit((Object)(object)sharedMaterial))
				{
					stringBuilder.Append($" color={sharedMaterial.color}");
					string[] texturePropertyNames = sharedMaterial.GetTexturePropertyNames();
					foreach (string text in texturePropertyNames)
					{
						Texture texture = sharedMaterial.GetTexture(text);
						stringBuilder.Append(" " + text + "=" + (Object.op_Implicit((Object)(object)texture) ? (((Object)texture).name + "(" + texture.width + "x" + texture.height + ")") : "none"));
					}
				}
				stringBuilder.Append('\n');
			}
			stringBuilder.Append("BerzModel albedo=" + (Object.op_Implicit((Object)(object)BerzModel.Albedo) ? (((Object)BerzModel.Albedo).name + " " + ((Texture)BerzModel.Albedo).width + "x" + ((Texture)BerzModel.Albedo).height) : "null") + " material=" + (Object.op_Implicit((Object)(object)BerzModel.Material) ? ((Object)BerzModel.Material).name : "null") + "\n");
			PajamalandPlugin.Log.LogDebug((object)stringBuilder.ToString());
			((ConCommandArgs)(ref args)).Log((object)"bones dumped to the log");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCMat(ConCommandArgs args)
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Expected O, but got Unknown
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			ModelLocator val = (Object.op_Implicit((Object)(object)senderBody) ? ((Component)senderBody).GetComponent<ModelLocator>() : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.modelTransform))
			{
				((ConCommandArgs)(ref args)).Log((object)"no model");
				return;
			}
			SkinnedMeshRenderer val2 = null;
			SkinnedMeshRenderer[] componentsInChildren = ((Component)val.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val3 in componentsInChildren)
			{
				if (((Object)val3).name == "BerzMesh")
				{
					val2 = val3;
				}
			}
			if (!Object.op_Implicit((Object)(object)val2))
			{
				((ConCommandArgs)(ref args)).Log((object)"no BerzMesh renderer");
				return;
			}
			int valueOrDefault = ((ConCommandArgs)(ref args)).TryGetArgInt(0).GetValueOrDefault();
			Material val4 = ((Renderer)val2).material;
			string text = string.Format("shader={0} keywords=[{1}] st={2} tex={3} queue={4}", ((Object)val4.shader).name, string.Join(" ", val4.shaderKeywords), val4.HasProperty("_MainTex") ? ((object)val4.GetVector("_MainTex_ST")/*cast due to .constrained prefix*/).ToString() : "-", Object.op_Implicit((Object)(object)val4.mainTexture) ? ((Object)val4.mainTexture).name : "null", val4.renderQueue);
			switch (valueOrDefault)
			{
			case 1:
			{
				Texture val9 = null;
				componentsInChildren = ((Component)val.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(true);
				foreach (SkinnedMeshRenderer val10 in componentsInChildren)
				{
					if (((Object)val10).name == "CommandoMesh" && Object.op_Implicit((Object)(object)((Renderer)val10).sharedMaterial))
					{
						val9 = ((Renderer)val10).sharedMaterial.mainTexture;
					}
				}
				if (!Object.op_Implicit((Object)(object)val9))
				{
					Material val11 = LegacyResourcesAPI.Load<Material>("Materials/matCommandoDualies");
					if (Object.op_Implicit((Object)(object)val11))
					{
						val9 = val11.mainTexture;
					}
				}
				val4.mainTexture = val9;
				break;
			}
			case 2:
			{
				Material val7 = (((Renderer)val2).material = new Material(Shader.Find("Standard"))
				{
					mainTexture = (Texture)(object)BerzModel.Albedo
				});
				val4 = val7;
				break;
			}
			case 3:
			{
				Texture2D val6 = new Texture2D(64, 64, (TextureFormat)4, false)
				{
					name = "checker"
				};
				for (int j = 0; j < 64; j++)
				{
					for (int k = 0; k < 64; k++)
					{
						val6.SetPixel(k, j, (Color)(((k / 8 + j / 8) % 4) switch
						{
							2 => Color.blue, 
							1 => Color.green, 
							0 => Color.red, 
							_ => Color.black, 
						}));
					}
				}
				val6.SetPixel(0, 0, Color.white);
				val6.Apply();
				val4.mainTexture = (Texture)(object)val6;
				break;
			}
			case 4:
			{
				string path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(((BaseUnityPlugin)PajamalandPlugin.Instance).Info.Location), "model", "texBerzAlbedo.png");
				Texture2D val5 = new Texture2D(2, 2, (TextureFormat)4, false)
				{
					name = "albedoNoMips"
				};
				ImageConversion.LoadImage(val5, File.ReadAllBytes(path));
				val4.mainTexture = (Texture)(object)val5;
				break;
			}
			case 5:
				val2.sharedMesh.uv2 = val2.sharedMesh.uv;
				val2.sharedMesh.uv3 = val2.sharedMesh.uv;
				val2.sharedMesh.uv4 = val2.sharedMesh.uv;
				val4.mainTexture = (Texture)(object)BerzModel.Albedo;
				break;
			default:
				val4.mainTexture = (Texture)(object)BerzModel.Albedo;
				break;
			}
			Mesh sharedMesh = val2.sharedMesh;
			Vector2[] array = (Vector2[])(Object.op_Implicit((Object)(object)sharedMesh) ? ((Array)sharedMesh.uv) : ((Array)new Vector2[0]));
			float num = 9f;
			float num2 = -9f;
			float num3 = 9f;
			float num4 = -9f;
			Vector2[] array2 = array;
			foreach (Vector2 val12 in array2)
			{
				num = Mathf.Min(num, val12.x);
				num2 = Mathf.Max(num2, val12.x);
				num3 = Mathf.Min(num3, val12.y);
				num4 = Mathf.Max(num4, val12.y);
			}
			PajamalandPlugin.Log.LogDebug((object)string.Format("berz_mat {0}: before {1}; after tex={2} shader={3} | mesh uv={4} u {5:0.000}..{6:0.000} v {7:0.000}..{8:0.000} uv2={9} colors={10} tangents={11} verts={12} albedo mips={13} fmt={14}", valueOrDefault, text, Object.op_Implicit((Object)(object)val4.mainTexture) ? ((Object)val4.mainTexture).name : "null", ((Object)val4.shader).name, array.Length, num, num2, num3, num4, Object.op_Implicit((Object)(object)sharedMesh) ? sharedMesh.uv2.Length : 0, Object.op_Implicit((Object)(object)sharedMesh) ? sharedMesh.colors.Length : 0, Object.op_Implicit((Object)(object)sharedMesh) ? sharedMesh.tangents.Length : 0, Object.op_Implicit((Object)(object)sharedMesh) ? sharedMesh.vertexCount : 0, Object.op_Implicit((Object)(object)BerzModel.Albedo) ? ((Texture)BerzModel.Albedo).mipmapCount : 0, Object.op_Implicit((Object)(object)BerzModel.Albedo) ? ((object)BerzModel.Albedo.format/*cast due to .constrained prefix*/).ToString() : "-"));
			((ConCommandArgs)(ref args)).Log((object)$"material mode {valueOrDefault} applied (details in the log)");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCBonePos(ConCommandArgs args)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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)
			//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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = BodyCatalog.FindBodyPrefab("BerzBody");
			ModelLocator val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ModelLocator>() : null);
			if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.modelTransform))
			{
				((ConCommandArgs)(ref args)).Log((object)"no body prefab/model");
				return;
			}
			Transform modelTransform = val2.modelTransform;
			StringBuilder stringBuilder = new StringBuilder($"BONEPOS model={((Object)modelTransform).name} scale={modelTransform.lossyScale}\n");
			Transform[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<Transform>(true);
			foreach (Transform val3 in componentsInChildren)
			{
				if (!((Object)(object)val3 == (Object)(object)modelTransform) && !Object.op_Implicit((Object)(object)((Component)val3).GetComponent<Renderer>()) && !Object.op_Implicit((Object)(object)((Component)val3).GetComponent<HurtBox>()) && !Object.op_Implicit((Object)(object)((Component)val3).GetComponent<HitBox>()))
				{
					Vector3 val4 = modelTransform.InverseTransformPoint(val3.position);
					Quaternion val5 = Quaternion.Inverse(modelTransform.rotation) * val3.rotation;
					stringBuilder.Append(string.Format("BONE {0} parent={1} pos=({2:0.0000},{3:0.0000},{4:0.0000}) rot=({5:0.0000},{6:0.0000},{7:0.0000},{8:0.0000}) scale=({9:0.000},{10:0.000},{11:0.000})\n", ((Object)val3).name, Object.op_Implicit((Object)(object)val3.parent) ? ((Object)val3.parent).name : "-", val4.x, val4.y, val4.z, val5.x, val5.y, val5.z, val5.w, val3.lossyScale.x, val3.lossyScale.y, val3.lossyScale.z));
				}
			}
			PajamalandPlugin.Log.LogDebug((object)stringBuilder.ToString());
			((ConCommandArgs)(ref args)).Log((object)"bone positions dumped to the log");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCDump(ConCommandArgs args)
		{
			string text = ((ConCommandArgs)(ref args)).TryGetArgString(0);
			GameObject val = (string.IsNullOrEmpty(text) ? null : LegacyResourcesAPI.Load<GameObject>(text));
			if (!Object.op_Implicit((Object)(object)val))
			{
				((ConCommandArgs)(ref args)).Log((object)("not found: " + text));
				return;
			}
			StringBuilder stringBuilder = new StringBuilder("Prefab " + text + ":\n");
			DumpTransform(val.transform, 0, 6, stringBuilder);
			PajamalandPlugin.Log.LogDebug((object)stringBuilder.ToString());
			((ConCommandArgs)(ref args)).Log((object)"dumped to the log");
		}

		private static void DumpTransform(Transform t, int depth, int maxDepth, StringBuilder sb)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (depth > maxDepth)
			{
				return;
			}
			sb.Append(new string(' ', depth * 2)).Append(((Object)t).name).Append(" scale=")
				.Append(t.localScale);
			Component[] components = ((Component)t).GetComponents<Component>();
			foreach (Component val in components)
			{
				if (Object.op_Implicit((Object)(object)val) && !(val is Transform))
				{
					sb.Append(' ').Append(((object)val).GetType().Name);
					LineRenderer val2 = (LineRenderer)(object)((val is LineRenderer) ? val : null);
					if (val2 != null)
					{
						sb.Append(string.Format("(mat={0} w={1}-{2} n={3})", Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial) ? ((Object)((Renderer)val2).sharedMaterial).name : "null", val2.startWidth, val2.endWidth, val2.positionCount));
					}
					Renderer val3 = (Renderer)(object)((val is Renderer) ? val : null);
					if (val3 != null && !(val is LineRenderer))
					{
						sb.Append("(mat=" + (Object.op_Implicit((Object)(object)val3.sharedMaterial) ? ((Object)val3.sharedMaterial).name : "null") + ")");
					}
				}
			}
			sb.Append('\n');
			for (int j = 0; j < t.childCount; j++)
			{
				DumpTransform(t.GetChild(j), depth + 1, maxDepth, sb);
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCPrimary(ConCommandArgs args)
		{
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody) || !Object.op_Implicit((Object)(object)senderBody.skillLocator) || !Object.op_Implicit((Object)(object)senderBody.skillLocator.primary))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			SkillFamily skillFamily = senderBody.skillLocator.primary.skillFamily;
			int valueOrDefault = ((ConCommandArgs)(ref args)).TryGetArgInt(0).GetValueOrDefault();
			if ((Object)(object)skillFamily == (Object)null || valueOrDefault < 0 || valueOrDefault >= skillFamily.variants.Length)
			{
				((ConCommandArgs)(ref args)).Log((object)"variant index out of range");
				return;
			}
			senderBody.skillLocator.primary.SetBaseSkill(skillFamily.variants[valueOrDefault].skillDef);
			((ConCommandArgs)(ref args)).Log((object)("primary = " + skillFamily.variants[valueOrDefault].skillDef.skillName));
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCSkill(ConCommandArgs args)
		{
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody) || !Object.op_Implicit((Object)(object)senderBody.skillLocator))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			int valueOrDefault = ((ConCommandArgs)(ref args)).TryGetArgInt(0).GetValueOrDefault();
			int valueOrDefault2 = ((ConCommandArgs)(ref args)).TryGetArgInt(1).GetValueOrDefault();
			GenericSkill skill = senderBody.skillLocator.GetSkill((SkillSlot)(sbyte)valueOrDefault);
			SkillFamily val = (Object.op_Implicit((Object)(object)skill) ? skill.skillFamily : null);
			if ((Object)(object)val == (Object)null || valueOrDefault2 < 0 || valueOrDefault2 >= val.variants.Length)
			{
				((ConCommandArgs)(ref args)).Log((object)"slot or variant index out of range");
				return;
			}
			skill.SetBaseSkill(val.variants[valueOrDefault2].skillDef);
			((ConCommandArgs)(ref args)).Log((object)$"slot {valueOrDefault} = {val.variants[valueOrDefault2].skillDef.skillName}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCReload(ConCommandArgs args)
		{
			((BaseUnityPlugin)PajamalandPlugin.Instance).Config.Reload();
			((ConCommandArgs)(ref args)).Log((object)$"config reloaded: ShortCircuit Damage={BerzTuning.ScDamage.Value} Duration={BerzTuning.ScDuration.Value} VoltagePerArc={BerzTuning.ScVoltagePerArc.Value} CadenceWindow={BerzTuning.ScCadenceWindow.Value}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCInfo(ConCommandArgs args)
		{
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected I4, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody senderBody = ((ConCommandArgs)(ref args)).senderBody;
			if (!Object.op_Implicit((Object)(object)senderBody))
			{
				((ConCommandArgs)(ref args)).Log((object)"no sender body");
				return;
			}
			VoltageController component = ((Component)senderBody).GetComponent<VoltageController>();
			PowerGridController component2 = ((Component)senderBody).GetComponent<PowerGridController>();
			((ConCommandArgs)(ref args)).Log((object)$"body={((Object)senderBody).name} voltage={(Object.op_Implicit((Object)(object)component) ? component.Voltage : (-1f)):0} fuse={Object.op_Implicit((Object)(object)component) && component.FuseRunning} grid={Object.op_Implicit((Object)(object)component2) && component2.Active} rods={GroundingRodController.Live.Count} barrier={senderBody.healthComponent.barrier:0}/{senderBody.maxBarrier:0}");
			Dictionary<short, NetworkMessageDelegate> server = NetworkServer.handlers;
			Dictionary<short, NetworkMessageDelegate> client = ((NetworkClient.allClients.Count > 0) ? NetworkClient.allClients[0].handlers : null);
			((ConCommandArgs)(ref args)).Log((object)("net handlers: hit=" + S(2801) + " arcs=" + S(2802) + " cable=" + S(2803) + " relay=" + C(2804) + " livewire=" + S(2805) + " | cue effect=" + (Object.op_Implicit((Object)(object)BerzContent.CueEffect) ? ((object)EffectCatalog.FindEffectIndexFromPrefab(BerzContent.CueEffect)/*cast due to .constrained prefix*/).ToString() : "null") + " " + string.Format("| net sound {0}={1} | gridbuff={2}", "Play_loader_R_variant_slam", (int)BerzContent.NetSoundIndex("Play_loader_R_variant_slam"), (!Object.op_Implicit((Object)(object)BerzContent.GridBuff)) ? (-1) : ((int)BerzContent.GridBuff.buffIndex))));
			string C(short id)
			{
				if (client == null || !client.ContainsKey(id))
				{
					return "-";
				}
				return "c";
			}
			string S(short id)
			{
				if (server == null || !server.ContainsKey(id))
				{
					return "-";
				}
				return "s";
			}
		}
	}
	internal static class BerzFeedback
	{
		public const string SndSwing = "Play_loader_m1_swing";

		public const string SndCableLaunch = "Play_loader_m2_launch";

		public const string SndCableAttach = "Play_loader_m2_impact";

		public const string SndCableLoop = "Play_loader_shift_charge_loop";

		public const string SndCableLoopStop = "Stop_loader_shift_charge_loop";

		public const string SndCableDry = "Play_captain_m2_tazer_bounce";

		public const string SndCableSnap = "Play_item_proc_personal_shield_end";

		public const string SndThunderfallLeap = "Play_loader_R_variant_activate";

		public const string SndSwingHit = "Play_loader_m1_impact";

		public const string SndSlamHit = "Play_loader_R_variant_slam";

		public const string SndRodThrow = "Play_loader_R_toss";

		public const string SndRodStick = "Play_loader_m2_impact";

		public const string SndWireStart = "Play_loader_shift_release";

		public const string SndWireHop = "Play_mage_m1_impact_lightning";

		public const string SndWireArrive = "Play_mage_R_lightningBlast";

		public const string SndShieldGain = "Play_loader_m1_shield";

		public const string SndShieldZap = "Play_captain_drone_zap";

		public const string SndGridStart = "Play_loader_R_activate";

		public const string SndGridLoop = "Play_loader_R_active_loop";

		public const string SndGridLoopStop = "Stop_loader_R_active_loop";

		public const string SndGridEnd = "Play_loader_R_expire";

		public const string SndFuseStart = "Play_item_proc_stickyBomb_countdown";

		public const string SndFuseTrip = "Play_captain_m2_tazer_impact";

		public const float SwingHitStop = 0.06f;

		public const float SlamHitStop = 0.12f;

		private static ConfigEntry<float> shakeScale;

		private static ConfigEntry<bool> hitStop;

		private static ConfigEntry<bool> voltageBar;

		private static ConfigEntry<bool> logSounds;

		private static Material wireMaterial;

		public static float ShakeScale
		{
			get
			{
				if (shakeScale == null)
				{
					return 1f;
				}
				return Mathf.Clamp01(shakeScale.Value);
			}
		}

		public static bool HitStopEnabled
		{
			get
			{
				if (hitStop != null)
				{
					return hitStop.Value;
				}
				return true;
			}
		}

		public static bool VoltageBarEnabled
		{
			get
			{
				if (voltageBar != null)
				{
					return voltageBar.Value;
				}
				return true;
			}
		}

		public static bool LogSoundsEnabled
		{
			get
			{
				if (logSounds != null)
				{
					return logSounds.Value;
				}
				return false;
			}
		}

		public static Material WireMaterial
		{
			get
			{
				//IL_0108: 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_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Expected O, but got Unknown
				if (Object.op_Implicit((Object)(object)wireMaterial))
				{
					return wireMaterial;
				}
				string[] array = new string[3] { "Prefabs/Effects/OrbEffects/LoaderLightningOrbEffect", "Prefabs/Effects/Tracers/TracerSmokeLine/TracerMageLightningLaser", "Prefabs/Effects/OrbEffects/LightningOrbEffect" };
				foreach (string text in array)
				{
					GameObject val = LegacyResourcesAPI.Load<GameObject>(text);
					LineRenderer val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponentInChildren<LineRenderer>(true) : null);
					if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial))
					{
						wireMaterial = ((Renderer)val2).sharedMaterial;
						PajamalandPlugin.Log.LogDebug((object)("Wire material: " + ((Object)wireMaterial).name + " (" + ((Object)wireMaterial.shader).name + ") from " + text));
						return wireMaterial;
					}
				}
				Shader val3 = Shader.Find("Sprites/Default") ?? Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Standard");
				wireMaterial = new Material(val3)
				{
					color = new Color(0.4f, 0.9f, 1f, 1f)
				};
				PajamalandPlugin.Log.LogWarning((object)("Wire material: no vanilla LineRenderer found, using " + ((Object)val3).name));
				return wireMaterial;
			}
		}

		public static void Init(ConfigFile config)
		{
			shakeScale = config.Bind<float>("Feel", "ScreenShake", 1f, "Camera shake strength for Berz's hits and bursts (0 = off, 1 = full).");
			hitStop = config.Bind<bool>("Feel", "HitStop", true, "Freeze Berz for a few frames when a Breaker Swing connects.");
			voltageBar = config.Bind<bool>("Feel", "VoltageBar", true, "Show a Voltage bar under the health bar when playing Berz.");
			logSounds = config.Bind<bool>("Feel", "LogSounds", false, "Log every Berz sound event and whether Wwise accepted it (development).");
		}

		public static uint Sound(string eventName, GameObject on)
		{
			if (string.IsNullOrEmpty(eventName) || !Object.op_Implicit((Object)(object)on))
			{
				return 0u;
			}
			uint num = Util.PlaySound(eventName, on);
			if (logSounds != null && logSounds.Value)
			{
				PajamalandPlugin.Log.LogDebug((object)("Sound " + eventName + " -> " + ((num == 0) ? "UNKNOWN EVENT" : num.ToString())));
			}
			return num;
		}

		public static void SoundServer(string eventName, GameObject on)
		{
			//IL_0012: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(eventName) || !Object.op_Implicit((Object)(object)on))
			{
				return;
			}
			NetworkSoundEventIndex val = BerzContent.NetSoundIndex(eventName);
			if (!NetworkServer.active || (int)val == -1 || !Object.op_Implicit((Object)(object)on.GetComponent<NetworkIdentity>()))
			{
				Sound(eventName, on);
				return;
			}
			EntitySoundManager.EmitSoundServer(val, on);
			if (logSounds != null && logSounds.Value)
			{
				PajamalandPlugin.Log.LogDebug((object)("Sound " + eventName + " -> server broadcast on " + ((Object)on).name));
			}
		}

		public static void Cue(Vector3 position, string sound, float shakeAmplitude = 0f, float shakeDuration = 0f, float shakeRadius = 30f)
		{
			//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_0025: 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_0035: 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_003d: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected I4, but got Unknown
			if (!Object.op_Implicit((Object)(object)BerzContent.CueEffect))
			{
				if (shakeAmplitude > 0f)
				{
					Shake(position, shakeAmplitude, shakeDuration, shakeRadius);
				}
				return;
			}
			EffectData val = new EffectData
			{
				origin = position,
				networkSoundEventIndex = (NetworkSoundEventIndex)(string.IsNullOrEmpty(sound) ? (-1) : ((int)BerzContent.NetSoundIndex(sound))),
				genericFloat = shakeAmplitude,
				genericUInt = PackShake(shakeDuration, shakeRadius)
			};
			EffectManager.SpawnEffect(BerzContent.CueEffect, val, true);
			if (logSounds != null && logSounds.Value && !string.IsNullOrEmpty(sound))
			{
				PajamalandPlugin.Log.LogDebug((object)string.Format("Cue {0} -> {1} shake {2:0.00}", sound, ((int)val.networkSoundEventIndex == -1) ? "NOT REGISTERED" : ("net index " + (int)val.networkSoundEventIndex), shakeAmplitude));
			}
		}

		public static uint PackShake(float duration, float radius)
		{
			return (uint)((Mathf.Clamp(Mathf.RoundToInt(radius), 0, 65535) << 16) | Mathf.Clamp(Mathf.RoundToInt(duration * 1000f), 0, 65535));
		}

		public static void UnpackShake(uint packed, out float duration, out float radius)
		{
			duration = (float)(packed & 0xFFFF) / 1000f;
			radius = packed >> 16;
		}

		public static void Shake(Vector3 position, float amplitude, float duration, float radius = 30f)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			float num = ShakeScale;
			if (!(num <= 0f) && !(amplitude <= 0f))
			{
				ShakeEmitter.CreateSimpleShakeEmitter(position, new Wave
				{
					amplitude = amplitude * num,
					frequency = 20f,
					cycleOffset = 0f
				}, duration, radius, true);
			}
		}

		public static void Bolt(Vector3 from, Vector3 to)
		{
			//IL_0012: 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_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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)BerzContent.BoltTracerEffect))
			{
				EffectManager.SpawnEffect(BerzContent.BoltTracerEffect, new EffectData
				{
					origin = to,
					start = from
				}, true);
			}
		}
	}
	internal static class BerzHooks
	{
		private static bool installed;

		public static void Install()
		{
			if (!installed)
			{
				installed = true;
				GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
			}
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			//IL_011a: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			if (!NetworkServer.active || report == null)
			{
				return;
			}
			CharacterBody attackerBody = report.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody) && report.damageInfo != null && (Object)(object)report.damageInfo.inflictor == (Object)(object)((Component)attackerBody).gameObject && report.damageDealt > 0f)
			{
				VoltageController component = ((Component)attackerBody).GetComponent<VoltageController>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.AddVoltage(10f);
				}
			}
			if (report.damageInfo != null && Object.op_Implicit((Object)(object)report.damageInfo.inflictor) && Object.op_Implicit((Object)(object)report.damageInfo.inflictor.GetComponent<GroundingRodController>()))
			{
				PajamalandPlugin.Log.LogDebug((object)string.Format("Rod damage {0:0} to {1} (victim HP {2:0})", report.damageDealt, Object.op_Implicit((Object)(object)report.victimBody) ? report.victimBody.GetDisplayName() : "?", Object.op_Implicit((Object)(object)report.victim) ? report.victim.combinedHealth : 0f));
			}
			CharacterBody victimBody = report.victimBody;
			if (!Object.op_Implicit((Object)(object)victimBody) || !(report.damageDealt > 0f))
			{
				return;
			}
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(report.victimTeamIndex))
			{
				if (!Object.op_Implicit((Object)(object)teamMember) || !Object.op_Implicit((Object)(object)teamMember.body) || (Object)(object)teamMember.body == (Object)(object)victimBody)
				{
					continue;
				}
				VoltageController component2 = ((Component)teamMember.body).GetComponent<VoltageController>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Vector3 val = teamMember.body.corePosition - victimBody.corePosition;
					if (((Vector3)(ref val)).sqrMagnitude <= 1600f)
					{
						component2.AddVoltage(5f);
					}
				}
			}
			ArcShieldController component3 = ((Component)victimBody).GetComponent<ArcShieldController>();
			if (!Object.op_Implicit((Object)(object)component3) || !component3.Active || !Object.op_Implicit((Object)(object)attackerBody) || !((Object)(object)attackerBody != (Object)(object)component3.owner) || !Object.op_Implicit((Object)(object)attackerBody.healthComponent) || !attackerBody.healthComponent.alive)
			{
				return;
			}
			HurtBox mainHurtBox = attackerBody.mainHurtBox;
			if (Object.op_Implicit((Object)(object)mainHurtBox))
			{
				BerzArcs.FireOrb(component3.owner, victimBody.corePosition, mainHurtBox, component3.owner.damage * 1f, crit: false, 0.5f, DamageTypeCombo.op_Implicit((DamageType)0));
				if (Object.op_Implicit((Object)(object)BerzContent.LightningImpactEffect))
				{
					EffectManager.SpawnEffect(BerzContent.LightningImpactEffect, new EffectData
					{
						origin = victimBody.corePosition,
						scale = 1.5f
					}, true);
				}
				BerzFeedback.SoundServer("Play_captain_drone_zap", ((Component)victimBody).gameObject);
				PajamalandPlugin.Log.LogDebug((object)("Arc Shield on " + victimBody.GetDisplayName() + " zapped " + attackerBody.GetDisplayName()));
			}
		}
	}
	internal static class BerzModel
	{
		private const string RendererName = "BerzMesh";

		public static Mesh Mesh { get; private set; }

		public static Texture2D Albedo { get; private set; }

		public static string[] BoneNames { get; private set; }

		public static Material Material { get; private set; }

		public static bool Load(string modelDir)
		{
			//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_0124: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			//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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			string text = Path.Combine(modelDir, "berz.mesh.bin");
			string text2 = Path.Combine(modelDir, "texBerzAlbedo.png");
			if (!File.Exists(text))
			{
				PajamalandPlugin.Log.LogWarning((object)("BerzModel: no mesh at " + text + "; keeping Commando's model"));
				return false;
			}
			try
			{
				using (BinaryReader binaryReader = new BinaryReader(File.OpenRead(text)))
				{
					if (new string(binaryReader.ReadChars(4)) != "BRZM")
					{
						throw new IOException("bad magic");
					}
					uint num = binaryReader.ReadUInt32();
					int num2 = (int)binaryReader.ReadUInt32();
					BoneNames = new string[num2];
					for (int i = 0; i < num2; i++)
					{
						int count = binaryReader.ReadUInt16();
						BoneNames[i] = Encoding.UTF8.GetString(binaryReader.ReadBytes(count));
					}
					int num3 = (int)binary