Decompiled source of Rusk of Rain 2 Railgunner v1.3.1
Ruskandgang.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using MonoMod.RuntimeDetour; using MonoMod.RuntimeDetour.HookGen; using RoR2; using RoR2.ContentManagement; using RuneFoxMods.DynamicSkins; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace LookoutRusk { [BepInPlugin("com.Pix97.LookoutRusk", "Lookout Rusk", "1.2.1")] public class LookoutRuskPlugin : BaseUnityPlugin { private class FieldException : Exception { public FieldException(string message, Exception innerException) : base(message, innerException) { } } public class DynamicSkinExtension { private Modification RuskStringLModification; private Modification RuskStringRModification; private Modification RuskTailModification; private Modification RuskEarLModification; private Modification RuskEarRModification; private Modification LookoutRuskStringLModification; private Modification LookoutRuskStringRModification; private Modification LookoutRuskTailModification; private Modification LookoutRuskEarLModification; private Modification LookoutRuskEarRModification; private Modification SunnyStringLModification; private Modification SunnyStringRModification; private Modification SunnyTailModification; private Modification SunnyEarLModification; private Modification SunnyEarRModification; private Modification StarsetStringLModification; private Modification StarsetStringRModification; private Modification StarsetTailModification; private Modification StarsetEarLModification; private Modification StarsetEarRModification; private Modification BoxtankRuskStringLModification; private Modification BoxtankRuskStringRModification; private Modification BoxtankRuskTailModification; private Modification BoxtankRuskEarLModification; private Modification BoxtankRuskEarRModification; private Modification KikoStringLModification; private Modification KikoStringRModification; private Modification KikoTailModification; private Modification KikoEarLModification; private Modification KikoEarRModification; private Modification PinkHAFStringLModification; private Modification PinkHAFStringRModification; private Modification PinkHAFTailModification; private Modification PinkHAFEarLModification; private Modification PinkHAFEarRModification; internal void BeforeStart() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) _DynamicSkinManager.InstanceLogger = ((BaseUnityPlugin)Instance).Logger; new Hook((MethodBase)typeof(SkinDef).GetMethod("Apply"), (Delegate)new Action<Action<SkinDef, GameObject>, SkinDef, GameObject>(_DynamicSkinManager.SkinDefApply)).Apply(); } internal void AfterStart() { InitializeModifications(); InitializeDynamicBones(); AddModificationsToList(); } internal void BeforeBodyCatalogInit() { RailgunnerBodyRuskSkinAddedEvent += onSkinAdded; RailgunnerBodyLookoutRuskSkinAddedEvent += onSkinAdded; RailgunnerBodySunnySkinAddedEvent += onSkinAdded; RailgunnerBodyStarsetSkinAddedEvent += onSkinAdded; RailgunnerBodyBoxtankRuskSkinAddedEvent += onSkinAdded; RailgunnerBodyKikoSkinAddedEvent += onSkinAdded; RailgunnerBodyPinkHAFSkinAddedEvent += onSkinAdded; } internal void AfterBodyCatalogInit() { } private void InitializeModifications() { RuskStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_RUSK_NAME", 67, AffectsBaseModel: true, assetBundle); RuskStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_RUSK_NAME", 62, AffectsBaseModel: true, assetBundle); RuskTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_RUSK_NAME", 114, AffectsBaseModel: true, assetBundle); RuskEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_RUSK_NAME", 32, AffectsBaseModel: true, assetBundle); RuskEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_RUSK_NAME", 34, AffectsBaseModel: true, assetBundle); LookoutRuskStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_LOOKOUTRUSK_NAME", 67, AffectsBaseModel: true, assetBundle); LookoutRuskStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_LOOKOUTRUSK_NAME", 62, AffectsBaseModel: true, assetBundle); LookoutRuskTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_LOOKOUTRUSK_NAME", 114, AffectsBaseModel: true, assetBundle); LookoutRuskEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_LOOKOUTRUSK_NAME", 32, AffectsBaseModel: true, assetBundle); LookoutRuskEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_LOOKOUTRUSK_NAME", 34, AffectsBaseModel: true, assetBundle); SunnyStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_SUNNY_NAME", 67, AffectsBaseModel: true, assetBundle); SunnyStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_SUNNY_NAME", 62, AffectsBaseModel: true, assetBundle); SunnyTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_SUNNY_NAME", 114, AffectsBaseModel: true, assetBundle); SunnyEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_SUNNY_NAME", 32, AffectsBaseModel: true, assetBundle); SunnyEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_SUNNY_NAME", 34, AffectsBaseModel: true, assetBundle); StarsetStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_STARSET_NAME", 67, AffectsBaseModel: true, assetBundle); StarsetStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_STARSET_NAME", 62, AffectsBaseModel: true, assetBundle); StarsetTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_STARSET_NAME", 114, AffectsBaseModel: true, assetBundle); StarsetEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_STARSET_NAME", 32, AffectsBaseModel: true, assetBundle); StarsetEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_STARSET_NAME", 34, AffectsBaseModel: true, assetBundle); BoxtankRuskStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_BOXTANKRUSK_NAME", 67, AffectsBaseModel: true, assetBundle); BoxtankRuskStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_BOXTANKRUSK_NAME", 62, AffectsBaseModel: true, assetBundle); BoxtankRuskTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_BOXTANKRUSK_NAME", 114, AffectsBaseModel: true, assetBundle); BoxtankRuskEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_BOXTANKRUSK_NAME", 32, AffectsBaseModel: true, assetBundle); BoxtankRuskEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_BOXTANKRUSK_NAME", 34, AffectsBaseModel: true, assetBundle); KikoStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_KIKO_NAME", 67, AffectsBaseModel: true, assetBundle); KikoStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_KIKO_NAME", 62, AffectsBaseModel: true, assetBundle); KikoTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_KIKO_NAME", 114, AffectsBaseModel: true, assetBundle); KikoEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_KIKO_NAME", 32, AffectsBaseModel: true, assetBundle); KikoEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_KIKO_NAME", 34, AffectsBaseModel: true, assetBundle); PinkHAFStringLModification = new Modification("StringL.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_PINKHAF_NAME", 67, AffectsBaseModel: true, assetBundle); PinkHAFStringRModification = new Modification("StringR.prefab", "chest", "RailgunnerBody", "PIX97_SKIN_PINKHAF_NAME", 62, AffectsBaseModel: true, assetBundle); PinkHAFTailModification = new Modification("Tail.prefab", "pelvis", "RailgunnerBody", "PIX97_SKIN_PINKHAF_NAME", 114, AffectsBaseModel: true, assetBundle); PinkHAFEarLModification = new Modification("EarL.prefab", "head", "RailgunnerBody", "PIX97_SKIN_PINKHAF_NAME", 32, AffectsBaseModel: true, assetBundle); PinkHAFEarRModification = new Modification("EarR.prefab", "head", "RailgunnerBody", "PIX97_SKIN_PINKHAF_NAME", 34, AffectsBaseModel: true, assetBundle); } private void InitializeDynamicBones() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_031b: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08fd: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_09ad: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_0a35: Unknown result type (might be due to invalid IL or missing references) //IL_0a49: Unknown result type (might be due to invalid IL or missing references) //IL_0a5d: Unknown result type (might be due to invalid IL or missing references) //IL_0ab4: Unknown result type (might be due to invalid IL or missing references) //IL_0ac8: Unknown result type (might be due to invalid IL or missing references) //IL_0adc: Unknown result type (might be due to invalid IL or missing references) //IL_0b33: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: Unknown result type (might be due to invalid IL or missing references) //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bda: Unknown result type (might be due to invalid IL or missing references) //IL_0bfa: Unknown result type (might be due to invalid IL or missing references) //IL_0c62: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c8a: Unknown result type (might be due to invalid IL or missing references) //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) //IL_0d26: Unknown result type (might be due to invalid IL or missing references) //IL_0d3a: Unknown result type (might be due to invalid IL or missing references) //IL_0d91: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_0e10: Unknown result type (might be due to invalid IL or missing references) //IL_0e24: Unknown result type (might be due to invalid IL or missing references) //IL_0e38: Unknown result type (might be due to invalid IL or missing references) //IL_0e8f: Unknown result type (might be due to invalid IL or missing references) //IL_0ea3: Unknown result type (might be due to invalid IL or missing references) //IL_0eb7: Unknown result type (might be due to invalid IL or missing references) //IL_0ed7: Unknown result type (might be due to invalid IL or missing references) //IL_0f3f: Unknown result type (might be due to invalid IL or missing references) //IL_0f53: Unknown result type (might be due to invalid IL or missing references) //IL_0f67: Unknown result type (might be due to invalid IL or missing references) //IL_0f87: Unknown result type (might be due to invalid IL or missing references) //IL_0fef: Unknown result type (might be due to invalid IL or missing references) //IL_1003: Unknown result type (might be due to invalid IL or missing references) //IL_1017: Unknown result type (might be due to invalid IL or missing references) //IL_106e: Unknown result type (might be due to invalid IL or missing references) //IL_1082: Unknown result type (might be due to invalid IL or missing references) //IL_1096: Unknown result type (might be due to invalid IL or missing references) //IL_10ed: Unknown result type (might be due to invalid IL or missing references) //IL_1101: Unknown result type (might be due to invalid IL or missing references) //IL_1115: Unknown result type (might be due to invalid IL or missing references) //IL_116c: Unknown result type (might be due to invalid IL or missing references) //IL_1180: Unknown result type (might be due to invalid IL or missing references) //IL_1194: Unknown result type (might be due to invalid IL or missing references) //IL_11b4: Unknown result type (might be due to invalid IL or missing references) //IL_121c: Unknown result type (might be due to invalid IL or missing references) //IL_1230: Unknown result type (might be due to invalid IL or missing references) //IL_1244: Unknown result type (might be due to invalid IL or missing references) //IL_1264: Unknown result type (might be due to invalid IL or missing references) //IL_12cc: Unknown result type (might be due to invalid IL or missing references) //IL_12e0: Unknown result type (might be due to invalid IL or missing references) //IL_12f4: Unknown result type (might be due to invalid IL or missing references) //IL_134b: Unknown result type (might be due to invalid IL or missing references) //IL_135f: Unknown result type (might be due to invalid IL or missing references) //IL_1373: Unknown result type (might be due to invalid IL or missing references) //IL_13ca: Unknown result type (might be due to invalid IL or missing references) //IL_13de: Unknown result type (might be due to invalid IL or missing references) //IL_13f2: Unknown result type (might be due to invalid IL or missing references) RuskStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); RuskStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); RuskTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); RuskEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); RuskEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); LookoutRuskStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); LookoutRuskStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); LookoutRuskTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); LookoutRuskEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); LookoutRuskEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); SunnyStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); SunnyStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); SunnyTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); SunnyEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); SunnyEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); StarsetStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); StarsetStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); StarsetTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); StarsetEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); StarsetEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); BoxtankRuskStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); BoxtankRuskStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); BoxtankRuskTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); BoxtankRuskEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); BoxtankRuskEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); KikoStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); KikoStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); KikoTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); KikoEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); KikoEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); PinkHAFStringLModification.dynamicBoneData = new DynamicBoneData("StringL", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); PinkHAFStringRModification.dynamicBoneData = new DynamicBoneData("StringR", 0.4f, null, 0f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, -0.01f, 0f), new List<DynamicBoneColliderData> { new DynamicBoneColliderData("pelvis", (Direction)0, new Vector3(0f, 0f, 0f), (Bound)0, 0.14f, 0.5f) }, new List<string>(), (FreezeAxis)0); PinkHAFTailModification.dynamicBoneData = new DynamicBoneData("Tail001", 0.17f, null, 0.06f, null, 0f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); PinkHAFEarLModification.dynamicBoneData = new DynamicBoneData("EarL001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); PinkHAFEarRModification.dynamicBoneData = new DynamicBoneData("EarR001", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0); } private void AddModificationsToList() { _DynamicSkinManager.AddModification("PIX97_SKIN_RUSK_NAME", 67, RuskStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_RUSK_NAME", 62, RuskStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_RUSK_NAME", 114, RuskTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_RUSK_NAME", 32, RuskEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_RUSK_NAME", 34, RuskEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_LOOKOUTRUSK_NAME", 67, LookoutRuskStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_LOOKOUTRUSK_NAME", 62, LookoutRuskStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_LOOKOUTRUSK_NAME", 114, LookoutRuskTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_LOOKOUTRUSK_NAME", 32, LookoutRuskEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_LOOKOUTRUSK_NAME", 34, LookoutRuskEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_SUNNY_NAME", 67, SunnyStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_SUNNY_NAME", 62, SunnyStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_SUNNY_NAME", 114, SunnyTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_SUNNY_NAME", 32, SunnyEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_SUNNY_NAME", 34, SunnyEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_STARSET_NAME", 67, StarsetStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_STARSET_NAME", 62, StarsetStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_STARSET_NAME", 114, StarsetTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_STARSET_NAME", 32, StarsetEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_STARSET_NAME", 34, StarsetEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_BOXTANKRUSK_NAME", 67, BoxtankRuskStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_BOXTANKRUSK_NAME", 62, BoxtankRuskStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_BOXTANKRUSK_NAME", 114, BoxtankRuskTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_BOXTANKRUSK_NAME", 32, BoxtankRuskEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_BOXTANKRUSK_NAME", 34, BoxtankRuskEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_KIKO_NAME", 67, KikoStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_KIKO_NAME", 62, KikoStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_KIKO_NAME", 114, KikoTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_KIKO_NAME", 32, KikoEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_KIKO_NAME", 34, KikoEarRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_PINKHAF_NAME", 67, PinkHAFStringLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_PINKHAF_NAME", 62, PinkHAFStringRModification); _DynamicSkinManager.AddModification("PIX97_SKIN_PINKHAF_NAME", 114, PinkHAFTailModification); _DynamicSkinManager.AddModification("PIX97_SKIN_PINKHAF_NAME", 32, PinkHAFEarLModification); _DynamicSkinManager.AddModification("PIX97_SKIN_PINKHAF_NAME", 34, PinkHAFEarRModification); } private static void onSkinAdded(object sender, SkinAddedArgs e) { _DynamicSkinManager.AddSkinDef(e.skinDef); } } public delegate void VoidDelegate(); public class SkinAddedArgs : EventArgs { public SkinDef skinDef { get; } public GameObject bodyPrefab { get; } public SkinAddedArgs(SkinDef newSkinDef, GameObject newGameObject) { skinDef = newSkinDef; bodyPrefab = newGameObject; } } private static AssetBundle assetBundle; private static readonly List<Material> materialsWithRoRShader = new List<Material>(); private static DynamicSkinExtension _DynamicSkinExtension = new DynamicSkinExtension(); private static DynamicSkinManager _DynamicSkinManager = new DynamicSkinManager(); private static VoidDelegate BeforeStartDelegate; private static VoidDelegate AfterStartDelegate; private static VoidDelegate BeforeBodyCatalogDelegate; private static VoidDelegate AfterBodyCatalogDelegate; internal static LookoutRuskPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { LookoutRuskPlugin instance = Instance; return (instance != null) ? ((BaseUnityPlugin)instance).Logger : null; } } private static event EventHandler<SkinAddedArgs> RailgunnerBodyRuskSkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodyLookoutRuskSkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodySunnySkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodyStarsetSkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodyBoxtankRuskSkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodyKikoSkinAddedEvent; private static event EventHandler<SkinAddedArgs> RailgunnerBodyPinkHAFSkinAddedEvent; private void Start() { Instance = this; BeforeStart(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LookoutRusk.pix97lookoutrusk")) { assetBundle = AssetBundle.LoadFromStream(stream); } ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit); HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LanguageLoadStrings)); ReplaceShaders(); AfterStart(); } private void BeforeStart() { BeforeStartDelegate = (VoidDelegate)Delegate.Combine(BeforeStartDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeStart)); BeforeStartDelegate?.Invoke(); } private void AfterStart() { AfterStartDelegate = (VoidDelegate)Delegate.Combine(AfterStartDelegate, new VoidDelegate(_DynamicSkinExtension.AfterStart)); AfterStartDelegate?.Invoke(); } private static void BeforeBodyCatalogInit() { BeforeBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(BeforeBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeBodyCatalogInit)); BeforeBodyCatalogDelegate?.Invoke(); } private static void AfterBodyCatalogInit() { AfterBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(AfterBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.AfterBodyCatalogInit)); AfterBodyCatalogDelegate?.Invoke(); } private static void ReplaceShaders() { LoadMaterialsWithReplacedShader("RoR2/Base/Shaders/HGStandard.shader", "Assets/Textures/RorRusk 1.mat", "Assets/Textures/RorRusk.mat", "Assets/Textures/RorRusk 2.mat", "Assets/Textures/RorRusk 3.mat", "Assets/Textures/RorRusk 4.mat", "Assets/Textures/RorRusk 5.mat", "Assets/Textures/RorRusk 6.mat"); } private static void LoadMaterialsWithReplacedShader(string shaderPath, params string[] materialPaths) { //IL_0002: 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) Shader shader = Addressables.LoadAssetAsync<Shader>((object)shaderPath).WaitForCompletion(); foreach (string text in materialPaths) { Material val = assetBundle.LoadAsset<Material>(text); val.shader = shader; materialsWithRoRShader.Add(val); } } private static void LanguageLoadStrings(Action<Language> orig, Language self) { orig(self); self.SetStringByToken("PIX97_SKIN_RUSK_NAME", "Rusk [Classic]"); self.SetStringByToken("PIX97_SKIN_LOOKOUTRUSK_NAME", "Rusk [Lookout] "); self.SetStringByToken("PIX97_SKIN_SUNNY_NAME", "Rusk [Sunshine]"); self.SetStringByToken("PIX97_SKIN_STARSET_NAME", "Rusk [Kai]"); self.SetStringByToken("PIX97_SKIN_BOXTANKRUSK_NAME", "Rusk [Box Tank] "); self.SetStringByToken("PIX97_SKIN_KIKO_NAME", "Rusk [希子あいし]"); self.SetStringByToken("PIX97_SKIN_PINKHAF_NAME", "Rusk [PINK H.A.F.] "); } private static void Nothing(Action<SkinDef> orig, SkinDef self) { } private static void BodyCatalogInit() { BeforeBodyCatalogInit(); MethodInfo method = typeof(SkinDef).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic); HookEndpointManager.Add((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing)); AddRailgunnerBodyRuskSkin(); AddRailgunnerBodyLookoutRuskSkin(); AddRailgunnerBodySunnySkin(); AddRailgunnerBodyStarsetSkin(); AddRailgunnerBodyBoxtankRuskSkin(); AddRailgunnerBodyKikoSkin(); AddRailgunnerBodyPinkHAFSkin(); HookEndpointManager.Remove((MethodBase)method, (Delegate)new Action<Action<SkinDef>, SkinDef>(Nothing)); AfterBodyCatalogInit(); } private static void RailgunnerBodyRuskSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyRuskSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyRuskSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "Rusk"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\RuskIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_RUSK_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [Classic] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 1.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 1.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyRuskSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodyLookoutRuskSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyLookoutRuskSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyLookoutRuskSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "LookoutRusk"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\LookoutRuskIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_LOOKOUTRUSK_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [Lookout] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyLookoutRuskSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodySunnySkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodySunnySkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodySunnySkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "Sunny"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\SunnyIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_SUNNY_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [Sunshine] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 2.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 2.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodySunnySkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodyStarsetSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyStarsetSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyStarsetSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "Starset"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\StarsetIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_STARSET_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [Kai] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 3.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 3.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyStarsetSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodyBoxtankRuskSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyBoxtankRuskSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyBoxtankRuskSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "BoxtankRusk"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\BoxtankRuskIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_BOXTANKRUSK_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [Box Tank] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 4.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 4.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyBoxtankRuskSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodyKikoSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyKikoSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyKikoSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "Kiko"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\KikoIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_KIKO_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [希子あいし] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 5.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 5.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyKikoSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void RailgunnerBodyPinkHAFSkinAdded(SkinDef skinDef, GameObject bodyPrefab) { LookoutRuskPlugin.RailgunnerBodyPinkHAFSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab)); } private static void AddRailgunnerBodyPinkHAFSkin() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) string text = "RailgunnerBody"; string text2 = "PinkHAF"; try { GameObject val = BodyCatalog.FindBodyPrefab(text); if (!Object.op_Implicit((Object)(object)val)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist")); return; } ModelLocator component = val.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)component)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component")); return; } GameObject gameObject = ((Component)component.modelTransform).gameObject; ModelSkinController skinController = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null); if (!Object.op_Implicit((Object)(object)skinController)) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component")); return; } Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true); SkinDef skin = ScriptableObject.CreateInstance<SkinDef>(); TryCatchThrow("Icon", delegate { skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\LookoutRusk\\Icons\\PinkHAFIcon.png"); }); ((Object)skin).name = text2; skin.nameToken = "PIX97_SKIN_PINKHAF_NAME"; skin.rootObject = gameObject; TryCatchThrow("Base Skins", delegate { skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { skinController.skins[0] }; }); TryCatchThrow("Unlockable Name", delegate { skin.unlockableDef = ((IEnumerable<UnlockableDef>)ContentManager.unlockableDefs).FirstOrDefault((Func<UnlockableDef, bool>)((UnlockableDef def) => def.cachedName == "Rusk [PINK H.A.F.] ")); }); TryCatchThrow("Game Object Activations", delegate { skin.gameObjectActivations = Array.Empty<GameObjectActivation>(); }); TryCatchThrow("Renderer Infos", delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) skin.rendererInfos = (RendererInfo[])(object)new RendererInfo[2] { new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 6.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[2] }, new RendererInfo { defaultMaterial = assetBundle.LoadAsset<Material>("Assets/Textures/RorRusk 6.mat"), defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false, renderer = renderers[3] } }; }); TryCatchThrow("Mesh Replacements", delegate { //IL_0011: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) skin.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[5] { new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[3] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\Rusk Body.mesh"), renderer = renderers[2] }, new MeshReplacement { mesh = null, renderer = renderers[0] }, new MeshReplacement { mesh = null, renderer = renderers[1] }, new MeshReplacement { mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\LookoutRusk\\Meshes\\mdlRailgunProto.001.mesh"), renderer = renderers[4] } }; }); TryCatchThrow("Minion Skin Replacements", delegate { skin.minionSkinReplacements = Array.Empty<MinionSkinReplacement>(); }); TryCatchThrow("Projectile Ghost Replacements", delegate { skin.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>(); }); Array.Resize(ref skinController.skins, skinController.skins.Length + 1); skinController.skins[skinController.skins.Length - 1] = skin; BodyCatalog.skins[BodyCatalog.FindBodyIndex(val)] = skinController.skins; RailgunnerBodyPinkHAFSkinAdded(skin, val); } catch (FieldException ex) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message)); InstanceLogger.LogError((object)ex.InnerException); } catch (Exception ex2) { InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\"")); InstanceLogger.LogError((object)ex2); } } private static void TryCatchThrow(string message, Action action) { try { action?.Invoke(); } catch (Exception innerException) { throw new FieldException(message, innerException); } } } } namespace RuneFoxMods { internal class Utils { public static void PrintBodyCatalog() { Debug.Log((object)"\nBodyCatalog"); foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs) { Debug.Log((object)((Object)allBodyPrefab).name); } Debug.Log((object)"\n"); } public static void ReadChildren(GameObject parent, int tabs, bool includecomponents = true) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } for (int j = 0; j < parent.transform.childCount; j++) { Transform child = parent.transform.GetChild(j); if ((Object)(object)child == (Object)null) { break; } string text2 = ((Component)child).gameObject.activeInHierarchy.ToString(); Debug.Log((object)(text + ((Object)child).name + " " + text2 + " " + ((Component)child).transform.position)); if (includecomponents) { ReadComponents(((Component)child).gameObject, tabs + 1); Debug.Log((object)""); } ReadChildren(((Component)child).gameObject, tabs + 1, includecomponents); } } public static void readheiarchy(GameObject parent, bool includeComponents = true) { Debug.Log((object)((Object)parent).name); if (includeComponents) { ReadComponents(parent, 1); Debug.Log((object)""); } ReadChildren(parent, 1, includeComponents); } public static void ReadComponents(GameObject obj, int tabs) { string text = ""; for (int i = 0; i < tabs; i++) { text += " "; } Component[] components = obj.GetComponents(typeof(Component)); Component[] array = components; foreach (Component val in array) { string text2 = ""; Debug.Log((object)(text + "Comp: " + ((object)val).GetType().ToString() + " " + text2)); } } public static void PrintAllPaths(GameObject parent) { Debug.Log((object)((Object)parent).name); PrintAllPathsInner(parent, ((Object)parent).name); } private static void PrintAllPathsInner(GameObject parent, string parent_string) { int childCount = parent.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = parent.transform.GetChild(i); if (((Object)child).name.EndsWith("_end")) { break; } string text = parent_string + "/" + ((Object)child).name; Debug.Log((object)(" " + ((Object)child).name + "\t\t" + text)); PrintAllPathsInner(((Component)child).gameObject, text); } } public static void PrintDynamicBone(DynamicBone DB) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Root: " + DB.m_Root)); Debug.Log((object)("Damping: " + DB.m_Damping)); Debug.Log((object)("Damping Dist: " + DB.m_DampingDistrib)); Debug.Log((object)("Elasticity: " + DB.m_Elasticity)); Debug.Log((object)("Elasticity Dist: " + DB.m_ElasticityDistrib)); Debug.Log((object)("Stiffness: " + DB.m_Stiffness)); Debug.Log((object)("Stiffness Dist: " + DB.m_StiffnessDistrib)); Debug.Log((object)("Inert: " + DB.m_Inert)); Debug.Log((object)("Inert Dist: " + DB.m_InertDistrib)); Debug.Log((object)("Radius: " + DB.m_Radius)); Debug.Log((object)("Radius Dist: " + DB.m_RadiusDistrib)); Debug.Log((object)("End Length: " + DB.m_EndLength)); Debug.Log((object)("End Offset: " + DB.m_EndOffset)); Debug.Log((object)("Gravity: " + DB.m_Gravity)); Debug.Log((object)("Force: " + DB.m_Force)); Debug.Log((object)("FreezeAxis: " + DB.m_FreezeAxis)); Debug.Log((object)("Colliders: " + DB.m_Colliders.Count)); foreach (DynamicBoneCollider collider in DB.m_Colliders) { Debug.Log((object)("\t Parent: " + ((Object)((Component)collider).transform).name)); Debug.Log((object)("\t Direction: " + collider.m_Direction)); Debug.Log((object)("\t Center " + collider.m_Center)); Debug.Log((object)("\t Bound " + collider.m_Bound)); Debug.Log((object)("\t Radius " + collider.m_Radius)); Debug.Log((object)("\t Height " + collider.m_Height)); } Debug.Log((object)("Exclusions: " + DB.m_Exclusions.Count)); foreach (Transform exclusion in DB.m_Exclusions) { Debug.Log((object)("\t Transform: " + ((Object)exclusion).name)); } } public static ChildLocator GetChildLocator(GameObject body) { ChildLocator val = null; Transform child = body.transform.GetChild(0); if (Object.op_Implicit((Object)(object)child)) { Transform child2 = child.GetChild(0); if (Object.op_Implicit((Object)(object)child2)) { val = ((Component)child2).GetComponent<ChildLocator>(); if (Object.op_Implicit((Object)(object)val)) { Debug.Log((object)"Locator Found"); } } } return val; } public static Transform FindChildInTree(Transform Root, string name) { Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(Root); while (queue.Count != 0) { Transform val = queue.Dequeue(); if (((Object)val).name == name) { return val; } for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); queue.Enqueue(child); } } return null; } public static string RemoveCloneNaming(string str) { return str.Remove(str.Length - 7); } } } namespace RuneFoxMods.DynamicSkins { public static class DynamicSkinHelpers { public static SkinnedMeshRenderer[] GetBaseSkinRenderers(GameObject modelObject) { SkinnedMeshRenderer[] componentsInChildren = modelObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if ((Object)(object)((Component)val).transform.parent == (Object)(object)modelObject.transform) { list.Add(val); } } return list.ToArray(); } public static Transform[] BoneArrayBuilder(Transform NewBoneRoot) { List<Transform> list = new List<Transform>(); BoneArrayBuilderHelper(NewBoneRoot, list); return list.ToArray(); } public static void BoneArrayBuilderHelper(Transform parent, List<Transform> list) { if (!((Object)parent).name.EndsWith("_end")) { list.Add(parent); } for (int i = 0; i < parent.childCount; i++) { BoneArrayBuilderHelper(parent.GetChild(i), list); } } public static Transform GetArmature(GameObject obj) { return GetArmatureHelper(obj); } public static Transform GetArmatureHelper(GameObject obj) { if (((Object)obj).name.ToLower().Contains("armature")) { return obj.transform; } for (int i = 0; i < obj.transform.childCount; i++) { Transform armatureHelper = GetArmatureHelper(((Component)obj.transform.GetChild(i)).gameObject); if (Object.op_Implicit((Object)(object)armatureHelper)) { return armatureHelper; } } return null; } public static Transform GetTopParent(Transform obj) { Transform val = obj; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } return val; } public static string GetPrevBoneInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return ((Object)bones[i]).name; } } return null; } public static int GetBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length; i++) { if (((Object)bones[i]).name == ((Object)targetBone).name) { return i; } } return -1; } public static int GetPrevBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer) { Transform[] bones = meshRenderer.bones; for (int i = 0; i <= bones.Length - 1; i++) { if (((Object)bones[i + 1]).name == ((Object)targetBone).name) { return i; } } return -1; } } internal class DynamicSkinManager { internal Dictionary<string, SkinDef> SkinDefs = new Dictionary<string, SkinDef>(); private GameObject LastModelObject; internal Dictionary<string, SortedList<int, Modification>> ModificationList = new Dictionary<string, SortedList<int, Modification>>(); private Dictionary<GameObject, AppliedModifications> ModifiedObjects = new Dictionary<GameObject, AppliedModifications>(); internal ManualLogSource InstanceLogger; internal void AddModification(string skinNameToken, int boneIndex, Modification modification) { if (!ModificationList.TryGetValue(skinNameToken, out var value)) { value = new SortedList<int, Modification>(); ModificationList.Add(skinNameToken, value); } value.Add(boneIndex, modification); } internal void AddSkinDef(SkinDef skinDef) { SkinDefs.Add(skinDef.nameToken, skinDef); } internal void SkinDefApply(Action<SkinDef, GameObject> orig, SkinDef self, GameObject modelObject) { orig(self, modelObject); RemoveInvalidModelObjects(); ModifiedObjects.TryGetValue(modelObject, out var value); try { if (!SkinDefs.TryGetValue(self.nameToken, out var _)) { if (value != null) { ClearSkinModifications(LastModelObject, value); } } else if (value == null) { AppliedModifications appliedModifications = new AppliedModifications(); ModifiedObjects.Add(modelObject, appliedModifications); ApplySkinModifications(self, modelObject, appliedModifications); } } catch (Exception ex) { InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin"); InstanceLogger.LogError((object)ex); } } private void RemoveInvalidModelObjects() { foreach (GameObject item in ModifiedObjects.Keys.Where((GameObject el) => !Object.op_Implicit((Object)(object)el)).ToList()) { ModifiedObjects.Remove(item); } } private void ClearSkinModifications(GameObject modelObject, AppliedModifications modifications) { while (modifications.BaseModelModifications.Count != 0) { Modification modification = modifications.BaseModelModifications.Pop(); clearModification(modification, modelObject, modifications); } while (modifications.OtherModifications.Count != 0) { clearModification(modifications.OtherModifications[0], modelObject, modifications); } ModifiedObjects.Remove(modelObject); } private void ApplySkinModifications(SkinDef skindef, GameObject modelObject, AppliedModifications modifications) { CharacterModel component = modelObject.GetComponent<CharacterModel>(); LastModelObject = modelObject; if (!ModificationList.TryGetValue(skindef.nameToken, out var value)) { return; } foreach (KeyValuePair<int, Modification> item in value) { ApplyModification(modelObject, component, item.Value, modifications); } } private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications) { string bodyname = modification.bodyname; string parentname = modification.parentname; Transform val = Utils.FindChildInTree(modelObject.transform, parentname); GameObject val2; if (modification.affectsbasemodel) { val2 = Object.Instantiate<GameObject>(modification.prefab, val, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; modification.inst_armature = val2; ModificationApplyBones(modelObject, modification, modifications); } else { val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false); ((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name); modification.instance = val2; Transform armature = DynamicSkinHelpers.GetArmature(val2); ((Component)armature).transform.SetParent(val, false); modification.inst_armature = ((Component)armature).gameObject; } modification.instance = val2; if (modification.dynamicBoneData != null) { ModificationApplyDynamicBones(modelObject, modification); } ModificationAddRenderers(val2, characterModel); modifications.OtherModifications.Add(modification); } pri