Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of MagicalWizardThatTeleportsYouToMithrix v2.0.0
MagicalWizard.dll
Decompiled 7 months agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using KinematicCharacterController; using R2API; using RoR2; using RoR2.Networking; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.SceneManagement; [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("MagicalWizard")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MagicalWizard")] [assembly: AssemblyTitle("MagicalWizard")] [assembly: AssemblyVersion("1.0.0.0")] namespace MagicalWizard; [BepInPlugin("com.rob.MagicalWizardThatTeleportsYouToMithrix", "MagicalWizardThatTeleportsYouToMithrix", "2.0.0")] public class Plugin : BaseUnityPlugin { public const string MODUID = "com.rob.MagicalWizardThatTeleportsYouToMithrix"; public static AssetBundle mainAssetBundle; public static GameObject wizardPrefab; public static Vector3 moonSpawnPoint = new Vector3(2607.263f, 204.15f, 732.7989f); public static Vector3 moon2SoupSpawnPoint = new Vector3(1072f, -283.95f, 1150f); public static Vector3 moon2SpawnPoint = new Vector3(-202.1794f, -145.382f, -344.0464f); public static Vector3 moonWarpPoint = new Vector3(128.1882f, 497.2452f, 160.3198f); public static Vector3 moon2SoupWarpPoint = new Vector3(-194.8317f, -144.1522f, -328.9149f); public static Vector3 moon2WarpPoint = new Vector3(128.1882f, 497.2452f, 160.3198f); private void Awake() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01cb: Unknown result type (might be due to invalid IL or missing references) using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MagicalWizard.robwizard")) { mainAssetBundle = AssetBundle.LoadFromStream(stream); } using (Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("MagicalWizard.wizard_bank.bnk")) { byte[] array = new byte[stream2.Length]; stream2.Read(array, 0, array.Length); SoundBanks.Add(array); } GameObject val = mainAssetBundle.LoadAsset<GameObject>("mdlWizard"); SkinnedMeshRenderer componentInChildren = val.GetComponentInChildren<SkinnedMeshRenderer>(); ((Renderer)componentInChildren).material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard"); wizardPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Barrel1/Barrel1.prefab").WaitForCompletion(), "MagicalWizard", true); wizardPrefab.GetComponent<Highlight>().targetRenderer.enabled = false; ((Component)wizardPrefab.GetComponent<Highlight>().targetRenderer).GetComponent<SkinnedMeshRenderer>().sharedMesh = null; Object.Destroy((Object)(object)wizardPrefab.GetComponent<BarrelInteraction>()); Object.Destroy((Object)(object)wizardPrefab.GetComponent<GenericDisplayNameProvider>()); wizardPrefab.GetComponent<SfxLocator>().openSound = ""; Transform modelTransform = wizardPrefab.GetComponent<ModelLocator>().modelTransform; wizardPrefab.AddComponent<WizardInteraction>().animator = val.GetComponentInChildren<Animator>(); ((Behaviour)((Component)modelTransform).GetComponent<Animator>()).enabled = false; ((Renderer)((Component)modelTransform.Find("BarrelMesh")).GetComponent<SkinnedMeshRenderer>()).enabled = false; val.transform.parent = ((Component)wizardPrefab.GetComponent<Highlight>().targetRenderer).transform; val.transform.localPosition = new Vector3(0f, 0f, 0f); val.transform.localRotation = Quaternion.Euler(new Vector3(90f, 0f, 0f)); wizardPrefab.GetComponent<Highlight>().targetRenderer = (Renderer)(object)componentInChildren; ((Component)componentInChildren).gameObject.AddComponent<EntityLocator>().entity = wizardPrefab; Object.Destroy((Object)(object)wizardPrefab.transform.Find("HologramPivot")); SceneManager.sceneLoaded += SceneManager_sceneLoaded; } private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "moon") { GameObject val = Object.Instantiate<GameObject>(wizardPrefab); val.transform.position = moonSpawnPoint; val.transform.rotation = Quaternion.Euler(new Vector3(0f, 130f, 0f)); return; } activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "moon2") { GameObject val2 = Object.Instantiate<GameObject>(wizardPrefab); val2.transform.position = moon2SpawnPoint; val2.transform.rotation = Quaternion.Euler(new Vector3(0f, 90f, 0f)); GameObject val3 = Object.Instantiate<GameObject>(wizardPrefab); val3.transform.position = moon2SoupSpawnPoint; val3.transform.rotation = Quaternion.Euler(new Vector3(0f, 90f, 0f)); val3.GetComponent<WizardInteraction>().isSoup = true; } } } public class DelayedWarp : MonoBehaviour { public bool isSoup = false; private void Awake() { ((MonoBehaviour)this).Invoke("Sound", 1.4f); ((MonoBehaviour)this).Invoke("Warp", 1.5f); } private void Sound() { Util.PlaySound("sfx_wizard_teleport", ((Component)this).gameObject); } private void Warp() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Plugin.moonWarpPoint; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "moon2") { val = (isSoup ? Plugin.moon2SoupWarpPoint : Plugin.moon2WarpPoint); } CharacterMotor component = ((Component)this).GetComponent<CharacterMotor>(); if (Object.op_Implicit((Object)(object)component)) { ((BaseCharacterController)component).Motor.SetPosition(val, true); } Object.Destroy((Object)(object)this); } } public class WizardInteraction : NetworkBehaviour, IInteractable, IDisplayNameProvider { public string displayNameToken = "Raphael"; public string contextToken = "Ask for the wizard's help"; public bool isSoup = false; public Animator animator; [SyncVar] private bool opened; private float stopwatch; private uint playID; public bool Networkopened { get { return opened; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar<bool>(value, ref opened, 1u); } } bool IInteractable.ShouldProximityHighlight() { return true; } public string GetContextString(Interactor activator) { return Language.GetString(contextToken); } public override int GetNetworkChannel() { return QosChannelIndex.defaultReliable.intVal; } public Interactability GetInteractability(Interactor activator) { //IL_0010: 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) if (opened) { return (Interactability)0; } return (Interactability)2; } private void Update() { stopwatch -= Time.deltaTime; if (stopwatch <= 0f) { opened = false; Networkopened = false; } } [Server] public void OnInteractionBegin(Interactor activator) { if (!NetworkServer.active || opened) { return; } Networkopened = true; if (Object.op_Implicit((Object)(object)animator)) { animator.PlayInFixedTime("CastSpell"); } Util.PlaySound("sfx_wizard_laugh2", ((Component)this).gameObject); stopwatch = 1.55f; if (Object.op_Implicit((Object)(object)activator)) { ((Component)activator).gameObject.AddComponent<DelayedWarp>().isSoup = isSoup; CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { component.AddTimedBuff(Buffs.Immune, 1.5f); } } } public string GetDisplayName() { return Language.GetString(displayNameToken); } public bool ShouldIgnoreSpherecastForInteractibility(Interactor activator) { return false; } public void OnEnable() { playID = Util.PlaySound("sfx_wizard_bgm", ((Component)this).gameObject); InstanceTracker.Add<WizardInteraction>(this); } public void OnDisable() { AkSoundEngine.StopPlayingID(playID); InstanceTracker.Remove<WizardInteraction>(this); } public bool ShouldShowOnScanner() { return !opened; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { if (forceAll) { writer.Write(opened); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(opened); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { if (initialState) { opened = reader.ReadBoolean(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { opened = reader.ReadBoolean(); } } public override void PreStartClient() { } }