Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of R2API Skins v1.4.4
plugins/R2API.Skins/R2API.Skins.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; 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.Logging; using EntityStates; using HG; using HG.Coroutines; using HG.Reflection; using HarmonyLib; using IL.RoR2; using IL.RoR2.Orbs; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates; using On.RoR2; using R2API.AutoVersionGen; using R2API.SkinsAPI.Interop; using R2API.Utils; using RoR2; using RoR2.ContentManagement; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.SurvivorMannequins; using RoR2.UI.MainMenu; using Unity.Collections; using Unity.Jobs; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("R2API.Skins")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.4.4.0")] [assembly: AssemblyInformationalVersion("1.4.4+ab0d797efb1b128b8d9132eeb65eec8f64f81fa7")] [assembly: AssemblyProduct("R2API.Skins")] [assembly: AssemblyTitle("R2API.Skins")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.4.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } } namespace R2API { internal struct IconTexJob : IJobParallelFor { [ReadOnly] public Color32 Top; [ReadOnly] public Color32 Right; [ReadOnly] public Color32 Bottom; [ReadOnly] public Color32 Left; [ReadOnly] public Color32 Line; public NativeArray<Color32> TexOutput; public void Execute(int index) { //IL_0033: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) int num = index % 128 - 64; int num2 = index / 128 - 64; if (Math.Abs(Math.Abs(num2) - Math.Abs(num)) <= 2) { TexOutput[index] = Line; } else if (num2 > num && num2 > -num) { TexOutput[index] = Top; } else if (num2 < num && num2 < -num) { TexOutput[index] = Bottom; } else if (num2 > num && num2 < -num) { TexOutput[index] = Left; } else if (num2 < num && num2 > -num) { TexOutput[index] = Right; } } } public class SkinCustomGameobjectComponent : MonoBehaviour { [Tooltip("CharacterModel of a character this object is instantiating to for custom uses. This field is null in Awake and first OnEnable")] [HideInInspector] public CharacterModel characterModel; [Tooltip("RendererInfos that will be added to CharacterModel.baseRendererInfos")] public RendererInfo[] extraRendererInfos; [Tooltip("LightInfos that will be added to CharacterModel.baseLightInfos")] public LightInfo[] extraLightInfos; } public struct SkinDefParamsInfo { public string Name; public string NameToken; public Sprite? Icon; public UnlockableDef? UnlockableDef; public GameObject? RootObject; public SkinDef?[]? BaseSkins; public SkinDefParams? SkinDefParams; public RendererInfo[]? RendererInfos; public MeshReplacement[]? MeshReplacements; public GameObjectActivation[]? GameObjectActivations; public ProjectileGhostReplacement[]? ProjectileGhostReplacements; public MinionSkinReplacement[]? MinionSkinReplacements; } [Obsolete] public struct SkinDefInfo { [Obsolete] public SkinDef?[]? BaseSkins; [Obsolete] public Sprite? Icon; [Obsolete] public string? NameToken; [Obsolete] public UnlockableDef? UnlockableDef; [Obsolete] public GameObject? RootObject; [Obsolete] public RendererInfo[]? RendererInfos; [Obsolete] public MeshReplacement[]? MeshReplacements; [Obsolete] public GameObjectActivation[]? GameObjectActivations; [Obsolete] public ProjectileGhostReplacement[]? ProjectileGhostReplacements; [Obsolete] public MinionSkinReplacement[]? MinionSkinReplacements; [Obsolete] public string? Name; public static implicit operator SkinDefParamsInfo(SkinDefInfo orig) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) SkinDefParamsInfo skinDefParamsInfo = default(SkinDefParamsInfo); skinDefParamsInfo.BaseSkins = orig.BaseSkins; skinDefParamsInfo.Icon = orig.Icon; skinDefParamsInfo.NameToken = orig.NameToken; skinDefParamsInfo.UnlockableDef = orig.UnlockableDef; skinDefParamsInfo.RootObject = orig.RootObject; skinDefParamsInfo.RendererInfos = orig.RendererInfos; skinDefParamsInfo.Name = orig.Name; SkinDefParamsInfo result = skinDefParamsInfo; if (orig.GameObjectActivations != null) { result.GameObjectActivations = (GameObjectActivation[]?)(object)new GameObjectActivation[orig.GameObjectActivations.Length]; for (int i = 0; i < orig.GameObjectActivations.Length; i++) { result.GameObjectActivations[i] = GameObjectActivation.op_Implicit(orig.GameObjectActivations[i]); } } if (orig.MeshReplacements != null) { result.MeshReplacements = (MeshReplacement[]?)(object)new MeshReplacement[orig.MeshReplacements.Length]; for (int j = 0; j < orig.MeshReplacements.Length; j++) { result.MeshReplacements[j] = MeshReplacement.op_Implicit(orig.MeshReplacements[j]); } } if (orig.ProjectileGhostReplacements != null) { result.ProjectileGhostReplacements = (ProjectileGhostReplacement[]?)(object)new ProjectileGhostReplacement[orig.ProjectileGhostReplacements.Length]; for (int k = 0; k < orig.ProjectileGhostReplacements.Length; k++) { result.ProjectileGhostReplacements[k] = ProjectileGhostReplacement.op_Implicit(orig.ProjectileGhostReplacements[k]); } } if (orig.MinionSkinReplacements != null) { result.MinionSkinReplacements = (MinionSkinReplacement[]?)(object)new MinionSkinReplacement[orig.MinionSkinReplacements.Length]; for (int l = 0; l < orig.MinionSkinReplacements.Length; l++) { result.MinionSkinReplacements[l] = MinionSkinReplacement.op_Implicit(orig.MinionSkinReplacements[l]); } } return result; } } public static class SkinIDRS { [CompilerGenerated] private static class <>O { public static hook_ApplySkin <0>__SetCustomIDRS; public static Action <1>__SystemInit; } private static readonly Dictionary<SkinDef, ItemDisplayRuleSet> skinToIDRS = new Dictionary<SkinDef, ItemDisplayRuleSet>(); private static readonly Dictionary<SkinDef, Dictionary<Object, DisplayRuleGroup>> skinIDRSOverrides = new Dictionary<SkinDef, Dictionary<Object, DisplayRuleGroup>>(); private static bool hooksSet = false; private static bool initialized = false; internal static void SetHooks() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!hooksSet) { hooksSet = true; object obj = <>O.<0>__SetCustomIDRS; if (obj == null) { hook_ApplySkin val = SetCustomIDRS; <>O.<0>__SetCustomIDRS = val; obj = (object)val; } ModelSkinController.ApplySkin += (hook_ApplySkin)obj; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(SystemInit)); } } internal static void UnsetHooks() { //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_0021: Expected O, but got Unknown hooksSet = false; object obj = <>O.<0>__SetCustomIDRS; if (obj == null) { hook_ApplySkin val = SetCustomIDRS; <>O.<0>__SetCustomIDRS = val; obj = (object)val; } ModelSkinController.ApplySkin -= (hook_ApplySkin)obj; RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(SystemInit)); } public static bool AddPair(SkinDef skinDef, ItemDisplayRuleSet ruleSet) { SetHooks(); if (initialized) { SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef} && {ruleSet} as the SkinIDRS has already initialized."); return false; } if (skinToIDRS.ContainsKey(skinDef)) { SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef} && {ruleSet}, the skin {skinDef} already has an entry associated to it."); return false; } skinToIDRS[skinDef] = ruleSet; return true; } public static bool AddGroupOverride(SkinDef skinDef, Object keyAsset, DisplayRuleGroup displayRuleGroup) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) SetHooks(); if (initialized) { SkinsPlugin.Logger.LogInfo((object)"Cannot add group SkinIDRS has already initialized."); return false; } if (!skinIDRSOverrides.TryGetValue(skinDef, out Dictionary<Object, DisplayRuleGroup> value)) { value = (skinIDRSOverrides[skinDef] = new Dictionary<Object, DisplayRuleGroup>()); } value[keyAsset] = displayRuleGroup; return true; } private static void SystemInit() { //IL_0060: 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) initialized = true; ModelLocator val = default(ModelLocator); CharacterModel val2 = default(CharacterModel); foreach (CharacterBody allBodyPrefabBodyBodyComponent in BodyCatalog.allBodyPrefabBodyBodyComponents) { if (!Object.op_Implicit((Object)(object)allBodyPrefabBodyBodyComponent) || !((Component)allBodyPrefabBodyBodyComponent).TryGetComponent<ModelLocator>(ref val) || !Object.op_Implicit((Object)(object)val.modelTransform) || !((Component)val.modelTransform).TryGetComponent<CharacterModel>(ref val2)) { continue; } ItemDisplayRuleSet itemDisplayRuleSet = val2.itemDisplayRuleSet; SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(allBodyPrefabBodyBodyComponent.bodyIndex); foreach (SkinDef key in bodySkinDefs) { if (!skinIDRSOverrides.TryGetValue(key, out Dictionary<Object, DisplayRuleGroup> value)) { if (!skinToIDRS.ContainsKey(key)) { skinToIDRS[key] = itemDisplayRuleSet; } continue; } if (!skinToIDRS.TryGetValue(key, out ItemDisplayRuleSet value2)) { value2 = (skinToIDRS[key] = (Object.op_Implicit((Object)(object)itemDisplayRuleSet) ? Object.Instantiate<ItemDisplayRuleSet>(itemDisplayRuleSet) : ScriptableObject.CreateInstance<ItemDisplayRuleSet>())); } foreach (KeyValuePair<Object, DisplayRuleGroup> item in value) { value2.SetDisplayRuleGroup(item.Key, item.Value); } IEnumerator enumerator3 = value2.GenerateRuntimeValuesAsync(); while (enumerator3.MoveNext()) { } } } skinIDRSOverrides.Clear(); } private static void SetCustomIDRS(orig_ApplySkin orig, ModelSkinController self, int skinIndex) { orig.Invoke(self, skinIndex); SkinDef safe = ArrayUtils.GetSafe<SkinDef>(self.skins, skinIndex); if (Object.op_Implicit((Object)(object)safe) && skinToIDRS.TryGetValue(safe, out ItemDisplayRuleSet value)) { self.characterModel.itemDisplayRuleSet = value; } } } [AutoVersion] public static class Skins { public const string PluginGUID = "com.bepis.r2api.skins"; public const string PluginName = "R2API.Skins"; private static bool _hooksSet; public const string PluginVersion = "1.4.4"; internal static void SetHooks() { if (!_hooksSet) { _hooksSet = true; MainMenuController.OnMainMenuInitialised += OnMainMenuInitialized; } } internal static void UnsetHooks() { _hooksSet = false; MainMenuController.OnMainMenuInitialised -= OnMainMenuInitialized; } private static void OnMainMenuInitialized() { MainMenuController.OnMainMenuInitialised -= OnMainMenuInitialized; SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs; foreach (SurvivorDef val in survivorDefs) { if (!Object.op_Implicit((Object)(object)val)) { continue; } GameObject displayPrefab = val.displayPrefab; GameObject bodyPrefab = val.bodyPrefab; if (!Object.op_Implicit((Object)(object)displayPrefab) || !Object.op_Implicit((Object)(object)bodyPrefab)) { SkinsPlugin.Logger.LogWarning((object)("SurvivorDef " + val.cachedName + " is missing a displayPrefab or bodyPrefab! You need to have this! Skipping...")); continue; } ModelSkinController componentInChildren = bodyPrefab.GetComponentInChildren<ModelSkinController>(); if (!Object.op_Implicit((Object)(object)componentInChildren) || componentInChildren.skins == null || componentInChildren.skins.Length == 0) { SkinsPlugin.Logger.LogWarning((object)("BodyPrefab for " + val.cachedName + " is missing a ModelSkinController on the bodyPrefab! You need to have this! Skipping...")); continue; } CharacterModel componentInChildren2 = displayPrefab.GetComponentInChildren<CharacterModel>(); if (!Object.op_Implicit((Object)(object)componentInChildren2)) { SkinsPlugin.Logger.LogWarning((object)("Display prefab " + ((Object)displayPrefab).name + " is missing the CharacterModel component! You need to have this! Skipping...")); continue; } ModelSkinController val2 = ((Component)componentInChildren2).GetComponent<ModelSkinController>(); if (!Object.op_Implicit((Object)(object)val2)) { SkinsPlugin.Logger.LogWarning((object)("Display prefab " + ((Object)componentInChildren2).name + " is missing a ModelSkinController component!\r\nHighly recommended you set the controller up manually. Adding component...")); val2 = ((Component)componentInChildren2).gameObject.AddComponent<ModelSkinController>(); } ModelSkinController val3 = val2; if (val3.skins == null) { val3.skins = Array.Empty<SkinDef>(); } if (val2.skins.Length != componentInChildren.skins.Length) { SkinsPlugin.Logger.LogWarning((object)("ModelSkinController skins array on the displayPrefab " + ((Object)componentInChildren2).name + " array does not match the one on the bodyPrefab!\r\nHighly recommended you set the controller up manually. Cloning from body prefab...")); val2.skins = ArrayUtils.Clone<SkinDef>(componentInChildren.skins); } } } public static SkinDef CreateNewSkinDef(SkinDefParamsInfo skin) { SetHooks(); SkinDef val = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val).name = skin.Name; val.nameToken = skin.NameToken; val.icon = skin.Icon; val.baseSkins = skin.BaseSkins ?? Array.Empty<SkinDef>(); val.unlockableDef = skin.UnlockableDef; val.rootObject = skin.RootObject; val.skinDefParams = skin.SkinDefParams; if ((Object)(object)val.skinDefParams == (Object)null) { val.skinDefParams = ScriptableObject.CreateInstance<SkinDefParams>(); val.skinDefParams.rendererInfos = skin.RendererInfos ?? Array.Empty<RendererInfo>(); val.skinDefParams.gameObjectActivations = skin.GameObjectActivations ?? Array.Empty<GameObjectActivation>(); val.skinDefParams.meshReplacements = skin.MeshReplacements ?? Array.Empty<MeshReplacement>(); val.skinDefParams.projectileGhostReplacements = skin.ProjectileGhostReplacements ?? Array.Empty<ProjectileGhostReplacement>(); val.skinDefParams.minionSkinReplacements = skin.MinionSkinReplacements ?? Array.Empty<MinionSkinReplacement>(); } return val; } [Obsolete] public static SkinDef CreateNewSkinDef(SkinDefInfo skin) { SetHooks(); SkinDef obj = CreateNewSkinDef((SkinDefParamsInfo)skin); obj.rendererInfos = skin.RendererInfos; obj.gameObjectActivations = skin.GameObjectActivations; obj.meshReplacements = skin.MeshReplacements; obj.projectileGhostReplacements = skin.ProjectileGhostReplacements; obj.minionSkinReplacements = skin.MinionSkinReplacements; return obj; } public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDefParamsInfo skin) { SetHooks(); SkinDef skin2 = CreateNewSkinDef(skin); return AddSkinToCharacter(bodyPrefab, skin2); } [Obsolete] public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDefInfo skin) { SetHooks(); SkinDef skin2 = CreateNewSkinDef(skin); return AddSkinToCharacter(bodyPrefab, skin2); } public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDef? skin) { //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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) SetHooks(); if ((Object)(object)bodyPrefab == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to null body prefab."); return false; } if ((Object)(object)skin == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add invalid skin."); return false; } if (string.IsNullOrEmpty(((Object)skin).name) || string.IsNullOrEmpty(skin.nameToken)) { SkinsPlugin.Logger.LogError((object)"Tried to add invalid skin. Please add a name and nameToken."); return false; } ModelLocator val = default(ModelLocator); if (!bodyPrefab.TryGetComponent<ModelLocator>(ref val)) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to invalid body prefab (No ModelLocator)."); return false; } Transform modelTransform = val.modelTransform; if ((Object)(object)modelTransform == (Object)null) { SkinsPlugin.Logger.LogError((object)"Tried to add skin to body prefab with no modelTransform."); return false; } if ((Object)(object)skin.rootObject != (Object)(object)((Component)modelTransform).gameObject) { SkinsPlugin.Logger.LogError((object)"Tried to add skin with improper root object set."); return false; } ModelSkinController val2 = default(ModelSkinController); if (!((Component)modelTransform).TryGetComponent<ModelSkinController>(ref val2)) { SkinsPlugin.Logger.LogWarning((object)(((Object)bodyPrefab).name + " does not have a modelSkinController.\nAdding a new one and attempting to populate the default skin.\nHighly recommended you set the controller up manually.")); CharacterModel val3 = default(CharacterModel); if (!((Component)modelTransform).TryGetComponent<CharacterModel>(ref val3)) { SkinsPlugin.Logger.LogError((object)"Unable to locate CharacterModel, default skin creation aborted."); return false; } SkinnedMeshRenderer mainSkinnedMeshRenderer = val3.mainSkinnedMeshRenderer; if ((Object)(object)mainSkinnedMeshRenderer == (Object)null) { SkinsPlugin.Logger.LogError((object)"CharacterModel did not contain a main SkinnedMeshRenderer, default skin creation aborted."); return false; } RendererInfo[] baseRendererInfos = val3.baseRendererInfos; if (baseRendererInfos == null || baseRendererInfos.Length == 0) { SkinsPlugin.Logger.LogError((object)"CharacterModel rendererInfos are invalid, default skin creation aborted."); return false; } val2 = ((Component)modelTransform).gameObject.AddComponent<ModelSkinController>(); SkinDefParamsInfo skin2 = default(SkinDefParamsInfo); skin2.Icon = CreateDefaultSkinIcon(); skin2.Name = "skin" + ((Object)bodyPrefab).name + "Default"; skin2.NameToken = ((Object)bodyPrefab).name.ToUpper() + "_DEFAULT_SKIN_NAME"; skin2.RootObject = ((Component)modelTransform).gameObject; skin2.UnlockableDef = null; skin2.RendererInfos = ArrayUtils.Clone<RendererInfo>(val3.baseRendererInfos); skin2.MeshReplacements = (MeshReplacement[]?)(object)new MeshReplacement[1] { new MeshReplacement { renderer = (Renderer)(object)mainSkinnedMeshRenderer, mesh = mainSkinnedMeshRenderer.sharedMesh } }; SkinDef val4 = CreateNewSkinDef(skin2); val2.skins = (SkinDef[])(object)new SkinDef[1] { val4 }; } ArrayUtils.ArrayAppend<SkinDef>(ref val2.skins, ref skin); return true; } public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) SetHooks(); return CreateSkinIcon(top, right, bottom, left, new Color(0.6f, 0.6f, 0.6f)); } public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left, Color line) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0021: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) SetHooks(); Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); IconTexJob iconTexJob = default(IconTexJob); iconTexJob.Top = Color32.op_Implicit(top); iconTexJob.Bottom = Color32.op_Implicit(bottom); iconTexJob.Right = Color32.op_Implicit(right); iconTexJob.Left = Color32.op_Implicit(left); iconTexJob.Line = Color32.op_Implicit(line); iconTexJob.TexOutput = val.GetRawTextureData<Color32>(); IconTexJob iconTexJob2 = iconTexJob; JobHandle val2 = default(JobHandle); val2 = IJobParallelForExtensions.Schedule<IconTexJob>(iconTexJob2, 16384, 1, val2); ((JobHandle)(ref val2)).Complete(); ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } private static Sprite CreateDefaultSkinIcon() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return CreateSkinIcon(Color.red, Color.green, Color.blue, Color.black); } } public static class SkinSkillVariants { [HarmonyPatch] private class Patches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(new Type[] { typeof(GameObject), typeof(List<AssetReferenceT<Material>>), typeof(List<AssetReferenceT<Mesh>>), typeof(List<AssetReferenceT<GameObject>>), typeof(AsyncReferenceHandleUnloadType) })] [HarmonyILManipulator] private static void SkinDef_RuntimeSkin_ApplyAsync(ILContext il) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0602: 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_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) int count = il.Body.Variables.Count; il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(List<SkillDef>)))); il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(Mesh)))); FieldReference fieldReference = null; FieldReference fieldReference2 = null; int locID = 0; Instruction val = il.Instrs[il.Instrs.Count - 1]; int i = 0; ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref fieldReference), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(GameObject), "transform")) })) { val2.Emit(OpCodes.Ldarg_0); val2.Emit(OpCodes.Ldfld, fieldReference); val2.Emit(OpCodes.Ldloc, 1); val2.EmitDelegate<Func<GameObject, RuntimeSkin, List<SkillDef>>>((Func<GameObject, RuntimeSkin, List<SkillDef>>)CacheSkillDefs); val2.Emit(OpCodes.Stloc, count); int num2 = default(int); int num = default(int); MethodReference val3 = default(MethodReference); if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchLdflda<RuntimeSkin>(x, "rendererInfoTemplates"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCall(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)Reflection.GetPropertyGetter(typeof(RendererInfoTemplate), "rendererInfoData")), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref i) })) { val2.Emit(OpCodes.Ldloca, i); val2.Emit(OpCodes.Ldloc, count); val2.EmitDelegate<<>A{00000001}<RendererInfo, List<SkillDef>>>((<>A{00000001}<RendererInfo, List<SkillDef>>)ApplyRendererInfoSkillVariants); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 2 failed!")); } if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 7) })) { Instruction prev = val2.Prev; val2.Index -= 2; Instruction next = val2.Next; val2.Emit(OpCodes.Dup); val2.Emit(OpCodes.Ldloc, count); val2.EmitDelegate<<>F{00000001}<LightReplacementTemplate, List<SkillDef>, bool>>((<>F{00000001}<LightReplacementTemplate, List<SkillDef>, bool>)CheckForLightInfoSkillVariants); val2.Emit(OpCodes.Brfalse_S, next); val2.Emit(OpCodes.Ldloc, count); val2.EmitDelegate<<>F{00000001}<LightReplacementTemplate, List<SkillDef>, LightInfo>>((<>F{00000001}<LightReplacementTemplate, List<SkillDef>, LightInfo>)ApplyLightInfoSkillVariants); val2.Emit(OpCodes.Br, prev); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 3 failed!")); } if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 19) })) { Instruction prev2 = val2.Prev; val2.Index -= 3; Instruction next2 = val2.Next; val2.Emit(OpCodes.Dup); val2.Emit(OpCodes.Ldloc, count); val2.EmitDelegate<<>F{00000001}<MeshReplacementTemplate, List<SkillDef>, Mesh>>((<>F{00000001}<MeshReplacementTemplate, List<SkillDef>, Mesh>)ApplyMeshReplacementSkillVariants); val2.Emit(OpCodes.Dup); val2.Emit(OpCodes.Stloc, count + 1); val2.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null)); val2.Emit(OpCodes.Brfalse_S, next2); val2.Emit(OpCodes.Pop); val2.Emit(OpCodes.Ldloc, count + 1); val2.Emit(OpCodes.Br, prev2); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 4 failed!")); } } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!")); } if (val2.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref fieldReference2), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterModel>(x, "forceUpdate") })) { if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterModel>(x, "customGameObjectActivationTransforms"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locID) })) { val2.Emit(OpCodes.Ldarg_0); val2.Emit(OpCodes.Ldfld, fieldReference2); val2.Emit(OpCodes.Ldloc, locID); val2.EmitDelegate<Action<CharacterModel, Transform>>((Action<CharacterModel, Transform>)HandleSkinCustomGameobjectComponent); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 6 failed!")); } } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 5 failed!")); } val2.Goto(val, (MoveType)0, false); int index = val2.Index; val2.Index = index - 1; val2.Emit(OpCodes.Ldarg_0); val2.Emit(OpCodes.Ldfld, fieldReference); val2.Emit(OpCodes.Ldloc, 1); val2.Emit(OpCodes.Ldloc, count); val2.EmitDelegate<Action<GameObject, RuntimeSkin, List<SkillDef>>>((Action<GameObject, RuntimeSkin, List<SkillDef>>)RunOnSkinApplied); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void SkinCatalog_Init(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007d: 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) ILCursor val = new ILCursor(il); MethodReference val4 = default(MethodReference); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 6), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val4) })) { val.Emit(OpCodes.Ldloc, 6); val.Emit(OpCodes.Ldloc, 2); val.EmitDelegate<Action<SkinDef, BodyIndex>>((Action<SkinDef, BodyIndex>)AddSkinToBodyDictionary); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!")); } FieldReference val3 = default(FieldReference); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchBr(x, ref val2) })) { val.EmitDelegate<Action>((Action)ApplyPendingSkinSkillVariations); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 2 failed!")); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void SkinDef_BakeAsync(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld<SkinDef>(x, "_runtimeSkin") })) { val.Emit(OpCodes.Ldloc, 1); val.EmitDelegate<Action<SkinDef>>((Action<SkinDef>)AddSkinDefToRuntimeSkin); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void ModelSkinController_ApplySkinAsync(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); FieldReference val3 = default(FieldReference); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)Reflection.GetPropertyGetter(typeof(ModelSkinController), "currentSkinIndex")), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val2) })) { val.RemoveRange(7); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } } public delegate void OnSkinApplied(GameObject gameObject, List<SkillDef> skillDefs); public interface ISkillVariantStruct<T> { bool lowPriority { get; set; } bool NullCheck(); bool Compare(T t); void Add(ref T t); void AddPending(SkinDefParams skinDefParams, T t); void AddPending(ModelSkinController modelSkinController, T t); } [Serializable] public struct RendererInfoSkillVariant : ISkillVariantStruct<RendererInfo> { [PrefabReference] public Renderer renderer; public SkillDef skillDef; public Material material; public ShadowCastingMode defaultShadowCastingMode; public bool ignoreOverlays; public bool hideOnDeath; public bool ignoresMaterialOverrides; private bool _lowPriority; public bool lowPriority { get { return _lowPriority; } set { _lowPriority = value; } } public bool Compare(RendererInfo t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)t.renderer == (Object)(object)renderer; } public bool NullCheck() { return (Object)(object)renderer == (Object)null; } public void Add(ref RendererInfo t) { t.AddSkillVariant(this); } public void AddPending(SkinDefParams skinDefParams, RendererInfo t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(skinDefParams, t, this); } public void AddPending(ModelSkinController modelSkinController, RendererInfo t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(modelSkinController, t, this); } } [Serializable] public struct MeshReplacementSkillVariant : ISkillVariantStruct<MeshReplacement> { [PrefabReference] public Renderer renderer; public SkillDef skillDef; public Mesh mesh; private bool _lowPriority; public bool lowPriority { get { return _lowPriority; } set { _lowPriority = value; } } public bool Compare(MeshReplacement t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)t.renderer == (Object)(object)renderer; } public bool NullCheck() { return (Object)(object)renderer == (Object)null; } public void Add(ref MeshReplacement t) { t.AddSkillVariant(this); } public void AddPending(SkinDefParams skinDefParams, MeshReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(skinDefParams, t, this); } public void AddPending(ModelSkinController modelSkinController, MeshReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(modelSkinController, t, this); } } [Serializable] public struct LightInfoSkillVariant : ISkillVariantStruct<LightInfo> { [PrefabReference] public Light originalLight; public SkillDef skillDef; public LightInfo lightInfo; private bool _lowPriority; public bool lowPriority { get { return _lowPriority; } set { _lowPriority = value; } } public bool Compare(LightInfo t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)t.light == (Object)(object)originalLight; } public bool NullCheck() { return (Object)(object)originalLight == (Object)null; } public void Add(ref LightInfo t) { t.AddSkillVariant(this); } public void AddPending(SkinDefParams skinDefParams, LightInfo t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(skinDefParams, t, this); } public void AddPending(ModelSkinController modelSkinController, LightInfo t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(modelSkinController, t, this); } } [Serializable] public struct ProjectileGhostReplacementSkillVariant : ISkillVariantStruct<ProjectileGhostReplacement> { public GameObject projectilePrefab; public SkillDef skillDef; public GameObject projectileGhostReplacementPrefab; private bool _lowPriority; public bool lowPriority { get { return _lowPriority; } set { _lowPriority = value; } } public bool Compare(ProjectileGhostReplacement t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)t.projectilePrefab == (Object)(object)projectilePrefab; } public bool NullCheck() { return (Object)(object)projectilePrefab == (Object)null; } public void Add(ref ProjectileGhostReplacement t) { t.AddSkillVariant(this); } public void AddPending(SkinDefParams skinDefParams, ProjectileGhostReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(skinDefParams, t, this); } public void AddPending(ModelSkinController modelSkinController, ProjectileGhostReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(modelSkinController, t, this); } } [Serializable] public struct MinionSkinReplacementSkillVariant : ISkillVariantStruct<MinionSkinReplacement> { public GameObject minionBodyPrefab; public SkillDef skillDef; public SkinDef minionSkin; private bool _lowPriority; public bool lowPriority { get { return _lowPriority; } set { _lowPriority = value; } } public bool Compare(MinionSkinReplacement t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return (Object)(object)t.minionBodyPrefab == (Object)(object)minionBodyPrefab; } public bool NullCheck() { return (Object)(object)minionBodyPrefab == (Object)null; } public void Add(ref MinionSkinReplacement t) { t.AddSkillVariant(this); } public void AddPending(SkinDefParams skinDefParams, MinionSkinReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(skinDefParams, t, this); } public void AddPending(ModelSkinController modelSkinController, MinionSkinReplacement t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddPendingSkillVariant(modelSkinController, t, this); } } [CompilerGenerated] private sealed class <<SurvivorCatalog_SetSurvivorDefs1>g__runLoadCoroutine|6_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<SurvivorCatalog_SetSurvivorDefs1>g__runLoadCoroutine|6_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = parallelCoroutine; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private static class <>O { public static hook_ctor <0>__MeshReplacementTemplate_ctor; public static hook_ctor <1>__GhostReplacementTemplate_ctor; public static hook_ctor <2>__LightReplacementTemplate_ctor; public static hook_ctor <3>__MinionSkinTemplate_ctor; public static Manipulator <4>__ProjectileGhostReplacementManager_FindProjectileGhostPrefab; public static Manipulator <5>__MasterSummon_Perform; public static Manipulator <6>__SurvivorCatalog_SetSurvivorDefs; public static hook_SetSurvivorDefs <7>__SurvivorCatalog_SetSurvivorDefs1; public static Action<SurvivorDef> <8>__SetLobbySkinToBodySkin; public static Func<CharacterBody, List<SkillDef>> <9>__CollectSkills; public static <>F{00000001}<MinionSkinTemplate, List<SkillDef>, SkinDef> <10>__ApplyMinionSkinVariants; public static Func<GhostReplacementTemplate, CharacterBody, GameObject> <11>__ReplaceProjectileGhost; } [CompilerGenerated] private sealed class <SetLobbySkinToBodySkinAsync>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SurvivorDef survivorDef; private ModelLocator <modelLocator>5__2; private ModelSkinController <bodyPrefabModelSkinController>5__3; private ModelSkinController <displayPrefabModelSkinController>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetLobbySkinToBodySkinAsync>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <modelLocator>5__2 = null; <bodyPrefabModelSkinController>5__3 = null; <displayPrefabModelSkinController>5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <modelLocator>5__2 = (Object.op_Implicit((Object)(object)survivorDef.bodyPrefab) ? survivorDef.bodyPrefab.GetComponent<ModelLocator>() : null); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if (!Object.op_Implicit((Object)(object)<modelLocator>5__2)) { return false; } <bodyPrefabModelSkinController>5__3 = (Object.op_Implicit((Object)(object)<modelLocator>5__2._modelTransform) ? ((Component)<modelLocator>5__2._modelTransform).GetComponent<ModelSkinController>() : null); <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; if (!Object.op_Implicit((Object)(object)<bodyPrefabModelSkinController>5__3)) { return false; } <displayPrefabModelSkinController>5__4 = (Object.op_Implicit((Object)(object)survivorDef.displayPrefab) ? survivorDef.displayPrefab.GetComponentInChildren<ModelSkinController>() : null); <>2__current = null; <>1__state = 3; return true; case 3: { <>1__state = -1; if (!Object.op_Implicit((Object)(object)<displayPrefabModelSkinController>5__4)) { return false; } SkinDef[] skins = <bodyPrefabModelSkinController>5__3.skins; SkinDef[] skins2 = <displayPrefabModelSkinController>5__4.skins; if (skins == null || skins2 == null || skins.Length != skins2.Length) { return false; } for (int i = 0; i < skins.Length; i++) { SkinDef val = skins[i]; SkinDef val2 = skins2[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && !lobbySkinDefToBodySkinDef.ContainsKey(val2)) { lobbySkinDefToBodySkinDef.Add(val2, val); } } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Dictionary<SkinDef, BodyIndex> skinToBody = new Dictionary<SkinDef, BodyIndex>(); private static Dictionary<SkinDef, SkinDef> lobbySkinDefToBodySkinDef = new Dictionary<SkinDef, SkinDef>(); private static ParallelCoroutine parallelCoroutine; private static bool _hooksSet; private static bool _isLoaded; internal static void SetHooks() { //IL_0038: 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_0043: Expected O, but got Unknown //IL_0058: 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_0063: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //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_00a3: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown if (!_hooksSet) { _hooksSet = true; SkinsPlugin.harmonyPatcher.CreateClassProcessor(typeof(Patches)).Patch(); object obj = <>O.<0>__MeshReplacementTemplate_ctor; if (obj == null) { hook_ctor val = MeshReplacementTemplate_ctor; <>O.<0>__MeshReplacementTemplate_ctor = val; obj = (object)val; } MeshReplacementTemplate.ctor += (hook_ctor)obj; object obj2 = <>O.<1>__GhostReplacementTemplate_ctor; if (obj2 == null) { hook_ctor val2 = GhostReplacementTemplate_ctor; <>O.<1>__GhostReplacementTemplate_ctor = val2; obj2 = (object)val2; } GhostReplacementTemplate.ctor += (hook_ctor)obj2; object obj3 = <>O.<2>__LightReplacementTemplate_ctor; if (obj3 == null) { hook_ctor val3 = LightReplacementTemplate_ctor; <>O.<2>__LightReplacementTemplate_ctor = val3; obj3 = (object)val3; } LightReplacementTemplate.ctor += (hook_ctor)obj3; object obj4 = <>O.<3>__MinionSkinTemplate_ctor; if (obj4 == null) { hook_ctor val4 = MinionSkinTemplate_ctor; <>O.<3>__MinionSkinTemplate_ctor = val4; obj4 = (object)val4; } MinionSkinTemplate.ctor += (hook_ctor)obj4; object obj5 = <>O.<4>__ProjectileGhostReplacementManager_FindProjectileGhostPrefab; if (obj5 == null) { Manipulator val5 = ProjectileGhostReplacementManager_FindProjectileGhostPrefab; <>O.<4>__ProjectileGhostReplacementManager_FindProjectileGhostPrefab = val5; obj5 = (object)val5; } ProjectileGhostReplacementManager.FindProjectileGhostPrefab += (Manipulator)obj5; object obj6 = <>O.<5>__MasterSummon_Perform; if (obj6 == null) { Manipulator val6 = MasterSummon_Perform; <>O.<5>__MasterSummon_Perform = val6; obj6 = (object)val6; } MasterSummon.Perform += (Manipulator)obj6; object obj7 = <>O.<6>__SurvivorCatalog_SetSurvivorDefs; if (obj7 == null) { Manipulator val7 = SurvivorCatalog_SetSurvivorDefs; <>O.<6>__SurvivorCatalog_SetSurvivorDefs = val7; obj7 = (object)val7; } SurvivorCatalog.SetSurvivorDefs += (Manipulator)obj7; object obj8 = <>O.<7>__SurvivorCatalog_SetSurvivorDefs1; if (obj8 == null) { hook_SetSurvivorDefs val8 = SurvivorCatalog_SetSurvivorDefs1; <>O.<7>__SurvivorCatalog_SetSurvivorDefs1 = val8; obj8 = (object)val8; } SurvivorCatalog.SetSurvivorDefs += (hook_SetSurvivorDefs)obj8; } } private static void SurvivorCatalog_SetSurvivorDefs1(orig_SetSurvivorDefs orig, SurvivorDef[] newSurvivorDefs) { orig.Invoke(newSurvivorDefs); if (parallelCoroutine != null) { ((MonoBehaviour)RoR2Application.instance).StartCoroutine(runLoadCoroutine()); } [IteratorStateMachine(typeof(<<SurvivorCatalog_SetSurvivorDefs1>g__runLoadCoroutine|6_0>d))] static IEnumerator runLoadCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<SurvivorCatalog_SetSurvivorDefs1>g__runLoadCoroutine|6_0>d(0); } } internal static void UnsetHooks() { //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_0021: Expected O, but got Unknown //IL_0036: 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_0041: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown _hooksSet = false; object obj = <>O.<0>__MeshReplacementTemplate_ctor; if (obj == null) { hook_ctor val = MeshReplacementTemplate_ctor; <>O.<0>__MeshReplacementTemplate_ctor = val; obj = (object)val; } MeshReplacementTemplate.ctor -= (hook_ctor)obj; object obj2 = <>O.<1>__GhostReplacementTemplate_ctor; if (obj2 == null) { hook_ctor val2 = GhostReplacementTemplate_ctor; <>O.<1>__GhostReplacementTemplate_ctor = val2; obj2 = (object)val2; } GhostReplacementTemplate.ctor -= (hook_ctor)obj2; object obj3 = <>O.<2>__LightReplacementTemplate_ctor; if (obj3 == null) { hook_ctor val3 = LightReplacementTemplate_ctor; <>O.<2>__LightReplacementTemplate_ctor = val3; obj3 = (object)val3; } LightReplacementTemplate.ctor -= (hook_ctor)obj3; object obj4 = <>O.<3>__MinionSkinTemplate_ctor; if (obj4 == null) { hook_ctor val4 = MinionSkinTemplate_ctor; <>O.<3>__MinionSkinTemplate_ctor = val4; obj4 = (object)val4; } MinionSkinTemplate.ctor -= (hook_ctor)obj4; object obj5 = <>O.<4>__ProjectileGhostReplacementManager_FindProjectileGhostPrefab; if (obj5 == null) { Manipulator val5 = ProjectileGhostReplacementManager_FindProjectileGhostPrefab; <>O.<4>__ProjectileGhostReplacementManager_FindProjectileGhostPrefab = val5; obj5 = (object)val5; } ProjectileGhostReplacementManager.FindProjectileGhostPrefab -= (Manipulator)obj5; object obj6 = <>O.<5>__MasterSummon_Perform; if (obj6 == null) { Manipulator val6 = MasterSummon_Perform; <>O.<5>__MasterSummon_Perform = val6; obj6 = (object)val6; } MasterSummon.Perform -= (Manipulator)obj6; object obj7 = <>O.<6>__SurvivorCatalog_SetSurvivorDefs; if (obj7 == null) { Manipulator val7 = SurvivorCatalog_SetSurvivorDefs; <>O.<6>__SurvivorCatalog_SetSurvivorDefs = val7; obj7 = (object)val7; } SurvivorCatalog.SetSurvivorDefs -= (Manipulator)obj7; } private static void SurvivorCatalog_SetSurvivorDefs(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int locID = 4; int num = default(int); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(SurvivorCatalog), "survivorDefs"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdelemRef(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locID) })) { val.Emit(OpCodes.Ldloc, locID); val.EmitDelegate<Action<SurvivorDef>>((Action<SurvivorDef>)SetLobbySkinToBodySkin); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } private static void MinionSkinTemplate_ctor(orig_ctor orig, ref MinionSkinTemplate self, MinionSkinReplacement minionSkinReplacement) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) self.SetSkillVariants(minionSkinReplacement.GetSkillVariants()); orig.Invoke(ref self, minionSkinReplacement); } private static void MasterSummon_Perform(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int count = il.Body.Variables.Count; il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(List<SkillDef>)))); il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(SkinDef)))); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(CharacterBody), "master")), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2) })) { val.Emit(OpCodes.Ldloc_1); val.EmitDelegate<Func<CharacterBody, List<SkillDef>>>((Func<CharacterBody, List<SkillDef>>)CollectSkills); val.Emit(OpCodes.Stloc, count); il.Body.Variables.Add(new VariableDefinition(il.Import(typeof(List<SkillDef>)))); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<MinionSkinTemplate>(x, "minionSkin") })) { Instruction next = val.Next; Instruction prev = val.Prev; int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Dup); val.Emit(OpCodes.Ldloc, count); val.EmitDelegate<<>F{00000001}<MinionSkinTemplate, List<SkillDef>, SkinDef>>((<>F{00000001}<MinionSkinTemplate, List<SkillDef>, SkinDef>)ApplyMinionSkinVariants); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Stloc, count + 1); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null)); val.Emit(OpCodes.Brfalse_S, prev); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldloc, count + 1); val.Emit(OpCodes.Br, next); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 2 failed!")); } } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!")); } } private static void LightReplacementTemplate_ctor(orig_ctor orig, ref LightReplacementTemplate self, LightInfo source, GameObject rootObject) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) self.SetSkillVariants(source.GetSkillVariants()); orig.Invoke(ref self, source, rootObject); } private static void GhostReplacementTemplate_ctor(orig_ctor orig, ref GhostReplacementTemplate self, ProjectileGhostReplacement projectileGhostReplacement) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) self.SetSkillVariants(projectileGhostReplacement.GetSkillVariants()); orig.Invoke(ref self, projectileGhostReplacement); } private static void ProjectileGhostReplacementManager_FindProjectileGhostPrefab(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel iLLabel = null; Instruction val2 = il.Instrs[il.Instrs.Count - 1]; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 5), (Instruction x) => ILPatternMatchingExt.MatchLdfld<GhostReplacementTemplate>(x, "projectileIndex"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ProjectileController>(x, "catalogIndex"), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref iLLabel) })) { val.Emit(OpCodes.Ldloc, 5); val.Emit(OpCodes.Ldloc, 1); val.EmitDelegate<Func<GhostReplacementTemplate, CharacterBody, GameObject>>((Func<GhostReplacementTemplate, CharacterBody, GameObject>)ReplaceProjectileGhost); val.Emit(OpCodes.Dup); val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null)); val.Emit(OpCodes.Brtrue_S, val2); val.Emit(OpCodes.Pop); } else { SkinsPlugin.Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } private static void MeshReplacementTemplate_ctor(orig_ctor orig, ref MeshReplacementTemplate self, MeshReplacement source, GameObject rootObject) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) self.SetSkillVariants(source.GetSkillVariants()); orig.Invoke(ref self, source, rootObject); } private static void HandleSkinCustomGameobjectComponent(CharacterModel characterModel, Transform transform) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)transform) || !Object.op_Implicit((Object)(object)characterModel)) { return; } SkinCustomGameobjectComponent component = ((Component)transform).GetComponent<SkinCustomGameobjectComponent>(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.characterModel = characterModel; if (characterModel.baseLightInfos != null && component.extraLightInfos != null && component.extraLightInfos.Length != 0) { int num = characterModel.baseLightInfos.Length; Array.Resize(ref characterModel.baseLightInfos, num + component.extraLightInfos.Length); for (int i = 0; i < component.extraLightInfos.Length; i++) { characterModel.baseLightInfos[i + num] = component.extraLightInfos[i]; } } if (characterModel.baseRendererInfos != null && component.extraRendererInfos != null && component.extraRendererInfos.Length != 0) { int num2 = characterModel.baseRendererInfos.Length; Array.Resize(ref characterModel.baseRendererInfos, num2 + component.extraRendererInfos.Length); for (int j = 0; j < component.extraRendererInfos.Length; j++) { characterModel.baseRendererInfos[j + num2] = component.extraRendererInfos[j]; } } } private static void SetLobbySkinToBodySkin(SurvivorDef survivorDef) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)survivorDef)) { if (parallelCoroutine == null) { parallelCoroutine = new ParallelCoroutine(); } parallelCoroutine.Add(SetLobbySkinToBodySkinAsync(survivorDef)); } } [IteratorStateMachine(typeof(<SetLobbySkinToBodySkinAsync>d__25))] private static IEnumerator SetLobbySkinToBodySkinAsync(SurvivorDef survivorDef) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetLobbySkinToBodySkinAsync>d__25(0) { survivorDef = survivorDef }; } private static List<SkillDef> CacheSkillDefs(GameObject gameObject, RuntimeSkin runtimeSkin) { HurtBoxGroup component = gameObject.GetComponent<HurtBoxGroup>(); if ((Object)(object)component == (Object)null) { return CacheSkillDefsInLobby(gameObject, runtimeSkin); } HurtBox mainHurtBox = component.mainHurtBox; if ((Object)(object)mainHurtBox == (Object)null) { return CacheSkillDefsInLobby(gameObject, runtimeSkin); } HealthComponent healthComponent = mainHurtBox.healthComponent; if ((Object)(object)healthComponent == (Object)null) { return CacheSkillDefsInLobby(gameObject, runtimeSkin); } CharacterBody body = healthComponent.body; if ((Object)(object)body == (Object)null) { return null; } return CollectSkills(body); } private static List<SkillDef> CollectSkills(CharacterBody characterBody) { SkillLocator skillLocator = characterBody.skillLocator; if ((Object)(object)skillLocator == (Object)null) { return null; } if (skillLocator.allSkills == null) { return null; } List<SkillDef> list = new List<SkillDef>(); GenericSkill[] allSkills = skillLocator.allSkills; foreach (GenericSkill val in allSkills) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.baseSkill == (Object)null)) { list.Add(val.baseSkill); } } return list; } private static List<SkillDef> CacheSkillDefsInLobby(GameObject gameObject, RuntimeSkin runtimeSkin) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_005b: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) SkinDef skinDef = runtimeSkin.GetSkinDef(); if ((Object)(object)skinDef == (Object)null) { return null; } BodyIndex val; if (skinToBody.ContainsKey(skinDef)) { val = skinToBody[skinDef]; } else { val = (BodyIndex)(-1); if (lobbySkinDefToBodySkinDef.TryGetValue(skinDef, out SkinDef value) && skinToBody.ContainsKey(value)) { val = skinToBody[value]; } } if ((int)val == -1) { return null; } GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(val); if ((Object)(object)bodyPrefab == (Object)null) { return null; } SurvivorMannequinSlotController componentInParent = gameObject.GetComponentInParent<SurvivorMannequinSlotController>(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent.networkUser == (Object)null) { return null; } Loadout val2 = Loadout.RequestInstance(); componentInParent.networkUser.networkLoadout.CopyLoadout(val2); GenericSkill[] components = bodyPrefab.GetComponents<GenericSkill>(); if (components == null || components.Length == 0) { return null; } List<SkillDef> list = new List<SkillDef>(); for (int i = 0; i < components.Length; i++) { GenericSkill val3 = components[i]; if (!((Object)(object)val3 == (Object)null)) { SkillDef skillDef = val3.skillFamily.variants[val2.bodyLoadoutManager.GetSkillVariant(val, i)].skillDef; if (!((Object)(object)skillDef == (Object)null)) { list.Add(skillDef); } } } return list; } private static void ApplyRendererInfoSkillVariants(ref RendererInfo rendererInfoData, List<SkillDef> skillDefs) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (skillDefs == null) { return; } object[] skillVariants = rendererInfoData.GetSkillVariants(); if (skillVariants == null) { return; } bool flag = false; object[] array = skillVariants; foreach (object obj in array) { if (obj != null) { RendererInfoSkillVariant rendererInfoSkillVariant = (RendererInfoSkillVariant)obj; SkillDef skillDef = rendererInfoSkillVariant.skillDef; if (!((Object)(object)skillDef == (Object)null) && skillDefs.Contains(skillDef) && (!flag || !rendererInfoSkillVariant.lowPriority)) { rendererInfoData.defaultMaterial = rendererInfoSkillVariant.material; rendererInfoData.defaultShadowCastingMode = rendererInfoSkillVariant.defaultShadowCastingMode; rendererInfoData.ignoreOverlays = rendererInfoSkillVariant.ignoreOverlays; rendererInfoData.hideOnDeath = rendererInfoSkillVariant.hideOnDeath; rendererInfoData.ignoresMaterialOverrides = rendererInfoSkillVariant.ignoresMaterialOverrides; _ = rendererInfoSkillVariant.lowPriority; } } } } private static Mesh ApplyMeshReplacementSkillVariants(ref MeshReplacementTemplate meshReplacementTemplate, List<SkillDef> skillDefs) { Mesh result = null; if (skillDefs == null) { return result; } object[] skillVariants = meshReplacementTemplate.GetSkillVariants(); if (skillVariants == null) { return result; } bool flag = false; object[] array = skillVariants; foreach (object obj in array) { if (obj == null) { continue; } MeshReplacementSkillVariant meshReplacementSkillVariant = (MeshReplacementSkillVariant)obj; SkillDef skillDef = meshReplacementSkillVariant.skillDef; if (!((Object)(object)skillDef == (Object)null) && skillDefs.Contains(skillDef) && (!flag || !meshReplacementSkillVariant.lowPriority)) { result = meshReplacementSkillVariant.mesh; if (!meshReplacementSkillVariant.lowPriority) { flag = true; } } } return result; } private static SkinDef ApplyMinionSkinVariants(ref MinionSkinTemplate minionSkinTemplate, List<SkillDef> skillDefs) { SkinDef minionSkin = minionSkinTemplate.minionSkin; if (skillDefs == null) { return minionSkin; } object[] skillVariants = minionSkinTemplate.GetSkillVariants(); if (skillVariants == null) { return minionSkin; } bool flag = false; object[] array = skillVariants; foreach (object obj in array) { if (obj == null) { continue; } MinionSkinReplacementSkillVariant minionSkinReplacementSkillVariant = (MinionSkinReplacementSkillVariant)obj; SkillDef skillDef = minionSkinReplacementSkillVariant.skillDef; if (!((Object)(object)skillDef == (Object)null) && skillDefs.Contains(skillDef) && (!flag || !minionSkinReplacementSkillVariant.lowPriority)) { minionSkin = minionSkinReplacementSkillVariant.minionSkin; if (minionSkinReplacementSkillVariant.lowPriority) { flag = true; } } } return minionSkin; } private static bool CheckForLightInfoSkillVariants(ref LightReplacementTemplate lightReplacementTemplate, List<SkillDef> skillDefs) { if (skillDefs == null) { return false; } object[] skillVariants = lightReplacementTemplate.GetSkillVariants(); if (skillVariants == null) { return false; } object[] array = skillVariants; foreach (object obj in array) { if (obj != null) { SkillDef skillDef = ((LightInfoSkillVariant)obj).skillDef; if (!((Object)(object)skillDef == (Object)null) && skillDefs.Contains(skillDef)) { return true; } } } return false; } private static LightInfo ApplyLightInfoSkillVariants(ref LightReplacementTemplate lightReplacementTemplate, List<SkillDef> skillDefs) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) //IL_0017: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) LightInfo result = lightReplacementTemplate.data; if (skillDefs == null) { return result; } object[] skillVariants = lightReplacementTemplate.GetSkillVariants(); if (skillVariants == null) { return result; } bool flag = false; object[] array = skillVariants; foreach (object obj in array) { if (obj == null) { continue; } LightInfoSkillVariant lightInfoSkillVariant = (LightInfoSkillVariant)obj; SkillDef skillDef = lightInfoSkillVariant.skillDef; if (!((Object)(object)skillDef == (Object)null) && skillDefs.Contains(skillDef) && (!flag || !lightInfoSkillVariant.lowPriority)) { result = lightInfoSkillVariant.lightInfo; if (!lightInfoSkillVariant.lowPriority) { flag = true; } } } return result; } private static void AddSkinToBodyDictionary(SkinDef skinDef, BodyIndex bodyIndex) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!skinToBody.ContainsKey(skinDef)) { skinToBody.Add(skinDef, bodyIndex); } } private static void ApplyPendingSkinSkillVariations() { _isLoaded = true; foreach (SkinSkillVariantsDef pendingSkinSkillVariantsDef in SkinSkillVariantsDef.pendingSkinSkillVariantsDefs) { if (!((Object)(object)pendingSkinSkillVariantsDef == (Object)null)) { pendingSkinSkillVariantsDef.Apply(); } } } private static void AddSkinDefToRuntimeSkin(SkinDef skinDef) { skinDef.runtimeSkin.SetSkinDef(skinDef); } internal static SkinDefParams GetSkinDefParams(SkinDef skinDef) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) SkinDefParams val = skinDef.skinDefParams; if ((Object)(object)val == (Object)null && skinDef.skinDefParamsAddress != null) { val = (SkinDefParams)((!Object.op_Implicit(((AssetReference)skinDef.skinDefParamsAddress).Asset)) ? ((object)skinDef.skinDefParamsAddress.LoadAsset().WaitForCompletion()) : ((object)/*isinst with value type is only supported in some contexts*/)); } return val; } internal static SkinDefParams GetOptimizedSkinDefParams(SkinDef skinDef) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) SkinDefParams val = skinDef.skinDefParams; if ((Object)(object)val == (Object)null && skinDef.optimizedSkinDefParamsAddress != null) { val = (SkinDefParams)((!Object.op_Implicit(((AssetReference)skinDef.optimizedSkinDefParamsAddress).Asset)) ? ((object)skinDef.optimizedSkinDefParamsAddress.LoadAsset().WaitForCompletion()) : ((object)/*isinst with value type is only supported in some contexts*/)); } return val; } private static ref RendererInfo GetRendererInfoByName(SkinDefParams skinDefParams, string rendererName) { RendererInfo[] rendererInfos = skinDefParams.rendererInfos; for (int i = 0; i < rendererInfos.Length; i++) { ref RendererInfo reference = ref rendererInfos[i]; if (!((Object)(object)reference.renderer == (Object)null) && ((Object)reference.renderer).name == rendererName) { return ref reference; } } throw new NullReferenceException($"Couldn't find renderer \"{rendererName}\" for \"{skinDefParams}\""); } private static ref MeshReplacement GetMeshReplacementByName(SkinDefParams skinDefParams, string meshRendererName) { MeshReplacement[] meshReplacements = skinDefParams.meshReplacements; for (int i = 0; i < meshReplacements.Length; i++) { ref MeshReplacement reference = ref meshReplacements[i]; if (!((Object)(object)reference.renderer == (Object)null) && ((Object)reference.renderer).name == meshRendererName) { return ref reference; } } throw new NullReferenceException($"Couldn't find renderer \"{meshRendererName}\" for \"{skinDefParams}\""); } private static ref LightInfo GetLightInfoByName(SkinDefParams skinDefParams, string lightInfoName) { LightInfo[] lightReplacements = skinDefParams.lightReplacements; for (int i = 0; i < lightReplacements.Length; i++) { ref LightInfo reference = ref lightReplacements[i]; if (!((Object)(object)reference.light == (Object)null) && ((Object)reference.light).name == lightInfoName) { return ref reference; } } throw new NullReferenceException($"Couldn't find light \"{lightInfoName}\" for \"{skinDefParams}\""); } private static ref ProjectileGhostReplacement GetProjectileGhostReplacementByName(SkinDefParams skinDefParams, string projectileName) { ProjectileGhostReplacement[] projectileGhostReplacements = skinDefParams.projectileGhostReplacements; for (int i = 0; i < projectileGhostReplacements.Length; i++) { ref ProjectileGhostReplacement reference = ref projectileGhostReplacements[i]; if (!((Object)(object)reference.projectilePrefab == (Object)null) && ((Object)reference.projectilePrefab).name == projectileName) { return ref reference; } } throw new NullReferenceException($"Couldn't find projectile \"{projectileName}\" for \"{skinDefParams}\""); } private static ref ProjectileGhostReplacement GetProjectileGhostReplacementByPrefab(SkinDefParams skinDefParams, GameObject projectilePrefab) { ProjectileGhostReplacement[] projectileGhostReplacements = skinDefParams.projectileGhostReplacements; for (int i = 0; i < projectileGhostReplacements.Length; i++) { ref ProjectileGhostReplacement reference = ref projectileGhostReplacements[i]; if (!((Object)(object)reference.projectilePrefab == (Object)null) && (Object)(object)reference.projectilePrefab == (Object)(object)projectilePrefab) { return ref reference; } } throw new NullReferenceException($"Couldn't find projectile \"{((Object)projectilePrefab).name}\" for \"{skinDefParams}\""); } private static ref MinionSkinReplacement GetMinionSkinReplacementByName(SkinDefParams skinDefParams, string minionBodyName) { MinionSkinReplacement[] minionSkinReplacements = skinDefParams.minionSkinReplacements; for (int i = 0; i < minionSkinReplacements.Length; i++) { ref MinionSkinReplacement reference = ref minionSkinReplacements[i]; if (!((Object)(object)reference.minionBodyPrefab == (Object)null) && ((Object)reference.minionBodyPrefab).name == minionBodyName) { return ref reference; } } throw new NullReferenceException($"Couldn't find minion body \"{minionBodyName}\" for \"{skinDefParams}\""); } private static ref MinionSkinReplacement GetMinionSkinReplacementByPrefab(SkinDefParams skinDefParams, GameObject minionBodyPrefab) { MinionSkinReplacement[] minionSkinReplacements = skinDefParams.minionSkinReplacements; for (int i = 0; i < minionSkinReplacements.Length; i++) { ref MinionSkinReplacement reference = ref minionSkinReplacements[i]; if (!((Object)(object)reference.minionBodyPrefab == (Object)null) && (Object)(object)reference.minionBodyPrefab == (Object)(object)minionBodyPrefab) { return ref reference; } } throw new NullReferenceException($"Couldn't find minion body \"{minionBodyPrefab}\" for \"{skinDefParams}\""); } internal static void AddItemToObjects<T>(ref object[] objects, T t) { if (objects == null) { objects = new object[1] { t }; } else { int num = objects.Length; Array.Resize(ref objects, num + 1); objects[num] = t; } } private static void RunOnSkinApplied(GameObject gameObject, RuntimeSkin runtimeSkin, List<SkillDef> skillDefs) { SkinDef skinDef = runtimeSkin.GetSkinDef(); if (!((Object)(object)skinDef == (Object)null)) { skinDef.GetOnSkinApplied()?.Invoke(gameObject, skillDefs); } } private static GameObject ReplaceProjectileGhost(GhostReplacementTemplate ghostReplacementTemplate, CharacterBody characterBody) { object[] skillVariants = ghostReplacementTemplate.GetSkillVariants(); if (skillVariants == null || skillVariants.Length == 0) { return null; } SkillLocator skillLocator = characterBody.skillLocator; if ((Object)(object)skillLocator == (Object)null) { return null; } GenericSkill[] allSkills = skillLocator.allSkills; if (allSkills == null || allSkills.Length == 0) { return null; } List<SkillDef> list = new List<SkillDef>(); GenericSkill[] array = allSkills; foreach (GenericSkill val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.baseSkill == (Object)null)) { list.Add(val.baseSkill); } } GameObject result = null; bool flag = false; for (int j = 0; j < skillVariants.Length; j++) { ProjectileGhostReplacementSkillVariant projectileGhostReplacementSkillVariant = (ProjectileGhostReplacementSkillVariant)skillVariants[j]; if (!((Object)(object)projectileGhostReplacementSkillVariant.skillDef == (Object)null) && list.Contains(projectileGhostReplacementSkillVariant.skillDef) && (!flag || !projectileGhostReplacementSkillVariant.lowPriority)) { result = projectileGhostReplacementSkillVariant.projectileGhostReplacementPrefab; if (!projectileGhostReplacementSkillVariant.lowPriority) { flag = true; } } } return result; } private static SkinSkillVariantsDef GetOrCreateSkinSkillVariantsDef(SkinDefParams skinDefParams) { SkinSkillVariantsDef skinSkillVariantsDef = skinDefParams.GetSkinSkillVariantsDef(); if ((Object)(object)skinSkillVariantsDef == (Object)null) { skinSkillVariantsDef = ScriptableObject.CreateInstance<SkinSkillVariantsDef>(); ((Object)skinSkillVariantsDef).name = ((Object)skinDefParams).name; skinSkillVariantsDef.Register(); skinSkillVariantsDef.AddSkinDefParams(skinDefParams); skinDefParams.SetSkinSkillVariantsDef(skinSkillVariantsDef); } return skinSkillVariantsDef; } private static SkinSkillVariantsDef GetOrCreateSkinSkillVariantsDef(ModelSkinController modelSkinController) { SkinSkillVariantsDef skinSkillVariantsDef = modelSkinController.GetSkinSkillVariantsDef(); if ((Object)(object)skinSkillVariantsDef == (Object)null) { skinSkillVariantsDef = ScriptableObject.CreateInstance<SkinSkillVariantsDef>(); ((Object)skinSkillVariantsDef).name = ((Object)modelSkinController).name; skinSkillVariantsDef.Register(); skinSkillVariantsDef.modelSkinController = modelSkinController; modelSkinController.SetSkinSkillVariantsDef(skinSkillVariantsDef); } return skinSkillVariantsDef; } private static void AddPendingSkillVariant(SkinDefParams skinDefParams, RendererInfo rendererInfo, RendererInfoSkillVariant rendererInfoSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(skinDefParams); rendererInfoSkillVariant.renderer = rendererInfo.renderer; orCreateSkinSkillVariantsDef.AddRendererInfoSkillVariant(rendererInfoSkillVariant); } private static void AddPendingSkillVariant(ModelSkinController modelSkinController, RendererInfo rendererInfo, RendererInfoSkillVariant rendererInfoSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(modelSkinController); rendererInfoSkillVariant.renderer = rendererInfo.renderer; orCreateSkinSkillVariantsDef.AddRendererInfoSkillVariant(rendererInfoSkillVariant); } private static void AddPendingSkillVariant(SkinDefParams skinDefParams, MeshReplacement meshReplacement, MeshReplacementSkillVariant meshReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(skinDefParams); meshReplacementSkillVariant.renderer = meshReplacement.renderer; orCreateSkinSkillVariantsDef.AddMeshReplacementSkillVariant(meshReplacementSkillVariant); } private static void AddPendingSkillVariant(ModelSkinController modelSkinController, MeshReplacement meshReplacement, MeshReplacementSkillVariant meshReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(modelSkinController); meshReplacementSkillVariant.renderer = meshReplacement.renderer; orCreateSkinSkillVariantsDef.AddMeshReplacementSkillVariant(meshReplacementSkillVariant); } private static void AddPendingSkillVariant(SkinDefParams skinDefParams, LightInfo lightInfo, LightInfoSkillVariant lightInfoSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(skinDefParams); lightInfoSkillVariant.originalLight = lightInfo.light; orCreateSkinSkillVariantsDef.AddLightInfoSkillVariant(lightInfoSkillVariant); } private static void AddPendingSkillVariant(ModelSkinController modelSkinController, LightInfo lightInfo, LightInfoSkillVariant lightInfoSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(modelSkinController); lightInfoSkillVariant.originalLight = lightInfo.light; orCreateSkinSkillVariantsDef.AddLightInfoSkillVariant(lightInfoSkillVariant); } private static void AddPendingSkillVariant(SkinDefParams skinDefParams, ProjectileGhostReplacement projectileGhostReplacement, ProjectileGhostReplacementSkillVariant projectileGhostReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(skinDefParams); projectileGhostReplacementSkillVariant.projectilePrefab = projectileGhostReplacement.projectilePrefab; orCreateSkinSkillVariantsDef.AddProjectileGhostReplacementSkillVariant(projectileGhostReplacementSkillVariant); } private static void AddPendingSkillVariant(ModelSkinController modelSkinController, ProjectileGhostReplacement projectileGhostReplacement, ProjectileGhostReplacementSkillVariant projectileGhostReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(modelSkinController); projectileGhostReplacementSkillVariant.projectilePrefab = projectileGhostReplacement.projectilePrefab; orCreateSkinSkillVariantsDef.AddProjectileGhostReplacementSkillVariant(projectileGhostReplacementSkillVariant); } private static void AddPendingSkillVariant(SkinDefParams skinDefParams, MinionSkinReplacement minionSkinReplacement, MinionSkinReplacementSkillVariant minionSkinReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(skinDefParams); minionSkinReplacementSkillVariant.minionBodyPrefab = minionSkinReplacement.minionBodyPrefab; orCreateSkinSkillVariantsDef.AddMinionSkinReplacementSkillVariant(minionSkinReplacementSkillVariant); } private static void AddPendingSkillVariant(ModelSkinController modelSkinController, MinionSkinReplacement minionSkinReplacement, MinionSkinReplacementSkillVariant minionSkinReplacementSkillVariant) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) SkinSkillVariantsDef orCreateSkinSkillVariantsDef = GetOrCreateSkinSkillVariantsDef(modelSkinController); minionSkinReplacementSkillVariant.minionBodyPrefab = minionSkinReplacement.minionBodyPrefab; orCreateSkinSkillVariantsDef.AddMinionSkinReplacementSkillVariant(minionSkinReplacementSkillVariant); } private static void HandleAddition<T1, T2>(SkinDefParams skinDefParams, T1 t1, ref T2 t2) where T1 : ISkillVariantStruct<T2> { if (_isLoaded) { t1.Add(ref t2); } else { t1.AddPending(skinDefParams, t2); } } private static void HandleAddition<T1, T2>(ModelSkinController modelSkinController, T1 t1, ref T2 t2) where T1 : ISkillVariantStruct<T2> { if (_isLoaded) { t1.Add(ref t2); } else { t1.AddPending(modelSkinController, t2); } } private static ref object[] GetSkillVariants(this ref MeshReplacementTemplate meshReplacementTemplate) { return ref SkinAPIInterop.GetSkillVariants(ref meshReplacementTemplate); } private static void SetSkillVariants(this ref MeshReplacementTemplate meshReplacementTemplate, object[] value) { SkinAPIInterop.SetSkillVariants(ref meshReplacementTemplate, value); } private static ref object[] GetSkillVariants(this ref LightReplacementTemplate lightReplacementTemplate) { return ref SkinAPIInterop.GetSkillVariants(ref lightReplacementTemplate); } private static void SetSkillVariants(this ref LightReplacementTemplate lightReplacementTemplate, object[] value) { SkinAPIInterop.SetSkillVariants(ref lightReplacementTemplate, value); } private static ref object[] GetSkillVariants(this ref GhostReplacementTemplate ghostReplacementTemplate) { return ref SkinAPIInterop.GetSkillVariants(ref ghostReplacementTemplate); } private static void SetSkillVariants(this ref GhostReplacementTemplate ghostReplacementTemplate, object[] value) { SkinAPIInterop.SetSkillVariants(ref ghostReplacementTemplate, value); } private static ref object[] GetSkillVariants(this ref MinionSkinTemplate minionSkinTemplate) { return ref SkinAPIInterop.GetSkillVariants(ref minionSkinTemplate); } private static void SetSkillVariants(this ref MinionSkinTemplate minionSkinTemplate, object[] value) { SkinAPIInterop.SetSkillVariants(ref minionSkinTemplate, value); } private static SkinDef GetSkinDef(this RuntimeSkin runtimeSkin) { return SkinAPIInterop.GetSkinDef(runtimeSkin); } private static void SetSkinDef(this RuntimeSkin runtimeSkin, SkinDef skinDef) { SkinAPIInterop.SetSkinDef(runtimeSkin, skinDef); } internal static SkinSkillVariantsDef GetSkinSkillVariantsDef(this SkinDefParams skinDefParams) { if (SkinAPIInterop.GetSkinSkillVariantsDef(skinDefParams) != null) { return SkinAPIInterop.GetSkinSkillVariantsDef(skinDefParams) as SkinSkillVariantsDef; } return null; } internal static void SetSkinSkillVariantsDef(this SkinDefParams skinDefParams, SkinSkillVariantsDef skinSkillVariantsDef) { SkinAPIInterop.SetSkinSkillVariantsDef(skinDefParams, (object)skinSkillVariantsDef); } internal static SkinSkillVariantsDef GetSkinSkillVariantsDef(this ModelSkinController modelSkinController) { if (SkinAPIInterop.GetSkinSkillVariantsDef(modelSkinController) != null) { return SkinAPIInterop.GetSkinSkillVariantsDef(modelSkinController) as SkinSkillVariantsDef; } return null; } internal static void SetSkinSkillVariantsDef(this ModelSkinController modelSkinController, SkinSkillVariantsDef skinSkillVariantsDef) { SkinAPIInterop.SetSkinSkillVariantsDef(modelSkinController, (object)skinSkillVariantsDef); } public static void AddRenderInfoSkillVariant(this SkinDef skinDef, string rendererName, RendererInfoSkillVariant rendererInfoSkillVariant) { GetSkinDefParams(skinDef).AddRenderInfoSkillVariant(rendererName, rendererInfoSkillVariant); } public static void AddRenderInfoSkillVariant(this SkinDefParams skinDefParams, string rendererName, RendererInfoSkillVariant rendererInfoSkillVariant) { SetHooks(); HandleAddition(skinDefParams, rendererInfoSkillVariant, ref GetRendererInfoByName(skinDefParams, rendererName)); } public static void AddRenderInfoSkillVariant(this ModelSkinController modelSkinController, string rendererName, RendererInfoSkillVariant rendererInfoSkillVariant) { SetHooks(); HandleAddition(modelSkinController, rendererInfoSkillVariant, ref GetRendererInfoByName(GetSkinDefParams(modelSkinController.skins[0]), rendererName)); } public static void AddRenderInfoSkillVariant(this SkinDef skinDef, int index, RendererInfoSkillVariant rendererInfoSkillVariant) { GetSkinDefParams(skinDef).AddRenderInfoSkillVariant(index, rendererInfoSkillVariant); } public static void AddRenderInfoSkillVariant(this SkinDefParams skinDefParams, int index, RendererInfoSkillVariant rendererInfoSkillVariant) { SetHooks(); HandleAddition(skinDefParams, rendererInfoSkillVariant, ref skinDefParams.rendererInfos[index]); } public static void AddRenderInfoSkillVariant(this ModelSkinController modelSkinController, int index, RendererInfoSkillVariant rendererInfoSkillVariant) { SetHooks(); HandleAddition(modelSkinController, rendererInfoSkillVariant, ref GetSkinDefParams(modelSkinController.skins[0]).rendererInfos[index]); } public static void AddSkillVariant(this ref RendererInfo rendererInfo, RendererInfoSkillVariant rendererInfoSkillVariant) { SetHooks(); AddItemToObjects(ref rendererInfo.GetSkillVariants(), rendererInfoSkillVariant); } public static void AddMeshReplacementSkillVariant(this SkinDef skinDef, string meshRendererName, MeshReplacementSkillVariant meshReplacementSkillVariant) { GetSkinDefParams(skinDef).AddMeshReplacementSkillVariant(meshRendererName, meshReplacementSkillVariant); } public static void AddMeshReplacementSkillVariant(this SkinDefParams skinDefParams, string meshRendererName, MeshReplacementSkillVariant meshReplacementSkillVariant) { SetHooks(); HandleAddition(skinDefParams, meshReplacementSkillVaria
plugins/R2API.Skins/R2API.Skins.Interop.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using RoR2; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("R2API.Skins")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("R2API.Skins.Interop")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ab0d797efb1b128b8d9132eeb65eec8f64f81fa7")] [assembly: AssemblyProduct("R2API.Skins.Interop")] [assembly: AssemblyTitle("R2API.Skins.Interop")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 R2API.SkinsAPI.Interop { public static class SkinAPIInterop { public static ref object[] GetSkillVariants(ref RendererInfo rendererInfo) { return ref rendererInfo.r2api_skillVariants; } public static void SetSkillVariants(ref RendererInfo rendererInfo, object[] value) { rendererInfo.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref MeshReplacement meshReplacement) { return ref meshReplacement.r2api_skillVariants; } public static void SetSkillVariants(ref MeshReplacement meshReplacement, object[] value) { meshReplacement.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref LightInfo lightInfo) { return ref lightInfo.r2api_skillVariants; } public static void SetSkillVariants(ref LightInfo lightInfo, object[] value) { lightInfo.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref ProjectileGhostReplacement projectileGhostReplacement) { return ref projectileGhostReplacement.r2api_skillVariants; } public static void SetSkillVariants(ref ProjectileGhostReplacement projectileGhostReplacement, object[] value) { projectileGhostReplacement.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref MinionSkinReplacement minionSkinReplacement) { return ref minionSkinReplacement.r2api_skillVariants; } public static void SetSkillVariants(ref MinionSkinReplacement minionSkinReplacement, object[] value) { minionSkinReplacement.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref MeshReplacementTemplate meshReplacementTemplate) { return ref meshReplacementTemplate.r2api_skillVariants; } public static void SetSkillVariants(ref MeshReplacementTemplate meshReplacement, object[] value) { meshReplacement.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref LightReplacementTemplate lightReplacementTemplate) { return ref lightReplacementTemplate.r2api_skillVariants; } public static void SetSkillVariants(ref LightReplacementTemplate lightReplacementTemplate, object[] value) { lightReplacementTemplate.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref GhostReplacementTemplate ghostReplacementTemplate) { return ref ghostReplacementTemplate.r2api_skillVariants; } public static void SetSkillVariants(ref GhostReplacementTemplate ghostReplacementTemplate, object[] value) { ghostReplacementTemplate.r2api_skillVariants = value; } public static ref object[] GetSkillVariants(ref MinionSkinTemplate minionSkinTemplate) { return ref minionSkinTemplate.r2api_skillVariants; } public static void SetSkillVariants(ref MinionSkinTemplate minionSkinTemplate, object[] value) { minionSkinTemplate.r2api_skillVariants = value; } public static SkinDef GetSkinDef(RuntimeSkin runtimeSkin) { return runtimeSkin.r2api_skinDef; } public static void SetSkinDef(RuntimeSkin runtimeSkin, SkinDef value) { runtimeSkin.r2api_skinDef = value; } public static Delegate GetOnSkinApplied(SkinDef skinDef) { return skinDef.r2api_onSkinApplied; } public static void SetOnSkinApplied(SkinDef skinDef, Delegate value) { skinDef.r2api_onSkinApplied = value; } public static object GetSkinSkillVariantsDef(SkinDefParams skinDefParams) { return skinDefParams.r2api_skinSkillVariantsDef; } public static void SetSkinSkillVariantsDef(SkinDefParams skinDefParams, object value) { skinDefParams.r2api_skinSkillVariantsDef = value; } public static object GetSkinSkillVariantsDef(ModelSkinController modelSkinController) { return modelSkinController.r2api_skinSkillVariantsDef; } public static void SetSkinSkillVariantsDef(ModelSkinController modelSkinController, object value) { modelSkinController.r2api_skinSkillVariantsDef = value; } } }
patchers/R2API.Skins/R2API.Skins.Patcher.dll
Decompiled 5 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using Mono.Cecil; [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("R2API.Skins.Patcher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ab0d797efb1b128b8d9132eeb65eec8f64f81fa7")] [assembly: AssemblyProduct("R2API.Skins.Patcher")] [assembly: AssemblyTitle("R2API.Skins.Patcher")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 R2API { internal static class SkinsPatcher { [CompilerGenerated] private sealed class <get_TargetDLLs>d__1 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; string IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <get_TargetDLLs>d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = "RoR2.dll"; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<string> IEnumerable<string>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <get_TargetDLLs>d__1(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<string>)this).GetEnumerator(); } } public const string skillVariants = "r2api_skillVariants"; public const string skinSkillVariantsDef = "r2api_skinSkillVariantsDef"; public static IEnumerable<string> TargetDLLs { [IteratorStateMachine(typeof(<get_TargetDLLs>d__1))] get { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <get_TargetDLLs>d__1(-2); } } public static void Patch(AssemblyDefinition assembly) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown TypeDefinition type = assembly.MainModule.GetType("RoR2.CharacterModel/RendererInfo"); if (type != null) { type.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type2 = assembly.MainModule.GetType("RoR2.SkinDefParams/MeshReplacement"); if (type2 != null) { type2.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type3 = assembly.MainModule.GetType("RoR2.CharacterModel/LightInfo"); if (type3 != null) { type3.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type4 = assembly.MainModule.GetType("RoR2.SkinDefParams/ProjectileGhostReplacement"); if (type4 != null) { type4.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type5 = assembly.MainModule.GetType("RoR2.SkinDefParams/MinionSkinReplacement"); if (type5 != null) { type5.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type6 = assembly.MainModule.GetType("RoR2.SkinDef/MeshReplacementTemplate"); if (type6 != null) { type6.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type7 = assembly.MainModule.GetType("RoR2.SkinDef/LightReplacementTemplate"); if (type7 != null) { type7.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type8 = assembly.MainModule.GetType("RoR2.SkinDef/GhostReplacementTemplate"); if (type8 != null) { type8.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type9 = assembly.MainModule.GetType("RoR2.SkinDef/MinionSkinTemplate"); if (type9 != null) { type9.Fields.Add(new FieldDefinition("r2api_skillVariants", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object[])))); } TypeDefinition type10 = assembly.MainModule.GetType("RoR2.SkinDef"); if (type10 != null) { type10.Fields.Add(new FieldDefinition("r2api_onSkinApplied", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(Delegate)))); TypeDefinition type11 = assembly.MainModule.GetType("RoR2.SkinDef/RuntimeSkin"); if (type11 != null) { type11.Fields.Add(new FieldDefinition("r2api_skinDef", (FieldAttributes)6, assembly.MainModule.ImportReference((TypeReference)(object)type10))); } } TypeDefinition type12 = assembly.MainModule.GetType("RoR2.SkinDefParams"); if (type12 != null) { type12.Fields.Add(new FieldDefinition("r2api_skinSkillVariantsDef", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object)))); } TypeDefinition type13 = assembly.MainModule.GetType("RoR2.ModelSkinController"); if (type13 != null) { type13.Fields.Add(new FieldDefinition("r2api_skinSkillVariantsDef", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(object)))); } } } }