Decompiled source of AnkletOfBloodlust v1.1.1

AnkletOfBloodlust.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AnkletOfBloodlust")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+59afe5570dda235f92eaf961e27ee0b336859bf0")]
[assembly: AssemblyProduct("AnkletOfBloodlust")]
[assembly: AssemblyTitle("AnkletOfBloodlust")]
[assembly: AssemblyVersion("1.1.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace AnkletOfBloodlust
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("prana.AnkletOfBloodlust", "AnkletOfBloodlust", "1.1.1")]
	public class AnkletOfBloodlustPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Action<DamageReport> <0>__OnCharacterDeath;

			public static Action<DamageReport> <1>__OnServerDamageDealt;

			public static StatHookEventHandler <2>__OnGetStatCoefficients;
		}

		public const string PluginGUID = "prana.AnkletOfBloodlust";

		public const string PluginName = "AnkletOfBloodlust";

		public const string PluginVersion = "1.1.1";

		private const string ItemName = "Anklet of Bloodlust";

		private const string BuffName = "Bloodlust";

		private static ItemDef itemDef;

		private static BuffDef bloodlustBuff;

		private static ConfigEntry<int> maxStacksPerItem;

		private static ConfigEntry<float> attackSpeedPerStack;

		private static ConfigEntry<float> moveSpeedPerStack;

		private static ConfigEntry<float> healthPenaltyPerItem;

		private static ConfigEntry<float> stacksLostOnHit;

		private static ConfigEntry<float> minHitFraction;

		public void Awake()
		{
			//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_008c: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			AssetManager.Init(((BaseUnityPlugin)this).Info.Location);
			BindConfig();
			CreateBuff();
			CreateItem();
			AddLanguage();
			GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath;
			GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
			object obj = <>O.<2>__OnGetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = OnGetStatCoefficients;
				<>O.<2>__OnGetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				ItemDisplays.ApplyDisplayRules(itemDef);
			});
		}

		private void BindConfig()
		{
			maxStacksPerItem = ((BaseUnityPlugin)this).Config.Bind<int>("Bloodlust", "MaxStacksPerItem", 10, "Maximum Bloodlust stacks granted per copy of the item.");
			attackSpeedPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Bloodlust", "AttackSpeedPerStack", 0.05f, "Attack speed bonus per Bloodlust stack (0.05 = +5%).");
			moveSpeedPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Bloodlust", "MoveSpeedPerStack", 0.04f, "Movement speed bonus per Bloodlust stack (0.04 = +4%).");
			stacksLostOnHit = ((BaseUnityPlugin)this).Config.Bind<float>("Bloodlust", "StacksLostOnHit", 0.5f, "Fraction of Bloodlust stacks lost when hit, rounded up (0.5 = half, 1 = all).");
			minHitFraction = ((BaseUnityPlugin)this).Config.Bind<float>("Bloodlust", "MinHitFraction", 0.05f, "Hits smaller than this fraction of your max health + shield don't remove stacks (0.05 = 5%).");
			healthPenaltyPerItem = ((BaseUnityPlugin)this).Config.Bind<float>("Downside", "HealthPenaltyPerItem", 0.15f, "Max health reduction per copy, applied multiplicatively (0.15 = -15%, two copies = -27.75%).");
		}

		private static void CreateBuff()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			bloodlustBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)bloodlustBuff).name = "bdAnkletOfBloodlust";
			bloodlustBuff.buffColor = new Color(0.8f, 0.1f, 0.15f);
			bloodlustBuff.canStack = true;
			bloodlustBuff.isDebuff = false;
			bloodlustBuff.isCooldown = false;
			bloodlustBuff.isHidden = false;
			bloodlustBuff.iconSprite = AssetManager.LoadSprite("texBloodlustBuffIcon.png");
			ContentAddition.AddBuffDef(bloodlustBuff);
		}

		private static void CreateItem()
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			itemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)itemDef).name = "ANKLETOFBLOODLUST";
			itemDef.nameToken = "ANKLETOFBLOODLUST_NAME";
			itemDef.pickupToken = "ANKLETOFBLOODLUST_PICKUP";
			itemDef.descriptionToken = "ANKLETOFBLOODLUST_DESC";
			itemDef.loreToken = "ANKLETOFBLOODLUST_LORE";
			SetLunarTier(itemDef);
			itemDef.canRemove = true;
			itemDef.hidden = false;
			itemDef.tags = (ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)1,
				(ItemTag)3
			};
			GameObject val = AssetManager.LoadPrefab("AnkletOfBloodlust.prefab");
			ModelPanelParameters obj = val.AddComponent<ModelPanelParameters>();
			obj.focusPointTransform = val.transform;
			obj.cameraPositionTransform = val.transform;
			obj.minDistance = 1.2f;
			obj.maxDistance = 4f;
			itemDef.pickupModelPrefab = val;
			itemDef.pickupIconSprite = AssetManager.LoadSprite("texAnkletOfBloodlustIcon.png");
			ItemAPI.Add(new CustomItem(itemDef, ItemDisplays.Create(val)));
		}

		private static void SetLunarTier(ItemDef def)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ItemTierDef value = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/LunarTierDef.asset").WaitForCompletion();
			typeof(ItemDef).GetField("_itemTierDef", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(def, value);
			typeof(ItemDef).GetField("deprecatedTier", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(def, (object)(ItemTier)3);
		}

		private void AddLanguage()
		{
			LanguageAPI.Add("ANKLETOFBLOODLUST_NAME", "Anklet of Bloodlust");
			LanguageAPI.Add("ANKLETOFBLOODLUST_PICKUP", "Kills build Bloodlust, increasing attack and movement speed. Big hits lose half your Bloodlust. <style=cDeath>Reduces maximum health.</style>");
			LanguageAPI.Add("ANKLETOFBLOODLUST_DESC", string.Format("Killing an enemy grants a stack of <style=cIsDamage>{0}</style>, up to <style=cIsUtility>{1}</style> <style=cStack>(+{2} per stack)</style>. ", "Bloodlust", maxStacksPerItem.Value, maxStacksPerItem.Value) + $"Each stack gives <style=cIsDamage>+{attackSpeedPerStack.Value * 100f:0.#}% attack speed</style> and <style=cIsUtility>+{moveSpeedPerStack.Value * 100f:0.#}% movement speed</style>. " + $"Taking at least <style=cIsHealth>{minHitFraction.Value * 100f:0.#}% of your max health</style> in one hit <style=cDeath>removes {stacksLostOnHit.Value * 100f:0.#}% of your stacks</style>. " + $"<style=cDeath>Reduces maximum health by {healthPenaltyPerItem.Value * 100f:0.#}%</style> <style=cStack>(+{healthPenaltyPerItem.Value * 100f:0.#}% per stack, multiplicative)</style>.");
			LanguageAPI.Add("ANKLETOFBLOODLUST_LORE", "Every death feeds the next. Every wound drains it all.");
		}

		private static int GetItemCount(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
			{
				return 0;
			}
			return body.inventory.GetItemCountEffective(itemDef);
		}

		private static void OnCharacterDeath(DamageReport report)
		{
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = report.attackerBody;
			int itemCount = GetItemCount(attackerBody);
			if (itemCount > 0)
			{
				int num = maxStacksPerItem.Value * itemCount;
				if (attackerBody.GetBuffCount(bloodlustBuff) < num)
				{
					attackerBody.AddBuff(bloodlustBuff);
				}
			}
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody victimBody = report.victimBody;
			if (Object.op_Implicit((Object)(object)victimBody) && !(report.damageDealt <= 0f) && !((Object)(object)report.attackerBody == (Object)(object)victimBody))
			{
				int buffCount = victimBody.GetBuffCount(bloodlustBuff);
				if (buffCount > 0 && !(report.damageDealt < victimBody.healthComponent.fullCombinedHealth * minHitFraction.Value))
				{
					int num = Mathf.CeilToInt((float)buffCount * Mathf.Clamp01(stacksLostOnHit.Value));
					victimBody.SetBuffCount(bloodlustBuff.buffIndex, buffCount - num);
				}
			}
		}

		private static void OnGetStatCoefficients(CharacterBody body, StatHookEventArgs args)
		{
			int itemCount = GetItemCount(body);
			if (itemCount > 0)
			{
				int buffCount = body.GetBuffCount(bloodlustBuff);
				args.attackSpeedMultAdd += attackSpeedPerStack.Value * (float)buffCount;
				args.moveSpeedMultAdd += moveSpeedPerStack.Value * (float)buffCount;
				float num = Mathf.Pow(1f - healthPenaltyPerItem.Value, (float)itemCount);
				args.healthMultAdd -= 1f - num;
			}
		}
	}
	internal static class AssetManager
	{
		public const string BundleName = "ankletofbloodlust";

		public static AssetBundle bundle;

		public static void Init(string pluginLocation)
		{
			string text = Path.Combine(Path.GetDirectoryName(pluginLocation), "ankletofbloodlust");
			bundle = AssetBundle.LoadFromFile(text);
			if (!Object.op_Implicit((Object)(object)bundle))
			{
				Log.Error("Couldn't load the AssetBundle at " + text, "C:\\Users\\prana\\Downloads\\anklet of bloodlust ror2\\AssetManager.cs", 19);
			}
		}

		public static Sprite LoadSprite(string name)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Sprite val = bundle.LoadAsset<Sprite>(name);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Warning("Missing sprite " + name + ". Substituting default...", "C:\\Users\\prana\\Downloads\\anklet of bloodlust ror2\\AssetManager.cs", 27);
				val = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion();
			}
			return val;
		}

		public static GameObject LoadPrefab(string name)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = bundle.LoadAsset<GameObject>(name);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Warning("Missing prefab " + name + ". Substituting default...", "C:\\Users\\prana\\Downloads\\anklet of bloodlust ror2\\AssetManager.cs", 38);
				return Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion();
			}
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
			Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material[] sharedMaterials = componentsInChildren[i].sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if (((Object)val2.shader).name == "Standard")
					{
						val2.shader = shader;
					}
				}
			}
			return val;
		}
	}
	internal static class ItemDisplays
	{
		private static GameObject displayPrefab;

		public static ItemDisplayRuleDict Create(GameObject prefab)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			displayPrefab = prefab;
			List<RendererInfo> list = new List<RendererInfo>();
			Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				list.Add(new RendererInfo
				{
					renderer = val,
					defaultMaterial = val.sharedMaterial,
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				});
			}
			prefab.AddComponent<ItemDisplay>().rendererInfos = list.ToArray();
			return new ItemDisplayRuleDict((ItemDisplayRule[])null);
		}

		private static Dictionary<string, ItemDisplayRule> HandPlaced()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: 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_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 angles = default(Vector3);
			((Vector3)(ref angles))..ctor(-1E-05f, 180f, 180f);
			return new Dictionary<string, ItemDisplayRule>
			{
				["CommandoBody"] = Rule("CalfR", new Vector3(-0.0019f, 0.34219f, 0.01456f), angles, Vector3.one * 0.2f),
				["HuntressBody"] = Rule("CalfR", new Vector3(0.0144f, 0.3496f, 0.01774f), angles, Vector3.one * 0.17647f),
				["Bandit2Body"] = Rule("CalfR", new Vector3(0.00564f, 0.33653f, 0.01252f), angles, Vector3.one * 0.2f),
				["EngiBody"] = Rule("CalfR", new Vector3(0.00236f, 0.27453f, 0.02143f), angles, Vector3.one * 0.29349f),
				["MageBody"] = Rule("CalfR", new Vector3(0.00187f, 0.47008f, 0.00318f), angles, new Vector3(0.10649f, 0.10649f, 0.1027f)),
				["MercBody"] = Rule("CalfR", new Vector3(-0.00708f, 0.32992f, 0.01145f), angles, Vector3.one * 0.21176f),
				["LoaderBody"] = Rule("CalfR", new Vector3(0.01126f, 0.412f, 0.00776f), angles, Vector3.one * 0.28235f),
				["CrocoBody"] = Rule("CalfR", new Vector3(0.10253f, 2.68812f, -0.01258f), angles, Vector3.one * 1.88235f),
				["CaptainBody"] = Rule("CalfR", new Vector3(-0.00282f, 0.30095f, 0.02098f), angles, Vector3.one * 0.23529f),
				["RailgunnerBody"] = Rule("CalfR", new Vector3(-0.00281f, 0.41252f, 0.00307f), angles, Vector3.one * 0.18913f),
				["VoidSurvivorBody"] = Rule("CalfR", new Vector3(0.00669f, 0.37404f, -0.00169f), angles, Vector3.one * 0.2f),
				["SeekerBody"] = Rule("CalfR", new Vector3(-0.00105f, 0.42784f, 0.00928f), angles, Vector3.one * 0.20366f),
				["FalseSonBody"] = Rule("CalfR", new Vector3(-0.02895f, 0.51184f, 0.00256f), angles, Vector3.one * 0.27812f),
				["DrifterBody"] = Rule("CalfR", new Vector3(-0.07849f, -0.01391f, -0.01058f), new Vector3(344.7775f, 167.481f, 268.9557f), Vector3.one * 0.37632f),
				["DroneTechBody"] = Rule("CalfR", new Vector3(0.53767f, -0.00194f, -0.03339f), new Vector3(34.70116f, 187.0946f, 280.0397f), Vector3.one * 0.18549f),
				["Enforcer2Body"] = Rule("CalfR", new Vector3(0.36633f, -0.00043f, -0.00977f), new Vector3(331.147f, 172.4216f, 278.125f), Vector3.one * 0.28011f),
				["AcolyteBody"] = Rule("CalfR", new Vector3(0.24679f, 8E-05f, -0.00817f), new Vector3(327.3785f, 168.8638f, 265.11f), Vector3.one * 0.2f)
			};
		}

		private static ItemDisplayRule Rule(string bone, Vector3 position, Vector3 angles, Vector3 scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0037: 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)
			return new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = displayPrefab,
				childName = bone,
				localPos = position,
				localAngles = angles,
				localScale = scale
			};
		}

		public static void ApplyDisplayRules(ItemDef anklet)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo field = typeof(ItemDisplayRuleSet).GetField("runtimeItemRuleGroups", BindingFlags.Instance | BindingFlags.NonPublic);
			foreach (KeyValuePair<string, ItemDisplayRule> item in HandPlaced())
			{
				ItemDisplayRuleSet itemDisplayRuleSet = ((Component)BodyCatalog.FindBodyPrefab(item.Key).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet;
				DisplayRuleGroup val = new DisplayRuleGroup
				{
					rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { item.Value }
				};
				itemDisplayRuleSet.SetDisplayRuleGroup((Object)(object)anklet, val);
				((DisplayRuleGroup[])field.GetValue(itemDisplayRuleSet))[anklet.itemIndex] = val;
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		private static string Format(object data, string file, int line)
		{
			return $"[{Path.GetFileName(file)}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}
	}
}