Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of LunarSoap v1.0.3
LunarSoap.dll
Decompiled a year agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using EntityStates; using IL.EntityStates; using LunarSoap.Properties; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("LunarSoap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LunarSoap")] [assembly: AssemblyTitle("LunarSoap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] [module: UnverifiableCode] [module: UnverifiableCode] namespace LunarSoap { public class WConfig { public static ConfigFile ConfigFileUNSORTED = new ConfigFile(Paths.ConfigPath + "\\Wolfo.WolfosItems.cfg", true); public static ConfigEntry<float> EnableLunarSoap; public static ConfigEntry<float> EnableVoidDrone; public static void InitConfig() { } } public static class ArrayUtil { public static T[] Add<T>(this T[] array, params T[] items) { return (array ?? Enumerable.Empty<T>()).Concat(items).ToArray(); } public static T[] Remove<T>(this T[] array, params T[] items) { return (array ?? Enumerable.Empty<T>()).Except(items).ToArray(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Wolfo.LunarSoap", "LunarSoap", "1.0.3")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class LunarSoap : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnInventoryChanged <>9__3_0; public static Func<Instruction, bool> <>9__4_0; public static Func<Instruction, bool> <>9__4_2; public static Func<float, BaseCharacterMain, float> <>9__4_1; internal void <Awake>b__3_0(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); self.AddItemBehavior<LunarSoapBehavior>(self.inventory.GetItemCount(ItemDef)); } internal bool <ScaleAnimationWithWalkCoeff>b__4_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.AnimationParameters", "walkSpeed"); } internal bool <ScaleAnimationWithWalkCoeff>b__4_2(Instruction x) { return ILPatternMatchingExt.MatchCallvirt(x, "RoR2.CharacterBody", "get_moveSpeed"); } internal float <ScaleAnimationWithWalkCoeff>b__4_1(float speed, BaseCharacterMain state) { if (state.hasCharacterMotor) { return ((EntityState)state).characterMotor.walkSpeed; } return speed; } } public static ItemDef ItemDef; public static GameObject DisplayItem; public static GameObject PickupModel; public void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown ItemDef val = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/RandomlyLunar"); ItemTierDef itemTierDef = LegacyResourcesAPI.Load<ItemTierDef>("ItemTierDefs/LunarTierDef"); PickupModel = PrefabAPI.InstantiateClone(val.pickupModelPrefab, "LunarSoapPickup", false); DisplayItem = PrefabAPI.InstantiateClone(new GameObject(), "DisplayLunarSoap", false); CreatePickupModel(); LanguageAPI.Add("ITEM_LUNARSOAP_NAME", "Temporal Soap"); LanguageAPI.Add("ITEM_LUNARSOAP_PICKUP", "Doubled movement speed... <color=#FF7F7F>BUT movement is harder to control.</color>"); LanguageAPI.Add("ITEM_LUNARSOAP_LORE", "Order: Special Soap\r\nTracking Number: 2*****\r\nEstimated Delivery: 09/24/2056\r\nShipping Method: Expedited\r\nShipping Address: 5757 Main St, Frisco, TX 75034, USA, Earth\r\nShipping Details:\r\n\r\nIf this delivery ever reaches the writing team they better come up with a new slogan for this new soap because we're fresh out of ideas over here. Maybe make a joke about Chiralium we're sure someone would appreciate that."); Texture2D val2 = new Texture2D(128, 128, (TextureFormat)12, false); ImageConversion.LoadImage(val2, Resources.IconSoap, true); ((Texture)val2).filterMode = (FilterMode)1; ((Texture)val2).wrapMode = (TextureWrapMode)1; Sprite pickupIconSprite = Sprite.Create(val2, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); ItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)ItemDef).name = "LunarSoap"; ItemDef.deprecatedTier = (ItemTier)3; ItemDef._itemTierDef = itemTierDef; ItemDef.nameToken = "ITEM_LUNARSOAP_NAME"; ItemDef.pickupToken = "ITEM_LUNARSOAP_PICKUP"; ItemDef.descriptionToken = "ITEM_LUNARSOAP_DESC"; ItemDef.loreToken = "ITEM_LUNARSOAP_LORE"; ItemDef.hidden = false; ItemDef.canRemove = true; ItemDef.pickupIconSprite = pickupIconSprite; ItemDef.pickupModelPrefab = PickupModel; ItemDef itemDef = ItemDef; ItemTag[] array = new ItemTag[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); itemDef.tags = (ItemTag[])(object)array; ItemDisplayRuleDict val3 = MakeItemDisplays(); CustomItem val4 = new CustomItem(ItemDef, val3); ItemAPI.Add(val4); CharacterBody.RecalculateStats += new hook_RecalculateStats(Stats_VariantWalkSpeed); LanguageAPI.Add("ITEM_LUNARSOAP_DESC", "Increases <style=cIsUtility>maxiumum walk speed</style> by <style=cIsUtility>100%</style> <style=cStack>(+40% per stack)</style>. <style=cIsUtility>Reduces acceleration and deceleration by 80%</style> <style=cStack>(+20% per stack)</style>. Acceleration no longer scales with movement speed."); object obj = <>c.<>9__3_0; if (obj == null) { hook_OnInventoryChanged val5 = delegate(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); self.AddItemBehavior<LunarSoapBehavior>(self.inventory.GetItemCount(ItemDef)); }; <>c.<>9__3_0 = val5; obj = (object)val5; } CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj; BaseCharacterMain.UpdateAnimationParameters += new Manipulator(ScaleAnimationWithWalkCoeff); } private void ScaleAnimationWithWalkCoeff(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.AnimationParameters", "walkSpeed") }); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "RoR2.CharacterBody", "get_moveSpeed") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, BaseCharacterMain, float>>((Func<float, BaseCharacterMain, float>)((float speed, BaseCharacterMain state) => state.hasCharacterMotor ? ((EntityState)state).characterMotor.walkSpeed : speed)); Debug.Log((object)"IL Found : IL.EntityStates.BaseCharacterMain.UpdateAnimationParameters"); } else { Debug.LogWarning((object)"IL Failed : IL.EntityStates.BaseCharacterMain.UpdateAnimationParameters"); } } private static ItemDisplayRuleDict MakeItemDisplays() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_0205: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0335: 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_0368: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Expected O, but got Unknown ItemDisplayRule[] array = (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootR", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 180f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootL", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }; ItemDisplayRule[] array2 = (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "RightLeg", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 180f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "LeftLeg", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }; ItemDisplayRule[] array3 = (ItemDisplayRule[])(object)new ItemDisplayRule[2] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "MainWheelR", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 180f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "MainWheelL", localPos = new Vector3(0f, 0f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }; ItemDisplayRule[] array4 = (ItemDisplayRule[])(object)new ItemDisplayRule[4] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootBackR", localPos = new Vector3(0f, 1f, 0f), localAngles = new Vector3(0f, 180f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootBackL", localPos = new Vector3(0f, 1f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootFrontR", localPos = new Vector3(0f, 1f, 0f), localAngles = new Vector3(0f, 180f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) }, new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = DisplayItem, childName = "FootFrontL", localPos = new Vector3(0f, 1f, 0f), localAngles = new Vector3(0f, 0f, 0f), localScale = new Vector3(0.1f, 0.1f, 0.1f) } }; ItemDisplayRuleDict val = new ItemDisplayRuleDict(array); val.Add("NemesisEnforcerBody", array); val.Add("MinerBody", array); val.Add("CHEF", array2); val.Add("ToolbotBody", array3); val.Add("TreebotBody", array4); return val; } private static void Stats_VariantWalkSpeed(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self.inventory)) { return; } int itemCount = self.inventory.GetItemCount(ItemDef); if (itemCount > 0) { itemCount--; if (Object.op_Implicit((Object)(object)self.characterMotor)) { self.characterMotor.walkSpeedPenaltyCoefficient = 2f + 0.4f * (float)itemCount; } self.acceleration = self.baseAcceleration * 2f * (0.2f / (1f + (float)itemCount * 0.2f)); if (self.isSprinting) { self.acceleration *= 0.875f; } } } public static void CreatePickupModel() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0493: 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_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Unknown result type (might be due to invalid IL or missing references) //IL_0929: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a4a: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0a51: Unknown result type (might be due to invalid IL or missing references) GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/BlueprintStation"); GameObject val2 = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MoonBatteryBlood"); GameObject gameObject = ((Component)((Component)((Component)((Component)((Component)val2.transform.GetChild(0)).transform.GetChild(0)).transform.GetChild(0)).transform.GetChild(1)).transform.GetChild(0)).gameObject; GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/arena/Arena_CrabFoam.prefab").WaitForCompletion(); GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/artifactworld/ArtifactFormulaDisplay.prefab").WaitForCompletion(); GameObject gameObject2 = ((Component)val4.transform.FindChild("ArtifactFormulaHolderMesh")).gameObject; GameObject val5 = LegacyResourcesAPI.Load<GameObject>("Prefabs/PickupModels/PickupLunarCoin"); Object.Destroy((Object)(object)((Component)PickupModel.transform.GetChild(0)).gameObject); PickupModel.GetComponent<ModelPanelParameters>().minDistance = 5f; PickupModel.GetComponent<ModelPanelParameters>().maxDistance = 10f; PickupModel.GetComponent<ModelPanelParameters>().cameraPositionTransform.localPosition = new Vector3(1f, 1f, -0.3f); PickupModel.GetComponent<ModelPanelParameters>().cameraPositionTransform.localEulerAngles = new Vector3(0f, 0f, 0f); PickupModel.GetComponent<ModelPanelParameters>().focusPointTransform.localPosition = new Vector3(0f, 1f, -0.3f); PickupModel.GetComponent<ModelPanelParameters>().focusPointTransform.localEulerAngles = new Vector3(0f, 0f, 0f); GameObject val6 = Object.Instantiate<GameObject>(gameObject, PickupModel.transform); ((Object)val6).name = "SoapMainBrick"; val6.GetComponent<MeshFilter>().mesh = gameObject2.GetComponent<MeshFilter>().mesh; val6.transform.localPosition = new Vector3(0f, -1.5f, 0f); val6.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); val6.transform.localEulerAngles = new Vector3(80f, 85f, 180f); Material val7 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/EliteIce/matEliteIce.mat").WaitForCompletion(); Material val8 = Object.Instantiate<Material>(val7); Material val9 = Object.Instantiate<Material>(val7); ((Object)val8).name = "matLunarSoapMain"; val8.SetFloat("_FresnelBoost", 2.4f); val8.color = new Color(0.6f, 0.8f, 1f); val8.enableInstancing = false; ((Object)val9).name = "matLunarSoapCoin"; val9.SetFloat("_FresnelBoost", 6.4f); val9.color = new Color(0.6f, 0.8f, 1f); val9.enableInstancing = false; ((Renderer)val6.GetComponent<MeshRenderer>()).material = val8; Object.Destroy((Object)(object)val6.GetComponent<BoxCollider>()); Object.Destroy((Object)(object)val6.GetComponent<DitherModel>()); Object.Destroy((Object)(object)val6.GetComponent<NonSolidToCamera>()); Object.Destroy((Object)(object)val6.GetComponent<EntityLocator>()); GameObject val10 = Object.Instantiate<GameObject>(((Component)val5.transform.GetChild(0)).gameObject, val6.transform); ((Object)val10).name = "CoinEmblem"; val10.transform.localPosition = new Vector3(0f, -1.1f, -4f); val10.transform.localScale = new Vector3(1.18f, 1.8f, 1.18f); val10.transform.localEulerAngles = new Vector3(0f, 0f, 0f); ((Renderer)val10.GetComponent<MeshRenderer>()).material = val9; Object.Destroy((Object)(object)((Component)val10.transform.GetChild(0)).gameObject); GameObject val11 = Object.Instantiate<GameObject>(((Component)((Component)val.transform.GetChild(0)).transform.GetChild(0)).gameObject, val6.transform); ParticleSystem component = val11.GetComponent<ParticleSystem>(); val11.transform.localPosition = new Vector3(0f, 0f, -4.5f); val11.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val11.transform.localScale = new Vector3(3f, 3f, 3f); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 1.1f; ((ShapeModule)(ref shape)).scale = new Vector3(1f, 1f, 1.9f); component.gravityModifier = 0f; component.playbackSpeed = 0.15f; component.emissionRate = 18f; component.scalingMode = (ParticleSystemScalingMode)0; GameObject val12 = Object.Instantiate<GameObject>(((Component)((Component)val.transform.GetChild(0)).transform.GetChild(1)).gameObject, val6.transform); val12.transform.localPosition = new Vector3(0f, 0f, -4f); val12.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val12.transform.localScale = new Vector3(4f, 3f, 6f); val12.SetActive(false); GameObject val13 = Object.Instantiate<GameObject>(val3, val6.transform); ((Object)val13).name = "BottomBubbles1"; ((Renderer)val13.GetComponent<MeshRenderer>()).material = ((Renderer)val12.GetComponent<MeshRenderer>()).material; Object.Destroy((Object)(object)val13.GetComponent<MeshCollider>()); Object.Destroy((Object)(object)val13.GetComponent<SurfaceDefProvider>()); Material val14 = Object.Instantiate<Material>(((Renderer)val13.GetComponent<MeshRenderer>()).material); val14.SetFloat("_InvFade", 8f); val14.enableInstancing = false; ((Object)val14).name = "matLunarSoapBubbles"; ((Renderer)val13.GetComponent<MeshRenderer>()).material = val14; val13.transform.localScale = new Vector3(1.55f, 1.55f, 1.55f); val13.transform.localPosition = new Vector3(1.81f, 0.4f, -0.58f); val13.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val13 = Object.Instantiate<GameObject>(val13, val6.transform); ((Object)val13).name = "BottomBubbles2"; ((Renderer)val13.GetComponent<MeshRenderer>()).material = val14; val13.transform.localPosition = new Vector3(-1.68f, -0.49f, -0.4f); val13.transform.rotation = new Quaternion(0.8168f, 0.1933f, 0.4053f, -0.3623f); val13.transform.localScale = new Vector3(1.55f, 1.55f, 1.55f); Object.Destroy((Object)(object)val13.GetComponent<MeshCollider>()); Object.Destroy((Object)(object)val13.GetComponent<SurfaceDefProvider>()); GameObject val15 = Object.Instantiate<GameObject>(val13, DisplayItem.transform); ((Object)val15).name = "BottomBubbles"; Object.Destroy((Object)(object)val15.GetComponent<MeshCollider>()); Object.Destroy((Object)(object)val15.GetComponent<SurfaceDefProvider>()); ((Renderer)val15.GetComponent<MeshRenderer>()).material = val14; val15.transform.localScale = new Vector3(1f, 1f, 1f); val15.transform.localPosition = new Vector3(0f, 0f, 0f); val15.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val15.SetActive(false); GameObject val16 = Object.Instantiate<GameObject>(val11, DisplayItem.transform); ((Object)val16).name = "BubbleParticlesDisplay"; component = val16.GetComponent<ParticleSystem>(); val16.transform.localPosition = new Vector3(0f, 0f, 0f); val16.transform.localEulerAngles = new Vector3(90f, 0f, 0f); val16.transform.localScale = new Vector3(1f, 1f, 1f); ((Renderer)val16.GetComponent<ParticleSystemRenderer>()).material = val14; MainModule main = component.main; ((MainModule)(ref main)).cullingMode = (ParticleSystemCullingMode)0; MinMaxCurve val17 = ((MainModule)(ref main)).startLifetime; val17.m_ConstantMin = 0.25f; ((MainModule)(ref main)).startLifetime = val17; val17 = ((MainModule)(ref main)).startSize; ((MinMaxCurve)(ref val17)).mode = (ParticleSystemCurveMode)3; val17.m_ConstantMin = 0.1f; ((MainModule)(ref main)).startSize = val17; ((MainModule)(ref main)).startSizeX = val17; shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = 0.4f; ((ShapeModule)(ref shape)).scale = new Vector3(1f, 1f, 1f); ((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f); SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime; MinMaxCurve size = ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size; MinMaxCurve size2 = ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size; AnimationCurve curveMax = ((MinMaxCurve)(ref size2)).curveMax; Keyframe[] keys = curveMax.keys; ((Keyframe)(ref keys[0])).value = 0.15f; ((Keyframe)(ref keys[1])).time = 0.8f; curveMax.SetKeys(keys); ((MinMaxCurve)(ref size)).curve = curveMax; ((MinMaxCurve)(ref size)).curveMax = curveMax; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = size; ((Component)component).transform.localPosition = new Vector3(0.05f, 0.05f, -0.15f); component.gravityModifier = -0.15f; component.playbackSpeed = 0.25f; component.startLifetime = 0.5f; component.startSize = 0.25f; component.emissionRate = 10f; component.scalingMode = (ParticleSystemScalingMode)1; component.simulationSpace = (ParticleSystemSimulationSpace)1; ItemDisplay val18 = DisplayItem.AddComponent<ItemDisplay>(); val18.rendererInfos = (RendererInfo[])(object)new RendererInfo[1] { new RendererInfo { defaultMaterial = ((Renderer)val16.GetComponent<ParticleSystemRenderer>()).material, renderer = (Renderer)(object)val16.GetComponent<ParticleSystemRenderer>(), defaultShadowCastingMode = (ShadowCastingMode)0 } }; } } internal class LunarSoapBehavior : ItemBehavior { private void Start() { Debug.Log((object)"Start Soap"); if (base.body.baseAcceleration >= 80f) { CharacterBody body = base.body; body.baseAcceleration /= 2f; } else { base.body.baseAcceleration = 40f; } if (Object.op_Implicit((Object)(object)base.body.characterMotor)) { CharacterMotor characterMotor = base.body.characterMotor; characterMotor.airControl *= 2f; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)base.body)) { base.body.baseAcceleration = base.body.master.bodyPrefab.GetComponent<CharacterBody>().baseAcceleration; CharacterMotor component = base.body.master.bodyPrefab.GetComponent<CharacterMotor>(); if (Object.op_Implicit((Object)(object)component)) { base.body.characterMotor.walkSpeedPenaltyCoefficient = 1f; base.body.characterMotor.mass = component.mass; base.body.characterMotor.airControl = component.airControl; } } } } public class VoidSpareDroneParts { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnInventoryChanged <>9__3_0; internal void <Start>b__3_0(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<VoidDronePartsBehavior>(self.inventory.GetItemCount(NewItemDef)); } } } public static ItemDef NewItemDef; public static GameObject DisplayItem; public static GameObject PickupModel; public static void Start() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown ItemDef val = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/CloverVoid"); ItemDef val2 = LegacyResourcesAPI.Load<ItemDef>("ItemDefs/DroneWeapons"); PickupModel = PrefabAPI.InstantiateClone(val2.pickupModelPrefab, "VoidDronePartsPickup", false); DisplayItem = PrefabAPI.InstantiateClone(new GameObject(), "DisplayVoidDroneParts", false); LanguageAPI.Add("ITEM_VOIDDRONEPARTS_NAME", "Leftover Crab Parts"); LanguageAPI.Add("ITEM_VOIDDRONEPARTS_PICKUP", "All your minions copy your equipment uses. <style=cIsVoid>Corrupts all Spare Drone Parts</style>."); LanguageAPI.Add("ITEM_VOIDDRONEPARTS_DESC", "All minions <style=cIsUtility>fire your equipment</style> when you fire it. <style=cIsUtility>Reduce equipment cooldown</style> by <style=cIsUtility>0%</style> <style=cStack>(+40% per stack)</style>. <style=cIsVoid>Corrupts all Spare Drone Parts</style>. "); LanguageAPI.Add("ITEM_VOIDDRONEPARTS_LORE", "All becomes crab eventually, mmm crab"); Texture2D val3 = new Texture2D(128, 128, (TextureFormat)12, false); ImageConversion.LoadImage(val3, Resources.IconDrone, true); ((Texture)val3).filterMode = (FilterMode)1; ((Texture)val3).wrapMode = (TextureWrapMode)1; Sprite pickupIconSprite = Sprite.Create(val3, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); NewItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)NewItemDef).name = "VoidDroneWeapons"; NewItemDef.deprecatedTier = (ItemTier)8; NewItemDef.nameToken = "ITEM_VOIDDRONEPARTS_NAME"; NewItemDef.pickupToken = "ITEM_VOIDDRONEPARTS_PICKUP"; NewItemDef.descriptionToken = "ITEM_VOIDDRONEPARTS_DESC"; NewItemDef.loreToken = "ITEM_VOIDDRONEPARTS_LORE"; NewItemDef.hidden = false; NewItemDef.canRemove = true; NewItemDef.pickupIconSprite = pickupIconSprite; NewItemDef.pickupModelPrefab = PickupModel; NewItemDef.requiredExpansion = val2.requiredExpansion; ItemDef newItemDef = NewItemDef; ItemTag[] array = new ItemTag[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); newItemDef.tags = (ItemTag[])(object)array; ItemDisplayRuleDict val4 = CreateItemDisplays(); CustomItem val5 = new CustomItem(NewItemDef, val4); ItemAPI.Add(val5); ItemRelationshipProvider val6 = LegacyResourcesAPI.Load<ItemRelationshipProvider>("ItemRelationships/ContagiousItemProvider"); Pair val7 = default(Pair); val7.itemDef1 = val2; val7.itemDef2 = NewItemDef; Pair val8 = val7; val6.relationships = val6.relationships.Add(val8); object obj = <>c.<>9__3_0; if (obj == null) { hook_OnInventoryChanged val9 = delegate(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<VoidDronePartsBehavior>(self.inventory.GetItemCount(NewItemDef)); } }; <>c.<>9__3_0 = val9; obj = (object)val9; } CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj; Inventory.CalculateEquipmentCooldownScale += new hook_CalculateEquipmentCooldownScale(Inventory_CalculateEquipmentCooldownScale); CreatePickupModel(); CreateItemDisplays(); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(CopyEquipmentActions); } private static float Inventory_CalculateEquipmentCooldownScale(orig_CalculateEquipmentCooldownScale orig, Inventory self) { int itemCount = self.GetItemCount(NewItemDef); float num = orig.Invoke(self); if (itemCount > 1) { num *= Mathf.Pow(0.6f, (float)itemCount - 1f); } return num; } private static bool CopyEquipmentActions(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { bool flag = orig.Invoke(self, equipmentDef); if (flag) { VoidDronePartsBehavior component = ((Component)self).GetComponent<VoidDronePartsBehavior>(); if (Object.op_Implicit((Object)(object)component)) { component.FireEquipment(equipmentDef); } } return flag; } public static void CreatePickupModel() { } private static ItemDisplayRuleDict CreateItemDisplays() { return null; } } public class VoidDronePartsBehavior : ItemBehavior { public int cooldown; private void OnEnable() { MasterSummon.onServerMasterSummonGlobal += OnServerMasterSummonGlobal; UpdateAllMinions(base.stack); } private void OnDisable() { MasterSummon.onServerMasterSummonGlobal -= OnServerMasterSummonGlobal; UpdateAllMinions(base.stack); } private void UpdateAllMinions(int newStack) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (newStack == 0) { } if (!Object.op_Implicit((Object)(object)base.body) || !Object.op_Implicit((Object)(object)base.body.master)) { return; } MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)base.body.master).netId); if (val == null) { return; } MinionOwnership[] members = val.members; foreach (MinionOwnership val2 in members) { if (!Object.op_Implicit((Object)(object)val2)) { continue; } CharacterMaster component = ((Component)val2).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && !Object.op_Implicit((Object)(object)body.equipmentSlot)) { Debug.Log((object)("Adding EquipmentSlot to " + (object)body)); ((Component)body).gameObject.AddComponent<EquipmentSlot>(); body.equipmentSlot = ((Component)body).gameObject.GetComponent<EquipmentSlot>(); } } } } private void OnServerMasterSummonGlobal(MasterSummonReport summonReport) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)base.body) || !Object.op_Implicit((Object)(object)base.body.master) || !((Object)(object)base.body.master == (Object)(object)summonReport.leaderMasterInstance)) { return; } CharacterMaster summonMasterInstance = summonReport.summonMasterInstance; if (Object.op_Implicit((Object)(object)summonMasterInstance)) { CharacterBody body = summonMasterInstance.GetBody(); if (Object.op_Implicit((Object)(object)body) && !Object.op_Implicit((Object)(object)body.equipmentSlot)) { ((Component)body).gameObject.AddComponent<EquipmentSlot>(); body.equipmentSlot = ((Component)body).gameObject.GetComponent<EquipmentSlot>(); } } } public void FireEquipment(EquipmentDef equipmentDef) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)base.body) || !Object.op_Implicit((Object)(object)base.body.master)) { return; } MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)base.body.master).netId); if (val == null) { return; } MinionOwnership[] members = val.members; foreach (MinionOwnership val2 in members) { if (!Object.op_Implicit((Object)(object)val2)) { continue; } CharacterMaster component = ((Component)val2).GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { continue; } CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body)) { Debug.Log((object)body); if (!Object.op_Implicit((Object)(object)body.equipmentSlot)) { Debug.Log((object)(((object)body)?.ToString() + "Has no equipment slot")); ((Component)body).gameObject.AddComponent<EquipmentSlot>(); body.equipmentSlot = ((Component)body).gameObject.GetComponent<EquipmentSlot>(); } else if (component.inventory.GetItemCount(Items.GummyCloneIdentifier) == 0) { body.equipmentSlot.PerformEquipmentAction(equipmentDef); } } } } } public class PickupDisplayTracker : ItemBehavior { public PickupDisplay display; private void OnEnable() { } private void OnDisable() { } } } namespace LunarSoap.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] public class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] public static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LunarSoap.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] public static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } public static byte[] IconDrone { get { object @object = ResourceManager.GetObject("IconDrone", resourceCulture); return (byte[])@object; } } public static byte[] IconSoap { get { object @object = ResourceManager.GetObject("IconSoap", resourceCulture); return (byte[])@object; } } internal Resources() { } } }