Decompiled source of DiyEngi v2.1.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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DiyEngi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+68e75d5f2ce9e98f2e793012ecfd8a8a5b1d9f2d")]
[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,
		代号280原型机_MegaDroneMaster,
		超载蠕虫_ElectricWormMaster,
		岩浆蠕虫_MagmaWormMaster,
		纽特_ShopkeeperMaster,
		盲虫_FlyingVerminMaster,
		月球喀迈拉小球_LunarExploderMaster,
		月球喀迈拉坦克_LunarGolemMaster,
		月球喀迈拉大幽魂_LunarWispMaster,
		指挥官_CommandoMonsterMaster,
		船长_CaptainMonsterMaster,
		大厨_ChefMonsterMaster,
		磁轨炮手_RailgunnerMonsterMaster,
		盗贼_Bandit2MonsterMaster,
		呛鼻毒师_CrocoMonsterMaster,
		工匠_MageMonsterMaster,
		工程师_EngiMonsterMaster,
		女猎人_HuntressMonsterMaster,
		雇佣兵_MercMonsterMaster,
		装卸工_LoaderMonsterMaster,
		多功能枪兵_ToolbotMonsterMaster,
		雷克斯_TreebotMonsterMaster,
		探寻者_SeekerMonsterMaster,
		虚空恶鬼_VoidSurvivorMonsterMaster,
		异教徒_HereticMonsterMaster,
		虚假子嗣_FalseSonMonsterMaster,
		阿尔法结构体_MinorConstructAttachableMaster,
		阿尔法结构体黄金_MinorConstructOnKillMaster,
		装备无人机_EquipmentDroneMaster,
		枪手机枪塔_Turret1Master,
		枪手无人机_Drone1Master,
		导弹无人机_DroneMissileMaster,
		焚烧无人机_FlameDroneMaster,
		治疗无人机_Drone2Master,
		应急无人机_EmergencyDroneMaster,
		攻击无人机_DroneBackupMaster,
		乌贼机枪塔_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,
		甲壳虫女王_BeetleQueenMaster,
		魔童_ChildMaster,
		黏土人_ClaymanMaster,
		月霖_CorruptionSpikeMaster,
		利莫里亚_DevotedLemurianMaster,
		虚假子嗣_FalseSonBossLunarShardBrokenMaster,
		虚假子嗣_FalseSonBossLunarShardMaster,
		虚假子嗣_FalseSonBossMaster,
		哈雷肯尼特_HalcyoniteMaster,
		利莫里亚长者_LemurianBruiserMasterFire,
		利莫里亚长者_LemurianBruiserMasterHaunted,
		利莫里亚长者_LemurianBruiserMasterIce,
		利莫里亚长者_LemurianBruiserMasterPoison,
		虚灵_MiniVoidRaidCrabMasterBase,
		虚灵_MiniVoidRaidCrabMasterPhase1,
		虚灵_MiniVoidRaidCrabMasterPhase2,
		虚灵_MiniVoidRaidCrabMasterPhase3,
		阿尔法结构体_MinorConstructMaster,
		烧灼地龙_ScorchlingMaster,
		虚空藤壶_VoidBarnacleAllyMaster,
		虚空毁灭者_VoidMegaCrabAllyMaster,
		虚灵_VoidRaidCrabJointMaster,
		虚灵_VoidRaidCrabMaster
	}
}
namespace DiyEngi
{
	public enum AutoFirEngiMissileTypeEnum
	{
		single_单发,
		all_并发
	}
	[BepInPlugin("top.sshh.DiyEngi", "DiyEngi", "2.1.0")]
	public class DiyEngi : BaseUnityPlugin
	{
		public static Stopwatch stopwatch = Stopwatch.StartNew();

		public static long time = stopwatch.ElapsedMilliseconds;

		public ChoiceOption turretConfig;

		public ConfigEntry<TurretEnum> engiTurretConfig;

		public ConfigEntry<bool> autoFireEngiMissileConfig;

		public ConfigEntry<bool> autoFireEngiMinesConfig;

		public ConfigEntry<bool> fireOnMasterConfig;

		public ConfigEntry<AutoFirEngiMissileTypeEnum> autoFirEngiMissileTypeConfig;

		public IntSliderOption primarySkillSetting;

		public IntSliderOption secondarySkillSetting;

		public IntSliderOption utilitySkillSetting;

		public IntSliderOption specialSkillSetting;

		public ConfigEntry<SkillOverridePriority> skillOverridePrioritySetting;

		public StepSliderOption skill2;

		public StepSliderOption skill3;

		public StepSliderOption skill4;

		public StepSliderOption skill5;

		public StepSliderOption skill6;

		public StepSliderOption skill7;

		public IntSliderOption turretPositionFix;

		public SkillOverridePriority skillOverridePriority = (SkillOverridePriority)0;

		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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0103: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: 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_0283: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Expected O, but got Unknown
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: 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_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Expected O, but got Unknown
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Expected O, but got Unknown
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Expected O, but got Unknown
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Expected O, but got Unknown
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Expected O, but got Unknown
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Expected O, but got Unknown
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Expected O, but got Unknown
			RoRConfig = ((BaseUnityPlugin)this).Config;
			Logger = ((BaseUnityPlugin)this).Logger;
			time = stopwatch.ElapsedMilliseconds;
			turretConfig = new ChoiceOption((ConfigEntryBase)(object)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 IntSliderOption(((BaseUnityPlugin)this).Config.Bind<int>("setting", "TurretPositionFix", 0, "炮塔摆放位置视线方向前后调整距离,-20,20"), new IntSliderConfig
			{
				min = -20,
				max = 20
			});
			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)(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_0606: Unknown result type (might be due to invalid IL or missing references)
				//IL_0610: Expected O, but got Unknown
				//IL_0674: Unknown result type (might be due to invalid IL or missing references)
				//IL_0679: Unknown result type (might be due to invalid IL or missing references)
				//IL_0680: Unknown result type (might be due to invalid IL or missing references)
				//IL_0692: Expected O, but got Unknown
				//IL_068d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0697: Expected O, but got Unknown
				//IL_06af: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_06cd: Expected O, but got Unknown
				//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d2: Expected O, but got Unknown
				//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0708: Expected O, but got Unknown
				//IL_0703: Unknown result type (might be due to invalid IL or missing references)
				//IL_070d: Expected O, but got Unknown
				//IL_0725: Unknown result type (might be due to invalid IL or missing references)
				//IL_072a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0731: Unknown result type (might be due to invalid IL or missing references)
				//IL_0743: Expected O, but got Unknown
				//IL_073e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0748: Expected O, but got Unknown
				//IL_076e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0778: 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";
									}
								}
							}
						}
					}
				}
				IEnumerable<SkillDef> allSkillDefs = SkillCatalog.allSkillDefs;
				foreach (SkillDef item in allSkillDefs)
				{
					if (skillTextList[item.skillIndex] == null)
					{
						skillTextList[item.skillIndex] = item.skillIndex + "_" + item.skillName + "_" + Language.GetString(item.skillNameToken) + "\n";
					}
				}
				string text = "";
				foreach (CharacterMaster allMaster in MasterCatalog.allMasters)
				{
					text = text + Util.GetBestMasterName(allMaster) + "_" + ((Object)allMaster).name + ",\n";
				}
				((BaseOption)turretConfig).SetDescription(text, (BaseOptionConfig)new ChoiceConfig());
				Logger.LogDebug((object)text);
				string text2 = "-1_defaultSkill_角色默认技能\n";
				for (int m = 0; m < skillTextList.Length; m++)
				{
					text2 += skillTextList[m];
				}
				Logger.LogDebug((object)text2);
				primarySkillSetting = new IntSliderOption(((BaseUnityPlugin)this).Config.Bind<int>("setting", "primary", -1, text2), new IntSliderConfig
				{
					min = -1,
					max = SkillCatalog._allSkillDefs.Length
				});
				secondarySkillSetting = new IntSliderOption(((BaseUnityPlugin)this).Config.Bind<int>("setting", "secondary", -1, text2), new IntSliderConfig
				{
					min = -1,
					max = SkillCatalog._allSkillDefs.Length
				});
				utilitySkillSetting = new IntSliderOption(((BaseUnityPlugin)this).Config.Bind<int>("setting", "utility", -1, text2), new IntSliderConfig
				{
					min = -1,
					max = SkillCatalog._allSkillDefs.Length
				});
				specialSkillSetting = new IntSliderOption(((BaseUnityPlugin)this).Config.Bind<int>("setting", "special", -1, text2), new IntSliderConfig
				{
					min = -1,
					max = SkillCatalog._allSkillDefs.Length
				});
				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_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				//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_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: 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_012a: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: 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)
				//IL_01c4: 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_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: 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)
				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(((EntityState)self).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(((EntityState)self).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();
				}
				else
				{
					orig.Invoke(self);
				}
			};
		}

		private void AutoFireEngiMissile(orig_FixedUpdate orig, EntityState self)
		{
			//IL_0164: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Expected O, but got Unknown
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_0656: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: 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();
							val2.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(self.gameObject);
							val = val2.GetResults().FirstOrDefault();
							if ((Object)(object)val == (Object)null)
							{
								return;
							}
						}
						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 ex)
				{
					Debug.LogError((object)ex);
					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 value)
			{
				Console.WriteLine(value);
				throw;
			}
		}

		private void HookMinePosition(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_004c: 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_005d: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Expected O, but got Unknown
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: 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_00ff: 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_0124: 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_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: 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_01fc: 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)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f0: 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_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_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)
				if (!((EntityState)mines).characterBody.isPlayerControlled)
				{
					return ((Ray)(ref aimRay)).origin;
				}
				if (mines is FireBubbleShield)
				{
					Ray val2 = default(Ray);
					((Ray)(ref val2))..ctor(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 2f, ((Ray)(ref aimRay)).direction);
					RaycastHit val3 = default(RaycastHit);
					if (Physics.Raycast(val2, ref val3))
					{
						return ((RaycastHit)(ref val3)).point - ((Ray)(ref aimRay)).direction * 2f;
					}
					return ((Ray)(ref aimRay)).origin;
				}
				if (fireOnMasterConfig.Value)
				{
					HurtBox val4 = null;
					BullseyeSearch val5 = new BullseyeSearch();
					val5.teamMaskFilter = TeamMask.allButNeutral;
					((TeamMask)(ref val5.teamMaskFilter)).RemoveTeam((TeamIndex)1);
					val5.filterByLoS = false;
					val5.viewer = null;
					val5.searchOrigin = ((Ray)(ref aimRay)).origin;
					val5.searchDirection = ((Ray)(ref aimRay)).direction;
					val5.minDistanceFilter = 0f;
					val5.maxDistanceFilter = 2000f;
					val5.sortMode = (SortMode)1;
					val5.minAngleFilter = 0f;
					val5.maxAngleFilter = 180f;
					val5.RefreshCandidates();
					val5.FilterOutGameObject(((EntityState)mines).gameObject);
					val4 = val5.GetResults().FirstOrDefault();
					if ((Object)(object)val4 != (Object)null)
					{
						return val4.healthComponent.body.inputBank.aimOrigin;
					}
					return ((Ray)(ref aimRay)).origin;
				}
				Ray val6 = default(Ray);
				((Ray)(ref val6))..ctor(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 5f, ((Ray)(ref aimRay)).direction);
				RaycastHit val7 = default(RaycastHit);
				return Physics.Raycast(val6, ref val7) ? (((RaycastHit)(ref val7)).point - ((Ray)(ref aimRay)).direction * 2f) : ((Ray)(ref aimRay)).origin;
			});
		}

		private void DiyPlacementInfo(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_010f: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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)
			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_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				Ray val2 = default(Ray);
				((Ray)(ref val2))..ctor(((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction * 5f, ((Ray)(ref aimRay)).direction);
				RaycastHit val3 = default(RaycastHit);
				Physics.Raycast(val2, ref val3);
				return ((RaycastHit)(ref val3)).point + ((Ray)(ref aimRay)).direction * (float)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_S)
			});
			val.Index += 2;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_0);
		}

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