Decompiled source of Oddments v0.2.1
plugins/Oddments.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using Alexandria; using Alexandria.DungeonAPI; using Alexandria.EnemyAPI; using Alexandria.ItemAPI; using Alexandria.Misc; using Alexandria.NPCAPI; using Alexandria.PrefabAPI; using BepInEx; using BindingAPI; using Brave.BulletScript; using Dungeonator; using FullSerializer; using GungeonAPI; using HarmonyLib; using InControl; using JuneLib; using JuneLib.Chests; using JuneLib.Items; using JuneLib.Status; using MonoMod.RuntimeDetour; using Oddments; using Pathfinding; using SaveAPI; using UnityEngine; [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")] [module: UnverifiableCode] namespace GungeonAPI { public static class HitboxMonitor { public class HitBoxDisplay : BraveBehaviour { private GameObject hitboxDisplay = null; private PixelCollider collider; private void Start() { CreateDisplay(); } public void CreateDisplay() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) collider = ((BraveBehaviour)this).specRigidbody.HitboxPixelCollider; string name = "HitboxDisplay"; if ((Object)(object)hitboxDisplay == (Object)null) { hitboxDisplay = GameObject.CreatePrimitive((PrimitiveType)3); } hitboxDisplay.GetComponent<Renderer>().material.color = new Color(1f, 0f, 1f, 0.75f); ((Object)hitboxDisplay).name = name; hitboxDisplay.transform.SetParent(((BraveBehaviour)((BraveBehaviour)this).specRigidbody).transform); } private void FixedUpdate() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) hitboxDisplay.transform.localScale = new Vector3((float)collider.Dimensions.x / pixelsPerUnit, (float)collider.Dimensions.y / pixelsPerUnit, 1f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)collider.Offset.x + (float)collider.Dimensions.x * 0.5f, (float)collider.Offset.y + (float)collider.Dimensions.y * 0.5f, 0f - pixelsPerUnit); val /= pixelsPerUnit; hitboxDisplay.transform.localPosition = val; } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)hitboxDisplay)) { Object.DestroyImmediate((Object)(object)hitboxDisplay); } } } private static float pixelsPerUnit = 16f; public static void DisplayHitbox(SpeculativeRigidbody speculativeRigidbody) { PixelCollider hitboxPixelCollider = speculativeRigidbody.HitboxPixelCollider; if (!Object.op_Implicit((Object)(object)((Component)speculativeRigidbody).gameObject.GetComponent<HitBoxDisplay>())) { ((Component)speculativeRigidbody).gameObject.AddComponent<HitBoxDisplay>(); } } public static void DeleteHitboxDisplays() { HitBoxDisplay[] array = Object.FindObjectsOfType<HitBoxDisplay>(); foreach (HitBoxDisplay hitBoxDisplay in array) { Object.Destroy((Object)(object)hitBoxDisplay); } } } public static class NPCBuilder { public enum AnimationType { Move, Idle, Fidget, Flight, Hit, Talk, Other } public static tk2dSpriteAnimationClip AddAnimation(this GameObject obj, string name, string spriteDirectory, int fps, AnimationType type, DirectionType directionType = 0, FlipType flipType = 0) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected I4, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) obj.AddComponent<tk2dSpriteAnimator>(); AIAnimator val = obj.GetComponent<AIAnimator>(); if (!Object.op_Implicit((Object)(object)val)) { val = CreateNewAIAnimator(obj); } DirectionalAnimation val2 = val.GetDirectionalAnimation(name, directionType, type); if (val2 == null) { DirectionalAnimation val3 = new DirectionalAnimation(); val3.AnimNames = new string[0]; val3.Flipped = (FlipType[])(object)new FlipType[0]; val3.Type = directionType; val3.Prefix = string.Empty; val2 = val3; } val2.AnimNames = val2.AnimNames.Concat(new string[1] { name }).ToArray(); val2.Flipped = val2.Flipped.Concat((IEnumerable<FlipType>)(object)new FlipType[1] { (FlipType)(int)flipType }).ToArray(); val.AssignDirectionalAnimation(name, val2, type); return BuildAnimation(val, name, spriteDirectory, fps); } private static AIAnimator CreateNewAIAnimator(GameObject obj) { AIAnimator val = obj.AddComponent<AIAnimator>(); val.FlightAnimation = CreateNewDirectionalAnimation(); val.HitAnimation = CreateNewDirectionalAnimation(); val.IdleAnimation = CreateNewDirectionalAnimation(); val.TalkAnimation = CreateNewDirectionalAnimation(); val.MoveAnimation = CreateNewDirectionalAnimation(); val.OtherAnimations = new List<NamedDirectionalAnimation>(); val.IdleFidgetAnimations = new List<DirectionalAnimation>(); val.OtherVFX = new List<NamedVFXPool>(); return val; } private static DirectionalAnimation CreateNewDirectionalAnimation() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) DirectionalAnimation val = new DirectionalAnimation(); val.AnimNames = new string[0]; val.Flipped = (FlipType[])(object)new FlipType[0]; val.Type = (DirectionType)0; return val; } public static tk2dSpriteAnimationClip BuildAnimation(AIAnimator aiAnimator, string name, string spriteDirectory, int fps) { tk2dSpriteCollectionData val = ((Component)aiAnimator).GetComponent<tk2dSpriteCollectionData>(); if (!Object.op_Implicit((Object)(object)val)) { val = SpriteBuilder.ConstructCollection(((Component)aiAnimator).gameObject, ((Object)aiAnimator).name + "_collection", false); } string[] resourceNames = ResourceExtractor.GetResourceNames((Assembly)null); List<int> list = new List<int>(); for (int i = 0; i < resourceNames.Length; i++) { if (resourceNames[i].StartsWith(spriteDirectory.Replace('/', '.'), StringComparison.OrdinalIgnoreCase)) { list.Add(SpriteBuilder.AddSpriteToCollection(resourceNames[i], val, (Assembly)null)); } } if (list.Count == 0) { ETGModConsole.Log((object)("No sprites found for animation " + name), false); } tk2dSpriteAnimationClip val2 = SpriteBuilder.AddAnimation(((BraveBehaviour)aiAnimator).spriteAnimator, val, list, name, (WrapMode)0, 15f); val2.fps = fps; return val2; } public static DirectionalAnimation GetDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionType directionType, AnimationType type) { DirectionalAnimation val = null; switch (type) { case AnimationType.Move: val = aiAnimator.MoveAnimation; break; case AnimationType.Idle: val = aiAnimator.IdleAnimation; break; case AnimationType.Flight: val = aiAnimator.FlightAnimation; break; case AnimationType.Hit: val = aiAnimator.HitAnimation; break; case AnimationType.Talk: val = aiAnimator.TalkAnimation; break; } if (val != null) { return val; } return null; } public static void AssignDirectionalAnimation(this AIAnimator aiAnimator, string name, DirectionalAnimation animation, AnimationType type) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007f: Expected O, but got Unknown switch (type) { case AnimationType.Move: aiAnimator.MoveAnimation = animation; return; case AnimationType.Idle: aiAnimator.IdleAnimation = animation; return; case AnimationType.Fidget: aiAnimator.IdleFidgetAnimations.Add(animation); return; case AnimationType.Flight: aiAnimator.FlightAnimation = animation; return; case AnimationType.Hit: aiAnimator.HitAnimation = animation; return; case AnimationType.Talk: aiAnimator.TalkAnimation = animation; return; } aiAnimator.OtherAnimations.Add(new NamedDirectionalAnimation { anim = animation, name = name }); } } public abstract class NPCInteractable : BraveBehaviour { public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public List<string> conversation; public List<string> conversation2; public Func<PlayerController, GameObject, bool> CanUse; public Transform talkPoint; public string text; public string acceptText; public string acceptText2; public string declineText; public string declineText2; public bool isToggle; protected bool m_isToggled; protected bool m_canUse = true; } public class ShrineFactory { public class ShrineShadowHandler : MonoBehaviour { public Vector3 Offset; public GameObject shadowObject; public ShrineShadowHandler() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_002d: 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) shadowObject = (GameObject)Object.Instantiate(ResourceCache.Acquire("DefaultShadowSprite")); Offset = Vector2.op_Implicit(new Vector2(0f, 0f)); } public void Start() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(shadowObject); val.transform.parent = ((Component)this).gameObject.transform; tk2dSprite component = val.GetComponent<tk2dSprite>(); ((BraveBehaviour)component).renderer.enabled = true; ((tk2dBaseSprite)component).HeightOffGround = ((tk2dBaseSprite)((Component)this).gameObject.GetComponent<tk2dSprite>()).HeightOffGround - 0.1f; Vector3Extensions.WithZ(val.transform.position, ((Component)this).gameObject.transform.position.z + 99999f); val.transform.position = ((Component)this).gameObject.transform.position + Offset; DepthLookupManager.ProcessRenderer(val.GetComponent<Renderer>(), (GungeonSortingLayer)0); ((tk2dBaseSprite)component).usesOverrideMaterial = true; ((BraveBehaviour)component).renderer.material.shader = Shader.Find("Brave/Internal/SimpleAlphaFadeUnlit"); ((BraveBehaviour)component).renderer.material.SetFloat("_Fade", 0.66f); } } public class CustomShrineController : DungeonPlaceableBehaviour { public bool HasRoomIcon; public bool RoomIcon; public string ID; public bool isBreachShrine; public Vector3 offset; public List<PixelCollider> pixelColliders; public Dictionary<string, int> roomStyles; public ShrineFactory factory; public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public Func<PlayerController, GameObject, bool> CanUse; private RoomHandler m_parentRoom; private GameObject m_instanceMinimapIcon; public int numUses = 0; public string text; public string acceptText; public string declineText; public GameObject roomIcon; private void Start() { string text = ((Object)this).name.Replace("(Clone)", ""); if (registeredShrines.ContainsKey(text)) { Copy(registeredShrines[text].GetComponent<CustomShrineController>()); } else { ETGModConsole.Log((object)("Was this shrine registered correctly?: " + text), false); } SimpleInteractable component = ((Component)this).GetComponent<SimpleInteractable>(); if ((Object)(object)component != (Object)null) { component.OnAccept = OnAccept; component.OnDecline = OnDecline; component.CanUse = CanUse; component.text = this.text; component.acceptText = acceptText; component.declineText = declineText; component.roomIcon = roomIcon; component.HasRoomIcon = HasRoomIcon; } } public void Copy(CustomShrineController other) { //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) ID = other.ID; roomStyles = other.roomStyles; isBreachShrine = other.isBreachShrine; offset = other.offset; pixelColliders = other.pixelColliders; factory = other.factory; OnAccept = other.OnAccept; OnDecline = other.OnDecline; CanUse = other.CanUse; text = other.text; acceptText = other.acceptText; declineText = other.declineText; roomIcon = other.roomIcon; HasRoomIcon = other.HasRoomIcon; } public void ConfigureOnPlacement(RoomHandler room) { m_parentRoom = room; RegisterMinimapIcon(); } public void RegisterMinimapIcon() { if (HasRoomIcon) { m_instanceMinimapIcon = Minimap.Instance.RegisterRoomIcon(m_parentRoom, roomIcon, false); } } public void GetRidOfMinimapIcon() { if ((Object)(object)m_instanceMinimapIcon != (Object)null) { Minimap.Instance.DeregisterRoomIcon(m_parentRoom, m_instanceMinimapIcon); m_instanceMinimapIcon = null; } } } public static Dictionary<string, GameObject> registeredShrines = new Dictionary<string, GameObject>(); public Vector2 roomOffset; public float ShrinePercentageChance; public DungeonPrerequisite[] preRequisites; public bool HasRoomIcon = true; public float RoomWeight; public string RoomIconSpritePath; public string name; public string modID; public string spritePath; public string roomPath; public string text; public string acceptText; public string declineText; public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public Func<PlayerController, GameObject, bool> CanUse; public Vector3 talkPointOffset; public Vector3 offset = new Vector3(43.8f, 42.4f, 42.9f); public IntVector2 colliderOffset; public IntVector2 colliderSize; public bool isToggle; public string shadowPath; public float ShadowOffsetX; public float ShadowOffsetY; public bool usesCustomColliderOffsetAndSize; public Type interactableComponent = null; public Type AdditionalComponent = null; public bool isBreachShrine = false; public PrototypeDungeonRoom room; public GameObject roomIcon; public Dictionary<string, int> roomStyles; private static bool m_initialized; private static bool m_builtShrines; public static void Init() { if (m_initialized) { return; } DungeonHooks.OnFoyerAwake += PlaceBreachShrines; DungeonHooks.OnPreDungeonGeneration += delegate(LoopDungeonGenerator generator, Dungeon dungeon, DungeonFlow flow, int dungeonSeed) { if (((Object)flow).name != "Foyer Flow" && !GameManager.IsReturningToFoyerWithPlayer) { CustomShrineController[] array = Object.FindObjectsOfType<CustomShrineController>(); foreach (CustomShrineController customShrineController in array) { if (!ShrineFakePrefab.IsFakePrefab((Object)(object)customShrineController)) { Object.Destroy((Object)(object)((Component)customShrineController).gameObject); } } m_builtShrines = false; } }; m_initialized = true; } public GameObject BuildWithoutBaseGameInterference() { //IL_0064: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0377: 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) try { Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(spritePath, (Assembly)null); GameObject val = SpriteBuilder.SpriteFromResource(spritePath, (GameObject)null, (Assembly)null); string text2 = (((Object)val).name = (modID + ":" + name).ToLower().Replace(" ", "_")); tk2dSprite component = val.GetComponent<tk2dSprite>(); ((tk2dBaseSprite)component).IsPerpendicular = true; ((tk2dBaseSprite)component).PlaceAtPositionByAnchor(offset, (Anchor)1); Transform transform = new GameObject("talkpoint").transform; transform.position = val.transform.position + talkPointOffset; transform.SetParent(val.transform); if (!usesCustomColliderOffsetAndSize) { IntVector2 val2 = default(IntVector2); ((IntVector2)(ref val2))..ctor(((Texture)textureFromResource).width, ((Texture)textureFromResource).height); _ = colliderOffset; colliderOffset = colliderOffset; _ = colliderSize; colliderSize = colliderSize; } SpeculativeRigidbody val3 = SpriteBuilder.SetUpSpeculativeRigidbody(component, colliderOffset, colliderSize); CustomShrineController customShrineController = val.AddComponent<CustomShrineController>(); customShrineController.ID = text2; customShrineController.roomStyles = roomStyles; customShrineController.isBreachShrine = true; customShrineController.offset = offset; customShrineController.pixelColliders = ((BraveBehaviour)val3).specRigidbody.PixelColliders; customShrineController.factory = this; customShrineController.OnAccept = OnAccept; customShrineController.OnDecline = OnDecline; customShrineController.CanUse = CanUse; customShrineController.text = this.text; customShrineController.acceptText = acceptText; customShrineController.declineText = declineText; customShrineController.HasRoomIcon = HasRoomIcon; if (!string.IsNullOrEmpty(RoomIconSpritePath)) { GameObject val4 = SpriteBuilder.SpriteFromResource(RoomIconSpritePath, (GameObject)null, (Assembly)null); Object.DontDestroyOnLoad((Object)(object)val4); FakePrefab.MarkAsFakePrefab(val4); val4.SetActive(false); customShrineController.roomIcon = val4; } else { customShrineController.roomIcon = (GameObject)BraveResources.Load("Global Prefabs/Minimap_Shrine_Icon", ".prefab"); } if ((object)interactableComponent == null) { SimpleShrine simpleShrine = val.AddComponent<SimpleShrine>(); simpleShrine.isToggle = isToggle; simpleShrine.OnAccept = OnAccept; simpleShrine.OnDecline = OnDecline; simpleShrine.CanUse = CanUse; simpleShrine.text = this.text; simpleShrine.acceptText = acceptText; simpleShrine.declineText = declineText; simpleShrine.roomIcon = customShrineController.roomIcon; simpleShrine.talkPoint = transform; simpleShrine.HasRoomIcon = HasRoomIcon; } else { val.AddComponent(interactableComponent); } if ((object)AdditionalComponent != null) { val.AddComponent(AdditionalComponent); } ((Object)val).name = text2; if (!isBreachShrine) { DungeonPlaceable asset = StaticReferences.GetAsset<DungeonPlaceable>("WhichShrineWillItBe"); if ((Object)(object)asset != (Object)null) { List<DungeonPlaceableVariant> variantTiers = asset.variantTiers; DungeonPlaceableVariant val5 = new DungeonPlaceableVariant(); val5.percentChance = ShrinePercentageChance; val5.prerequisites = (DungeonPrerequisite[])(((object)preRequisites) ?? ((object)new DungeonPrerequisite[0])); val5.nonDatabasePlaceable = val; _ = roomOffset; val5.unitOffset = roomOffset; variantTiers.Add(val5); } } FakePrefab.MarkAsFakePrefab(val); StaticReferences.StoredRoomObjects.Add(name, val); registeredShrines.Add(text2, val); PrototypeDungeonRoom protoroom = RoomFactory.CreateEmptyRoom(12, 12); RegisterShrineRoom(val, protoroom, name, Vector2.op_Implicit(new Vector3(-1f, -1f, 0f)), -1f); return val; } catch (Exception ex) { ETGModConsole.Log((object)ex, false); return null; } } public static void RegisterShrineRoom(GameObject shrine, PrototypeDungeonRoom protoroom, string ID, Vector2 offset, float roomweight) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011d: Unknown result type (might be due to invalid IL or missing references) DungeonPrerequisite[] array = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)(protoroom.Width / 2) + offset.x, (float)(protoroom.Height / 2) + offset.y); protoroom.placedObjectPositions.Add(val); DungeonPlaceable val2 = ScriptableObject.CreateInstance<DungeonPlaceable>(); val2.width = 2; val2.height = 2; val2.respectsEncounterableDifferentiator = true; List<DungeonPlaceableVariant> list = new List<DungeonPlaceableVariant>(); DungeonPlaceableVariant val3 = new DungeonPlaceableVariant(); val3.percentChance = 1f; val3.nonDatabasePlaceable = shrine; val3.prerequisites = array; val3.materialRequirements = (DungeonPlaceableRoomMaterialRequirement[])(object)new DungeonPlaceableRoomMaterialRequirement[0]; list.Add(val3); val2.variantTiers = list; protoroom.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = val, fieldData = new List<PrototypePlacedObjectFieldData>(), instancePrerequisites = array, linkedTriggerAreaIDs = new List<int>(), placeableContents = val2 }); RoomData val4 = default(RoomData); val4.room = protoroom; val4.category = ((object)(RoomCategory)(ref protoroom.category)).ToString(); val4.weight = roomweight; RoomData val5 = val4; RoomFactory.rooms.Add(ID, val5); DungeonHandler.RegisterForShrine(val5); } public static void RegisterShrineRoomNoObject(PrototypeDungeonRoom protoroom, string ID, float roomweight) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) RoomData val = default(RoomData); val.room = protoroom; val.category = ((object)(RoomCategory)(ref protoroom.category)).ToString(); val.weight = roomweight; RoomData val2 = val; RoomFactory.rooms.Add(ID, val2); DungeonHandler.RegisterForShrine(val2); } public static void PlaceBreachShrines() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (m_builtShrines) { return; } foreach (GameObject value in registeredShrines.Values) { try { CustomShrineController component = value.GetComponent<CustomShrineController>(); if (component.isBreachShrine) { CustomShrineController component2 = Object.Instantiate<GameObject>(value).GetComponent<CustomShrineController>(); component2.Copy(component); ((Component)component2).gameObject.SetActive(true); ((BraveBehaviour)component2).sprite.PlaceAtPositionByAnchor(component2.offset, (Anchor)1); IPlayerInteractable component3 = ((Component)component2).GetComponent<IPlayerInteractable>(); if (component3 is SimpleInteractable) { ((SimpleInteractable)(object)component3).OnAccept = component2.OnAccept; ((SimpleInteractable)(object)component3).OnDecline = component2.OnDecline; ((SimpleInteractable)(object)component3).CanUse = component2.CanUse; } if (!RoomHandler.unassignedInteractableObjects.Contains(component3)) { RoomHandler.unassignedInteractableObjects.Add(component3); } } } catch (Exception ex) { ETGModConsole.Log((object)ex, false); } } m_builtShrines = true; } } public class ShrineFakePrefab : Component { internal static HashSet<GameObject> ExistingFakePrefabs = new HashSet<GameObject>(); public static bool IsFakePrefab(Object o) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (o is GameObject) { return ExistingFakePrefabs.Contains((GameObject)o); } if (o is Component) { return ExistingFakePrefabs.Contains(((Component)o).gameObject); } return false; } public static void MarkAsFakePrefab(GameObject obj) { ExistingFakePrefabs.Add(obj); } public static GameObject Clone(GameObject obj) { bool flag = IsFakePrefab((Object)(object)obj); bool activeSelf = obj.activeSelf; if (activeSelf) { obj.SetActive(false); } GameObject val = Object.Instantiate<GameObject>(obj); if (activeSelf) { obj.SetActive(true); } foreach (object componentInChild in val.GetComponentInChildren<Transform>()) { Object.DontDestroyOnLoad((Object)(object)val); } ExistingFakePrefabs.Add(val); return val; } public static Object Instantiate(Object o, Object new_o) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0022: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (o is GameObject && ExistingFakePrefabs.Contains((GameObject)o)) { ((GameObject)new_o).SetActive(true); } else if (o is Component && ExistingFakePrefabs.Contains(((Component)o).gameObject)) { ((Component)new_o).gameObject.SetActive(true); } return new_o; } } public static class ShrineFakePrefabHooks { public delegate TResult Func<T1, T2, T3, T4, T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); public static void Init() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[3] { typeof(Object), typeof(Transform), typeof(bool) }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPI")); Hook val2 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[2] { typeof(Object), typeof(Transform) }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOP")); Hook val3 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[1] { typeof(Object) }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateO")); Hook val4 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[3] { typeof(Object), typeof(Vector3), typeof(Quaternion) }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPR")); Hook val5 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[4] { typeof(Object), typeof(Vector3), typeof(Quaternion), typeof(Transform) }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPRP")); } catch (Exception ex) { ETGModConsole.Log((object)ex, false); } } public static T InstantiateGeneric<T>(Object original) where T : Object { return (T)(object)ShrineFakePrefab.Instantiate(original, Object.Instantiate(original)); } public static Object InstantiateOPI(Func<Object, Transform, bool, Object> orig, Object original, Transform parent, bool instantiateInWorldSpace) { return ShrineFakePrefab.Instantiate(original, orig(original, parent, instantiateInWorldSpace)); } public static Object InstantiateOP(Func<Object, Transform, Object> orig, Object original, Transform parent) { return ShrineFakePrefab.Instantiate(original, orig(original, parent)); } public static Object InstantiateO(Func<Object, Object> orig, Object original) { return ShrineFakePrefab.Instantiate(original, orig(original)); } public static Object InstantiateOPR(Func<Object, Vector3, Quaternion, Object> orig, Object original, Vector3 position, Quaternion rotation) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ShrineFakePrefab.Instantiate(original, orig(original, position, rotation)); } public static Object InstantiateOPRP(Func<Object, Vector3, Quaternion, Transform, Object> orig, Object original, Vector3 position, Quaternion rotation, Transform parent) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return ShrineFakePrefab.Instantiate(original, orig(original, position, rotation, parent)); } } public abstract class SimpleInteractable : BraveBehaviour { public Action<PlayerController, GameObject> OnAccept; public Action<PlayerController, GameObject> OnDecline; public List<string> conversation; public List<string> conversation2; public List<string> conversation3; public List<string> conversation4; public Func<PlayerController, GameObject, bool> CanUse; public Transform talkPoint; public string text; public string acceptText; public string acceptText2; public string declineText; public string declineText2; public bool isToggle; public GameObject roomIcon; protected bool m_isToggled; protected bool m_canUse = true; public bool HasRoomIcon; } public class SimpleShrine : SimpleInteractable, IPlayerInteractable { public RoomHandler instanceRoom; public GameObject instanceMinimapIcon; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00bb: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black, 1f, 0f, (OutlineType)0); talkPoint = ((BraveBehaviour)this).transform.Find("talkpoint"); m_isToggled = false; if (HasRoomIcon) { instanceRoom = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(((BraveBehaviour)this).transform.position, (VectorConversions)0)); if (instanceRoom != null && !((Object)(object)roomIcon == (Object)null)) { instanceMinimapIcon = Minimap.Instance.RegisterRoomIcon(instanceRoom, (GameObject)(((object)roomIcon) ?? ((object)(GameObject)BraveResources.Load("Global Prefabs/Minimap_Shrine_Icon", ".prefab"))), false); } } } public void Interact(PlayerController interactor) { if (!TextBoxManager.HasTextBox(talkPoint)) { m_canUse = ((CanUse != null) ? CanUse(interactor, ((Component)this).gameObject) : m_canUse); ((MonoBehaviour)this).StartCoroutine(HandleConversation(interactor)); } } private IEnumerator HandleConversation(PlayerController interactor) { if ((Object)(object)talkPoint == (Object)null) { ETGModConsole.Log((object)"talkPoint is NULL", false); } _ = talkPoint.position; if (false) { ETGModConsole.Log((object)"talkPoint.position is NULL", false); } if (text == null) { ETGModConsole.Log((object)"text is NULL", false); } TextBoxManager.ShowStoneTablet(talkPoint.position, talkPoint, -1f, text, true, false); int selectedResponse = -1; interactor.SetInputOverride("shrineConversation"); yield return null; if (!m_canUse) { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, declineText, string.Empty); } else if (isToggle) { if (m_isToggled) { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, declineText, string.Empty); } else { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, acceptText, string.Empty); } } else { GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, acceptText, declineText); } while (!GameUIRoot.Instance.GetPlayerConversationResponse(ref selectedResponse)) { yield return null; } interactor.ClearInputOverride("shrineConversation"); TextBoxManager.ClearTextBox(talkPoint); if (!m_canUse) { yield break; } if (selectedResponse == 0 && isToggle) { (m_isToggled ? OnDecline : OnAccept)?.Invoke(interactor, ((Component)this).gameObject); m_isToggled = !m_isToggled; } else if (selectedResponse == 0) { OnAccept?.Invoke(interactor, ((Component)this).gameObject); instanceRoom.DeregisterInteractable((IPlayerInteractable)(object)this); if (Object.op_Implicit((Object)(object)instanceMinimapIcon)) { Minimap.Instance.DeregisterRoomIcon(instanceRoom, instanceMinimapIcon); instanceMinimapIcon = null; } } else { OnDecline?.Invoke(interactor, ((Component)this).gameObject); } } public void OnEnteredRange(PlayerController interactor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.white, 1f, 0f, (OutlineType)0); ((BraveBehaviour)this).sprite.UpdateZDepth(); } public void OnExitRange(PlayerController interactor) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public float GetDistanceToPoint(Vector2 point) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)this).sprite == (Object)null) { return 100f; } Vector3 val = Vector2.op_Implicit(BraveMathCollege.ClosestPointOnRectangle(point, ((BraveBehaviour)this).specRigidbody.UnitBottomLeft, ((BraveBehaviour)this).specRigidbody.UnitDimensions)); return Vector2.Distance(point, Vector2.op_Implicit(val)) / 1.5f; } public float GetOverrideMaxDistance() { return -1f; } } } namespace Oddments { public static class OddUnlockMethods { private static readonly int highestVanillaID = 823; private static readonly List<int> blackList = new List<int> { 569, 521 }; public static void Init() { CustomActions.OnRunStart = (Action<PlayerController, PlayerController, GameMode>)Delegate.Combine(CustomActions.OnRunStart, new Action<PlayerController, PlayerController, GameMode>(NewRun)); CustomActions.OnBossKilled = (Action<HealthHaver, bool>)Delegate.Combine(CustomActions.OnBossKilled, new Action<HealthHaver, bool>(BossKilled)); } private static void BossKilled(HealthHaver arg1, bool arg2) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)((BraveBehaviour)arg1).aiActor) && ((BraveBehaviour)arg1).aiActor.ParentRoom != null && !((BraveBehaviour)arg1).aiActor.ParentRoom.PlayerHasTakenDamageInThisRoom) { ValidTilesets tilesetId = GameManager.Instance.Dungeon.tileIndices.tilesetId; ValidTilesets val = tilesetId; ValidTilesets val2 = val; if ((int)val2 == 8) { SaveAPIManager.SetFlag(CustomDungeonFlags.CADUELCEUS_FLAG, value: true); } } } private static void NewRun(PlayerController arg1, PlayerController arg2, GameMode arg3) { List<PickupObject> allItemsWithTag = AlexandriaTags.GetAllItemsWithTag("bullet_modifier"); List<PickupObject> allItemsWithTag2 = AlexandriaTags.GetAllItemsWithTag("companion"); bool value = AllVanillaUnlocked(allItemsWithTag); SaveAPIManager.SetFlag(CustomDungeonFlags.EVERY_VANILLA_BULLET_UNLOCKED, value); bool value2 = AllVanillaUnlocked(allItemsWithTag2); SaveAPIManager.SetFlag(CustomDungeonFlags.EVERY_VANILLA_COMPANION_UNLOCKED, value2); } public static bool AllVanillaUnlocked(List<PickupObject> items) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 bool flag = true; foreach (PickupObject item in items) { if ((int)item.quality != -100 && item.PickupObjectId <= highestVanillaID && !blackList.Contains(item.PickupObjectId)) { flag &= item.PrerequisitesMet(); } } return flag; } } public static class UnlockCommands { public static void Init() { ConsoleCommandGroup val = ETGModConsole.Commands.AddGroup("oddments", (Action<string[]>)delegate { Module.Log("Please specify a valid command.", Module.TEXT_COLOR); }); ETGModConsole.Commands.GetGroup("oddments").AddUnit("unlocks", (Action<string[]>)delegate { int num = 0; int num2 = 0; List<PickupObject> list = new List<PickupObject>(); List<PickupObject> list2 = new List<PickupObject>(); foreach (int key in JuneSaveManagerCore.unlocksDict.Keys) { PickupObject byId = PickupObjectDatabase.GetById(key); EncounterTrackable component = ((Component)byId).GetComponent<EncounterTrackable>(); if (Object.op_Implicit((Object)(object)component)) { num++; if (component.PrerequisitesMet()) { num2++; list2.Add(byId); } else { list.Add(byId); } } } if (list2.Count > 0) { Module.Log("Items Unlocked:", Module.TEXT_COLOR); foreach (PickupObject item in list2) { Module.Log(((Object)item).name, Module.TEXT_COLOR); } } if (list.Count > 0) { Module.Log("Items Left:", Module.TEXT_COLOR); foreach (PickupObject item2 in list) { Module.Log(((Object)item2).name + ": " + JuneSaveManagerCore.unlocksDict[item2.PickupObjectId], Module.TEXT_COLOR); } } Module.Log($"Unlocked: {num2}/{num}", Module.TEXT_COLOR); }); ETGModConsole.Commands.GetGroup("oddments").AddUnit("unlockall", (Action<string[]>)delegate { SaveAPIManager.SetFlag(CustomDungeonFlags.FLAG_ODDMENTS_UNLOCK_ALL, !SaveAPIManager.GetFlag(CustomDungeonFlags.FLAG_ODDMENTS_UNLOCK_ALL)); Module.Log($"Unlock All is now {SaveAPIManager.GetFlag(CustomDungeonFlags.FLAG_ODDMENTS_UNLOCK_ALL)}", Module.TEXT_COLOR); Module.Log("Please note you will have to restart the game for this to take effect"); }); } } [Serializable] public class GameActorOnDeathEffect : GameActorEffect { protected Type onDeathBehaviour; public DeathType deathType; protected Component comp; public Action<Component> PostApplyAction; public GameActorOnDeathEffect(Type behaviour) { onDeathBehaviour = behaviour; } public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { //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) Debug.Log((object)"tried to apply effect"); ((GameActorEffect)this).OnEffectApplied(actor, effectData, partialAmount); Debug.Log((object)"added effect"); comp = ((Component)actor).gameObject.AddComponent(onDeathBehaviour); Debug.Log((object)"saved component"); PostApplyAction?.Invoke(comp); Debug.Log((object)"applied action"); Component obj = comp; OnDeathBehavior val = (OnDeathBehavior)(object)((obj is OnDeathBehavior) ? obj : null); if (val != null) { val.deathType = deathType; } } public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData) { ((GameActorEffect)this).OnEffectRemoved(actor, effectData); if ((Object)(object)comp != (Object)null) { Object.Destroy((Object)(object)comp); } } } public static class AilmentsCore { public static GoopDefinition HemorragingBloodGoop; public static GoopDefinition CloneGoop; public static GoopDefinition CryotheumGoop; public static GameActorWarpEffect WarpEffect; public static GameActorHemorragingEffect HemorragingEffect; public static GameActorHemorragingEffect PoisBleedEffect; public static GameActorOnDeathEffect HellfireEffect; public static GameActorOnDeathEffect AcridRoundsEffect; public static GameObject hemoraggingOverhead; public static GameObject greenShitOverhead; public static void Init() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) CloneGoop = ScriptableObject.CreateInstance<GoopDefinition>(); CloneGoop.CanBeIgnited = true; CloneGoop.damagesPlayers = false; CloneGoop.damagesEnemies = false; CloneGoop.baseColor32 = Color32.op_Implicit(Color.red); CryotheumGoop = ScriptableObject.CreateInstance<GoopDefinition>(); CryotheumGoop.CanBeIgnited = false; WarpEffect = new GameActorWarpEffect { AppliesTint = true, duration = float.MaxValue, TintColor = new Color(0.77f, 0.21f, 0.48f, 1f), AffectsPlayers = false }; List<string> list = new List<string>(); for (int i = 1; i <= 6; i++) { list.Add($"{Module.ASSEMBLY_NAME}/Resources/Sprites/VFX/blooddripoverhead_00{i}.png"); } HemorragingBloodGoop = EasyGoopDefinitions.GenerateBloodGoop(7f, Color.red, 20f); hemoraggingOverhead = VFXAndAnimationShit.CreateOverheadVFX(list, "HemorragingOverhead", 10, (Assembly)null); List<string> list2 = new List<string>(); for (int j = 1; j <= 6; j++) { list2.Add($"{Module.ASSEMBLY_NAME}/Resources/Sprites/VFX/greenblood_overhead_00{j}.png"); } greenShitOverhead = VFXAndAnimationShit.CreateOverheadVFX(list2, "HemorragingOverhead", 10, (Assembly)null); HemorragingEffect = new GameActorHemorragingEffect { AffectsPlayers = false, duration = float.MaxValue, AffectsEnemies = true, gooper = HemorragingBloodGoop, effectIdentifier = "hemorraging", OverheadVFX = hemoraggingOverhead }; PoisBleedEffect = new GameActorHemorragingEffect { AffectsPlayers = false, duration = float.MaxValue, AffectsEnemies = true, gooper = EasyGoopDefinitions.PoisonDef, DMGOnBleed = 0.1f, effectIdentifier = "poisonbleed", isGreenBlood = true, OverheadVFX = greenShitOverhead }; HellfireEffect = new GameActorOnDeathEffect(typeof(HellfireRoundsItem.HellfireExplodeOnDeath)) { TintColor = Color.red, AppliesTint = true, duration = 6f, effectIdentifier = "explosiveHellfire", deathType = (DeathType)0, PostApplyAction = delegate(Component onDeath) { HellfireRoundsItem.HellfireExplodeOnDeath hellfireExplodeOnDeath = (HellfireRoundsItem.HellfireExplodeOnDeath)(object)onDeath; hellfireExplodeOnDeath.explosionData = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData; } }; AcridRoundsEffect = new GameActorOnDeathEffect(typeof(GoopDoer)) { duration = 6f, effectIdentifier = "causticAcridity", PostApplyAction = delegate(Component goopDoer) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) GoopDoer val = (GoopDoer)(object)((goopDoer is GoopDoer) ? goopDoer : null); val.goopDefinition = EasyGoopDefinitions.PoisonDef; val.updateOnPreDeath = true; val.defaultGoopRadius = 2f; val.updateOnAnimFrames = false; val.updateTiming = (UpdateTiming)2; } }; } } [HarmonyPatch] public class CloneGoopEffectDoer : MonoBehaviour { public class CustomEffectHandler : BraveBehaviour { protected float CloneTick; public bool IncrementCloneTick() { if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).aiActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver) && 1f > ((GameActor)((BraveBehaviour)this).aiActor).GetResistanceForEffectType((EffectResistanceType)4)) { CloneTick += 0.25f; if (CloneTick >= 1f) { CloneTick = 0f; return true; } } return false; } } public bool IsCloner; public CloneGoopEffectDoer() { IsCloner = false; } [HarmonyPatch(typeof(DeadlyDeadlyGoopManager), "DoGoopEffect")] [HarmonyPostfix] public static void CoolNewCustomGoopEffects(DeadlyDeadlyGoopManager __instance, GameActor actor, IntVector2 goopPosition) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (actor is PlayerController) { return; } AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val == null || Object.op_Implicit((Object)(object)val.CompanionOwner) || !Object.op_Implicit((Object)(object)actor) || ((BraveBehaviour)actor).aiAnimator.IsPlaying("spawn") || ((BraveBehaviour)actor).aiAnimator.IsPlaying("awaken")) { return; } CloneGoopEffectDoer component = ((Component)__instance).GetComponent<CloneGoopEffectDoer>(); if (!((Object)(object)component != (Object)null)) { return; } CustomEffectHandler orAddComponent = GameObjectExtensions.GetOrAddComponent<CustomEffectHandler>(((Component)actor).gameObject); if (!component.IsCloner) { return; } if (orAddComponent.IncrementCloneTick()) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(val.EnemyGuid); if ((Object)(object)orLoadByGuid != (Object)null) { AIActor val2 = AIActor.Spawn(orLoadByGuid, Vector2Extensions.ToIntVector2(actor.CenterPosition, (VectorConversions)2), ((DungeonPlaceableBehaviour)actor).GetAbsoluteParentRoom(), true, (AwakenAnimationType)0, true); LootEngine.DoDefaultItemPoof(Vector2.op_Implicit(val2.Position), false, false); } } __instance.RemoveGoopedPosition(goopPosition); } } [Serializable] public class GameActorHemorragingEffect : GameActorEffect { public GoopDefinition gooper; public float DMGOnBleed = 1f; public float HeresTheTicker = 1.25f; public bool isGreenBlood = false; private float shittyGradualCheckThing; public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { ((GameActorEffect)this).OnEffectApplied(actor, effectData, partialAmount); shittyGradualCheckThing = 0f; } public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ((GameActorEffect)this).EffectTick(actor, effectData); shittyGradualCheckThing += BraveTime.DeltaTime; if (HeresTheTicker <= shittyGradualCheckThing) { shittyGradualCheckThing = 0f; PixelCollider hitboxPixelCollider = ((BraveBehaviour)actor).specRigidbody.HitboxPixelCollider; Vector3 val = Vector2Extensions.ToVector3ZisY(hitboxPixelCollider.UnitBottomLeft, 0f); Vector3 val2 = Vector2Extensions.ToVector3ZisY(hitboxPixelCollider.UnitTopRight, 0f); if (isGreenBlood || JuneSaveManagerCore.DoPinkBlood) { OddSparksDoer.SparksType sparksType = (isGreenBlood ? OddSparksDoer.SparksType.VEGETABLE_BLOOD : OddSparksDoer.SparksType.DANGANRONPA_BLOOD); int num = Random.Range(4, 8); Vector3 down = Vector3.down; OddSparksDoer.SparksType systemType = sparksType; OddSparksDoer.DoRandomParticleBurst(num, val, val2, down, 90f, 0.5f, null, null, null, systemType); } else { GlobalSparksDoer.DoRandomParticleBurst(Random.Range(4, 8), val, val2, Vector3.down, 90f, 0.5f, (float?)null, (float?)null, (Color?)null, (SparksType)7); } DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(gooper).AddGoopCircle(actor.CenterPosition, 1f, -1, false, -1); ((BraveBehaviour)actor).healthHaver.ApplyDamage(DMGOnBleed, Vector2.zero, "get this man a bandage", (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); } } } public class GameActorWarpEffect : GameActorHealthEffect { } internal class GoopFreezeEffectDoer : SpecialGoopBehaviourDoer { } internal class TestOverrideEnemyStuff { public class TestOverrideBehavior : OverrideBehavior { public override string OverrideAIActorGUID => "b1770e0f1c744d9d887cc16122882b4f"; public override void DoOverride() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0036: 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_0050: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown AttackBehaviorGroup val = (AttackBehaviorGroup)((BraveBehaviour)base.actor).behaviorSpeculator.AttackBehaviors[0]; AttackBehaviorBase behavior = val.AttackBehaviors[0].Behavior; ShootGunBehavior val2 = (ShootGunBehavior)(object)((behavior is ShootGunBehavior) ? behavior : null); val2.WeaponType = (WeaponType)2; val2.BulletScript = (BulletScriptSelector)new CustomBulletScriptSelector(typeof(TestBulletShootScript)); AttackBehaviorBase behavior2 = val.AttackBehaviors[1].Behavior; ShootBehavior val3 = (ShootBehavior)(object)((behavior2 is ShootBehavior) ? behavior2 : null); val3.BulletScript = (BulletScriptSelector)new CustomBulletScriptSelector(typeof(TestChainShootScript)); ((BraveBehaviour)base.actor).bulletBank.Bullets.Add(((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid("ec6b674e0acd4553b47ee94493d66422")).bulletBank.GetBullet("bigBullet")); ((GameActor)base.actor).SetResistance((EffectResistanceType)2, 1f); } } public class NewTestComponent : BraveBehaviour { private void Update() { if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).healthHaver)) { } } } public class TestBulletShootScript : Script { public float angleVariance = 10f; public float baseDistance = 10f; public int baseAdditionalBullets = 2; public override IEnumerator Top() { for (int j = -3; j < 3; j++) { float variance = Random.Range(0f - angleVariance, angleVariance); ((Bullet)this).Fire(new Direction((float)j * baseDistance + variance, (DirectionType)0, -1f), new Speed(10f, (SpeedType)0), (Bullet)null); } for (int i = 0; i < baseAdditionalBullets; i++) { float newVariance = Random.Range((0f - baseDistance) * 2f, baseDistance * 2f); ((Bullet)this).Fire(new Direction(newVariance, (DirectionType)1, -1f), new Speed(7f, (SpeedType)0), (Bullet)null); } yield break; } } public class TestChainShootScript : Script { public class BigBullet : Bullet { public override IEnumerator Top() { float speed = 2f; float elapsed = 0f; DeadlyDeadlyGoopManager gooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PoisonDef); while (!((Bullet)this).IsEnded) { elapsed += 1f; if (elapsed == 10f) { elapsed = 0f; ((Bullet)this).ChangeSpeed(new Speed(speed, (SpeedType)1), 1); } gooper.AddGoopCircle(((Bullet)this).Position, 1f, -1, false, -1); yield return null; } } public BigBullet() : base("bigBullet", false, false, true) { } public override void OnBulletDestruction(DestroyType destroyType, SpeculativeRigidbody hitRigidbody, bool preventSpawningProjectiles) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!preventSpawningProjectiles) { DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PoisonDef).AddGoopCircle(((Bullet)this).Position, 3f, -1, false, -1); } } } public override IEnumerator Top() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0027: Expected O, but got Unknown ((Bullet)this).Fire(new Direction(0f, (DirectionType)0, -1f), new Speed(4f, (SpeedType)0), (Bullet)(object)new BigBullet()); return ((Bullet)this).Top(); } } } internal static class EnemiesCore { public static void Init() { PlagueShellKinBehaviour.Init(); } } public class PlagueShellKinBehaviour : BraveBehaviour { private const string guid = "odmnts_plague_shotgun"; public static void Init() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0194: Expected O, but got Unknown GameObject val = EnemyBuilder.BuildPrefab("Plague Doctor", "odmnts_plague_shotgun", Module.ASSEMBLY_NAME + "/Resources/Sprites/Enemies/Placeholder/iloveweezer.png", new IntVector2(0, 0), new IntVector2(8, 9), true); PlagueShellKinBehaviour plagueShellKinBehaviour = val.AddComponent<PlagueShellKinBehaviour>(); AIActor aiActor = ((BraveBehaviour)plagueShellKinBehaviour).aiActor; ((BraveBehaviour)aiActor).knockbackDoer.weight = 200f; aiActor.MovementSpeed = 1f; ((BraveBehaviour)aiActor).healthHaver.PreventAllDamage = false; aiActor.CollisionDamage = 1f; ((GameActor)aiActor).HasShadow = false; aiActor.IgnoreForRoomClear = false; ((BraveBehaviour)aiActor).aiAnimator.HitReactChance = 0f; ((BraveBehaviour)aiActor).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)aiActor).specRigidbody.CollideWithTileMap = true; aiActor.PreventFallingInPitsEver = false; ((BraveBehaviour)aiActor).healthHaver.ForceSetCurrentHealth(55f); aiActor.CollisionKnockbackStrength = 0f; aiActor.procedurallyOutlined = true; aiActor.CanTargetPlayers = true; ((BraveBehaviour)aiActor).healthHaver.SetHealthMaximum(55f, (float?)null, false); aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").CorpseObject; GameObject val2 = EnemyBuildingTools.GenerateShootPoint(val, new Vector2(0.5f, 0.5f), "Gootpoint"); BehaviorSpeculator component = val.GetComponent<BehaviorSpeculator>(); component.TargetBehaviors = new List<TargetBehaviorBase> { (TargetBehaviorBase)new TargetPlayerBehavior() }; component.MovementBehaviors = new List<MovementBehaviorBase> { (MovementBehaviorBase)new SeekTargetBehavior() }; component.AttackBehaviorGroup.AttackBehaviors = new List<AttackGroupItem> { new AttackGroupItem { NickName = "Shoot", Probability = 1f, Behavior = (AttackBehaviorBase)new ShootGunBehavior() } }; AIShooter component2 = val.GetComponent<AIShooter>(); } } public static class AssetBundleLoader { public static AssetBundle LoadAssetBundleFromLiterallyAnywhere(string name, bool logs = false) { AssetBundle result = null; if (File.Exists(Module.FilePathFolder + "/" + name)) { try { result = AssetBundle.LoadFromFile(Path.Combine(Module.FilePathFolder, name)); if (logs) { ETGModConsole.Log((object)"Successfully loaded assetbundle!", false); } } catch (Exception ex) { ETGModConsole.Log((object)"Failed loading asset bundle from file.", false); ETGModConsole.Log((object)ex.ToString(), false); } } else { ETGModConsole.Log((object)"AssetBundle NOT FOUND!", false); } return result; } } public static class JuneSaveManagerCore { public static readonly int NUMBER_OF_THE_BEAST = 276167616; public static int SeedToSet = -1; public static Dictionary<int, string> unlocksDict = new Dictionary<int, string>(); public static Random PersonalizationRandom; public static bool DoPinkBlood; public static bool InnapropriateLanguage; public static bool Flipments; public static bool DeluxeEdition; public static bool AltTextA; public static bool AltTextB; public static bool AltTextC; public static bool AltTextD; public static void Personalize() { int num = (int)SaveAPIManager.GetPlayerMaximum(CustomTrackedMaximums.PERSONALIZATION_SEED); Debug.Log((object)num); Debug.Log((object)AdvancedGameStatsManager.HasInstance); if (num == 0) { num = (SeedToSet = BraveRandom.GenerationRandomRange(1, NUMBER_OF_THE_BEAST)); } PersonalizationRandom = new Random(num); DoPinkBlood = GetRandomBool(7); InnapropriateLanguage = GetRandomBool(14); Flipments = GetRandomBool(100); DeluxeEdition = GetRandomBool(10); AltTextA = GetRandomBool(2); AltTextB = GetRandomBool(3); AltTextC = GetRandomBool(5); AltTextD = GetRandomBool(10); Debug.Log((object)num); Debug.Log((object)$"For June's eyes only: {DoPinkBlood}, {InnapropriateLanguage}, {Flipments}, {DeluxeEdition}, {AltTextA}, {AltTextB}, {AltTextC}, {AltTextD}"); Flipments = true; DeluxeEdition = true; } public static bool GetRandomBool(int num) { return PersonalizationRandom.Next(num) == 0; } public static void Init() { Personalize(); OddUnlockMethods.Init(); UnlockCommands.Init(); } public static void AddUnlockText(this PickupObject self, string text) { unlocksDict[self.PickupObjectId] = text; } } [HarmonyPatch] public class AmmoOverloaderItem : PassiveItem { public class AmmoExtenderComponent : BraveBehaviour { private int ammoAdded; public int AmmoAdded { get { return ammoAdded; } set { ammoAdded = Math.Max(0, value); if (ammoAdded == 0) { Object.Destroy((Object)(object)this); } } } } public static OddItemTemplate template = new OddItemTemplate(typeof(AmmoOverloaderItem)) { Name = "Ammo Repurposer", Quality = (ItemQuality)3, Description = "Shell Space", LongDescription = "Picking up an ammo box also adds bonus ammo to your gun that goes over the ammo limit.\n\nThis unusual box is actually a wormhole to another dimension, where an even more unusual cosmic horror resides", SpriteResource = Module.SPRITE_PATH + "/ammorepurposer.png", PostInitAction = delegate(PickupObject item) { AmmoOverloaderItem ammoOverloaderItem = item as AmmoOverloaderItem; ammoOverloaderItem.DoOverload = true; ammoOverloaderItem.SpreadAmmoBonusPercent = 0.25f; ammoOverloaderItem.SplitForOtherMult = 0f; } }; public static OddItemTemplate template2 = new OddItemTemplate(typeof(AmmoOverloaderItem)) { Name = "splitter" }; public float SpreadAmmoBonusPercent = 0.5f; public bool DoOverload = false; public float SplitForOtherMult = 0.25f; private static bool Skip = false; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); ExtendedPlayerComponent extComp = PlayerUtility.GetExtComp(player); extComp.OnPickedUpAmmo = (Action<PlayerController, AmmoPickup>)Delegate.Combine(extComp.OnPickedUpAmmo, new Action<PlayerController, AmmoPickup>(PickUpAmmo)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); ExtendedPlayerComponent extComp = PlayerUtility.GetExtComp(player); extComp.OnPickedUpAmmo = (Action<PlayerController, AmmoPickup>)Delegate.Remove(extComp.OnPickedUpAmmo, new Action<PlayerController, AmmoPickup>(PickUpAmmo)); } private void PickUpAmmo(PlayerController player, AmmoPickup arg2) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 Gun currentGun = ((GameActor)player).CurrentGun; if ((int)arg2.mode == 1 && DoOverload) { AmmoExtenderComponent orAddComponent = GameObjectExtensions.GetOrAddComponent<AmmoExtenderComponent>(((Component)currentGun).gameObject); Skip = true; orAddComponent.AmmoAdded += Mathf.FloorToInt((float)currentGun.AdjustedMaxAmmo); Skip = false; currentGun.GainAmmo(currentGun.AdjustedMaxAmmo); } float num = SplitForOtherMult; if ((int)arg2.mode == 2) { num = SpreadAmmoBonusPercent / 2f; currentGun.GainAmmo(Mathf.CeilToInt((float)currentGun.AdjustedMaxAmmo * SpreadAmmoBonusPercent)); currentGun.ForceImmediateReload(false); } if (num == 0f) { return; } for (int i = 0; i < player.inventory.AllGuns.Count; i++) { if (Object.op_Implicit((Object)(object)player.inventory.AllGuns[i]) && (Object)(object)currentGun != (Object)(object)player.inventory.AllGuns[i]) { player.inventory.AllGuns[i].GainAmmo(Mathf.FloorToInt((float)player.inventory.AllGuns[i].AdjustedMaxAmmo * num)); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void ChangeResults(Gun __instance, ref int __result) { if (!Skip) { AmmoExtenderComponent component = ((Component)__instance).GetComponent<AmmoExtenderComponent>(); if ((Object)(object)component != (Object)null) { __result += component.AmmoAdded; } } } [HarmonyPatch(typeof(Gun), "LoseAmmo")] [HarmonyPostfix] public static void Fucker(Gun __instance, int amt) { AmmoExtenderComponent component = ((Component)__instance).GetComponent<AmmoExtenderComponent>(); if ((Object)(object)component != (Object)null) { component.AmmoAdded -= amt; Debug.Log((object)__instance.AdjustedMaxAmmo); } } [HarmonyPatch(typeof(Gun), "DecrementAmmoCost")] [HarmonyPostfix] public static void DP(Gun __instance, ProjectileModule module) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 AmmoExtenderComponent component = ((Component)__instance).GetComponent<AmmoExtenderComponent>(); if (!((Object)(object)component != (Object)null)) { return; } int ammoCost = module.ammoCost; if ((int)module.shootStyle == 3) { ChargeProjectile chargeProjectile = module.GetChargeProjectile(__instance.m_moduleData[module].chargeTime); if (chargeProjectile.UsesAmmo) { ammoCost = chargeProjectile.AmmoCost; } } component.AmmoAdded -= ammoCost; Debug.Log((object)__instance.AdjustedMaxAmmo); } [HarmonyPatch(typeof(GameUIAmmoController), "UpdateUIGun")] [HarmonyPrefix] public static void SkipMethod() { Skip = true; } [HarmonyPatch(typeof(GameUIAmmoController), "UpdateUIGun")] [HarmonyPostfix] public static void unskip() { Skip = false; } } internal class ArmorGeneratingOnRoomClearItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(ArmorGeneratingOnRoomClearItem)); public int roomsCleared = 0; public int timesPayedOut = 0; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); player.OnRoomClearEvent += Player_OnRoomClearEvent; } private void Player_OnRoomClearEvent(PlayerController obj) { roomsCleared++; if (roomsCleared > (2 ^ timesPayedOut)) { timesPayedOut++; roomsCleared = 0; HealthHaver healthHaver = ((BraveBehaviour)obj).healthHaver; float armor = healthHaver.Armor; healthHaver.Armor = armor + 1f; } } public override void MidGameSerialize(List<object> data) { ((PickupObject)this).MidGameSerialize(data); data.Add(timesPayedOut); data.Add(roomsCleared); } public override void MidGameDeserialize(List<object> data) { ((PassiveItem)this).MidGameDeserialize(data); timesPayedOut = (int)data[0]; roomsCleared = (int)data[1]; } } public class ArrayBulletModifierItem : PassiveItem { private class ArrayBulletMod : BraveBehaviour { public Projectile bulletOnTop; public int idx = 0; public void Initialize(Projectile theGoat, int newIdx, float miniDamage, float miniScale) { bulletOnTop = theGoat; idx = newIdx; if (newIdx > 1 && newIdx < 4) { ProjectileData baseData = ((BraveBehaviour)this).projectile.baseData; baseData.damage *= miniDamage; ((BraveBehaviour)this).projectile.RuntimeUpdateScale(miniScale); } } public void FixedUpdate() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"projectile real"); if ((Object)(object)bulletOnTop != (Object)null && Object.op_Implicit((Object)(object)((BraveBehaviour)bulletOnTop).specRigidbody) && Object.op_Implicit((Object)(object)((Component)bulletOnTop).gameObject)) { int num = idx - 2; if (num <= 0) { num--; } Debug.Log((object)$"everything exists, {num}"); Vector2 val = Vector2Extensions.Rotate(((BraveBehaviour)bulletOnTop).specRigidbody.Velocity, 90f); Vector3 val2 = Vector2.op_Implicit(((Vector2)(ref val)).normalized) * 30f; } } } public static OddItemTemplate template = new OddItemTemplate(typeof(ArrayBulletModifierItem)) { Name = "Array Bullets", Description = "Matrishells" }; private float m_activateChance = 1f; public float m_miniDamage = 0.3f; public float m_miniScale = 0.5f; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); JEventsComponent component = ((Component)player).GetComponent<JEventsComponent>(); component.PostProcessProjectileMod = (Action<Projectile, Gun, ProjectileModule>)Delegate.Combine(component.PostProcessProjectileMod, new Action<Projectile, Gun, ProjectileModule>(Player_PostProcessProjectile)); } private void Player_PostProcessProjectile(Projectile arg1, Gun arg2, ProjectileModule arg3) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (arg3 != null && !((Object)(object)((PassiveItem)this).Owner == (Object)null) && Object.op_Implicit((Object)(object)arg1) && Object.op_Implicit((Object)(object)((BraveBehaviour)arg1).sprite) && !Object.op_Implicit((Object)(object)((Component)arg1).gameObject.GetComponent<ArrayBulletMod>()) && Random.value < m_activateChance) { ProjectileData baseData = arg1.baseData; baseData.damage *= m_miniDamage; arg1.RuntimeUpdateScale(m_miniScale); Projectile val = Object.Instantiate<Projectile>(arg3.GetCurrentProjectile()); for (int i = 1; i <= 4; i++) { ETGModConsole.Log((object)$"Successfully added bonus projectile: {i}", false); Projectile val2 = VolleyUtility.ShootSingleProjectile(val, ((BraveBehaviour)arg1).sprite.WorldCenter, Vector2Extensions.ToAngle(((BraveBehaviour)arg1).specRigidbody.Velocity), false, (GameActor)(object)((PassiveItem)this).Owner); ((BraveBehaviour)val2).transform.position = ((BraveBehaviour)arg1).transform.position; ((BraveBehaviour)val2).transform.rotation = ((BraveBehaviour)arg1).transform.rotation; ArrayBulletMod arrayBulletMod = ((Component)val2).gameObject.AddComponent<ArrayBulletMod>(); arrayBulletMod.Initialize(arg1, i, m_miniDamage, m_miniScale); ((PassiveItem)this).Owner.DoPostProcessProjectile(val2); } } } } public class BiggerAmmoDropsItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(BiggerAmmoDropsItem)); public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); ItemsCore.AddChangeSpawnItem((Func<PickupObject, GameObject>)ChangeAmmoDrops); } private GameObject ChangeAmmoDrops(PickupObject arg) { return null; } } public class BlackCatItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(BlackCatItem)) { PostInitAction = delegate(PickupObject item) { LootUtility.RemovePickupFromLootTables(item); } }; private int m_pickups = 5; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); player.OnRoomClearEvent += ClearBossHopefully; } private void ClearBossHopefully(PlayerController player) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 RoomHandler currentRoom = player.CurrentRoom; if (currentRoom != null && (int)currentRoom.area.PrototypeRoomCategory == 3) { } } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); } } public class BottledFairyItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(BottledFairyItem)) { Name = "Tissue Sample" }; private bool queueHeal = false; public float wait = 1.5f; public override void Pickup(PlayerController player) { if (!base.m_pickedUpThisRun) { EasyFullHeal(player); } player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Combine(player.OnNewFloorLoaded, new Action<PlayerController>(LoadNewFloor)); ((PassiveItem)this).Pickup(player); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(LoadNewFloor)); } public override void Update() { ((PassiveItem)this).Update(); if (!GameManager.Instance.IsLoadingLevel && Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) && ((PassiveItem)this).Owner.AcceptingAnyInput && queueHeal) { queueHeal = false; ((MonoBehaviour)((PassiveItem)this).Owner).StartCoroutine(HealCoroutine(((PassiveItem)this).Owner)); } } public IEnumerator HealCoroutine(PlayerController player) { yield return (object)new WaitForSeconds(wait); EasyFullHeal(player); } public static void EasyFullHeal(PlayerController player) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)player).healthHaver.FullHeal(); AkSoundEngine.PostEvent("Play_OBJ_heart_heal_01", ((Component)player).gameObject); ? val = player; Object obj = ResourceCache.Acquire("Global VFX/vfx_healing_sparkles_001"); ((GameActor)val).PlayEffectOnActor((GameObject)(object)((obj is GameObject) ? obj : null), Vector3.zero, true, false, false); } private void LoadNewFloor(PlayerController obj) { queueHeal = true; } } [HarmonyPatch] public class BuffFromCurrencyItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(BuffFromCurrencyItem)) { Name = "metamoney to damage" }; public static OddItemTemplate template2 = new OddItemTemplate(typeof(BuffFromCurrencyItem)) { Name = "reg money to curse damage", PostInitAction = delegate(PickupObject item) { BuffFromCurrencyItem buffFromCurrencyItem = item as BuffFromCurrencyItem; buffFromCurrencyItem.incrementsNeeded = 60; buffFromCurrencyItem.statTypes = (StatType[])(object)new StatType[2] { (StatType)5, (StatType)14 }; buffFromCurrencyItem.damagePer = 0.075f; buffFromCurrencyItem.metaCurrency = false; } }; public float damagePer = 0.01f; public StatType[] statTypes = (StatType[])(object)new StatType[1] { (StatType)5 }; public bool metaCurrency = true; public int incrementsNeeded = 1; public int increments = 0; [HarmonyPatch(typeof(CurrencyPickup), "Pickup")] public static void CurrencyPickupPatch(CurrencyPickup __instance, PlayerController player) { //IL_0070: 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_0077: Invalid comparison between Unknown and I4 //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown BuffFromCurrencyItem[] componentsInChildren = ((Component)player).GetComponentsInChildren<BuffFromCurrencyItem>(); BuffFromCurrencyItem[] array = componentsInChildren; foreach (BuffFromCurrencyItem buffFromCurrencyItem in array) { if (__instance.IsMetaCurrency != buffFromCurrencyItem.metaCurrency) { continue; } buffFromCurrencyItem.increments += __instance.currencyValue; while (buffFromCurrencyItem.increments >= buffFromCurrencyItem.incrementsNeeded) { buffFromCurrencyItem.increments -= buffFromCurrencyItem.incrementsNeeded; StatType[] array2 = buffFromCurrencyItem.statTypes; foreach (StatType val in array2) { float amount = (((int)val == 14) ? 1f : buffFromCurrencyItem.damagePer); player.ownerlessStatModifiers.Add(new StatModifier { amount = amount, statToBoost = val, modifyType = (ModifyMethod)0 }); } } } } } internal class BuffOnReloadItem : PassiveItem { public static OddItemTemplate template2 = new OddItemTemplate(typeof(BuffOnReloadItem)) { Name = "Double Chamber", Description = "Really Wanna Know DOUBLE", LongDescription = "Reloading a gun briefly doubles fire rate, and allows you to fire automatically", DontAutoTitleize = true, Quality = (ItemQuality)3, SpriteResource = Module.SPRITE_PATH + "/doublechamber.png", PostInitAction = delegate(PickupObject item) { ItemBuilder.AddToSubShop(item, (ShopType)2, 1f); } }; public static OddItemTemplate template3 = new OddItemTemplate(typeof(BuffOnReloadItem)) { Name = "hunt'ers harpoon", PostInitAction = delegate(PickupObject item) { BuffOnReloadItem buffOnReloadItem = item as BuffOnReloadItem; buffOnReloadItem.ReloadDuration = 0.8f; buffOnReloadItem.isDouble = false; } }; private bool isDouble = true; protected float elapsed = 1f; protected bool isActive = false; public float ReloadDuration = 0.4f; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); player.OnReloadedGun = (Action<PlayerController, Gun>)Delegate.Combine(player.OnReloadedGun, new Action<PlayerController, Gun>(ReloadedGun)); player.GunChanged += Player_GunChanged; } private void Player_GunChanged(Gun arg1, Gun arg2, bool arg3) { isActive = false; } private void ReloadedGun(PlayerController arg1, Gun arg2) { if (Object.op_Implicit((Object)(object)arg1) && Object.op_Implicit((Object)(object)arg2)) { if (!isActive) { ((MonoBehaviour)arg1).StartCoroutine(OnReloadBuff(arg1)); } else { elapsed = 0f; } } } public IEnumerator OnReloadBuff(PlayerController player) { ItemHelpers.RemoveStat((PassiveItem)(object)this, (StatType)1); if (isDouble) { player.stats.AdditionalVolleyModifiers += Stats_AdditionalVolleyModifiers; ItemHelpers.AddStat((PassiveItem)(object)this, (StatType)1, 2f, (ModifyMethod)0); } else { ItemHelpers.AddStat((PassiveItem)(object)this, (StatType)0, 2f, (ModifyMethod)0); } player.stats.RecalculateStats(player, false, false); elapsed = 0f; isActive = true; while (elapsed < ReloadDuration && isActive && Object.op_Implicit((Object)(object)this)) { yield return null; if (!Object.op_Implicit((Object)(object)((GameActor)player).CurrentGun) || !((GameActor)player).CurrentGun.IsReloading) { elapsed += BraveTime.DeltaTime; } } if (isDouble) { player.stats.AdditionalVolleyModifiers -= Stats_AdditionalVolleyModifiers; ItemHelpers.RemoveStat((PassiveItem)(object)this, (StatType)1); } else { ItemHelpers.RemoveStat((PassiveItem)(object)this, (StatType)0); } player.stats.RecalculateStats(player, false, false); if (Object.op_Implicit((Object)(object)this)) { elapsed = ReloadDuration; isActive = false; } } private void Stats_AdditionalVolleyModifiers(ProjectileVolleyData obj) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) foreach (ProjectileModule projectile in obj.projectiles) { if ((int)projectile.shootStyle == 0) { projectile.shootStyle = (ShootStyle)1; } } } } public class BulletOnTheCobItem : OddProjectileModifierItem { public static OddItemTemplate template = new OddItemTemplate(typeof(BulletOnTheCobItem)) { Name = "Bullet on the Cob" }; } [HarmonyPatch] public class CaduceusBulletsItem : PassiveItem { public class CaduceusHelper : BraveBehaviour { public static readonly float Cooldown = 2.5f; private float m_elapsed = 0f; private Dictionary<string, float> dict = new Dictionary<string, float>(); private void Update() { m_elapsed += BraveTime.DeltaTime; } public bool ShouldDoBonusEffect(GameActorEffect effect) { string effectIdentifier = effect.effectIdentifier; if (!dict.ContainsKey(effectIdentifier)) { dict.Add(effectIdentifier, -999f); } if (dict[effectIdentifier] - m_elapsed < Cooldown) { dict[effectIdentifier] = m_elapsed; return true; } return false; } } public class CaduceusFloater : BraveBehaviour { private Vector3 maxHeight = new Vector3(0f, 40f, 0f); private bool m_isRenderedRn = false; private float m_elapsed = 0f; private float m_duration = 2f; private float m_postBlinkDuration = 1f; private float m_blinkspeed = 0.1f; private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0052: 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) float num = m_elapsed + BraveTime.DeltaTime; if (num < m_duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Vector3 val = GetVector(num) - GetVector(m_elapsed); Transform transform = ((BraveBehaviour)this).transform; transform.localPosition += val; if (num >= m_postBlinkDuration) { float num2 = num - m_postBlinkDuration; num2 %= m_blinkspeed * 2f; bool flag = num2 > m_blinkspeed; if (flag != m_isRenderedRn) { m_isRenderedRn = flag; ((BraveBehaviour)this).renderer.enabled = flag; } } m_elapsed = num; } private Vector3 GetVector(float elapsed) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) float num = 1f - 1f / (1f + elapsed * 2f); return maxHeight * num; } } public static GameObject HealDamageVFX; public static OddItemTemplate template = new OddItemTemplate(typeof(CaduceusBulletsItem)) { Name = "Hippocratic Rounds", Description = "Do No Harm", LongDescription = "Fire rate up. Poison, fire and electricity immunity. Any status effects applied to enemies will instead be converted into raw damage", Quality = (ItemQuality)4, PostInitAction = delegate(PickupObject item) { List<string> list = new List<string>(); for (int i = 1; i <= 4; i++) { list.Add($"{Module.ASSEMBLY_NAME}/Resources/Sprites/VFX/caduceusonhitflash_00{i}.png"); } GameObject val = VFXAndAnimationShit.CreateOverheadVFX(list, "Caduceus Flash", 10, (Assembly)null); val.AddComponent<CaduceusFloater>(); HealDamageVFX = val; ItemHelpers.PlaceItemInAmmonomiconAfterItemById(item, 524); ItemBuilder.AddPassiveStatModifier(item, (StatType)1, 0.15f, (ModifyMethod)0); } }; public static float DMG = 6f; public static readonly List<string> banlist = new List<string> { "jamBuff", "Infection", "InfectionBoss", "broken Armor" }; private List<DamageTypeModifier> mods = new List<DamageTypeModifier> { new DamageTypeModifier { damageMultiplier = 0f, damageType = (CoreDamageTypes)4 }, new DamageTypeModifier { damageMultiplier = 0f, damageType = (CoreDamageTypes)16 }, new DamageTypeModifier { damageMultiplier = 0f, damageType = (CoreDamageTypes)64 } }; public override void Pickup(PlayerController player) { ((PassiveItem)this).Pickup(player); ItemHelpers.AddFlagsToPlayer(player, ((object)this).GetType()); foreach (DamageTypeModifier mod in mods) { ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Add(mod); } } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); ItemHelpers.RemoveFlagsFromPlayer(player, ((object)this).GetType()); foreach (DamageTypeModifier mod in mods) { ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Remove(mod); } } [HarmonyPatch(typeof(GameActor), "ApplyEffect")] [HarmonyPrefix] public static bool PreventAffectApply(GameActor __instance, GameActorEffect effect) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (!PassiveItem.IsFlagSetAtAll(typeof(CaduceusBulletsItem)) || __instance is PlayerController) { return true; } if (effect is AIActorBuffEffect || banlist.Contains(effect.effectIdentifier)) { return true; } CaduceusHelper orAddComponent = GameObjectExtensions.GetOrAddComponent<CaduceusHelper>(((Component)__instance).gameObject); if ((Object)(object)orAddComponent != (Object)null && orAddComponent.ShouldDoBonusEffect(effect)) { ((BraveBehaviour)__instance).healthHaver.ApplyDamage(DMG * Mathf.Min(8f, effect.duration), Vector2.zero, "Caduceus", (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); Object.Instantiate<GameObject>(HealDamageVFX, ((BraveBehaviour)__instance).transform.position, Quaternion.identity); } if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)((BraveBehaviour)__instance).aiActor) && ((BraveBehaviour)__instance).aiActor.EnemyGuid == "9d50684ce2c044e880878e86dbada919") { return true; } return false; } } public class CardinalBulletsItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(CardinalBulletsItem)) { Name = "Cardinallets", Description = "Sign of the Cross", LongDescription = "Firing your guns has a chance to shoot 3 additional bullets, to form a cross from where you fired", Quality = (ItemQuality)3, SpriteResource = Module.SPRITE_PATH + "/cardinallets.png", PostInitAction = delegate(PickupObject item) { item.SetupUnlockOnFlag((GungeonFlags)10180, requiredFlagValue: true); item.AddUnlockText("Kill the Old King"); } }; private float m_ProcChance = 0.25f; public override void Pickup(PlayerController player) { JEventsComponent component = ((Component)player).GetComponent<JEventsComponent>(); component.ConstantModifyGunVolley = (Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>)Delegate.Combine(component.ConstantModifyGunVolley, new Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>(Stats_AdditionalVolleyModifiers)); ((PassiveItem)this).Pickup(player); } public override void DisableEffect(PlayerController player) { JEventsComponent component = ((Component)player).GetComponent<JEventsComponent>(); component.ConstantModifyGunVolley = (Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>)Delegate.Remove(component.ConstantModifyGunVolley, new Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>(Stats_AdditionalVolleyModifiers)); ((PassiveItem)this).DisableEffect(player); } private void Stats_AdditionalVolleyModifiers(PlayerController player, Gun gun, ProjectileVolleyData data, ModifyProjArgs args) { List<ProjectileModule> list = RegeneratingVolleyModifiers.AllAvailableModules(data, gun); if (list.Count <= 0 || !(Random.value < m_ProcChance)) { return; } List<ProjectileModule> list2 = new List<ProjectileModule>(); for (int i = 90; i < 360; i += 90) { int num = Random.Range(0, list.Count - 1); ProjectileModule val = list[num]; int num2 = num; if (val.CloneSourceIndex >= 0) { num2 = val.CloneSourceIndex; } ProjectileModule val2 = ProjectileModule.CreateClone(val, false, num2); val2.ignoredForReloadPurposes = true; val2.ammoCost = 0; val2.angleFromAim = val.angleFromAim + (float)i; list2.Add(val2); } args.projs.Add("odmnts_cardinalBullets", list2); } } public class ClockHandItem : PassiveItem { public static OddItemTemplate template = new OddItemTemplate(typeof(ClockHandItem)); public float MaxRotate; public override void Pickup(PlayerController player) { JEventsComponent component = ((Component)player).GetComponent<JEventsComponent>(); component.ConstantModifyGunVolley = (Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>)Delegate.Combine(component.ConstantModifyGunVolley, new Action<PlayerController, Gun, ProjectileVolleyData, ModifyProjArgs>(ModifyVolleyConstant)); ((PassiveItem)this).Pickup(player); } private void ModifyVolleyConstant(PlayerController player, Gun gun, ProjectileVolleyData data, ModifyProjArgs args) { List<ProjectileModule> list = RegeneratingVolleyModifiers.AllAvailableModules(data, gun); if (list.Count <= 0) { return; } List<ProjectileModule> list2 = new List<ProjectileModule>(); int count = list.Count; for (int i = 0; i < count; i++) { ProjectileModule val = list[i]; int num = i; if (val.CloneSourceIndex >= 0) { num = val.CloneSourceIndex; } ProjectileModule val2 = ProjectileModule.CreateClone(val, false, num); val2.ignoredForReloadPurposes = true; val2.ammoCost = 0; float num2 = player.m_elapsedNonalertTime % MaxRotate / MaxRotate; val2.angleFromAim = val.angleFromAim + num2 * 360f; list2.Add(val2); } args.projs.Add("odmnts_clockHand", list2); } } [HarmonyPatch] internal class GunDisplayNameHook { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void MakeWet(Gun __instance, ref string __result) { WhetStoneWaxStoneItem.SlightlyBoostComponent component = ((Component)__instance).GetComponent<WhetStoneWaxStoneItem.SlightlyBoostComponent>(); if ((Object)(object)component != (Object)null) { string text = ""; bool flag = false; if (component.WaxLevel > 0) { flag = true; text = text + WhetStoneWaxStoneItem.SlightlyBoostComponent.powerLevel[component.WaxLevel - 1] + "Waxed "; } if (component.SharpnessLevel > 0) { if (flag) { text += "and "; } text = text + WhetStoneWaxStoneItem.SlightlyBoostComponent.powerLevel[component.SharpnessLevel - 1] + "Sharpened "; } __result = text + __result; } if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<NewFloorGunModItem>())) { __result = "Shelltan's Own " + __result; } } } public class LightningModifier : BraveBehaviour { public static GameObject DefaultLightningPrefab; private AIActor m_dontJoltMe; public GameObject LightningPrefab = DefaultLightningPrefab; public bool IsJustLightning = false; public float MaxDistance = 3f; public int MaxChains = 3; public static void Init() { PickupObject byId = PickupObjectDatabase.GetById(298); ComplexProjectileModifier val = (ComplexProjectileModifier)(object)((byId is ComplexProjectileModifier) ? byId : null); DefaultLightningPrefab = val.ChainLightningVFX; } public LightningModifier() { LightningPrefab = DefaultLightningPrefab; } public void Start() { if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).projectile)) { ((BraveBehaviour)this).projectile.OnDestruction += DestroyProj; Projectile projectile = ((BraveBehaviour)this).projectile; projectile.OnHitEnemy = (Action<Projectile, SpeculativeRigidbody, bool>)Delegate.Combine(projectile.OnHitEnemy, new Action<Projectile, SpeculativeRigidbody, bool>(HitEnemy)); if (IsJustLightning) { Object.Destroy((Object)(object)((Component)this).gameObject); } } else { ETGModConsole.Log((object)"projectile be null", false); } } private void HitEnemy(Projectile arg1, SpeculativeRigidbody arg2, bool arg3) { if (Object.op_Implicit((Object)(object)arg2) && Object.op_Implicit((Object)(object)((BraveBehaviour)arg2).aiActor)) { m_dontJoltMe = ((BraveBehaviour)arg2).aiActor; } } public IEnumerator StartLightning(Vector3 pos, Vector2 backupVelocity) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 newPos = pos; RoomHandler room = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector2Extensions.ToIntVector2(Vector2.op_Implicit(pos), (VectorConversions)2)); int chains = 0; AIActor lastEnemy = null; tk2dTiledSprite lastLightning = null; while (true) { if (Object.op_Implicit((Object)(object)lastLightning) && Object.op_Implicit((Object)(object)((Component)lastLightning).gameObject)) { Object.Destroy((Object)(object)((Component)lastLightning).gameObject); } if (chains >= MaxChains) { break; } float dist; AIActor enemy = Core.GetNearestEnemyWithIgnore(room, Vector2.op_Implicit(newPos), out dist, lastEnemy ?? m_dontJoltMe); if (dist < MaxDistance || chains == 0) { lastEnemy = enemy; AIActor obj = lastEnemy; Vector3 val3; if (obj == null) { Vector3 val = newPos; Vector2 val2 = Vector2Extensions.Rotate(backupVelocity, (float)((!IsJustLightning) ? 180 : 0)); val3 = val + Vector2.op_Implicit(((Vector2)(ref val2)).normalized) * MaxDistance; } else { val3 = obj.Position; } Vector3 endPos = val3; tk2dTiledSprite chainer = SpawnManager.SpawnVFX(LightningPrefab, fals