using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using PaladinMod.Misc; using PaladinMod.Modules; using RoR2; using UnityEngine; [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.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("PaladinGotSwords")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PaladinGotSwords")] [assembly: AssemblyTitle("PaladinGotSwords")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace PaladinGotSwords; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Dragonyck.PaladinGotSwords", "PaladinGotSwords", "1.0.0")] public class MainPlugin : BaseUnityPlugin { private class MoreSwords : MonoBehaviour { public class SwordTracker : MonoBehaviour { [SerializeField] public List swords = new List(); } public class Sword { public struct SwordTransform { public Vector3 localPosition; public Quaternion localRotation; public Vector3 localScale; } public string childName; public SwordTransform swordTransform; public static Sword NewSword(string childName, SwordTransform swordTransform) { return new Sword { childName = childName, swordTransform = swordTransform }; } public static Sword NewRandomSwordTransform() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) Sword sword = baseSwords[RoR2Application.rng.RangeInt(0, baseSwords.Length)]; return NewSword(sword.childName, NewSwordTransform(sword.swordTransform.localPosition, Random.rotation, Vector3.one)); } public static SwordTransform NewSwordTransform(Vector3 localPosition, Quaternion localRotation, Vector3 localScale) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SwordTransform result = default(SwordTransform); result.localPosition = localPosition; result.localRotation = localRotation; result.localScale = localScale; return result; } } public SwordTracker tracker; private static readonly string[] childNames = new string[10] { "HandL", "Chest", "Chest", "Stomach", "Pelvis", "Pelvis", "Head", "Stomach", "Stomach", "Sword" }; private static Sword[] baseSwords = new Sword[12] { Sword.NewSword("HandL", Sword.NewSwordTransform(new Vector3(-0.053f, 0.142f, 0.094f), Quaternion.Euler(-7.447001f, 6.863f, -156.527f), Vector3.one * 0.9584653f)), Sword.NewSword("Stomach", Sword.NewSwordTransform(new Vector3(1.125f, 0.075f, -0.327f), Quaternion.Euler(-0.513f, -83.77801f, 4.693f), Vector3.one * 0.9584653f)), Sword.NewSword("Chest", Sword.NewSwordTransform(new Vector3(0.414f, 0.594f, -0.393f), Quaternion.Euler(62.931f, -80.441f, 10.971f), Vector3.one * 0.9584653f)), Sword.NewSword("Chest", Sword.NewSwordTransform(new Vector3(-0.414f, 0.594f, -0.393f), Quaternion.Euler(62.931f, 80.441f, -10.971f), Vector3.one * 0.9584653f)), Sword.NewSword("ThighL", Sword.NewSwordTransform(new Vector3(-0.11f, -0.066f, -0.544f), Quaternion.Euler(-11.388f, -15.65f, 5.89f), Vector3.one * 0.9584653f)), Sword.NewSword("ThighR", Sword.NewSwordTransform(new Vector3(0.11f, -0.219f, -0.444f), Quaternion.Euler(-41.388f, 15.65f, -5.89f), Vector3.one * 0.9584653f)), Sword.NewSword("Head", Sword.NewSwordTransform(new Vector3(-0.144f, 0.04f, 0.201f), Quaternion.Euler(1.059f, -96.554f, 9.314f), Vector3.one * 0.9584653f)), Sword.NewSword("Sword", Sword.NewSwordTransform(new Vector3(-0.034f, 2.122f, -0.044f), Quaternion.Euler(-91.297f, 40.267f, -89.26501f), Vector3.one * 0.9584653f)), Sword.NewSword("HandL", Sword.NewSwordTransform(new Vector3(0.2f, 0.43f, 2.222f), Quaternion.Euler(-5f, 7f, 205f), Vector3.one * 0.9584653f)), Sword.NewSword("UpperArmR", Sword.NewSwordTransform(new Vector3(-0.4417481f, -0.03341782f, 0.2558637f), Quaternion.Euler(-35.827f, 162.657f, -175.32f), Vector3.one * 0.9584653f)), Sword.NewSword("UpperArmL", Sword.NewSwordTransform(new Vector3(0.402f, -0.069f, 0.276f), Quaternion.Euler(-9.927f, -159.828f, -185.013f), Vector3.one * 0.9584653f)), Sword.NewSword("Pelvis", Sword.NewSwordTransform(new Vector3(0f, 0.088f, -0.241f), Quaternion.Euler(-98.244f, 0.6609955f, -0.6779785f), Vector3.one * 0.9584653f)) }; private ChildLocator childLocator; private GameObject originalSword; private CharacterBody body; private Quaternion[] fingieRotations = (Quaternion[])(object)new Quaternion[10] { Quaternion.Euler(20.305f, -99.29f, -29.443f), Quaternion.Euler(77.596f, 140.148f, 137.646f), Quaternion.Euler(2.278f, -94.00201f, -33.02f), Quaternion.Euler(15.213f, 1.44f, 28.627f), Quaternion.Euler(23.77f, -94.61001f, -24.605f), Quaternion.Euler(72.704f, 86.749f, 76.43f), Quaternion.Euler(25.435f, -84.555f, -5.675f), Quaternion.Euler(73.149f, 34.461f, 28.295f), Quaternion.Euler(28.005f, -80.00401f, 13.456f), Quaternion.Euler(56.692f, 13.024f, 13.553f) }; private List fingies = new List(); public List swordInstances = new List(); private void Start() { CharacterModel component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { body = component.body; if (Object.op_Implicit((Object)(object)body.masterObject)) { tracker = body.masterObject.GetComponent(); } } childLocator = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)childLocator)) { return; } Transform val = childLocator.FindChild("HandL"); if (Object.op_Implicit((Object)(object)val)) { Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Transform val2 in componentsInChildren) { switch (((Object)val2).name) { case "palm.01.L": case "f_index.02.L": case "thumb.01.L": case "thumb.02.L": case "palm.02.L": case "f_middle.02.L": case "palm.03.L": case "f_ring.02.L": case "palm.04.L": case "f_pinky.02.L": fingies.Add(val2); break; } } } Transform val3 = childLocator.FindChild("SwordModel"); if (Object.op_Implicit((Object)(object)val3)) { originalSword = ((Component)val3).gameObject; } UpdateSwords(); } private void LateUpdate() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)tracker) && tracker.swords.Count > 0) { for (int i = 0; i < fingies.Count; i++) { Transform val = fingies[i]; val.localRotation = fingieRotations[i]; } } } public void UpdateSwords() { if (!Object.op_Implicit((Object)(object)tracker) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)originalSword)) { return; } if (tracker.swords.Count < baseSwords.Length) { for (int i = 0; i < baseSwords.Length; i++) { Sword sword = baseSwords[i]; if (!tracker.swords.Contains(baseSwords[i])) { tracker.swords.Add(sword); InstantiateSword(sword); } if (i == (int)body.level - 2) { break; } } } else { int num = (int)body.level - 2; int num2 = num - tracker.swords.Count; if (num2 > 0) { for (int j = 0; j < num2; j++) { Sword sword2 = Sword.NewRandomSwordTransform(); tracker.swords.Add(sword2); InstantiateSword(sword2); } } } if (swordInstances.Count != 0) { return; } foreach (Sword sword3 in tracker.swords) { InstantiateSword(sword3); } } private void InstantiateSword(Sword s) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) Transform val = childLocator.FindChild(s.childName); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = Object.Instantiate(swordBase, val.position, Quaternion.identity, val); val2.transform.localPosition = s.swordTransform.localPosition; val2.transform.localRotation = s.swordTransform.localRotation; val2.transform.localScale = s.swordTransform.localScale; SkinnedMeshRenderer component = originalSword.GetComponent(); val2.GetComponentInChildren().mesh = component.sharedMesh; ((Renderer)val2.GetComponentInChildren()).material = ((Renderer)component).material; swordInstances.Add(val2); } } } public const string MODUID = "com.Dragonyck.PaladinGotSwords"; public const string MODNAME = "PaladinGotSwords"; public const string VERSION = "1.0.0"; private static GameObject swordBase; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) GlobalEventManager.onCharacterLevelUp += GlobalEventManager_onCharacterLevelUp; GameObject val = new GameObject("DontDestroy"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); swordBase = new GameObject("NewSword"); GameObject val2 = new GameObject("SwordMesh", new Type[2] { typeof(MeshRenderer), typeof(MeshFilter) }); val2.transform.localRotation = Quaternion.Euler(180f, 90f, 90f); val2.transform.parent = swordBase.transform; swordBase.transform.parent = val.transform; ObjectScaleCurve val3 = swordBase.AddComponent(); val3.useOverallCurveOnly = true; val3.overallCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); val3.timeMax = 0.1f; } private void Start() { ((Component)Prefabs.paladinPrefab.GetComponent().modelTransform).gameObject.AddComponent(); } private void GlobalEventManager_onCharacterLevelUp(CharacterBody body) { if (Object.op_Implicit((Object)(object)((Component)body).GetComponent()) && Object.op_Implicit((Object)(object)body.masterObject) && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { MoreSwords.SwordTracker swordTracker = body.masterObject.GetComponent(); if (!Object.op_Implicit((Object)(object)swordTracker)) { swordTracker = body.masterObject.AddComponent(); } MoreSwords component = ((Component)body.modelLocator.modelTransform).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.tracker = swordTracker; component.UpdateSwords(); } } } }