using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using Alexandria.ItemAPI; using Alexandria.SoundAPI; using BepInEx; using Dungeonator; using Gungeon; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LichItems")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LichItems")] [assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a9ef0c54-e80e-4d2c-86ea-ad425c05c9e6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LichItems { public class CrossChamber { public class IgnoreEnemyCollisions : BraveBehaviour { public void Start() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown ((BraveBehaviour)this).specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)2)); ((BraveBehaviour)this).specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)3)); ((BraveBehaviour)this).healthHaver.OnDamaged += new OnDamagedEvent(HandleDamaged); } private void HandleDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { ((BraveBehaviour)this).healthHaver.FullHeal(); } } public static GameObject prefab; public static GameObject synergyPrefab; public static CustomSynergyType CrossfireSynergy; public static void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //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_005a: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown string text = "Cross Chamber"; string text2 = "LichItems/Resources/Cross_Chamber"; GameObject val = new GameObject(text); CompanionItem val2 = val.AddComponent(); ItemBuilder.AddSpriteToObject(text, text2, val, (Assembly)null); string text3 = "Marbled Minion"; string text4 = "A relic that summons one of the Lich's personal guards. While unable to attack, it can still block bullets for the owner."; ItemBuilder.SetupItem((PickupObject)(object)val2, text3, text4, "spapi"); CrossfireSynergy = ETGModCompatibility.ExtendEnum("spapi.etg.lichitems", "CROSSFIRE"); ((PickupObject)val2).quality = (ItemQuality)(-50); val2.CompanionGuid = "Cross_Chamber"; val2.Synergies = (CompanionTransformSynergy[])(object)new CompanionTransformSynergy[1] { new CompanionTransformSynergy { RequiredSynergy = CrossfireSynergy, SynergyCompanionGuid = "Synergy_Cross_Chamber" } }; BuildPrefab(); BuildSynergyPrefab(); } public static AIShooter SetupBasicAIShooter(GameObject go, int gunid, Transform gunattachpoint, GameObject handobject) { AIShooter orAddComponent = GameObjectExtensions.GetOrAddComponent(go); orAddComponent.equippedGunId = gunid; orAddComponent.shouldUseGunReload = true; orAddComponent.customShootCooldownPeriod = 1f; orAddComponent.gunAttachPoint = gunattachpoint; orAddComponent.handObject = handobject.GetComponent(); orAddComponent.AllowTwoHands = true; return orAddComponent; } public static void BuildPrefab() { //IL_003c: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown if (!((Object)(object)prefab != (Object)null) && !CompanionBuilder.companionDictionary.ContainsKey("Cross_Chamber")) { prefab = CompanionBuilder.BuildPrefab("Cross Chamber", "Cross_Chamber", "LichItems/Resources/CrossChamber/IdleRight/tomb_idle_right_001", new IntVector2(0, 0), new IntVector2(14, 16)); CompanionController val = prefab.AddComponent(); val.CanInterceptBullets = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val).specRigidbody; specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)0, ManualWidth = 14, ManualHeight = 16, ManualOffsetX = 0, ManualOffsetY = 0 }); specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)2)); specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)3)); specRigidbody.CollideWithOthers = true; KnockbackDoer orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)val).gameObject); orAddComponent.weight = 100f; AIActor aiActor = ((BraveBehaviour)val).aiActor; aiActor.IsNormalEnemy = false; aiActor.CollisionDamage = 0f; aiActor.MovementSpeed = 3f; aiActor.CanDropCurrency = false; ((Component)val).gameObject.AddComponent(); ((BraveBehaviour)val).healthHaver.PreventAllDamage = false; CompanionBuilder.AddAnimation(prefab, "idle_right", "LichItems/Resources/CrossChamber/IdleRight", 4, (AnimationType)1, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(prefab, "idle_left", "LichItems/Resources/CrossChamber/IdleLeft", 4, (AnimationType)1, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(prefab, "run_right", "LichItems/Resources/CrossChamber/MoveRight", 10, (AnimationType)0, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(prefab, "run_left", "LichItems/Resources/CrossChamber/MoveLeft", 10, (AnimationType)0, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(prefab, "hit_left", "LichItems/Resources/CrossChamber/HitLeft", 6, (AnimationType)4, (DirectionType)2, (FlipType)0).wrapMode = (WrapMode)2; CompanionBuilder.AddAnimation(prefab, "hit_right", "LichItems/Resources/CrossChamber/HitRight", 6, (AnimationType)4, (DirectionType)2, (FlipType)0).wrapMode = (WrapMode)2; BehaviorSpeculator component = prefab.GetComponent(); List movementBehaviors = component.MovementBehaviors; CompanionFollowPlayerBehavior val2 = new CompanionFollowPlayerBehavior(); val2.IdleAnimations = new string[1] { "idle" }; val2.DisableInCombat = false; movementBehaviors.Add((MovementBehaviorBase)(object)val2); } } public static void BuildSynergyPrefab() { //IL_003c: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //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_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Expected O, but got Unknown //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Expected O, but got Unknown if (!((Object)(object)synergyPrefab != (Object)null) && !CompanionBuilder.companionDictionary.ContainsKey("Synergy_Cross_Chamber")) { synergyPrefab = CompanionBuilder.BuildPrefab("Synergy Cross Chamber", "Synergy_Cross_Chamber", "LichItems/Resources/CrossChamber/IdleRight/tomb_idle_right_001", new IntVector2(0, 0), new IntVector2(14, 16)); CompanionController val = synergyPrefab.AddComponent(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val).specRigidbody; specRigidbody.PrimaryPixelCollider.CollisionLayer = (CollisionLayer)1; specRigidbody.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)0, ManualWidth = 14, ManualHeight = 16, ManualOffsetX = 0, ManualOffsetY = 0 }); specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)2)); specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)3)); specRigidbody.CollideWithOthers = true; KnockbackDoer orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)val).gameObject); orAddComponent.weight = 100f; AIActor aiActor = ((BraveBehaviour)val).aiActor; aiActor.IsNormalEnemy = false; aiActor.CollisionDamage = 0f; aiActor.MovementSpeed = 3f; aiActor.CanDropCurrency = false; val.CanInterceptBullets = true; ((Component)val).gameObject.AddComponent(); ((BraveBehaviour)val).healthHaver.PreventAllDamage = false; GameObject val2 = new GameObject("GunAttachPoint"); FakePrefab.MarkAsFakePrefab(val2); Object.DontDestroyOnLoad((Object)(object)val2); Transform transform = val2.transform; transform.parent = synergyPrefab.transform; transform.localPosition = new Vector3(-0.0625f, 0.3125f, 0f); GameObject val3 = SpriteBuilder.SpriteFromResource("LichItems/Resources/CrossChamber/Hand/hand_001", new GameObject("SynergyCrossChamberHand"), (Assembly)null); FakePrefab.MarkAsFakePrefab(val3); Object.DontDestroyOnLoad((Object)(object)val3); GunTools.ConstructOffsetsFromAnchor(val3.GetComponent().GetCurrentSpriteDef(), (Anchor)4, (Vector2?)null, false, true); PlayerHandController val4 = val3.AddComponent(); val4.ForceRenderersOff = false; val4.attachPoint = null; val4.handHeightFromGun = 0.05f; SetupBasicAIShooter(synergyPrefab, 38, transform, val3); CompanionBuilder.AddAnimation(synergyPrefab, "idle_right", "LichItems/Resources/CrossChamber/IdleRight", 4, (AnimationType)1, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(synergyPrefab, "idle_left", "LichItems/Resources/CrossChamber/IdleLeft", 4, (AnimationType)1, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(synergyPrefab, "run_right", "LichItems/Resources/CrossChamber/MoveRight", 10, (AnimationType)0, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(synergyPrefab, "run_left", "LichItems/Resources/CrossChamber/MoveLeft", 10, (AnimationType)0, (DirectionType)2, (FlipType)0); CompanionBuilder.AddAnimation(synergyPrefab, "hit_left", "LichItems/Resources/CrossChamber/HitLeft", 6, (AnimationType)4, (DirectionType)2, (FlipType)0).wrapMode = (WrapMode)2; CompanionBuilder.AddAnimation(synergyPrefab, "hit_right", "LichItems/Resources/CrossChamber/HitRight", 6, (AnimationType)4, (DirectionType)2, (FlipType)0).wrapMode = (WrapMode)2; BehaviorSpeculator component = synergyPrefab.GetComponent(); List movementBehaviors = component.MovementBehaviors; CompanionFollowPlayerBehavior val5 = new CompanionFollowPlayerBehavior(); val5.IdleAnimations = new string[1] { "idle" }; val5.DisableInCombat = false; movementBehaviors.Add((MovementBehaviorBase)(object)val5); component.TargetBehaviors = new List(1) { (TargetBehaviorBase)new TargetPlayerBehavior { Radius = 35f, LineOfSight = true, ObjectPermanence = true, SearchInterval = 0.25f, PauseOnTargetSwitch = false, PauseTime = 0.25f } }; component.AttackBehaviors = new List(1) { (AttackBehaviorBase)new ShootGunBehavior { GroupCooldownVariance = -1f, LineOfSight = true, WeaponType = (WeaponType)0, OverrideBulletName = "default", BulletScript = null, FixTargetDuringAttack = false, StopDuringAttack = false, LeadAmount = 0f, LeadChance = 1f, RespectReload = true, MagazineCapacity = 6f, ReloadSpeed = 2f, EmptiesClip = false, SuppressReloadAnim = false, TimeBetweenShots = -1f, PreventTargetSwitching = false, OverrideAnimation = string.Empty, OverrideDirectionalAnimation = string.Empty, HideGun = false, UseLaserSight = false, UseGreenLaser = false, PreFireLaserTime = -1f, AimAtFacingDirectionWhenSafe = false } }; AIBulletBank orAddComponent2 = GameObjectExtensions.GetOrAddComponent(synergyPrefab); orAddComponent2.Bullets = new List(1) { new Entry { Name = "default", OverrideProjectile = true, ProjectileData = new ProjectileData { damage = 5f, speed = 10f, range = 60f, force = 10f, damping = 0f, UsesCustomAccelerationCurve = false, AccelerationCurve = null, CustomAccelerationCurveDuration = 0f, IgnoreAccelCurveTime = 0f, onDestroyBulletScript = null }, BulletObject = null } }; orAddComponent2.useDefaultBulletIfMissing = false; orAddComponent2.transforms = new List(1) { synergyPrefab.transform }; } } } public class LichsBook : MonoBehaviour { public float Duration = 8f; public float Radius = 5f; private bool m_radialIndicatorActive; private HeatIndicatorController m_radialIndicator; public GameObject shadowPrefab; private readonly Dictionary statModifiers = new Dictionary(); public IEnumerator Start() { HandleRadialIndicator(); Object.Instantiate(shadowPrefab, ((Component)this).transform.position - Vector2Extensions.ToVector3ZUp(Vector2Extensions.WithX(((Component)this).GetComponent().GetRelativePositionFromAnchor((Anchor)7), 0f), 0f) + new Vector3(0f, 0.1875f), Quaternion.identity, ((Component)this).transform); yield return (object)new WaitForSeconds(Duration); Object.Destroy((Object)(object)((Component)this).gameObject); } public void Update() { //IL_0053: 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_0063: Unknown result type (might be due to invalid IL or missing references) if (Dungeon.IsGenerating || GameManager.Instance.IsLoadingLevel) { return; } for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { PlayerController val = GameManager.Instance.AllPlayers[i]; if ((Object)(object)val == (Object)null) { continue; } bool flag = statModifiers.ContainsKey(val); bool flag2 = Vector2.Distance(((GameActor)val).CenterPosition, Vector3Extensions.XY(((Component)this).transform.position)) < Radius; if (!flag && flag2) { StatModifier val2 = StatModifier.Create((StatType)10, (ModifyMethod)0, -1000f); val.ownerlessStatModifiers.Add(val2); val.stats.RecalculateStats(val, true, false); statModifiers.Add(val, val2); } else if (flag && !flag2) { StatModifier item = statModifiers[val]; if (val.ownerlessStatModifiers.Contains(item)) { val.ownerlessStatModifiers.Remove(item); val.stats.RecalculateStats(val, true, false); } statModifiers.Remove(val); } } } public void OnDestroy() { for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { PlayerController val = GameManager.Instance.AllPlayers[i]; if (Object.op_Implicit((Object)(object)val) && statModifiers.TryGetValue(val, out var value)) { if (val.ownerlessStatModifiers.Contains(value)) { val.ownerlessStatModifiers.Remove(value); val.stats.RecalculateStats(val, true, false); } statModifiers.Remove(val); } } UnhandleRadialIndicator(); } private void HandleRadialIndicator() { //IL_0025: 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) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!m_radialIndicatorActive) { m_radialIndicatorActive = true; ref HeatIndicatorController radialIndicator = ref m_radialIndicator; Object obj = Object.Instantiate(ResourceCache.Acquire("Global VFX/HeatIndicator"), ((Component)this).transform.position, Quaternion.identity, ((Component)this).transform); radialIndicator = ((GameObject)((obj is GameObject) ? obj : null)).GetComponent(); m_radialIndicator.CurrentColor = Color.white; m_radialIndicator.IsFire = false; m_radialIndicator.CurrentRadius = Radius; } } private void UnhandleRadialIndicator() { if (m_radialIndicatorActive) { m_radialIndicatorActive = false; if (Object.op_Implicit((Object)(object)m_radialIndicator)) { m_radialIndicator.EndEffect(); } m_radialIndicator = null; } } } public class LichsBookItem : PlayerItem { public GameObject LichsBookPrefab; private GameObject m_instanceBook; public tk2dSpriteAnimation replacementLibrary; public tk2dSprite replacementHandSprite; private PlayerController m_lastPlayer; private bool m_transformed; private readonly List synergyModifiers = new List(); public static CustomSynergyType MasterOfTheGungeonSynergy; public static void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) string text = "Lich's Book"; string text2 = "LichItems/Resources/lichsbook_item_001"; GameObject val = new GameObject(text); LichsBookItem lichsBookItem = val.AddComponent(); ItemBuilder.AddSpriteToObject(text, text2, val, (Assembly)null); string text3 = "Reload Spell"; string text4 = "The book of the Gungoen master. Place to create a zone of instant reload."; ItemBuilder.SetupItem((PickupObject)(object)lichsBookItem, text3, text4, "spapi"); ItemBuilder.SetCooldownType((PlayerItem)(object)lichsBookItem, (CooldownType)1, 600f); ((PlayerItem)lichsBookItem).consumable = false; ((PickupObject)lichsBookItem).quality = (ItemQuality)2; Game.Items.Rename("spapi:lich's_book", "spapi:lichs_book"); GameObject val2 = SpriteBuilder.SpriteFromResource("LichItems/Resources/lichsbook_shadow_001", (GameObject)null, (Assembly)null); val2.SetActive(false); FakePrefab.MarkAsFakePrefab(val2); Object.DontDestroyOnLoad((Object)(object)val2); tk2dBaseSprite component = val2.GetComponent(); GunTools.ConstructOffsetsFromAnchor(component.GetCurrentSpriteDef(), (Anchor)1, (Vector2?)null, false, true); Shader shader = ((BraveBehaviour)((Component)((Component)GameManager.Instance.RewardManager.A_Chest).gameObject.transform.Find("Shadow")).gameObject.GetComponent()).renderer.material.shader; component.GetCurrentSpriteDef().material.shader = shader; component.GetCurrentSpriteDef().materialInst.shader = shader; GameObject val3 = SpriteBuilder.SpriteFromResource("LichItems/Resources/lichsbook_depoy_001", (GameObject)null, (Assembly)null); val3.SetActive(false); FakePrefab.MarkAsFakePrefab(val3); Object.DontDestroyOnLoad((Object)(object)val3); tk2dSpriteAnimator val4 = val3.gameObject.AddComponent(); List list = new List { val3.GetComponent().spriteId, SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_002", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_003", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_004", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_005", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_006", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_007", val3.GetComponent().Collection, (Assembly)null), SpriteBuilder.AddSpriteToCollection("LichItems/Resources/lichsbook_depoy_008", val3.GetComponent().Collection, (Assembly)null) }; foreach (int item in list) { GunTools.ConstructOffsetsFromAnchor(val3.GetComponent().Collection.spriteDefinitions[item], (Anchor)1, (Vector2?)null, false, true); } SpriteBuilder.AddAnimation(val4, val3.GetComponent().Collection, list, "idle", (WrapMode)0, 15f).fps = 10f; val4.DefaultClipId = val4.GetClipIdByName("idle"); val4.playAutomatically = true; val3.AddComponent().shadowPrefab = val2; lichsBookItem.LichsBookPrefab = val3; MasterOfTheGungeonSynergy = ETGModCompatibility.ExtendEnum("spapi.etg.lichitems", "MASTER_OF_THE_GUNGEON"); BuildLibrary(lichsBookItem); } public static tk2dSpriteDefinition CopyDefinitionFrom(tk2dSpriteDefinition other) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0046: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteDefinition val = new tk2dSpriteDefinition { boundsDataCenter = new Vector3 { x = other.boundsDataCenter.x, y = other.boundsDataCenter.y, z = other.boundsDataCenter.z }, boundsDataExtents = new Vector3 { x = other.boundsDataExtents.x, y = other.boundsDataExtents.y, z = other.boundsDataExtents.z }, colliderConvex = other.colliderConvex, colliderSmoothSphereCollisions = other.colliderSmoothSphereCollisions, colliderType = other.colliderType, colliderVertices = other.colliderVertices, collisionLayer = other.collisionLayer, complexGeometry = other.complexGeometry, extractRegion = other.extractRegion, flipped = other.flipped, indices = other.indices, material = new Material(other.material), materialId = other.materialId, materialInst = new Material(other.materialInst), metadata = other.metadata, name = other.name, normals = other.normals, physicsEngine = other.physicsEngine, position0 = new Vector3 { x = other.position0.x, y = other.position0.y, z = other.position0.z }, position1 = new Vector3 { x = other.position1.x, y = other.position1.y, z = other.position1.z }, position2 = new Vector3 { x = other.position2.x, y = other.position2.y, z = other.position2.z }, position3 = new Vector3 { x = other.position3.x, y = other.position3.y, z = other.position3.z }, regionH = other.regionH, regionW = other.regionW, regionX = other.regionX, regionY = other.regionY, tangents = other.tangents, texelSize = new Vector2 { x = other.texelSize.x, y = other.texelSize.y }, untrimmedBoundsDataCenter = new Vector3 { x = other.untrimmedBoundsDataCenter.x, y = other.untrimmedBoundsDataCenter.y, z = other.untrimmedBoundsDataCenter.z }, untrimmedBoundsDataExtents = new Vector3 { x = other.untrimmedBoundsDataExtents.x, y = other.untrimmedBoundsDataExtents.y, z = other.untrimmedBoundsDataExtents.z } }; List list = new List(); Vector2[] uvs = other.uvs; foreach (Vector2 val2 in uvs) { list.Add(new Vector2 { x = val2.x, y = val2.y }); } val.uvs = list.ToArray(); List list2 = new List(); Vector3[] colliderVertices = other.colliderVertices; foreach (Vector3 val3 in colliderVertices) { list2.Add(new Vector3 { x = val3.x, y = val3.y, z = val3.z }); } val.colliderVertices = list2.ToArray(); return val; } private static void BuildLibrary(LichsBookItem targetBook) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown List list = new List(); string[] resourceNames = ResourceExtractor.GetResourceNames((Assembly)null); string text = "LichItems/Resources/InfinilichTransformation"; foreach (string text2 in resourceNames) { if (text2.StartsWith(text.Replace('/', '.'), StringComparison.OrdinalIgnoreCase)) { list.Add(text2); } } List list2 = new List(); foreach (string item in list) { list2.Add(ResourceExtractor.GetTextureFromResource(item, (Assembly)null)); } PickupObject byId = PickupObjectDatabase.GetById(163); tk2dSpriteAnimation val = Object.Instantiate(((BulletArmorItem)((byId is BulletArmorItem) ? byId : null)).knightLibrary); Object.DontDestroyOnLoad((Object)(object)val); tk2dSpriteCollectionData spriteCollection = val.clips[0].frames[0].spriteCollection; tk2dSpriteCollectionData val2 = Object.Instantiate(spriteCollection); PickupObject byId2 = PickupObjectDatabase.GetById(607); tk2dSpriteDefinition val3 = CopyDefinitionFrom(((tk2dBaseSprite)((BankMaskItem)((byId2 is BankMaskItem) ? byId2 : null)).OverrideHandSprite).GetCurrentSpriteDef()); val3.name = "knight_hand_001"; int num = SpriteBuilder.AddSpriteToCollection(val3, val2); Object.DontDestroyOnLoad((Object)(object)val2); for (int j = 0; j < list2.Count; j++) { Texture2D val4 = list2[j]; tk2dSpriteDefinition spriteDefinition = val2.GetSpriteDefinition(((Object)val4).name); if (spriteDefinition != null) { ETGMod.ReplaceTexture(spriteDefinition, val4, true); spriteDefinition.name = spriteDefinition.name.Replace("knight", "inflich"); GunTools.MakeOffset(spriteDefinition, new Vector2(-0.0625f, 0f), false); } } tk2dSpriteAnimationClip[] clips = val.clips; foreach (tk2dSpriteAnimationClip val5 in clips) { for (int l = 0; l < val5.frames.Length; l++) { val5.frames[l].spriteCollection = val2; } } tk2dSpriteAnimationClip[] clips2 = val.clips; foreach (tk2dSpriteAnimationClip val6 in clips2) { tk2dSpriteAnimationFrame[] frames = val6.frames; foreach (tk2dSpriteAnimationFrame val7 in frames) { if (!string.IsNullOrEmpty(val7.eventAudio) && (!(val7.eventAudio != "Play_FS") || !(val7.eventAudio != "Play_CHR_boot_stairs_01"))) { val7.eventAudio = ""; } } } GameObject val8 = new GameObject("OverrideHandSprite"); val8.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val8); tk2dSprite val9 = val8.AddComponent(); ((tk2dBaseSprite)val9).SetSprite(val2, num); targetBook.replacementHandSprite = val9; targetBook.replacementLibrary = val; } public override void Update() { ((PlayerItem)this).Update(); ProcessInfinilichStatus(base.LastOwner); } public override void OnDestroy() { if (m_transformed) { ProcessInfinilichStatus(null, forceDisable: true); } ((PlayerItem)this).OnDestroy(); } private void RevealAllRooms(PlayerController player) { if (!((Object)(object)Minimap.Instance == (Object)null)) { Minimap.Instance.RevealAllRooms(true); } } private void ProcessInfinilichStatus(PlayerController player, bool forceDisable = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Invalid comparison between Unknown and I4 //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Invalid comparison between Unknown and I4 bool flag = Object.op_Implicit((Object)(object)player) && player.HasActiveBonusSynergy(MasterOfTheGungeonSynergy, false) && !forceDisable; if (flag && !m_transformed) { m_lastPlayer = player; if (Object.op_Implicit((Object)(object)player)) { m_transformed = true; if ((Object)(object)Minimap.Instance != (Object)null) { Minimap.Instance.RevealAllRooms(true); } player.OnNewFloorLoaded = (Action)Delegate.Combine(player.OnNewFloorLoaded, new Action(RevealAllRooms)); player.carriedConsumables.InfiniteKeys = true; player.OverrideAnimationLibrary = replacementLibrary; player.SetOverrideShader(ShaderCache.Acquire(player.LocalShaderName)); if ((int)player.characterIdentity == 9) { ((Component)player).GetComponent().AddOverrideAnimLibrary(replacementLibrary); } player.ChangeHandsToCustomType(((tk2dBaseSprite)replacementHandSprite).Collection, ((tk2dBaseSprite)replacementHandSprite).spriteId); StatModifier item = StatModifier.Create((StatType)8, (ModifyMethod)0, 1f); player.ownerlessStatModifiers.Add(item); player.stats.RecalculateStats(player, false, false); synergyModifiers.Add(item); } } else { if (!m_transformed || flag) { return; } m_transformed = false; if (!Object.op_Implicit((Object)(object)m_lastPlayer)) { return; } PlayerController lastPlayer = m_lastPlayer; lastPlayer.OnNewFloorLoaded = (Action)Delegate.Remove(lastPlayer.OnNewFloorLoaded, new Action(RevealAllRooms)); m_lastPlayer.carriedConsumables.InfiniteKeys = false; m_lastPlayer.OverrideAnimationLibrary = null; m_lastPlayer.ClearOverrideShader(); if ((int)m_lastPlayer.characterIdentity == 9) { ((Component)m_lastPlayer).GetComponent().RemoveOverrideAnimLibrary(replacementLibrary); } m_lastPlayer.RevertHandsToBaseType(); foreach (StatModifier synergyModifier in synergyModifiers) { m_lastPlayer.ownerlessStatModifiers.Remove(synergyModifier); } m_lastPlayer.stats.RecalculateStats(m_lastPlayer, false, false); synergyModifiers.Clear(); m_lastPlayer = null; } } public override bool CanBeUsed(PlayerController user) { return !Object.op_Implicit((Object)(object)m_instanceBook) && ((PlayerItem)this).CanBeUsed(user); } public override void DoEffect(PlayerController user) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) m_instanceBook = Object.Instantiate(LichsBookPrefab, Vector2Extensions.ToVector3ZisY(((GameActor)user).CenterPosition, 0f), Quaternion.identity, (Transform)null); } } public class LichsGun { public static List shootFrames = new List(5) { "lichsgun_fire_001", "lichsgun_fire_002", "lichsgun_fire_003", "lichsgun_fire_004", "lichsgun_idle_001" }; public static List reloadFrames = new List(7) { "lichsgun_reload_001", "lichsgun_reload_001", "lichsgun_reload_002", "lichsgun_reload_003", "lichsgun_reload_002", "lichsgun_reload_003", "lichsgun_reload_004" }; public static List fireOffsets = new List(4) { new IntVector2(0, 0), new IntVector2(-3, 1), new IntVector2(-2, 0), new IntVector2(1, -1) }; public static List reloadOffsets = new List(4) { new IntVector2(1, -2), new IntVector2(-3, -1), new IntVector2(-3, 0), new IntVector2(-1, 1) }; public static tk2dSpriteCollectionData VFXCollection { get { PickupObject byId = PickupObjectDatabase.GetById(95); return ((Gun)((byId is Gun) ? byId : null)).clipObject.GetComponent().Collection; } } public static void Init() { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Expected O, but got Unknown //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Expected O, but got Unknown //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Expected O, but got Unknown //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Expected O, but got Unknown Gun val = Databases.Items.NewGun("Lich's Gun", "lichsgun"); Game.Items.Rename("outdated_gun_mods:lich's_gun", "spapi:lichs_gun"); GunExt.SetShortDescription((PickupObject)(object)val, "The Freeshooter"); GunExt.SetLongDescription((PickupObject)(object)val, "The gun of the Gungeon master. The bullets of this gun can be guided after being fired."); GunExt.SetupSprite(val, (tk2dSpriteCollectionData)null, "lichsgun_idle_001", 10); GunExt.SetAnimationFPS(val, val.shootAnimation, 12); GunExt.AddProjectileModuleFrom(val, "klobb", true, false); PickupObject byId = PickupObjectDatabase.GetById(183); InputGuidedProjectile val2 = LichsGun.CopyFields(Object.Instantiate(((Gun)((byId is Gun) ? byId : null)).DefaultModule.projectiles[0])); ((Component)val2).gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(((Component)val2).gameObject); Object.DontDestroyOnLoad((Object)(object)val2); ((Projectile)val2).baseData.damage = 5f; ((Projectile)val2).shouldRotate = true; ((Object)val2).name = "LichsGun_Projectile"; ((Projectile)val2).baseData.range = 18f; ((Projectile)val2).baseData.speed = 22f; val2.trackingSpeed = 500f; val2.dumbfireTime = -1f; PickupObject byId2 = PickupObjectDatabase.GetById(183); Projectile val3 = ((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]; GunTools.SetProjectileSpriteRight((Projectile)(object)val2, "lichsgun_projectile_001", 6, 6, false, (Anchor)4, (int?)null, (int?)null, true, false, (int?)null, (int?)null, val3); val.DefaultModule.projectiles[0] = (Projectile)(object)val2; val.DefaultModule.shootStyle = (ShootStyle)0; val.DefaultModule.angleVariance = 0f; val.DefaultModule.ammoType = (AmmoType)1; val.DefaultModule.cooldownTime = 0.1f; val.DefaultModule.numberOfShotsInClip = 6; val.reloadClipLaunchFrame = 0; val.gunSwitchGroup = "SAA"; val.reloadTime = 1.1f; val.SetBaseMaxAmmo(350); ((PickupObject)val).quality = (ItemQuality)(-50); ((Component)val.barrelOffset).transform.localPosition = new Vector3(1.1875f, 0.5625f, 0f); val.gunClass = (GunClass)1; val.InfiniteAmmo = true; ((PickupObject)val).PreventStartingOwnerFromDropping = true; tk2dSpriteAnimator component = ((Component)val).GetComponent(); tk2dSpriteAnimationClip clipByName = component.GetClipByName(val.shootAnimation); tk2dSpriteAnimationClip clipByName2 = component.GetClipByName(val.reloadAnimation); Vector2 val6 = default(Vector2); for (int i = 0; i < clipByName.frames.Length; i++) { tk2dSpriteAnimationFrame val4 = clipByName.frames[i]; tk2dSpriteDefinition val5 = val4.spriteCollection.spriteDefinitions[val4.spriteId]; ((Vector2)(ref val6))..ctor((float)fireOffsets[i].x / 16f, (float)fireOffsets[i].y / 16f); GunTools.MakeOffset(val5, val6, false); } Vector2 val9 = default(Vector2); for (int j = 0; j < clipByName2.frames.Length; j++) { tk2dSpriteAnimationFrame val7 = clipByName2.frames[j]; tk2dSpriteDefinition val8 = val7.spriteCollection.spriteDefinitions[val7.spriteId]; ((Vector2)(ref val9))..ctor((float)reloadOffsets[j].x / 16f, (float)reloadOffsets[j].y / 16f); GunTools.MakeOffset(val8, val9, false); } clipByName.frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[shootFrames.Count]; for (int k = 0; k < shootFrames.Count; k++) { string text = shootFrames[k]; clipByName.frames[k] = new tk2dSpriteAnimationFrame { spriteCollection = Databases.Items.WeaponCollection, spriteId = Databases.Items.WeaponCollection.GetSpriteIdByName(text) }; } clipByName2.frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[reloadFrames.Count]; for (int l = 0; l < reloadFrames.Count; l++) { string text2 = reloadFrames[l]; clipByName2.frames[l] = new tk2dSpriteAnimationFrame { spriteCollection = Databases.Items.WeaponCollection, spriteId = Databases.Items.WeaponCollection.GetSpriteIdByName(text2) }; } List list = new List { VFXCollection.GetSpriteIdByName("lichsgun_vfx_001"), VFXCollection.GetSpriteIdByName("lichsgun_vfx_002"), VFXCollection.GetSpriteIdByName("lichsgun_vfx_003"), VFXCollection.GetSpriteIdByName("lichsgun_vfx_004") }; GameObject val10 = new GameObject("LichsGunMuzzleflash"); val10.SetActive(false); FakePrefab.MarkAsFakePrefab(val10); Object.DontDestroyOnLoad((Object)(object)val10); ((tk2dBaseSprite)val10.AddComponent()).SetSprite(VFXCollection, list[0]); tk2dSpriteAnimator val11 = val10.AddComponent(); SpriteBuilder.AddAnimation(val11, val10.GetComponent().Collection, list, "flash", (WrapMode)2, 15f).fps = 16f; val11.playAutomatically = true; val11.DefaultClipId = val11.GetClipIdByName("flash"); SpriteAnimatorKiller val12 = val10.AddComponent(); val12.fadeTime = -1f; val12.delayDestructionTime = -1f; val12.animator = val11; foreach (int item in list) { GunTools.ConstructOffsetsFromAnchor(VFXCollection.spriteDefinitions[item], (Anchor)3, (Vector2?)null, false, true); } VFXPool val13 = new VFXPool(); val13.type = (VFXPoolType)1; VFXComplex[] array = new VFXComplex[1]; VFXComplex val14 = new VFXComplex(); val14.effects = (VFXObject[])(object)new VFXObject[1] { new VFXObject { effect = val10, alignment = (VFXAlignment)0, attached = false, orphaned = true, persistsOnDeath = false, destructible = true, usesZHeight = true, zHeight = -0.25f } }; array[0] = val14; val13.effects = (VFXComplex[])(object)array; val.muzzleFlashEffects = val13; Databases.Items.Add(val, (tk2dSpriteCollectionData)null, "ANY"); InitSynergyForm(val); } public static void InitSynergyForm(Gun original) { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) Gun val = Databases.Items.NewGun("Synergy Lich's Gun", "lichsgun2"); Game.Items.Rename("outdated_gun_mods:synergy_lich's_gun", "spapi:lichs_gun+master_of_the_gungeon"); GunExt.SetShortDescription((PickupObject)(object)val, "The Freeshooter"); GunExt.SetLongDescription((PickupObject)(object)val, "The gun of the Gungeon master. The bullets of this gun can be guided after being fired."); GunExt.SetupSprite(val, (tk2dSpriteCollectionData)null, "lichsgun2_idle_001", 10); GunExt.SetAnimationFPS(val, val.shootAnimation, 12); GunExt.AddProjectileModuleFrom(val, "klobb", true, false); PickupObject byId = PickupObjectDatabase.GetById(183); InputGuidedProjectile val2 = LichsGun.CopyFields(Object.Instantiate(((Gun)((byId is Gun) ? byId : null)).DefaultModule.projectiles[0])); ((Component)val2).gameObject.SetActive(false); FakePrefab.MarkAsFakePrefab(((Component)val2).gameObject); Object.DontDestroyOnLoad((Object)(object)val2); ((Projectile)val2).baseData.damage = 3f; ((Projectile)val2).shouldRotate = true; ((Object)val2).name = "LichsGun2_Projectile"; ((Projectile)val2).baseData.range = 100f; ((Projectile)val2).baseData.speed = 14f; val2.dumbfireTime = -1f; PickupObject byId2 = PickupObjectDatabase.GetById(183); Projectile val3 = ((Gun)((byId2 is Gun) ? byId2 : null)).DefaultModule.projectiles[0]; GunTools.SetProjectileSpriteRight((Projectile)(object)val2, "lichsgun_projectile_001", 6, 6, false, (Anchor)4, (int?)null, (int?)null, true, false, (int?)null, (int?)null, val3); val.DefaultModule.projectiles[0] = (Projectile)(object)val2; val.DefaultModule.shootStyle = (ShootStyle)4; val.DefaultModule.angleVariance = 0f; val.DefaultModule.burstShotCount = 17; val.DefaultModule.burstCooldownTime = 0.06f; val.DefaultModule.ammoType = (AmmoType)1; val.DefaultModule.cooldownTime = 0.1f; val.DefaultModule.numberOfShotsInClip = 17; val.reloadClipLaunchFrame = 0; val.doesScreenShake = false; ((PickupObject)val).quality = (ItemQuality)(-100); ((Component)val.barrelOffset).transform.localPosition = new Vector3(1.1875f, 0.5625f, 0f); val.gunClass = (GunClass)1; val.gunSwitchGroup = "Hammer"; val.gunHandedness = (GunHandedness)3; VFXPool val4 = new VFXPool(); val4.type = (VFXPoolType)0; val4.effects = (VFXComplex[])(object)new VFXComplex[0]; val.muzzleFlashEffects = val4; val.reloadTime = 1.1f; val.SetBaseMaxAmmo(700); val.gunSwitchGroup = "SPAPI_LichsGunSynergy"; SoundManager.AddCustomSwitchData("WPN_Guns", "SPAPI_LichsGunSynergy", "Play_WPN_Gun_Shot_01", (SwitchedEvent[])(object)new SwitchedEvent[1] { SwitchedEvent.op_Implicit("Play_WPN_h4mmer_shot_01") }); SoundManager.AddCustomSwitchData("WPN_Guns", "SPAPI_LichsGunSynergy", "Play_WPN_gun_reload_01", (SwitchedEvent[])(object)new SwitchedEvent[1] { SwitchedEvent.op_Implicit("Play_BOSS_lichC_morph_01") }); Databases.Items.Add(val, (tk2dSpriteCollectionData)null, "ANY"); TransformGunSynergyProcessor val5 = ((Component)original).gameObject.AddComponent(); val5.NonSynergyGunId = ((PickupObject)original).PickupObjectId; val5.SynergyGunId = ((PickupObject)val).PickupObjectId; val5.SynergyToCheck = LichsBookItem.MasterOfTheGungeonSynergy; } public static T CopyFields(Projectile sample2) where T : Projectile { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) T val = ((Component)sample2).gameObject.AddComponent(); ((Projectile)val).PossibleSourceGun = sample2.PossibleSourceGun; ((Projectile)val).SpawnedFromOtherPlayerProjectile = sample2.SpawnedFromOtherPlayerProjectile; ((Projectile)val).PlayerProjectileSourceGameTimeslice = sample2.PlayerProjectileSourceGameTimeslice; ((Projectile)val).BulletScriptSettings = sample2.BulletScriptSettings; ((Projectile)val).damageTypes = sample2.damageTypes; ((Projectile)val).allowSelfShooting = sample2.allowSelfShooting; ((Projectile)val).collidesWithPlayer = sample2.collidesWithPlayer; ((Projectile)val).collidesWithProjectiles = sample2.collidesWithProjectiles; ((Projectile)val).collidesOnlyWithPlayerProjectiles = sample2.collidesOnlyWithPlayerProjectiles; ((Projectile)val).projectileHitHealth = sample2.projectileHitHealth; ((Projectile)val).collidesWithEnemies = sample2.collidesWithEnemies; ((Projectile)val).shouldRotate = sample2.shouldRotate; ((Projectile)val).shouldFlipVertically = sample2.shouldFlipVertically; ((Projectile)val).shouldFlipHorizontally = sample2.shouldFlipHorizontally; ((Projectile)val).ignoreDamageCaps = sample2.ignoreDamageCaps; ((Projectile)val).baseData = sample2.baseData; ((Projectile)val).AppliesPoison = sample2.AppliesPoison; ((Projectile)val).PoisonApplyChance = sample2.PoisonApplyChance; ((Projectile)val).healthEffect = sample2.healthEffect; ((Projectile)val).AppliesSpeedModifier = sample2.AppliesSpeedModifier; ((Projectile)val).SpeedApplyChance = sample2.SpeedApplyChance; ((Projectile)val).speedEffect = sample2.speedEffect; ((Projectile)val).AppliesCharm = sample2.AppliesCharm; ((Projectile)val).CharmApplyChance = sample2.CharmApplyChance; ((Projectile)val).charmEffect = sample2.charmEffect; ((Projectile)val).AppliesFreeze = sample2.AppliesFreeze; ((Projectile)val).FreezeApplyChance = sample2.FreezeApplyChance; ((Projectile)val).freezeEffect = sample2.freezeEffect; ((Projectile)val).AppliesFire = sample2.AppliesFire; ((Projectile)val).FireApplyChance = sample2.FireApplyChance; ((Projectile)val).fireEffect = sample2.fireEffect; ((Projectile)val).AppliesStun = sample2.AppliesStun; ((Projectile)val).StunApplyChance = sample2.StunApplyChance; ((Projectile)val).AppliedStunDuration = sample2.AppliedStunDuration; ((Projectile)val).AppliesBleed = sample2.AppliesBleed; ((Projectile)val).bleedEffect = sample2.bleedEffect; ((Projectile)val).AppliesCheese = sample2.AppliesCheese; ((Projectile)val).CheeseApplyChance = sample2.CheeseApplyChance; ((Projectile)val).cheeseEffect = sample2.cheeseEffect; ((Projectile)val).BleedApplyChance = sample2.BleedApplyChance; ((Projectile)val).CanTransmogrify = sample2.CanTransmogrify; ((Projectile)val).ChanceToTransmogrify = sample2.ChanceToTransmogrify; ((Projectile)val).TransmogrifyTargetGuids = sample2.TransmogrifyTargetGuids; ((Projectile)val).BossDamageMultiplier = sample2.BossDamageMultiplier; ((Projectile)val).SpawnedFromNonChallengeItem = sample2.SpawnedFromNonChallengeItem; ((Projectile)val).TreatedAsNonProjectileForChallenge = sample2.TreatedAsNonProjectileForChallenge; ((Projectile)val).hitEffects = sample2.hitEffects; ((Projectile)val).CenterTilemapHitEffectsByProjectileVelocity = sample2.CenterTilemapHitEffectsByProjectileVelocity; ((Projectile)val).wallDecals = sample2.wallDecals; ((Projectile)val).persistTime = sample2.persistTime; ((Projectile)val).angularVelocity = sample2.angularVelocity; ((Projectile)val).angularVelocityVariance = sample2.angularVelocityVariance; ((Projectile)val).spawnEnemyGuidOnDeath = sample2.spawnEnemyGuidOnDeath; ((Projectile)val).HasFixedKnockbackDirection = sample2.HasFixedKnockbackDirection; ((Projectile)val).FixedKnockbackDirection = sample2.FixedKnockbackDirection; ((Projectile)val).pierceMinorBreakables = sample2.pierceMinorBreakables; ((Projectile)val).objectImpactEventName = sample2.objectImpactEventName; ((Projectile)val).enemyImpactEventName = sample2.enemyImpactEventName; ((Projectile)val).onDestroyEventName = sample2.onDestroyEventName; ((Projectile)val).additionalStartEventName = sample2.additionalStartEventName; ((Projectile)val).IsRadialBurstLimited = sample2.IsRadialBurstLimited; ((Projectile)val).MaxRadialBurstLimit = sample2.MaxRadialBurstLimit; ((Projectile)val).AdditionalBurstLimits = sample2.AdditionalBurstLimits; ((Projectile)val).AppliesKnockbackToPlayer = sample2.AppliesKnockbackToPlayer; ((Projectile)val).PlayerKnockbackForce = sample2.PlayerKnockbackForce; ((Projectile)val).HasDefaultTint = sample2.HasDefaultTint; ((Projectile)val).DefaultTintColor = sample2.DefaultTintColor; ((Projectile)val).IsCritical = sample2.IsCritical; ((Projectile)val).BlackPhantomDamageMultiplier = sample2.BlackPhantomDamageMultiplier; ((Projectile)val).PenetratesInternalWalls = sample2.PenetratesInternalWalls; ((Projectile)val).neverMaskThis = sample2.neverMaskThis; ((Projectile)val).isFakeBullet = sample2.isFakeBullet; ((Projectile)val).CanBecomeBlackBullet = sample2.CanBecomeBlackBullet; ((Projectile)val).TrailRenderer = sample2.TrailRenderer; ((Projectile)val).CustomTrailRenderer = sample2.CustomTrailRenderer; ((Projectile)val).ParticleTrail = sample2.ParticleTrail; ((Projectile)val).DelayedDamageToExploders = sample2.DelayedDamageToExploders; ((Projectile)val).OnHitEnemy = sample2.OnHitEnemy; ((Projectile)val).OnWillKillEnemy = sample2.OnWillKillEnemy; ((Projectile)val).OnBecameDebris = sample2.OnBecameDebris; ((Projectile)val).OnBecameDebrisGrounded = sample2.OnBecameDebrisGrounded; ((Projectile)val).IsBlackBullet = sample2.IsBlackBullet; ((Projectile)val).statusEffectsToApply = sample2.statusEffectsToApply; ((Projectile)val).AdditionalScaleMultiplier = sample2.AdditionalScaleMultiplier; ((Projectile)val).ModifyVelocity = sample2.ModifyVelocity; ((Projectile)val).CurseSparks = sample2.CurseSparks; ((Projectile)val).PreMoveModifiers = sample2.PreMoveModifiers; ((Projectile)val).OverrideMotionModule = sample2.OverrideMotionModule; ((Projectile)val).Shooter = sample2.Shooter; ((Projectile)val).Owner = sample2.Owner; ((Projectile)val).Speed = sample2.Speed; ((Projectile)val).Direction = sample2.Direction; ((Projectile)val).DestroyMode = sample2.DestroyMode; ((Projectile)val).Inverted = sample2.Inverted; ((Projectile)val).LastVelocity = sample2.LastVelocity; ((Projectile)val).ManualControl = sample2.ManualControl; ((Projectile)val).ForceBlackBullet = sample2.ForceBlackBullet; ((Projectile)val).IsBulletScript = sample2.IsBulletScript; ((Projectile)val).OverrideTrailPoint = sample2.OverrideTrailPoint; ((Projectile)val).SkipDistanceElapsedCheck = sample2.SkipDistanceElapsedCheck; ((Projectile)val).ImmuneToBlanks = sample2.ImmuneToBlanks; ((Projectile)val).ImmuneToSustainedBlanks = sample2.ImmuneToSustainedBlanks; ((Projectile)val).ForcePlayerBlankable = sample2.ForcePlayerBlankable; ((Projectile)val).IsReflectedBySword = sample2.IsReflectedBySword; ((Projectile)val).LastReflectedSlashId = sample2.LastReflectedSlashId; ((Projectile)val).TrailRendererController = sample2.TrailRendererController; ((Projectile)val).braveBulletScript = sample2.braveBulletScript; ((Projectile)val).TrapOwner = sample2.TrapOwner; ((Projectile)val).SuppressHitEffects = sample2.SuppressHitEffects; Object.Destroy((Object)(object)sample2); return val; } } [BepInPlugin("spapi.etg.lichitems", "Lich Items", "1.0.10")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string MOD_GUID = "spapi.etg.lichitems"; public void Start() { ETGModMainBehaviour.WaitForGameManagerStart((Action)GMStart); } public void GMStart(GameManager gm) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) new Harmony("spapi.etg.lichitems").PatchAll(); Assets.SetupSpritesFromAssembly(typeof(Plugin).Assembly, "LichItems/Resources/MTGAPISpriteRoot"); CrossChamber.Init(); LichsBookItem.Init(); LichsGun.Init(); AdvancedSynergyEntry val = CustomSynergies.Add("Master of the Gungeon", new List(3) { "spapi:lichs_gun", "spapi:lichs_book", "lichs_eye_bullets" }, (List)null, true); val.bonusSynergies = new List(1) { LichsBookItem.MasterOfTheGungeonSynergy }; val.ActiveWhenGunUnequipped = true; AdvancedSynergyEntry val2 = CustomSynergies.Add("Crossfire", new List(2) { "spapi:cross_chamber", "magnum" }, (List)null, true); val2.bonusSynergies = new List(1) { CrossChamber.CrossfireSynergy }; val2.ActiveWhenGunUnequipped = true; ETGMod.StartGlobalCoroutine(DelayedStartCR()); } private IEnumerator DelayedStartCR() { yield return null; Object obj = BraveResources.Load("PlayerLich", ".prefab"); GameObject obj2 = (GameObject)(object)((obj is GameObject) ? obj : null); PlayerController player = default(PlayerController); int num; if (!((Object)(object)obj2 == (Object)null)) { player = obj2.GetComponent(); num = ((player == null) ? 1 : 0); } else { num = 1; } if (num != 0) { yield break; } tk2dSpriteAnimationClip[] clips = ((BraveBehaviour)player).spriteAnimator.Library.clips; foreach (tk2dSpriteAnimationClip clip in clips) { tk2dSpriteAnimationFrame[] frames = clip.frames; foreach (tk2dSpriteAnimationFrame frame in frames) { if (!string.IsNullOrEmpty(frame.eventAudio) && (!(frame.eventAudio != "Play_FS") || !(frame.eventAudio != "Play_CHR_boot_stairs_01"))) { frame.eventAudio = ""; } } } } } }