Decompiled source of DiyEngi v1.17.0

DiyEngi.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Engi.EngiWeapon;
using ExamplePlugin.libs;
using HG;
using HarmonyLib;
using IL.EntityStates.Engi.EngiWeapon;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.Engi.EngiWeapon;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("DiyEngi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DiyEngi")]
[assembly: AssemblyTitle("DiyEngi")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 ExamplePlugin.libs
{
	public enum TurretEnum
	{
		工程师普通机枪塔_EngiTurretMaster,
		工程师移动机枪塔_EngiWalkerTurretMaster,
		工程师机枪塔2_EngiBeamTurretMaster,
		孔雀石刺塔_UrchinTurretMaster,
		克西结构体_MegaConstructMaster,
		固定克西结构体_MajorConstructMaster,
		TC280原型机_MegaDroneMaster,
		超载蠕虫_ElectricWormMaster,
		岩浆蠕虫_MagmaWormMaster,
		纽特_ShopkeeperMaster,
		盲虫_FlyingVerminMaster,
		月球喀迈拉小球_LunarExploderMaster,
		月球喀迈拉坦克_LunarGolemMaster,
		月球喀迈拉大幽魂_LunarWispMaster,
		指挥官_CommandoMonsterMaster,
		船长_CaptainMonsterMaster,
		磁轨炮手_RailgunnerMonsterMaster,
		盗贼_Bandit2MonsterMaster,
		毒狗_CrocoMonsterMaster,
		法师_MageMonsterMaster,
		工程师_EngiMonsterMaster,
		弓箭手_HuntressMonsterMaster,
		剑圣_MercMonsterMaster,
		铁拳_LoaderMonsterMaster,
		小车_ToolbotMonsterMaster,
		小花_TreebotMonsterMaster,
		虚空恶鬼_VoidSurvivorMonsterMaster,
		异教徒_HereticMonsterMaster,
		阿尔法结构体_MinorConstructAttachableMaster,
		阿尔法结构体黄金_MinorConstructOnKillMaster,
		装备无人机_EquipmentDroneMaster,
		枪手机枪塔_Turret1Master,
		枪手无人机_Drone1Master,
		导弹无人机_DroneMissileMaster,
		焚烧无人机_FlameDroneMaster,
		治疗无人机_Drone2Master,
		应急无人机_EmergencyDroneMaster,
		乌贼机枪塔_SquidTurretMaster,
		先祖孵化舱_ParentPodMaster,
		祖人_ParentMaster,
		元祖_GrandparentMaster,
		不知道_BrotherHauntMaster,
		米斯历克斯一阶段_BrotherMaster,
		米斯历克斯复制体_BrotherGlassMaster,
		米斯历克斯三阶段_BrotherHurtMaster,
		刺客_Assassin2Master,
		合金崇拜单体_SuperRoboBallBossMaster,
		单独控制单元_RoboBallBossMaster,
		独一探针_RoboBallMiniMaster,
		安静的探测器_RoboBallRedBuddyMaster,
		兴奋的探测器_RoboBallGreenBuddyMaster,
		德鲁曼上校_DroneCommanderMaster,
		合金秃鹫_VultureMaster,
		黄铜装置_BellMaster,
		加普_GupMaster,
		基普_GeepMaster,
		格普_GipMaster,
		寄居蟹_HermitCrabMaster,
		甲壳虫_BeetleMaster,
		甲壳虫守卫_BeetleGuardAllyMaster,
		甲壳虫守卫_BeetleGuardMaster,
		甲壳虫守卫_BeetleGuardMasterCrystal,
		巨角野牛_BisonMaster,
		巨型幽魂_GreaterWispMaster,
		利莫里亚_LemurianMaster,
		利莫里亚长者_LemurianBruiserMaster,
		灵魂小型幽魂_WispSoulMaster,
		漫游者_VagrantMaster,
		盲眼害虫_VerminMaster,
		迷你菇_MiniMushroomMaster,
		黏土沙丘行者_ClayBossMaster,
		黏土圣堂武士_ClayBruiserMaster,
		黏土药剂师_ClayGrenadierMaster,
		森林守护者_GravekeeperMaster,
		奥利雷奥尼特_TitanGoldAllyMaster,
		奥利雷奥尼特_TitanGoldMaster,
		石巨人_TitanMaster,
		石傀儡_GolemMaster,
		水母_JellyfishMaster,
		小恶魔_ImpMaster,
		小恶魔霸主_ImpBossMaster,
		小型幽魂_WispMaster,
		清道夫_ScavMaster,
		温柔的基基普_ScavLunar1Master,
		狂野的威威普_ScavLunar2Master,
		信徒推推普_ScavLunar3Master,
		幸运儿摇摇晃_ScavLunar4Master,
		虚空感染者_VoidInfestorMaster,
		虚空毁灭者_VoidMegaCrabMaster,
		虚空掠夺者_NullifierAllyMaster,
		虚空掠夺者_NullifierMaster,
		虚空藤壶_VoidBarnacleMaster,
		虚空藤壶_VoidBarnacleNoCastMaster,
		虚空狱卒_VoidJailerAllyMaster,
		虚空狱卒_VoidJailerMaster,
		幼体_AcidLarvaMaster,
		治疗核心_AffixEarthHealerMaster,
		神器圣匣_ArtifactShellMaster,
		AncientWispMaster_AncientWispMaster,
		ArchWispMaster_ArchWispMaster,
		BeetleCrystalMaster_BeetleCrystalMaster
	}
}
namespace DiyEngi
{
	public enum AutoFirEngiMissileTypeEnum
	{
		single_单发,
		all_并发
	}
	[BepInPlugin("top.sshh.DiyEngi", "DiyEngi", "1.0.0")]
	public class DiyEngi : BaseUnityPlugin
	{
		public static Stopwatch stopwatch = Stopwatch.StartNew();

		public static long time = stopwatch.ElapsedMilliseconds;

		public ConfigEntry<TurretEnum> turretConfig;

		public ConfigEntry<TurretEnum> engiTurretConfig;

		public ConfigEntry<bool> autoFireEngiMissileConfig;

		public ConfigEntry<bool> autoFireEngiMinesConfig;

		public ConfigEntry<bool> fireOnMasterConfig;

		public ConfigEntry<AutoFirEngiMissileTypeEnum> autoFirEngiMissileTypeConfig;

		public StepSliderOption primarySkillSetting;

		public StepSliderOption secondarySkillSetting;

		public StepSliderOption utilitySkillSetting;

		public StepSliderOption specialSkillSetting;

		public ConfigEntry<SkillOverridePriority> skillOverridePrioritySetting;

		public StepSliderOption skill2;

		public StepSliderOption skill3;

		public StepSliderOption skill4;

		public StepSliderOption skill5;

		public StepSliderOption skill6;

		public StepSliderOption skill7;

		public StepSliderOption turretPositionFix;

		public SkillOverridePriority skillOverridePriority;

		public int[] lastSkillIndex = new int[4] { -1, -1, -1, -1 };

		public static string[] skillTextList;

		private GameObject engiBody = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiBody.prefab").WaitForCompletion();

		public static ConfigFile RoRConfig { get; set; }

		public static GameObject currentTurret { get; set; }

		public static DiyEngi Instance { get; set; }

		internal static ManualLogSource Logger { get; set; }

		public void Awake()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0110: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_0175: 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_0185: 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_01a0: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: 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_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Expected O, but got Unknown
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected O, but got Unknown
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Expected O, but got Unknown
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Expected O, but got Unknown
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Expected O, but got Unknown
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Expected O, but got Unknown
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Expected O, but got Unknown
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Expected O, but got Unknown
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Expected O, but got Unknown
			RoRConfig = ((BaseUnityPlugin)this).Config;
			Logger = ((BaseUnityPlugin)this).Logger;
			time = stopwatch.ElapsedMilliseconds;
			turretConfig = RoRConfig.Bind<TurretEnum>("setting", "TurretType", TurretEnum.工程师普通机枪塔_EngiTurretMaster, "怪物名称");
			engiTurretConfig = RoRConfig.Bind<TurretEnum>("setting", "AllyTurretType", TurretEnum.工程师普通机枪塔_EngiTurretMaster, "友军工程师炮塔");
			autoFireEngiMissileConfig = RoRConfig.Bind<bool>("setting", "MissileSkillAutoUse", true, "是否自动使用导弹");
			autoFireEngiMinesConfig = RoRConfig.Bind<bool>("setting", "MinesAutoUse", true, "是否自动使用地雷");
			fireOnMasterConfig = RoRConfig.Bind<bool>("setting", "FireOnMonsterPosition", true, "地雷和鱼叉是否生成在怪物身上");
			turretPositionFix = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("setting", "TurretPositionFix", 0f, "炮塔摆放位置视线方向前后调整距离,-20,20"), new StepSliderConfig
			{
				min = -20f,
				max = 20f,
				increment = 1f
			});
			autoFireEngiMissileConfig = RoRConfig.Bind<bool>("setting", "MissileSkillAutoUse", true, "是否自动使用导弹");
			autoFirEngiMissileTypeConfig = RoRConfig.Bind<AutoFirEngiMissileTypeEnum>("setting", "MissileSkillUseType", AutoFirEngiMissileTypeEnum.single_单发, "自动使用导弹发射类型");
			skill2 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "PressureMines_压力地雷", 8f, "PressureMinesCooldown_压力地雷基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			skill3 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "SpiderMines_蜘蛛地雷", 8f, "SpiderMinesCooldown_蜘蛛地雷基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			skill4 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "BubbleShield_泡泡护盾", 25f, "BubbleShieldCooldown_泡泡护盾基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			skill5 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "ThermalHarpoons_热力鱼叉", 2.5f, "ThermalHarpoonsCooldown_热力鱼叉基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			skill6 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "TR12GaussAutoTurret_TR12高斯自动炮塔", 30f, "TR12GaussAutoTurretCooldown_TR12高斯自动炮塔基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			skill7 = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("skillRechargeInterval", "TR58CarbonizerTurret_TR58碳化器炮塔", 30f, "TR58CarbonizerTurretCooldown_TR58碳化器炮塔基础冷却时间_needRestartGame需要重启游戏"), new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 0.1f
			});
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)turretConfig));
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)engiTurretConfig));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(autoFireEngiMissileConfig));
			ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)autoFirEngiMissileTypeConfig));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(autoFireEngiMinesConfig));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(fireOnMasterConfig));
			ModSettingsManager.AddOption((BaseOption)(object)turretPositionFix);
			ModSettingsManager.AddOption((BaseOption)(object)skill2);
			ModSettingsManager.AddOption((BaseOption)(object)skill3);
			ModSettingsManager.AddOption((BaseOption)(object)skill4);
			ModSettingsManager.AddOption((BaseOption)(object)skill5);
			ModSettingsManager.AddOption((BaseOption)(object)skill6);
			ModSettingsManager.AddOption((BaseOption)(object)skill7);
			engiBody.GetComponent<SkillLocator>().secondary.skillFamily.variants[0].skillDef.baseRechargeInterval = skill2.Value;
			engiBody.GetComponent<SkillLocator>().secondary.skillFamily.variants[1].skillDef.baseRechargeInterval = skill3.Value;
			engiBody.GetComponent<SkillLocator>().utility.skillFamily.variants[0].skillDef.baseRechargeInterval = skill4.Value;
			engiBody.GetComponent<SkillLocator>().utility.skillFamily.variants[1].skillDef.baseRechargeInterval = skill5.Value;
			engiBody.GetComponent<SkillLocator>().special.skillFamily.variants[0].skillDef.baseRechargeInterval = skill6.Value;
			engiBody.GetComponent<SkillLocator>().special.skillFamily.variants[1].skillDef.baseRechargeInterval = skill7.Value;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				//IL_050a: Unknown result type (might be due to invalid IL or missing references)
				//IL_050f: Unknown result type (might be due to invalid IL or missing references)
				//IL_051a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0528: Unknown result type (might be due to invalid IL or missing references)
				//IL_0538: Expected O, but got Unknown
				//IL_0533: Unknown result type (might be due to invalid IL or missing references)
				//IL_053d: Expected O, but got Unknown
				//IL_0559: Unknown result type (might be due to invalid IL or missing references)
				//IL_055e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0569: Unknown result type (might be due to invalid IL or missing references)
				//IL_0577: Unknown result type (might be due to invalid IL or missing references)
				//IL_0587: Expected O, but got Unknown
				//IL_0582: Unknown result type (might be due to invalid IL or missing references)
				//IL_058c: Expected O, but got Unknown
				//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d6: Expected O, but got Unknown
				//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05db: Expected O, but got Unknown
				//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0607: Unknown result type (might be due to invalid IL or missing references)
				//IL_0615: Unknown result type (might be due to invalid IL or missing references)
				//IL_0625: Expected O, but got Unknown
				//IL_0620: Unknown result type (might be due to invalid IL or missing references)
				//IL_062a: Expected O, but got Unknown
				//IL_0650: Unknown result type (might be due to invalid IL or missing references)
				//IL_065a: Expected O, but got Unknown
				skillTextList = new string[SkillCatalog._allSkillDefs.Length];
				foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs)
				{
					SkillLocator component = allBodyPrefab.GetComponent<SkillLocator>();
					CharacterBody component2 = allBodyPrefab.GetComponent<CharacterBody>();
					if (!((Object)(object)component == (Object)null) && !((Object)(object)component2 == (Object)null))
					{
						if ((Object)(object)component.primary != (Object)null && (Object)(object)component.primary.skillFamily != (Object)null)
						{
							Variant[] variants = component.primary.skillFamily.variants;
							if (variants != null)
							{
								for (int i = 0; i < variants.Length; i++)
								{
									SkillDef skillDef = variants[i].skillDef;
									if ((Object)(object)skillDef != (Object)null && skillTextList[skillDef.skillIndex] == null)
									{
										skillTextList[skillDef.skillIndex] = skillDef.skillIndex + "_" + component2.GetDisplayName() + "_primary_" + skillDef.skillName + "_" + Language.GetString(skillDef.skillNameToken) + "\n";
									}
								}
							}
						}
						if ((Object)(object)component.secondary != (Object)null && (Object)(object)component.secondary.skillFamily != (Object)null)
						{
							Variant[] variants2 = component.secondary.skillFamily.variants;
							if (variants2 != null)
							{
								for (int j = 0; j < variants2.Length; j++)
								{
									SkillDef skillDef2 = variants2[j].skillDef;
									if ((Object)(object)skillDef2 != (Object)null && skillTextList[skillDef2.skillIndex] == null)
									{
										skillTextList[skillDef2.skillIndex] = skillDef2.skillIndex + "_" + component2.GetDisplayName() + "_secondary_" + skillDef2.skillName + "_" + Language.GetString(skillDef2.skillNameToken) + "\n";
									}
								}
							}
						}
						if ((Object)(object)component.utility != (Object)null && (Object)(object)component.utility.skillFamily != (Object)null)
						{
							Variant[] variants3 = component.utility.skillFamily.variants;
							if (variants3 != null)
							{
								for (int k = 0; k < variants3.Length; k++)
								{
									SkillDef skillDef3 = variants3[k].skillDef;
									if ((Object)(object)skillDef3 != (Object)null && skillTextList[skillDef3.skillIndex] == null)
									{
										skillTextList[skillDef3.skillIndex] = skillDef3.skillIndex + "_" + component2.GetDisplayName() + "_utility_" + skillDef3.skillName + "_" + Language.GetString(skillDef3.skillNameToken) + "\n";
									}
								}
							}
						}
						if ((Object)(object)component.special != (Object)null && (Object)(object)component.special.skillFamily != (Object)null)
						{
							Variant[] variants4 = component.special.skillFamily.variants;
							if (variants4 != null)
							{
								for (int l = 0; l < variants4.Length; l++)
								{
									SkillDef skillDef4 = variants4[l].skillDef;
									if ((Object)(object)skillDef4 != (Object)null && skillTextList[skillDef4.skillIndex] == null)
									{
										skillTextList[skillDef4.skillIndex] = skillDef4.skillIndex + "_" + component2.GetDisplayName() + "_special_" + skillDef4.skillName + "_" + Language.GetString(skillDef4.skillNameToken) + "\n";
									}
								}
							}
						}
					}
				}
				foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs)
				{
					if (skillTextList[allSkillDef.skillIndex] == null)
					{
						skillTextList[allSkillDef.skillIndex] = allSkillDef.skillIndex + "_" + allSkillDef.skillName + "_" + Language.GetString(allSkillDef.skillNameToken) + "\n";
					}
				}
				string text = "-1_defaultSkill_角色默认技能\n";
				for (int m = 0; m < skillTextList.Length; m++)
				{
					text += skillTextList[m];
				}
				Logger.LogDebug((object)text);
				primarySkillSetting = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("setting", "primary", -1f, text), new StepSliderConfig
				{
					min = -1f,
					max = SkillCatalog._allSkillDefs.Length,
					increment = 1f
				});
				secondarySkillSetting = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("setting", "secondary", -1f, text), new StepSliderConfig
				{
					min = -1f,
					max = SkillCatalog._allSkillDefs.Length,
					increment = 1f
				});
				utilitySkillSetting = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("setting", "utility", -1f, text), new StepSliderConfig
				{
					min = -1f,
					max = SkillCatalog._allSkillDefs.Length,
					increment = 1f
				});
				specialSkillSetting = new StepSliderOption(((BaseUnityPlugin)this).Config.Bind<float>("setting", "special", -1f, text), new StepSliderConfig
				{
					min = -1f,
					max = SkillCatalog._allSkillDefs.Length,
					increment = 1f
				});
				skillOverridePrioritySetting = RoRConfig.Bind<SkillOverridePriority>("setting", "skillOverridePriority", (SkillOverridePriority)0, "技能覆盖优先级");
				ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)skillOverridePrioritySetting));
				ModSettingsManager.AddOption((BaseOption)(object)primarySkillSetting);
				ModSettingsManager.AddOption((BaseOption)(object)secondarySkillSetting);
				ModSettingsManager.AddOption((BaseOption)(object)utilitySkillSetting);
				ModSettingsManager.AddOption((BaseOption)(object)specialSkillSetting);
				lastSkillIndex[0] = Convert.ToInt32(primarySkillSetting.Value);
				lastSkillIndex[1] = Convert.ToInt32(secondarySkillSetting.Value);
				lastSkillIndex[2] = Convert.ToInt32(utilitySkillSetting.Value);
				lastSkillIndex[3] = Convert.ToInt32(specialSkillSetting.Value);
			});
			PlaceTurret.OnEnter += new hook_OnEnter(HookPlaceTurret);
			FireMines.OnEnter += new Manipulator(HookMinePosition);
			EntityState.FixedUpdate += new hook_FixedUpdate(AutoFireEngiMissile);
			PlaceTurret.GetPlacementInfo += new Manipulator(DiyPlacementInfo);
			Paint.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, Paint self)
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//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_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_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_01de: Unknown result type (might be due to invalid IL or missing references)
				if (((EntityState)self).isAuthority)
				{
					if (!((EntityState)self).characterBody.isPlayerControlled)
					{
						orig.Invoke(self);
					}
					self.targetsList = new List<HurtBox>();
					self.targetIndicators = new Dictionary<HurtBox, IndicatorInfo>();
					self.stickyTargetIndicator = new Indicator(((Component)this).gameObject, Paint.stickyTargetIndicatorPrefab);
					self.search = new BullseyeSearch();
					int stock = ((BaseSkillState)self).activatorSkillSlot.stock;
					((BaseSkillState)self).activatorSkillSlot.DeductStock(stock);
					HurtBox val = null;
					if (fireOnMasterConfig.Value)
					{
						Ray aimRay = ((BaseState)self).GetAimRay();
						self.search.teamMaskFilter = TeamMask.GetUnprotectedTeams(((EntityState)self).teamComponent.teamIndex);
						self.search.filterByLoS = false;
						self.search.viewer = null;
						self.search.searchOrigin = ((Ray)(ref aimRay)).origin;
						self.search.searchDirection = ((Ray)(ref aimRay)).direction;
						self.search.searchDirection = ((Ray)(ref aimRay)).direction;
						self.search.minDistanceFilter = 0f;
						self.search.maxDistanceFilter = 2000f;
						self.search.sortMode = (SortMode)1;
						self.search.minAngleFilter = 0f;
						self.search.maxAngleFilter = 180f;
						self.search.RefreshCandidates();
						self.search.FilterOutGameObject(((Component)this).gameObject);
						val = self.search.GetResults().FirstOrDefault();
					}
					while (stock-- > 0)
					{
						Vector3 aimOrigin = ((EntityState)self).inputBank.aimOrigin;
						if ((Object)(object)val != (Object)null)
						{
							aimOrigin = val.healthComponent.body.inputBank.aimOrigin;
						}
						MissileUtils.FireMissile(aimOrigin, ((EntityState)self).characterBody, default(ProcChainMask), ((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null, ((EntityState)self).characterBody.damage * Fire.damageCoefficient, ((EntityState)self).characterBody.RollCrit(), Fire.projectilePrefab, (DamageColorIndex)0, Vector3.up, 0f, false);
					}
					((EntityState)self).outer.SetNextStateToMain();
				}
			};
		}

		private void AutoFireEngiMissile(orig_FixedUpdate orig, EntityState self)
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0545: 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_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			SkillLocator skillLocator = self.skillLocator;
			if ((Object)(object)skillLocator == (Object)null)
			{
				return;
			}
			GenericSkill skill = skillLocator.GetSkill((SkillSlot)0);
			GenericSkill skill2 = skillLocator.GetSkill((SkillSlot)1);
			GenericSkill skill3 = skillLocator.GetSkill((SkillSlot)2);
			GenericSkill skill4 = skillLocator.GetSkill((SkillSlot)3);
			if ((Object)(object)skill3 == (Object)null || (Object)(object)skill2 == (Object)null)
			{
				return;
			}
			SkillDef skillDef = skill3.skillDef;
			SkillDef skillDef2 = skill2.skillDef;
			if ((Object)(object)skillDef == (Object)null || (Object)(object)skillDef2 == (Object)null || (Object)(object)self.characterBody == (Object)null || !self.characterBody.isPlayerControlled || !self.isAuthority)
			{
				return;
			}
			long elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
			if (time + 100 > elapsedMilliseconds)
			{
				return;
			}
			time = elapsedMilliseconds;
			if (Convert.ToInt32(primarySkillSetting.Value) == -1 && lastSkillIndex[0] != -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.primary.skillOverrides, 0, self.skillLocator.primary.skillOverrides.Length);
				self.skillLocator.primary.PickCurrentOverride();
			}
			else if ((skillOverridePrioritySetting.Value != skillOverridePriority || skill.skillDef.skillIndex != Convert.ToInt32(primarySkillSetting.Value)) && Convert.ToInt32(primarySkillSetting.Value) > -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.primary.skillOverrides, 0, self.skillLocator.primary.skillOverrides.Length);
				self.skillLocator.primary.SetSkillOverride((object)self, SkillCatalog.GetSkillDef(Convert.ToInt32(primarySkillSetting.Value)), skillOverridePrioritySetting.Value);
			}
			if (Convert.ToInt32(secondarySkillSetting.Value) == -1 && lastSkillIndex[1] != -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.secondary.skillOverrides, 0, self.skillLocator.secondary.skillOverrides.Length);
				self.skillLocator.secondary.PickCurrentOverride();
			}
			else if ((skillOverridePrioritySetting.Value != skillOverridePriority || skill2.skillDef.skillIndex != Convert.ToInt32(secondarySkillSetting.Value)) && Convert.ToInt32(secondarySkillSetting.Value) > -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.secondary.skillOverrides, 0, self.skillLocator.secondary.skillOverrides.Length);
				self.skillLocator.secondary.SetSkillOverride((object)self, SkillCatalog.GetSkillDef(Convert.ToInt32(secondarySkillSetting.Value)), skillOverridePrioritySetting.Value);
			}
			if (Convert.ToInt32(utilitySkillSetting.Value) == -1 && lastSkillIndex[2] != -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.utility.skillOverrides, 0, self.skillLocator.utility.skillOverrides.Length);
				self.skillLocator.utility.PickCurrentOverride();
			}
			else if ((skillOverridePrioritySetting.Value != skillOverridePriority || skill3.skillDef.skillIndex != Convert.ToInt32(utilitySkillSetting.Value)) && Convert.ToInt32(utilitySkillSetting.Value) > -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.utility.skillOverrides, 0, self.skillLocator.utility.skillOverrides.Length);
				self.skillLocator.utility.SetSkillOverride((object)self, SkillCatalog.GetSkillDef(Convert.ToInt32(utilitySkillSetting.Value)), skillOverridePrioritySetting.Value);
			}
			if (Convert.ToInt32(specialSkillSetting.Value) == -1 && lastSkillIndex[3] != -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.special.skillOverrides, 0, self.skillLocator.special.skillOverrides.Length);
				self.skillLocator.special.PickCurrentOverride();
			}
			else if ((skillOverridePrioritySetting.Value != skillOverridePriority || skill4.skillDef.skillIndex != Convert.ToInt32(specialSkillSetting.Value)) && Convert.ToInt32(specialSkillSetting.Value) > -1)
			{
				ArrayUtils.ArrayRemoveAtAndResize<SkillOverride>(ref self.skillLocator.special.skillOverrides, 0, self.skillLocator.special.skillOverrides.Length);
				self.skillLocator.special.SetSkillOverride((object)self, SkillCatalog.GetSkillDef(Convert.ToInt32(specialSkillSetting.Value)), skillOverridePrioritySetting.Value);
			}
			lastSkillIndex[0] = Convert.ToInt32(primarySkillSetting.Value);
			lastSkillIndex[1] = Convert.ToInt32(secondarySkillSetting.Value);
			lastSkillIndex[2] = Convert.ToInt32(utilitySkillSetting.Value);
			lastSkillIndex[3] = Convert.ToInt32(specialSkillSetting.Value);
			skillOverridePriority = skillOverridePrioritySetting.Value;
			HurtBox val = null;
			if ((Object)(object)skillDef != (Object)null && "EngiHarpoons".Equals(skillDef.skillName))
			{
				try
				{
					if (self.isAuthority)
					{
						if (fireOnMasterConfig.Value)
						{
							BullseyeSearch val2 = new BullseyeSearch
							{
								teamMaskFilter = TeamMask.allButNeutral
							};
							((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam((TeamIndex)1);
							val2.filterByLoS = false;
							val2.viewer = null;
							val2.searchOrigin = self.inputBank.aimOrigin;
							val2.searchDirection = self.inputBank.aimDirection;
							val2.minDistanceFilter = 0f;
							val2.maxDistanceFilter = 2000f;
							val2.sortMode = (SortMode)1;
							val2.minAngleFilter = 0f;
							val2.maxAngleFilter = 180f;
							val2.RefreshCandidates();
							val2.FilterOutGameObject(((Component)this).gameObject);
							val = val2.GetResults().FirstOrDefault();
						}
						if (autoFireEngiMissileConfig.Value && (!fireOnMasterConfig.Value || ((Object)(object)val != (Object)null && val.healthComponent.alive)))
						{
							switch (autoFirEngiMissileTypeConfig.Value)
							{
							case AutoFirEngiMissileTypeEnum.single_单发:
								if (skill3.stock >= 0)
								{
									skill3.skillDef.cancelSprintingOnActivation = false;
									skill3.ExecuteIfReady();
								}
								break;
							case AutoFirEngiMissileTypeEnum.all_并发:
								if (skill3.stock >= skill3.maxStock)
								{
									skill3.skillDef.cancelSprintingOnActivation = false;
									skill3.ExecuteIfReady();
								}
								break;
							}
						}
					}
				}
				catch (Exception value)
				{
					Console.WriteLine(value);
					throw;
				}
			}
			if (!((Object)(object)skillDef2 != (Object)null) || (!"PlaceSpiderMine".Equals(skillDef2.skillName) && !"PlaceMine".Equals(skillDef2.skillName)) || !self.isAuthority || !autoFireEngiMinesConfig.Value || (fireOnMasterConfig.Value && !((Object)(object)val != (Object)null)))
			{
				return;
			}
			try
			{
				if (skill2.stock >= skill2.maxStock)
				{
					skill2.skillDef.cancelSprintingOnActivation = false;
					skill2.ExecuteIfReady();
				}
			}
			catch (Exception value2)
			{
				Console.WriteLine(value2);
				throw;
			}
		}

		private void HookMinePosition(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0038: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction c) => ILPatternMatchingExt.MatchCall<Ray>(c, "get_origin")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<FireMines, Ray, Vector3>>((Func<FireMines, Ray, Vector3>)delegate(FireMines mines, Ray aimRay)
			{
				//IL_000f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: 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_00cb: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: 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_0051: 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_0062: 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_0194: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				if (!((EntityState)mines).characterBody.isPlayerControlled)
				{
					return ((Ray)(ref aimRay)).origin;
				}
				if (mines is FireBubbleShield)
				{
					RaycastHit val2 = default(RaycastHit);
					if (Physics.Raycast(new Ray(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 2f, ((Ray)(ref aimRay)).direction), ref val2))
					{
						return ((RaycastHit)(ref val2)).point - ((Ray)(ref aimRay)).direction * 2f;
					}
					return ((Ray)(ref aimRay)).origin;
				}
				if (fireOnMasterConfig.Value)
				{
					HurtBox val3 = null;
					BullseyeSearch val4 = new BullseyeSearch
					{
						teamMaskFilter = TeamMask.allButNeutral
					};
					((TeamMask)(ref val4.teamMaskFilter)).RemoveTeam((TeamIndex)1);
					val4.filterByLoS = false;
					val4.viewer = null;
					val4.searchOrigin = ((Ray)(ref aimRay)).origin;
					val4.searchDirection = ((Ray)(ref aimRay)).direction;
					val4.minDistanceFilter = 0f;
					val4.maxDistanceFilter = 2000f;
					val4.sortMode = (SortMode)1;
					val4.minAngleFilter = 0f;
					val4.maxAngleFilter = 180f;
					val4.RefreshCandidates();
					val4.FilterOutGameObject(((Component)this).gameObject);
					val3 = val4.GetResults().FirstOrDefault();
					if ((Object)(object)val3 != (Object)null)
					{
						return val3.healthComponent.body.inputBank.aimOrigin;
					}
					return ((Ray)(ref aimRay)).origin;
				}
				RaycastHit val5 = default(RaycastHit);
				return Physics.Raycast(new Ray(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 5f, ((Ray)(ref aimRay)).direction), ref val5) ? (((RaycastHit)(ref val5)).point - ((Ray)(ref aimRay)).direction * 2f) : ((Ray)(ref aimRay)).origin;
			});
		}

		private void DiyPlacementInfo(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Ldloca_S),
				(Instruction x) => ILPatternMatchingExt.Match<float>(x, OpCodes.Ldc_R4, 0f),
				(Instruction x) => ILPatternMatchingExt.MatchStfld<Vector3>(x, "y")
			});
			val.RemoveRange(3);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[3]
			{
				(Instruction c) => ILPatternMatchingExt.Match(c, OpCodes.Ldloca_S),
				(Instruction c) => ILPatternMatchingExt.Match(c, OpCodes.Ldc_I4_0),
				(Instruction c) => ILPatternMatchingExt.MatchStfld<PlacementInfo>(c, "ok")
			});
			val.Index += 1;
			val.Remove();
			val.Emit(OpCodes.Ldc_I4_1);
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction c) => ILPatternMatchingExt.MatchStfld<PlacementInfo>(c, "position")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<Ray, Vector3>>((Func<Ray, Vector3>)delegate(Ray aimRay)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0033: 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_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)
				RaycastHit val2 = default(RaycastHit);
				Physics.Raycast(new Ray(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 5f, ((Ray)(ref aimRay)).direction), ref val2);
				return ((RaycastHit)(ref val2)).point + ((Ray)(ref aimRay)).direction * turretPositionFix.Value;
			});
			val.GotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction c) => ILPatternMatchingExt.MatchLdloc(c, 2),
				(Instruction c) => ILPatternMatchingExt.MatchLdfld<PlacementInfo>(c, "ok"),
				(Instruction c) => ILPatternMatchingExt.Match(c, OpCodes.Brfalse)
			});
			val.Index += 2;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}

		private void HookPlaceTurret(orig_OnEnter orig, PlaceTurret self)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			try
			{
				string[] array = turretConfig.Value.ToString().Split(new char[1] { '_' });
				_ = array[0];
				string text = array[1];
				currentTurret = MasterCatalog.FindMasterPrefab(text);
				if ((int)((EntityState)self).characterBody.teamComponent._teamIndex == 1)
				{
					if (((EntityState)self).characterBody.isPlayerControlled)
					{
						self.turretMasterPrefab = currentTurret;
					}
					else
					{
						string[] array2 = engiTurretConfig.Value.ToString().Split(new char[1] { '_' });
						_ = array2[0];
						text = array2[1];
						if (!text.Equals("EngiMonsterMaster"))
						{
							currentTurret = MasterCatalog.FindMasterPrefab(text);
							self.turretMasterPrefab = currentTurret;
						}
					}
				}
				orig.Invoke(self);
			}
			catch (Exception value)
			{
				Console.WriteLine(value);
			}
		}
	}
}