Decompiled source of Camod Up v1.0.1
plugins/AshReskin.dll
Decompiled 19 hours agousing System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] [BepInPlugin("brokenruune.ashreskin", "Ash Set Reskin", "1.0.5")] public sealed class AshReskin : BaseUnityPlugin { private const int MaskId = 3000221; private static Texture2D albedo; private static Texture2D surface; private static readonly Dictionary<Material, Material> Finishes = new Dictionary<Material, Material>(); private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown albedo = Load("AshAlbedo", linear: false); surface = Load("AshSurface", linear: true); Harmony val = new Harmony("brokenruune.ashreskin"); string[] array = new string[2] { "InstantiateVisuals", "InstantiateSpecialVisuals" }; foreach (string text in array) { val.Patch((MethodBase)AccessTools.Method(typeof(ItemManager), text, new Type[1] { typeof(Item) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(AshReskin), "FinishInstance", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } string[] array2 = new string[2] { "GetVisuals", "GetSpecialVisuals" }; foreach (string text2 in array2) { val.Patch((MethodBase)AccessTools.Method(typeof(ItemManager), text2, new Type[1] { typeof(Item) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(AshReskin), "FinishRetrievedVisual", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo = AccessTools.Method(typeof(CharacterVisuals), "EquipVisuals", new Type[2] { typeof(EquipmentSlotIDs), typeof(ArmorVisuals) }, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(AshReskin), "FinishEquippedVisual", (Type[])null); val2.priority = 0; val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.PropertyGetter(typeof(Item), "Description"), (HarmonyMethod)null, new HarmonyMethod(typeof(AshReskin), "DescribeMask", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(StatusEffectManager), "AddStatusEffectBuildUp", new Type[3] { typeof(StatusEffect), typeof(float), typeof(Character) }, (Type[])null), new HarmonyMethod(typeof(AshReskin), "AllowPoison", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(StatusEffectManager), "AddStatusEffect", new Type[3] { typeof(StatusEffect), typeof(Character), typeof(string[]) }, (Type[])null), new HarmonyMethod(typeof(AshReskin), "AllowPoison", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static Texture2D Load(string name, bool linear) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true, linear); ((Object)val).name = name; ((Texture)val).anisoLevel = 4; Texture2D val2 = val; using Stream stream = typeof(AshReskin).Assembly.GetManifestResourceStream(name); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); if (!ImageConversion.LoadImage(val2, memoryStream.ToArray(), true)) { throw new InvalidDataException(name); } return val2; } private static void FinishInstance(Item __0, Transform __result) { if (Object.op_Implicit((Object)(object)__result)) { FinishRetrievedVisual(__0, ((Component)__result).GetComponent<ItemVisual>()); } } private static void FinishRetrievedVisual(Item __0, ItemVisual __result) { if (Object.op_Implicit((Object)(object)__0)) { ApplyFinish(__result, __0.ItemID); } } private static void FinishEquippedVisual(ArmorVisuals __1) { if (Object.op_Implicit((Object)(object)__1)) { int itemIDFromName = ((ItemVisual)__1).GetItemIDFromName(); ApplyFinish((ItemVisual)(object)__1, (itemIDFromName > 0) ? itemIDFromName : ((ItemVisual)__1).ItemID); } } private static void ApplyFinish(ItemVisual visual, int id) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)visual) || id < 3000220 || id > 3000222) { return; } Renderer[] componentsInChildren = ((Component)visual).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!Object.op_Implicit((Object)(object)val2) || !((Object)val2).name.StartsWith("mat_cha_ashArmor", StringComparison.OrdinalIgnoreCase)) { continue; } if (!Finishes.TryGetValue(val2, out var value)) { Material val3 = new Material(val2); ((Object)val3).name = "Ash blackened plate and camouflage"; value = val3; value.SetTexture("_MainTex", (Texture)(object)albedo); value.SetTexture("_GenTex", (Texture)(object)surface); string[] array = new string[6] { "_DETAIL", "_DETAIL_ALBEDO", "_DETAIL_MASK", "_DETAIL_MULX2", "_DETAIL_TEXTURED", "_SPEC_COLOR" }; foreach (string text in array) { value.DisableKeyword(text); } value.EnableKeyword("_NORMALMAP"); value.EnableKeyword("_SPECGLOSSMAP"); value.SetFloat("_SpecBoost", 0.015f); value.SetFloat("_GlossMin", 0.035f); if (value.HasProperty("_SmoothMin")) { value.SetFloat("_SmoothMin", 0.035f); } Finishes.Add(val2, value); } sharedMaterials[j] = value; flag = true; } if (flag) { val.sharedMaterials = sharedMaterials; } } } private static void DescribeMask(Item __instance, ref string __result) { if (__instance.ItemID == 3000221) { __result += "\nGrants poison immunity while equipped, including Hallowed Marsh water."; } } private static bool AllowPoison(StatusEffect __0, Character ___m_character) { if (!Object.op_Implicit((Object)(object)__0) || !Object.op_Implicit((Object)(object)___m_character) || !Object.op_Implicit((Object)(object)___m_character.Inventory) || !Object.op_Implicit((Object)(object)___m_character.Inventory.Equipment)) { return true; } Item equippedItem = ___m_character.Inventory.Equipment.GetEquippedItem((EquipmentSlotIDs)0); if (!Object.op_Implicit((Object)(object)equippedItem) || equippedItem.ItemID != 3000221) { return true; } if (!IsPoison(__0.IdentifierName) && !IsPoison(__0.StatusName)) { return !IsPoison(__0.NameLocKey); } return false; } private static bool IsPoison(string name) { if (string.IsNullOrEmpty(name)) { return false; } switch (name.Replace(" ", "").Replace("_", "").Replace("-", "") .ToLowerInvariant()) { case "statuseffectpoisonedhexname": case "statuseffectpoisonedhex2name": case "statuseffectfoodpoisonedhexname": case "statuseffectfoodpoisonedhex2name": case "foodpoisoned": case "hallowedmarshpoisonlvl1": case "hallowedmarshpoisonlvl2": case "statuseffecthallowedmarshpoisonlvl1name": case "statuseffecthallowedmarshpoisonlvl2name": case "poison": case "poisoned": case "poison2": case "poison3": case "extremepoison": case "poisonextreme": case "strongpoison": case "poisonstrong": return true; default: return false; } } }
plugins/BlackPlateFlecktarn.dll
Decompiled 19 hours agousing System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] [BepInPlugin("brokenruune.blackplateflecktarn", "Black Plate Flecktarn", "1.0.1")] public sealed class BlackPlateFlecktarn : BaseUnityPlugin { private const string PluginId = "brokenruune.blackplateflecktarn"; private const int ChestId = 3100093; private const string Donor = "mat_cha_crimsonPlateArmorSimple"; private static Texture2D albedo; private static readonly Dictionary<Material, Material> Finishes = new Dictionary<Material, Material>(); private void Awake() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ((Object)val).name = "Black Plate Flecktarn"; ((Texture)val).anisoLevel = 4; albedo = val; using (Stream stream = typeof(BlackPlateFlecktarn).Assembly.GetManifestResourceStream("FlecktarnAlbedo")) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); if (!ImageConversion.LoadImage(albedo, memoryStream.ToArray(), true)) { throw new InvalidDataException("FlecktarnAlbedo"); } } Harmony val2 = new Harmony("brokenruune.blackplateflecktarn"); val2.Patch((MethodBase)AccessTools.Method(typeof(ItemVisual), "Awake", Type.EmptyTypes, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(BlackPlateFlecktarn), "AfterVisualAwake", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(typeof(CharacterVisuals), "EquipVisuals", new Type[2] { typeof(EquipmentSlotIDs), typeof(ArmorVisuals) }, (Type[])null); HarmonyMethod val3 = new HarmonyMethod(typeof(BlackPlateFlecktarn), "AfterArmorEquipped", (Type[])null); val3.priority = 0; val2.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void AfterArmorEquipped(ArmorVisuals __1) { if (Object.op_Implicit((Object)(object)__1)) { AfterVisualAwake((ItemVisual)(object)__1); } } private static void AfterVisualAwake(ItemVisual __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown int num = __instance.GetItemIDFromName(); if (num <= 0) { num = __instance.ItemID; } if (num != 3100093) { return; } Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (Object.op_Implicit((Object)(object)val2) && (!(((Object)val2).name != "mat_cha_crimsonPlateArmorSimple") || !(((Object)val2).name != "mat_cha_crimsonPlateArmorSimple (Instance)"))) { if (!Finishes.TryGetValue(val2, out var value)) { Material val3 = new Material(val2); ((Object)val3).name = "Black Plate Flecktarn chest"; value = val3; value.SetTexture("_MainTex", (Texture)(object)albedo); Finishes.Add(val2, value); } sharedMaterials[j] = value; flag = true; } } if (flag) { val.sharedMaterials = sharedMaterials; } } } }
plugins/PaddedCamo.dll
Decompiled 19 hours agousing System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] [BepInPlugin("brokenruune.paddedcamo", "Padded Camo", "1.0.5")] public sealed class PaddedCamo : BaseUnityPlugin { private const string PluginId = "brokenruune.paddedcamo"; private const int LooterMask = 3000039; private const int LooterArmor = 3000038; private const int ScavengerBoots = 3000034; private static readonly int[] PaddedItems = new int[3] { 3000010, 3000011, 3000012 }; private static readonly Dictionary<Material, Material> Finishes = new Dictionary<Material, Material>(); private static readonly HashSet<Material> PrivateMaterials = new HashSet<Material>(); private static Texture2D paddedColor; private static Texture2D paddedSurface; private static Texture2D looterColor; private static Texture2D looterSurface; private static Texture2D scavengerColor; private static Texture2D scavengerSurface; private void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown paddedColor = Load("PaddedColor", linear: false); paddedSurface = Load("PaddedSurface", linear: true); looterColor = Load("LooterColor", linear: false); looterSurface = Load("LooterSurface", linear: true); scavengerColor = Load("ScavengerColor", linear: false); scavengerSurface = Load("ScavengerSurface", linear: true); Harmony val = new Harmony("brokenruune.paddedcamo"); string[] array = new string[2] { "GetVisuals", "GetSpecialVisuals" }; foreach (string text in array) { val.Patch((MethodBase)AccessTools.Method(typeof(ItemManager), text, new Type[1] { typeof(Item) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(PaddedCamo), "ApplyFinish", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } val.Patch((MethodBase)AccessTools.Method(typeof(VisualSlot), "PositionVisuals", Type.EmptyTypes, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(PaddedCamo), "ApplyEquippedFinish", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(typeof(CharacterVisuals), "EquipVisuals", new Type[2] { typeof(EquipmentSlotIDs), typeof(ArmorVisuals) }, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(PaddedCamo), "ApplyArmorFinish", (Type[])null); val2.priority = 0; val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void ApplyArmorFinish(ArmorVisuals __1) { ApplyFinish(null, (ItemVisual)(object)__1); } private static void ApplyEquippedFinish(Item ___m_currentItem, ItemVisual ___m_currentVisual) { if (Object.op_Implicit((Object)(object)___m_currentVisual)) { ApplyFinish(___m_currentItem, ___m_currentVisual); } } private static Texture2D Load(string name, bool linear) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true, linear); ((Object)val).name = name; ((Texture)val).anisoLevel = 4; Texture2D val2 = val; using Stream stream = typeof(PaddedCamo).Assembly.GetManifestResourceStream(name); using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); if (!ImageConversion.LoadImage(val2, memoryStream.ToArray(), true)) { throw new InvalidDataException(name); } return val2; } private static void ApplyFinish(Item __0, ItemVisual __result) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)__result)) { return; } int num = __result.GetItemIDFromName(); if (num <= 0) { num = __result.ItemID; } if (Object.op_Implicit((Object)(object)__0) && __0.ItemID != num) { return; } bool flag = num == 3000039 || num == 3000038; bool flag2 = num == 3000034; if (!flag && !flag2 && Array.IndexOf(PaddedItems, num) < 0) { return; } string text = (flag ? "mat_cha_scavengerArmorBeige" : (flag2 ? "mat_cha_scavengerArmor" : "mat_cha_paddedArmor")); Renderer[] componentsInChildren = ((Component)__result).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { Material[] sharedMaterials = val.sharedMaterials; bool flag3 = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (!Object.op_Implicit((Object)(object)val2) || PrivateMaterials.Contains(val2) || !((Object)val2).name.StartsWith(text, StringComparison.OrdinalIgnoreCase)) { continue; } if (!Finishes.TryGetValue(val2, out var value)) { Material val3 = new Material(val2); ((Object)val3).name = text + " (Padded Camo)"; value = val3; value.SetTexture("_MainTex", (Texture)(object)(flag ? looterColor : (flag2 ? scavengerColor : paddedColor))); value.SetTexture("_GenTex", (Texture)(object)(flag ? looterSurface : (flag2 ? scavengerSurface : paddedSurface))); string[] array = new string[6] { "_DETAIL", "_DETAIL_ALBEDO", "_DETAIL_MASK", "_DETAIL_MULX2", "_DETAIL_TEXTURED", "_SPEC_COLOR" }; foreach (string text2 in array) { value.DisableKeyword(text2); } value.EnableKeyword("_NORMALMAP"); value.EnableKeyword("_SPECGLOSSMAP"); string[] array2 = new string[3] { "_SpecBoost", "_GlossMin", "_SmoothMin" }; foreach (string text3 in array2) { if (value.HasProperty(text3)) { value.SetFloat(text3, (text3 == "_SpecBoost") ? 0.015f : 0.035f); } } Finishes.Add(val2, value); PrivateMaterials.Add(value); } sharedMaterials[j] = value; flag3 = true; } if (flag3) { val.sharedMaterials = sharedMaterials; } } } }